-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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!: remove list and watch on secrets. Fixes #8534 #8555
fix!: remove list and watch on secrets. Fixes #8534 #8555
Conversation
Signed-off-by: bjenuhb <Basanth_JenuHB@intuit.com>
Signed-off-by: bjenuhb <Basanth_JenuHB@intuit.com>
server/cache/cache.go
Outdated
} | ||
informerFactory.Start(ctx.Done()) | ||
informerFactory.WaitForCacheSync(ctx.Done()) | ||
return cache | ||
} | ||
|
||
func (c *ResourceCache) GetSecret(namespace string, secretName string) (*v12.Secret, 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.
Reason to introduce this method is if we want to introduce caching in future, we can easily change its implementation and keep external contract same
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 added to avoid repeated API calls. Prior to this there was a rought 1-to-1 mapping between Argo Server API calls and Kubernetes API calls O(1). This is now O(2).
Please use a cache (e.g lru
) so that this is mitigated.
The problem with a cache is cache invalidation, |
Signed-off-by: bjenuhb <Basanth_JenuHB@intuit.com>
Signed-off-by: bjenuhb <Basanth_JenuHB@intuit.com>
Signed-off-by: bjenuhb <Basanth_JenuHB@intuit.com>
Signed-off-by: bjenuhb <Basanth_JenuHB@intuit.com>
It can be less than 20m. We only want to avoid doing 1 per call. A cache of 1m would work. |
Just wanted to keep the timeout same as the informer |
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.
There was one bug that is not addressed in this PR: getResourceCacheNamespace()
needs to consider --namespaced
as well as --managed-namespace
.
As you can see, the code only considers --namespaced
option:
func getResourceCacheNamespace(opts ArgoServerOpts) string {
if opts.Namespaced {
return opts.SSONameSpace
}
return v1.NamespaceAll
}
Signed-off-by: bjenuhb <Basanth_JenuHB@intuit.com>
Actually that piece of code is handled here if namespaced {
// Case 1: If ssoNamespace is not specified, default it to installation namespace
if ssoNamespace == "" {
ssoNamespace = namespace
}
// Case 2: If ssoNamespace is not equal to installation or managed namespace, default it to installation namespace
if ssoNamespace != namespace && ssoNamespace != managedNamespace {
log.Warn("--sso-namespace should be equal to --managed-namespace or the installation namespace")
ssoNamespace = namespace
}
} It can either be |
Signed-off-by: bjenuhb <Basanth_JenuHB@intuit.com>
Signed-off-by: bjenuhb <Basanth_JenuHB@intuit.com>
Signed-off-by: bjenuhb <Basanth_JenuHB@intuit.com>
Signed-off-by: bjenuhb <Basanth_JenuHB@intuit.com>
@alexec I feel 20 min should be fine since we don't have cache invalidation issue. |
Signed-off-by: bjenuhb <Basanth_JenuHB@intuit.com>
I see. I think something should be done to improve the UX since this was something the user we worked with overlooked (and even myself). I understand now that currently I would suggest one of two things to improve:
@alexec WDYT? |
Signed-off-by: bjenuhb <Basanth_JenuHB@intuit.com>
Signed-off-by: bjenuhb <Basanth_JenuHB@intuit.com>
Signed-off-by: bjenuhb <Basanth_JenuHB@intuit.com>
Signed-off-by: bjenuhb <Basanth_JenuHB@intuit.com>
@jessesuen |
@jessesuen Anything else needed in this PR. want to take the PR to closure |
…8555) Signed-off-by: bjenuhb <Basanth_JenuHB@intuit.com>
…8555) Signed-off-by: bjenuhb <Basanth_JenuHB@intuit.com>
…8555) Signed-off-by: bjenuhb <Basanth_JenuHB@intuit.com>
…8555) Signed-off-by: bjenuhb <Basanth_JenuHB@intuit.com>
…8555) Signed-off-by: bjenuhb <Basanth_JenuHB@intuit.com>
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.
There appear to have been some undocumented breaking changes in this PR 😕
Those changes were unrelated to the goals and title of this PR too, which themselves were fully backward-compatible (as they only reduced permissions) 😕
@@ -224,7 +213,6 @@ See %s`, help.ArgoServer), | |||
command.Flags().StringVar(&configMap, "configmap", common.ConfigMapName, "Name of K8s configmap to retrieve workflow controller configuration") | |||
command.Flags().BoolVar(&namespaced, "namespaced", false, "run as namespaced mode") | |||
command.Flags().StringVar(&managedNamespace, "managed-namespace", "", "namespace that watches, default to the installation namespace") | |||
command.Flags().StringVar(&ssoNamespace, "sso-namespace", "", "namespace that will be used for SSO RBAC. Defaults to installation namespace. Used only in namespaced mode") |
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.
This is a breaking change. I see it was discussed above, but it wasn't mentioned in the changelog or release notes (nor even the PR description). The PR title is also missing an exclamation point indicating breakage 😕 (I added the exclamation point myself post-hoc just now)
ssoNamespace := namespace | ||
if managedNamespace != "" { | ||
ssoNamespace = managedNamespace | ||
} |
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.
this actually is different from the logic on line 151 and line 160 below. Those set the SSO namespace to the installation namespace when using a managed namespace. That makes sense, since your Argo configuration and Argo Server are in the installation namespace. Only your Workflows are in the managed namespace.
This change is actually quite confusing as a result, as due to this, with a managed namespace you now configure SSO RBAC there and not in the installation namespace. Normally that only happens when you enable SSO namespace delegation, which is named fairly explicitly.
This resulted in an undocumented breaking change that caused a regression too: #9989 (comment) 😕
Signed-off-by: bjenuhb Basanth_JenuHB@intuit.com
Fixes #8534