-
Notifications
You must be signed in to change notification settings - Fork 69
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
[SRVKS-1179] enable secret filter informer by default #2445
Merged
openshift-merge-bot
merged 3 commits into
openshift-knative:main
from
skonto:enable_secret_filter_informers_by_default
Feb 1, 2024
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,18 +8,13 @@ import ( | |
corev1 "k8s.io/api/core/v1" | ||
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" | ||
"knative.dev/networking/pkg/apis/networking" | ||
"knative.dev/networking/pkg/config" | ||
"knative.dev/operator/pkg/apis/operator/base" | ||
operatorv1beta1 "knative.dev/operator/pkg/apis/operator/v1beta1" | ||
) | ||
|
||
const ( | ||
// TODO: Remove when available in knative.dev/networking/config | ||
ServingInternalCertName = "knative-serving-certs" | ||
// TODO: Maybe decide to fetch from net-kourier deps instead | ||
EnableSecretInformerFilteringByCertUIDEnv = "ENABLE_SECRET_INFORMER_FILTERING_BY_CERT_UID" | ||
// TODO: Annotation is deprecated, remove in future releases | ||
secretInformerFilteringAnnotation = "serverless.openshift.io/enable-secret-informer-filtering" | ||
) | ||
// TODO: Maybe decide to fetch from net-kourier deps instead | ||
const EnableSecretInformerFilteringByCertUIDEnv = "ENABLE_SECRET_INFORMER_FILTERING_BY_CERT_UID" | ||
|
||
func enableSecretInformerFilteringTransformers(ks base.KComponent) []mf.Transformer { | ||
shouldInject := false | ||
|
@@ -41,7 +36,8 @@ func enableSecretInformerFilteringTransformers(ks base.KComponent) []mf.Transfor | |
|
||
func injectLabelIntoInternalEncryptionSecret() mf.Transformer { | ||
return func(u *unstructured.Unstructured) error { | ||
if u.GetKind() == "Secret" && u.GetName() == ServingInternalCertName { | ||
//nolint:staticcheck // ignore the deprecation until internal encryption is implemented downstream | ||
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. As good as it can gets: golangci/golangci-lint#741. |
||
if u.GetKind() == "Secret" && u.GetName() == config.ServingInternalCertName { | ||
labels := u.GetLabels() | ||
if labels == nil { | ||
labels = make(map[string]string, 1) | ||
|
@@ -74,15 +70,10 @@ func configIfUnsetAndCheckIfShouldInject(comp *operatorv1beta1.KnativeServing, d | |
} | ||
} | ||
|
||
// The annotation is deprecated | ||
// TODO: Remove this block in future releases | ||
if deployment == "net-istio-controller" { | ||
if v, ok := comp.GetAnnotations()[secretInformerFilteringAnnotation]; ok { | ||
b, _ := strconv.ParseBool(v) | ||
// Keep the same behavior as in 1.27 | ||
return b, common.InjectEnvironmentIntoDeployment("net-istio-controller", "controller", | ||
corev1.EnvVar{Name: EnableSecretInformerFilteringByCertUIDEnv, Value: v}) | ||
} | ||
// TODO: remove when set to true at the net-* repos upstream/midstream | ||
ReToCode marked this conversation as resolved.
Show resolved
Hide resolved
|
||
if deployment == "net-istio-controller" || deployment == "net-kourier-controller" { | ||
return true, common.InjectEnvironmentIntoDeployment(deployment, "controller", | ||
corev1.EnvVar{Name: EnableSecretInformerFilteringByCertUIDEnv, Value: "true"}) | ||
} | ||
return false, nil | ||
} |
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
Oops, something went wrong.
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.
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 am thinking of moving that const to knative.dev/pkg upstream or something so net-istio could benefit from it. So not eager to bring in the net-kourier dep.
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.
Yeah, probably better to move it to pkg upstream. Do you want to create a JIRA for that. We'll probably forget the TODO here.