-
Notifications
You must be signed in to change notification settings - Fork 28
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
Fix ObjectMeta CRD validation #242
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
What about |
Pull Request Test Coverage Report for Build 1696
💛 - Coveralls |
@aermakov-zalando ^ from the issue description |
mikkeloscar
force-pushed
the
fix-object-meta-crd-validation
branch
from
August 26, 2020 15:43
e779a83
to
494cb01
Compare
aryszka
reviewed
Aug 26, 2020
Signed-off-by: Mikkel Oscar Lyderik Larsen <mikkel.larsen@zalando.de>
mikkeloscar
force-pushed
the
fix-object-meta-crd-validation
branch
from
August 26, 2020 15:48
494cb01
to
7cf30e0
Compare
👍 |
Signed-off-by: Mikkel Oscar Lyderik Larsen <mikkel.larsen@zalando.de>
Signed-off-by: Mikkel Oscar Lyderik Larsen <mikkel.larsen@zalando.de>
Signed-off-by: Mikkel Oscar Lyderik Larsen <mikkel.larsen@zalando.de>
👍 |
1 similar comment
👍 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As mentioned in #241 the CRD validation for the ObjectMeta fields which we used in various places doesn't work because the schema is just
object
for the wholemetadata
field so anything below is dropped.This PR aims to fix the problem in two ways.
EmbeddedObjectMetaWithAnnotations
which is a slimmed down version ofmetav1.ObjectMeta
that only hasAnnotations
as a field. This has the bonus of only exposing the field which is actually used by the stackset controller for various sub resources e.g. setting a custom annotation on the ingress or service resources (Labels
are not used, so no need to allow users to set them for instance).It uses a patched version of https://github.com/kubernetes-sigs/controller-tools based on this PR: ⚠️ Only prevent validation of top-level ObjectMeta field kubernetes-sigs/controller-tools#395. (I have made a fork and are pulling it from there: mikkeloscar/controller-tools@54e4525, I'm open for suggestions on how to better manage this).EmbeddedObjectMeta
which is a slimmed down version ofmetav1.ObjectMeta
that hasLabels
andAnnotations
. This is used for a newly definedPodTemplateSpec
type which is similar tov1.PodTemplateSpec
but hasEmbeddedObjectMeta
instead ofmetav1.ObjectMeta
.Additionally it drops
metav1.ObjectMeta
from theHorizontalPodAutoscaler
field. This is not in use in the code, so it doesn't make sense to support users setting it. We may want to add it in the future as annotations may be needed for interacting with https://github.com/zalando-incubator/kube-metrics-adapter but we have theAutoscaler
field supporting this already. I would like to refactor theHorizontalPodAutoscaler
field anyway in the future.