Skip to content
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

policy: Error out on missing secrets in policy computation #9897

Merged
merged 1 commit into from
Jan 20, 2020

Conversation

jrajahalme
Copy link
Member

@jrajahalme jrajahalme commented Jan 17, 2020

Currently missing secrets cause empty TLS contexts to be sent to
Envoy, which will then NACK the policy. Error out earlier in the
Cilium endpoint regeneration logic so that Envoy is not bothered with
errorneous configuration.

Currently this will still lead to endpoint being not-ready, but at
least the endpoint log contains the failure message pinpointing the
problem (e.g., "Error regenerating endpoint: unable to regenerate
policy for '310': secrets "swapi-server" not found").

Signed-off-by: Jarno Rajahalme jarno@covalent.io


This change is Reviewable

Currently missing secrets cause empty TLS contexts to be sent to
Envoy, which will then NACK the policy. Error out earlier in the
Cilium endpoint regeneration logic so that Envoy is not bothered with
errorneous configuration.

Currently this will still lead to endpoint being not-ready, but at
least the endpoint log contains the failure message pinpointing the
problem (e.g., "Error regenerating endpoint: unable to regenerate
policy for '310': secrets \"swapi-server\" not found").

Signed-off-by: Jarno Rajahalme <jarno@covalent.io>
@jrajahalme jrajahalme added kind/enhancement This would improve or streamline existing functionality. pending-review sig/policy Impacts whether traffic is allowed or denied based on user-defined policies. labels Jan 17, 2020
@jrajahalme jrajahalme requested a review from a team January 17, 2020 23:38
@maintainer-s-little-helper
Copy link

Release note label not set, please set the appropriate release note.

2 similar comments
@maintainer-s-little-helper
Copy link

Release note label not set, please set the appropriate release note.

@maintainer-s-little-helper
Copy link

Release note label not set, please set the appropriate release note.

}
case OriginatingTLS:
if ca == "" {
return nil, fmt.Errorf("Originating TLS context is missing CA certs.")

Choose a reason for hiding this comment

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

error strings should not be capitalized or end with punctuation or a newline

switch direction {
case TerminatingTLS:
if public == "" || private == "" {
return nil, fmt.Errorf("Terminating TLS context is missing certs.")

Choose a reason for hiding this comment

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

error strings should not be capitalized or end with punctuation or a newline

type TLSDirection string

const (
TerminatingTLS TLSDirection = "terminating"

Choose a reason for hiding this comment

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

exported const TerminatingTLS should have comment (or a comment on this block) or be unexported

@@ -390,19 +390,40 @@ func (l7 L7DataMap) addRulesForEndpoints(rules api.L7Rules, endpoints []CachedSe
}
}

func (l4 *L4Filter) getCerts(policyCtx PolicyContext, tls *api.TLSContext, direction string) *TLSContext {
type TLSDirection string

Choose a reason for hiding this comment

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

exported type TLSDirection should have comment or be unexported

@jrajahalme
Copy link
Member Author

test-me-please

@coveralls
Copy link

Coverage Status

Coverage increased (+0.02%) to 45.902% when pulling a389c54 on pr/jrajahalme/policy-error-out-tls into ff54dbd on master.

@aanm aanm merged commit 412089f into master Jan 20, 2020
1.7.0 automation moved this from In progress to Merged Jan 20, 2020
@aanm aanm deleted the pr/jrajahalme/policy-error-out-tls branch January 20, 2020 11:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement This would improve or streamline existing functionality. release-note/misc This PR makes changes that have no direct user impact. sig/policy Impacts whether traffic is allowed or denied based on user-defined policies.
Projects
No open projects
1.7.0
  
Merged
Development

Successfully merging this pull request may close these issues.

None yet

4 participants