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

registry: use generated imagestream clientset to retrieve secrets #16098

Merged

Conversation

mfojtik
Copy link
Contributor

@mfojtik mfojtik commented Sep 1, 2017

@deads2k this is making registry using purely external client.

@openshift-merge-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mfojtik

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these OWNERS Files:

You can indicate your approval by writing /approve in a comment
You can cancel your approval by writing /approve cancel in a comment

@openshift-merge-robot openshift-merge-robot added approved Indicates a PR has been approved by an approver from all required OWNERS files. needs-api-review labels Sep 1, 2017
@openshift-ci-robot openshift-ci-robot added the size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. label Sep 1, 2017
@@ -39,6 +39,7 @@ func NewFakeOpenShift() *FakeOpenShift {
// NewFakeOpenShiftWithClient constructs a fake client associated with
// the stateful fake in-memory OpenShift reactors. The fake OpenShift is
// available for direct interaction, so you can make buggy states.
// TODO: remove the FakeOpenshift as the legacy client is not needed anymore
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@legionus @dmage i'm leaving this as a techdebt for you.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mfojtik I guess you are about testclient.Fake, not FakeOpenShift.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

testclient.Fake is not longer needed in registry, we should use imagefake.Clientset{} from generated client (similar to other clients required for openshift resources....).

@mfojtik
Copy link
Contributor Author

mfojtik commented Sep 1, 2017

(pls do not tag until the dependency PR merges)

@mfojtik mfojtik force-pushed the registry-imagestreamsecrets branch from c4644e1 to 43b26b0 Compare September 1, 2017 11:42
@@ -139,16 +138,8 @@ func (s *SecretCredentialStore) init() credentialprovider.DockerKeyring {
}
}

secretsv1 := make([]kapiv1.Secret, len(s.secrets))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

round two... make the caller deal with conversion, honor callers that use external version (like registry).

@mfojtik mfojtik force-pushed the registry-imagestreamsecrets branch from 43b26b0 to 209a08d Compare September 1, 2017 12:59
@mfojtik
Copy link
Contributor Author

mfojtik commented Sep 1, 2017

@legionus @dmage ready for review and shipping, all tests are green.

@mfojtik mfojtik force-pushed the registry-imagestreamsecrets branch from 209a08d to 906cbfd Compare September 1, 2017 22:26
@openshift-ci-robot openshift-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Sep 1, 2017
images: imageclient,
}
}

func (c *fakeRegistryClient) Client() (Interface, error) {
return newAPIClient(c.client, nil, nil, c.images, nil), nil
return newAPIClient(nil, nil, c.images, nil), nil
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dmage as part of the test client refactoring we should get rid of all this nils and just pass the clients we actually use (I believe we use just images client).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We just don't have unit tests for the paths with other clients (e.g., limit ranges). If we have better code coverage, we will not have nils there.

secrets, err := r.secrets.ImageStreamSecrets(namespace).Secrets(isi.Name, metav1.ListOptions{})
if err != nil {
return nil, err
}
return secrets.Items, nil
secretsv1 := make([]kapiv1.Secret, len(secrets.Items))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@soltysh this might be interesting for you... this is needed to allow registry use the credentials (registry use external client). when we switch to external client in image controller, this can be nuked.

@mfojtik
Copy link
Contributor Author

mfojtik commented Sep 4, 2017

/retest

2 similar comments
@mfojtik
Copy link
Contributor Author

mfojtik commented Sep 4, 2017

/retest

@mfojtik
Copy link
Contributor Author

mfojtik commented Sep 5, 2017

/retest

@@ -132,14 +125,9 @@ func (c *registryClient) Client() (Interface, error) {
// ClientFromToken returns the client based on the bearer token.
func (c *registryClient) ClientFromToken(token string) (Interface, error) {
newClient := *c
newOpenshiftConfig := clientcmd.AnonymousClientConfig(newClient.openshiftConfig)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use k8s.io/client-go/rest.AnonymousClientConfig

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed.

for i, secret := range secrets.Items {
err := kapiv1.Convert_api_Secret_To_v1_Secret(&secret, &secretsv1[i], nil)
if err != nil {
glog.V(2).Infof("Unable to make the Docker keyring for %s/%s secret: %v", secret.Name, secret.Namespace, err)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utilruntime.HandleError

@deads2k
Copy link
Contributor

deads2k commented Sep 5, 2017

Two comments. After they are fixed, lgtm.

@mfojtik mfojtik force-pushed the registry-imagestreamsecrets branch from 906cbfd to a96b157 Compare September 5, 2017 19:15
@mfojtik mfojtik added the lgtm Indicates that a PR is ready to be merged. label Sep 5, 2017
@dmage
Copy link
Contributor

dmage commented Sep 6, 2017

/retest

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@soltysh
Copy link
Contributor

soltysh commented Sep 7, 2017

/retest

@openshift-merge-robot
Copy link
Contributor

Automatic merge from submit-queue (batch tested with PRs 16098, 16155)

@openshift-merge-robot openshift-merge-robot merged commit 0c944c4 into openshift:master Sep 7, 2017
@mfojtik mfojtik deleted the registry-imagestreamsecrets branch September 5, 2018 21:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants