-
Notifications
You must be signed in to change notification settings - Fork 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
Add LocalSecretStore #1256
Add LocalSecretStore #1256
Conversation
9e2218f
to
a8f00a6
Compare
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.
Looks good to me Michael!
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.
Some optional suggestions/questions:
internal/k8s/controller.go
Outdated
glog.Warningf("Error validating secret %v for Ingress %v: %v", secretName, ing.Name, err) | ||
secret = nil | ||
} | ||
glog.Warningf("Error trying to get the secret %v for Ingress %v: %v", secretName, ing.Name, err) |
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.
Should we add some context about the namespace of at least one of the resources?
glog.Warningf("Error trying to get the secret %v for Ingress %v: %v", secretName, ing.Name, err) | |
glog.Warningf("Error trying to get the secret %v for Ingress %v/%v: %v", secretKey, ing.Namespace, ing.Name, err) |
internal/k8s/controller.go
Outdated
@@ -2227,58 +2164,84 @@ func (lbc *LoadBalancerController) getPolicies(policies []conf_v1.PolicyReferenc | |||
return result, errors | |||
} | |||
|
|||
func (lbc *LoadBalancerController) addJWTSecrets(policies []*conf_v1alpha1.Policy, jwtKeys map[string]*api_v1.Secret) error { | |||
func (lbc *LoadBalancerController) addJWTSecrets(secrets map[string]*configs.SecretReference, policies []*conf_v1alpha1.Policy) 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.
Should we call this var(and all similar references) secretRefs
so the reader can assume it's type to be map[string]*configs.SecretReference
instead of map[string]*api_v1.Secret
without reading the func signature?
func (lbc *LoadBalancerController) addJWTSecrets(secrets map[string]*configs.SecretReference, policies []*conf_v1alpha1.Policy) error { | |
func (lbc *LoadBalancerController) addJWTSecrets(secretRefs map[string]*configs.SecretReference, policies []*conf_v1alpha1.Policy) 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.
renamed
@@ -352,7 +352,7 @@ def test_jwt_policy_delete_secret( | |||
assert f"Request ID:" in resp1.text | |||
assert crd_info["status"]["state"] == "Warning" | |||
assert ( | |||
f'"{v_s_route_setup.route_m.namespace}/{secret}" which does not exist' | |||
"references an invalid Secret: secret doesn't exist or of an unsupported type" |
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.
No more secret name in warning message?
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.
good point. I can improve those messages in the next PR that implements remaining warnings
a8f00a6
to
0f3b908
Compare
Proposed changes
This PR introduces LocalSecretStore for storing secrets (TLS, CA, JWK).
LocalSecretStore validates secrets and updates the secret contents on the file system when a secret is updated.
The Ingress Controller code was simplified as it is no longer necessary to update the secret contents on the file system on every regeneration of Ingress (or VS) config.