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
Add namespace scoped ParametersReference to IngressClass #99275
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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 |
---|---|---|
|
@@ -20,6 +20,9 @@ import ( | |
"k8s.io/api/core/v1" | ||
networkingv1 "k8s.io/api/networking/v1" | ||
"k8s.io/apimachinery/pkg/runtime" | ||
utilfeature "k8s.io/apiserver/pkg/util/feature" | ||
"k8s.io/kubernetes/pkg/features" | ||
utilpointer "k8s.io/utils/pointer" | ||
) | ||
|
||
func addDefaultingFuncs(scheme *runtime.Scheme) error { | ||
|
@@ -43,3 +46,12 @@ func SetDefaults_NetworkPolicy(obj *networkingv1.NetworkPolicy) { | |
} | ||
} | ||
} | ||
|
||
func SetDefaults_IngressClass(obj *networkingv1.IngressClass) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. minor: you could make this named and typed for the Params struct, so you don't need the additional nil-check (I think) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Tried but this didn't work. I'm not familiar with codegen here but based on some reading of a few |
||
if !utilfeature.DefaultFeatureGate.Enabled(features.IngressClassNamespacedParams) { | ||
return | ||
} | ||
if obj.Spec.Parameters != nil && obj.Spec.Parameters.Scope == nil { | ||
obj.Spec.Parameters.Scope = utilpointer.StringPtr(networkingv1.IngressClassParametersReferenceScopeCluster) | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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.
minor: We're adding a
+featureGate=IngressClassNamespacedParams
tag for gated fields, which would be both of theseThere 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.
A quick grep revealed no prior art.
I added the tag here as well as in
k8s.io/api/networking/*
. Let me know if we only need this in pkg/apis.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.
We really only needed in the versioned files, but most people sync those comments to the unversioned