Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use the new Otterize-API endpoints for workload user and password management #96

Merged
merged 5 commits into from
Dec 5, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/operator/controllers/otterizeclient/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,15 @@ func (c *CloudClient) RegisterK8SPod(ctx context.Context, namespace string, _ st
}

func (c *CloudClient) AcquireServiceUserAndPassword(ctx context.Context, serviceName, namespace string) (*otterizegraphql.UserPasswordCredentials, error) {
res, err := otterizegraphql.GetUserAndPasswordCredentials(ctx, c.graphqlClient, serviceName, namespace)
res, err := otterizegraphql.RequestUserAndPassword(ctx, c.graphqlClient, serviceName, namespace)
if err != nil {
return nil, err
}
return &res.ServiceUserAndPassword.UserPasswordCredentials, nil
res2, err := otterizegraphql.GetUserAndPasswordCredentials(ctx, c.graphqlClient, res.KubernetesServiceUserAndPasswordRequest.Id)
omris94 marked this conversation as resolved.
Show resolved Hide resolved
if err != nil {
return nil, err
}
return &res2.Service.UserAndPassword.UserPasswordCredentials, nil
}

func (c *CloudClient) CleanupOrphanK8SPodEntries(ctx context.Context, _ string, existingServicesByNamespace map[string]*goset.Set[string]) error {
Expand Down
113 changes: 95 additions & 18 deletions src/operator/controllers/otterizeclient/otterizegraphql/generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,17 @@ mutation ReportActiveCertificateRequesters($existingPodOwners: [NamespacedPodOwn
reportActiveCertificateRequesters(activePodOwners: $existingPodOwners)
}

query GetUserAndPasswordCredentials($serviceName: String!, $namespace: String!) {
serviceUserAndPassword(namespace: $namespace, service: $serviceName) {
...UserPasswordCredentials
mutation RequestUserAndPassword($serviceName: String!, $namespace: String!) {
kubernetesServiceUserAndPasswordRequest(podOwner: {name: $serviceName, namespace: $namespace}) {
id
}
}

query GetUserAndPasswordCredentials($id: ID!) {
service(id: $id) {
userAndPassword{
...UserPasswordCredentials
}
}
}

Expand Down
Loading
Loading