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

Prune image configs of manifest V2 schema 2 #10835

Merged

Conversation

miminar
Copy link

@miminar miminar commented Sep 7, 2016

A follow-up for #10805.

Resolves #10375

@miminar
Copy link
Author

miminar commented Sep 7, 2016

I'm working on extended test now. Otherwise ready for review. /cc @soltysh, @legionus

[test]

@miminar miminar force-pushed the prune-manifest-config-of-schema2 branch from a28053f to a5bacbe Compare September 7, 2016 13:55
// ReferencedImageLayerEdgeKind defines an edge from an ImageStreamNode or an
// ImageNode to an ImageLayerNode.
// ImageNode to an ImageComponentNode.
ReferencedImageLayerEdgeKind = "ReferencedImageLayer"
Copy link
Contributor

Choose a reason for hiding this comment

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

If you're replacing all, this should be renamed to ReferencedImageComponent, right?

Copy link
Contributor

Choose a reason for hiding this comment

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

Actually on second thought, you renamed the ImageLayerNode in the comment unnecessarily.

Copy link
Author

Choose a reason for hiding this comment

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

Well, I'm differentiating whether the image refers to the component as its layer or as its config. I'm using different edges for both cases. The edges don't serve any purpose later on. So instead of two, we could have just one ReferencedImageComponent, as you suggest. I kind of like the differentiation though.

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't mind the differentiation. The first comment was too quick, I've later noticed you've renamed the variable in the comment but all the rest is left. I'm just saying one should reflect the other.

@soltysh
Copy link
Contributor

soltysh commented Sep 9, 2016

In the end I'm still wondering if having the separation between layers and configs worth the trouble. They both end up being treated in the same way, we just need to make sure when adding config to the graph not to added if a layer was already added, right?

@miminar
Copy link
Author

miminar commented Sep 9, 2016

In the end I'm still wondering if having the separation between layers and configs worth the trouble. They both end up being treated in the same way, we just need to make sure when adding config to the graph not to added if a layer was already added, right?

For debugging purposes, I'd like to know whether the digest being deleted is a layer or a config. Also in the future, we might prefer to keep the configs only in etcd. Keeping some level of separation now will make it easier.

@miminar miminar force-pushed the prune-manifest-config-of-schema2 branch from a5bacbe to 55c8ea8 Compare September 9, 2016 14:52
@miminar miminar changed the title [WIP] Prune image configs of manifest V2 schema 2 Prune image configs of manifest V2 schema 2 Sep 9, 2016
@miminar
Copy link
Author

miminar commented Sep 9, 2016

Added extended test.

@miminar
Copy link
Author

miminar commented Sep 9, 2016

[testextended][extended:core(images)][extended:core(builds)][extended:core(imageapis)]

// -1 if rc a is older than b
// 1 if rc a is newer than b
// 0 if their names are the same
func cmpResourceControllerNames(a, b string) int {
Copy link
Contributor

Choose a reason for hiding this comment

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

Use full names compareResourceControllerNames

Copy link
Author

Choose a reason for hiding this comment

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

Renamed.

@@ -870,6 +965,20 @@ var CheckPodIsSucceededFn = func(pod kapi.Pod) bool {
return pod.Status.Phase == kapi.PodSucceeded
}

// CheckPodIsReadyFn returns true if the pod's ready probe determined that the pod is ready.
var CheckPodIsReadyFn = func(pod kapi.Pod) bool {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can this be a regular function, like:

func CheckPodIsReadyFn(pod kapi.Pod) bool {
...

why this construct?

Copy link
Author

Choose a reason for hiding this comment

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

It could, I'm just following a convention used to define other callback function defined in this file. See

var CheckPodIsSucceededFn = func(pod kapi.Pod) bool {
,
var CheckBuildSuccessFn = func(b *buildapi.Build) bool {
,
var CheckImageStreamLatestTagPopulatedFn = func(i *imageapi.ImageStream) bool {
as examples. I'm not really sure why, but I'd rather stay consistent.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok

}
}

testPruneImagesOfSchema := func(version int) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Turn this into regular function as well.

o.Expect(err).NotTo(o.HaveOccurred())
})

tearDown := func(cleanUp *cleanUpContainer) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Same - regular function.

Copy link
Author

Choose a reason for hiding this comment

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

Done.

return false, err
}

return strings.Contains(env, "REGISTRY_MIDDLEWARE_REPOSITORY_OPENSHIFT_ACCEPTSCHEMA2=true"), nil
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you use a constant here?

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm talking about this

AcceptSchema2EnvVar = "REGISTRY_MIDDLEWARE_REPOSITORY_OPENSHIFT_ACCEPTSCHEMA2"

Copy link
Author

Choose a reason for hiding this comment

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

Sure, I'll use the constant.

Copy link
Contributor

@soltysh soltysh left a comment

Choose a reason for hiding this comment

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

I've left some comments, mind addressing them?

return err
}

