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

Force MeshTLSAuthentication CRs to provide at least one identity/identityRef #10888

Merged
merged 2 commits into from
May 18, 2023

Conversation

alpeb
Copy link
Member

@alpeb alpeb commented May 12, 2023

Fixes #10782

Added the minItems: 1 field to spec.identities and spec.identitiRefs. This is a BC change so it's not required to bump the CRD version, plus current CRs not abiding to this constraint would be broken anyway.

$ cat << EOF | k apply -f -
> apiVersion: policy.linkerd.io/v1alpha1
kind: MeshTLSAuthentication
metadata:
  name: "test"
spec:
  identities: []
> EOF
The MeshTLSAuthentication "test" is invalid: spec.identities: Invalid value: 0: spec.identities in body should have at least 1 items

Also refactored the MeshTLSAuthentication index reset loop to avoid stop processing items when one of them fails.

…tityRef

Fixes #10782

Added the `minItems: 1` field to `spec.identities` and
`spec.identitiRefs`. This is a BC change so it's not required to bump
the CRD version, plus current CRs not abiding to this constraint would
be broken anyway.

```bash
$ cat << EOF | k apply -f -
> apiVersion: policy.linkerd.io/v1alpha1
kind: MeshTLSAuthentication
metadata:
  name: "test"
spec:
  identities: []
> EOF
The MeshTLSAuthentication "test" is invalid: spec.identities: Invalid value: 0: spec.identities in body should have at least 1 items
```
@alpeb alpeb requested a review from a team as a code owner May 12, 2023 14:16
@alpeb alpeb merged commit 7e264bd into main May 18, 2023
@alpeb alpeb deleted the alpeb/meshauth-minitems branch May 18, 2023 14:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

MeshTLSAuthentication requires at least one identity, but CRD doesn't correctly document it
3 participants