8000 Add LocalSecretStore by pleshakov · Pull Request #1256 · nginx/kubernetes-ingress · GitHub
[go: up one dir, main page]

Skip to content

Conversation

pleshakov
Copy link
Contributor

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.

@pleshakov pleshakov added the enhancement Pull requests for new features/feature enhancements label Nov 30, 2020
@pleshakov pleshakov added the change Pull requests that introduce a change label Dec 1, 2020
Copy link
@mikestephen mikestephen left a 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!

Copy link
Contributor
@Dean-Coakley Dean-Coakley left a 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:

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)
Copy link
Contributor
@Dean-Coakley Dean-Coakley Dec 2, 2020

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?

Suggested change
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)

8000
}

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 {
Copy link
Contributor
@Dean-Coakley Dean-Coakley Dec 2, 2020

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?

Suggested change
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 {

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

renamed

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"
Copy link
Contributor

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?

Copy link
Contributor Author

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

@pleshakov pleshakov merged commit 4841668 into master Dec 2, 2020
@pleshakov pleshakov deleted the localsecretstore branch December 2, 2020 20:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
change Pull requests that introduce a change enhancement Pull requests for new features/feature enhancements
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
0