value := fmt.Sprintf("REGISTRY_MIDDLEWARE_REPOSITORY_OPENSHIFT_ACCEPTSCHEMA2=%t", accept)
Copy link
Contributor

Choose a reason for hiding this comment

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

Same env, please.

// ensureRegistryAcceptsSchema2 checks whether the registry is configured to accept manifests V2 schema 2 or
// not. If the result doesn't match given accept argument, registry's deployment config is updated accordingly
// and the function blocks until the registry is re-deployed and ready for new requests.
func ensureRegistryAcceptsSchema2(oc *exutil.CLI, accept bool) error {
Copy link
Contributor

Choose a reason for hiding this comment

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

The only worry I have here, is that we might leave the registry in a state different than at the beginning, you are aware that this might influence other tests in the future? How about reverting it back to is original?

Copy link
Author

Choose a reason for hiding this comment

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

@miminar
Copy link
Author

miminar commented Sep 22, 2016

I've left some comments, mind addressing them?

Of course! Always a pleasure.

Michal Minář added 4 commits September 22, 2016 13:45
LayerDeleter suggests it is usable to delete just image layers. It is
suitable to delete image configs as well. In fact, it doesn't really
remove the layers, it just removes layer links from desired repository.
This LayerLinkDeleter is a more appropriate.

Signed-off-by: Michal Minář <[email protected]>
Resolves openshift#10375

Signed-off-by: Michal Minář <[email protected]>
Renamed LayerNode to ComponentNode because it now identifies image
configs as well. The ComponentNode still needs to contain an information
whether it represents config or layer for proper logging.

The ComponentNode can now be connected to ImageNode or ImageStreamNode
using either ImageLayerEdge or ImageConfigEdge.

Signed-off-by: Michal Minář <[email protected]>
Add a utility function WaitForRegistry to wait for a re-deployed
registry pod to become ready.

Also make sure to support more than 9 re-deployments.

Signed-off-by: Michal Minář <[email protected]>
One test for manifest V2 schema 1 and one test for manifest V2 schema 2.

Signed-off-by: Michal Minář <[email protected]>
@miminar miminar force-pushed the prune-manifest-config-of-schema2 branch from 6c36b2d to 0bc9d63 Compare September 22, 2016 11:45
@openshift-bot
Copy link
Contributor

Evaluated for origin test up to 0bc9d63

@openshift-bot
Copy link
Contributor

Evaluated for origin testextended up to 0bc9d63

Copy link
Contributor

@soltysh soltysh left a comment

Choose a reason for hiding this comment

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

LGTM [merge]

@openshift-bot
Copy link
Contributor

continuous-integration/openshift-jenkins/test FAILURE (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin/9132/)

@miminar
Copy link
Author

miminar commented Sep 22, 2016

Flake #10987

@openshift-bot
Copy link
Contributor

continuous-integration/openshift-jenkins/testextended SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin_extended/506/) (Extended Tests: core(images))

@soltysh
Copy link
Contributor

soltysh commented Sep 22, 2016

[merge]

@soltysh
Copy link
Contributor

soltysh commented Sep 26, 2016

Flake #11079.

[merge]

@openshift-bot
Copy link
Contributor

Evaluated for origin merge up to 0bc9d63

@openshift-bot
Copy link
Contributor

openshift-bot commented Sep 26, 2016

continuous-integration/openshift-jenkins/merge SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin/9280/) (Image: devenv-rhel7_5075)

@openshift-bot openshift-bot merged commit a400f5a into openshift:master Sep 26, 2016
@miminar
Copy link
Author

miminar commented Sep 26, 2016

@soltysh you made it happen! 🎆 🎉

Sorry for the pain.

@soltysh
Copy link
Contributor

soltysh commented Sep 26, 2016

party

@miminar miminar deleted the prune-manifest-config-of-schema2 branch November 10, 2016 15:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants