-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Prune image configs of manifest V2 schema 2 #10835
Conversation
a28053f
to
a5bacbe
Compare
// ReferencedImageLayerEdgeKind defines an edge from an ImageStreamNode or an | ||
// ImageNode to an ImageLayerNode. | ||
// ImageNode to an ImageComponentNode. | ||
ReferencedImageLayerEdgeKind = "ReferencedImageLayer" |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
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. |
a5bacbe
to
55c8ea8
Compare
Added extended test. |
[testextended][extended:core(images)][extended:core(builds)][extended:core(imageapis)] |
919493f
to
27a86b6
Compare
d37c79f
to
313c88c
Compare
// -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 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use full names compareResourceControllerNames
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
origin/test/extended/util/framework.go
Line 964 in 313c88c
var CheckPodIsSucceededFn = func(pod kapi.Pod) bool { |
origin/test/extended/util/framework.go
Line 492 in 313c88c
var CheckBuildSuccessFn = func(b *buildapi.Build) bool { |
origin/test/extended/util/framework.go
Line 600 in 313c88c
var CheckImageStreamLatestTagPopulatedFn = func(i *imageapi.ImageStream) bool { |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same - regular function.
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
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.
There was a problem hiding this 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) |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See
origin/test/extended/images/prune.go
Line 170 in 313c88c
} |
origin/test/extended/images/prune.go
Line 189 in 313c88c
} |
313c88c
to
6c36b2d
Compare
Of course! Always a pleasure. |
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]>
6c36b2d
to
0bc9d63
Compare
Evaluated for origin test up to 0bc9d63 |
Evaluated for origin testextended up to 0bc9d63 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM [merge]
continuous-integration/openshift-jenkins/test FAILURE (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin/9132/) |
Flake #10987 |
continuous-integration/openshift-jenkins/testextended SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin_extended/506/) (Extended Tests: core(images)) |
[merge] |
Flake #11079. [merge] |
Evaluated for origin merge up to 0bc9d63 |
continuous-integration/openshift-jenkins/merge SUCCESS (https://ci.openshift.redhat.com/jenkins/job/test_pr_origin/9280/) (Image: devenv-rhel7_5075) |
@soltysh you made it happen! 🎆 🎉 Sorry for the pain. |
A follow-up for #10805.
Resolves #10375