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

Allow additional CRs to be managed by the chart #78

Closed
wants to merge 59 commits into from
Closed
Show file tree
Hide file tree
Changes from 53 commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
9fe0bd9
Add support for the new spire-controller-manager class feature
kfox1111 Oct 25, 2023
ef589a9
Fix docs. Swich nested deployment to use controller manager
kfox1111 Oct 25, 2023
91c49f5
Incorperate feedback
kfox1111 Oct 25, 2023
eff2e04
Merge branch 'main' into controller-manager-class
kfox1111 Oct 26, 2023
7f195fb
Test with nightly
kfox1111 Oct 26, 2023
cdf6e14
Fix global object naming clash
kfox1111 Oct 26, 2023
690ff7e
Fix missing dot
kfox1111 Oct 26, 2023
fb01de4
Fix naming conflict with cluster ids
kfox1111 Oct 26, 2023
d683f5f
Fix scoping issue
kfox1111 Oct 26, 2023
1e30d9e
Fix typo
kfox1111 Oct 26, 2023
0ddc76b
Fix webhook name collision
kfox1111 Oct 26, 2023
85a12a9
Fix webhook reference and add note to user about className
kfox1111 Oct 26, 2023
93ff943
Upgrade has to work on the old version of the object before rename
kfox1111 Oct 26, 2023
b8d276b
Fix formatting
kfox1111 Oct 26, 2023
f7466a4
Remove extra junk from job
kfox1111 Oct 26, 2023
3db9a0c
Easier local runs and wait for crds
kfox1111 Oct 26, 2023
6ce33bc
Add missing crd upgrade
kfox1111 Oct 27, 2023
04a02cb
Merge branch 'main' into controller-manager-class
kfox1111 Oct 27, 2023
17283dd
Update upgrade notes
kfox1111 Oct 27, 2023
51599c3
Update charts/spire/charts/spire-server/templates/controller-manager-…
kfox1111 Oct 27, 2023
7aac57c
Incorperate feedback
kfox1111 Oct 27, 2023
74388e3
Merge branch 'main' into controller-manager-class
kfox1111 Oct 31, 2023
d4f6d45
Bump version to the released 0.4.0
kfox1111 Nov 2, 2023
d344095
Merge branch 'main' into controller-manager-class
kfox1111 Nov 2, 2023
80036b6
Fix docs
kfox1111 Nov 2, 2023
1fff86d
Merge in crd changes from upstream
kfox1111 Nov 2, 2023
8bbd20a
Add auto populate dns
kfox1111 Nov 2, 2023
48b7644
Merge branch 'main' into controller-manager-class
kfox1111 Nov 3, 2023
3e9c053
Merge branch 'main' into controller-manager-class
kfox1111 Nov 3, 2023
a009101
Update charts/spire/README.md
kfox1111 Nov 4, 2023
6842584
Add missing ClusterSPIFFEID fields
kfox1111 Nov 4, 2023
1094b1f
Add another missing one
kfox1111 Nov 4, 2023
28ba4c6
Fix docs
kfox1111 Nov 4, 2023
0c58959
Allow additional CRs to be managed by the chart
kfox1111 Nov 4, 2023
7f56dc0
Add validation
kfox1111 Nov 4, 2023
3ccca0d
Merge branch 'main' into controller-manager-class
kfox1111 Nov 6, 2023
b6b4f05
Merge branch 'main' into extra-crs
kfox1111 Nov 6, 2023
0f59c4e
Fix docs
kfox1111 Nov 6, 2023
1c8bf9f
Merge branch 'main' into extra-crs
kfox1111 Nov 6, 2023
8c9d5fc
Merge branch 'main' into controller-manager-class
kfox1111 Nov 6, 2023
a0bf1ba
Merge branch 'controller-manager-class' into extra-crs
kfox1111 Nov 6, 2023
bf9b3c3
Add className to crs
kfox1111 Nov 6, 2023
cfe0ad9
Fix docs
kfox1111 Nov 6, 2023
2cffee9
Merge branch 'main' into extra-crs
kfox1111 Nov 8, 2023
36781e4
Merge branch 'main' into extra-crs
kfox1111 Nov 8, 2023
835968f
Merge branch 'main' into extra-crs
kfox1111 Nov 9, 2023
1032b14
Merge branch 'main' into extra-crs
kfox1111 Nov 13, 2023
a59213f
Merge branch 'main' into extra-crs
kfox1111 Nov 14, 2023
0dabc45
Incorperate feedback
kfox1111 Nov 15, 2023
eb95300
Fix readme formatting
kfox1111 Nov 15, 2023
03ecaab
Merge branch 'main' into extra-crs
kfox1111 Nov 15, 2023
0d86e0a
Merge branch 'main' into extra-crs
kfox1111 Nov 16, 2023
6bba33d
Merge branch 'main' into extra-crs
kfox1111 Nov 16, 2023
57241f7
Update charts/spire/README.md
kfox1111 Nov 16, 2023
4093159
Merge branch 'main' into extra-crs
kfox1111 Nov 16, 2023
c60a4ca
Merge branch 'main' into extra-crs
kfox1111 Nov 20, 2023
ba75a76
Merge branch 'main' into extra-crs
kfox1111 Nov 24, 2023
35c08d9
Merge branch 'main' into extra-crs
kfox1111 Nov 27, 2023
c01e512
Incorperate feedback
kfox1111 Nov 27, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions .github/tests/dependencies/spire-root-server-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@ global:
spire-server:
controllerManager:
identities:
namespaceSelector:
kubernetes.io/metadata.name: spire-server
podSelector:
app.kubernetes.io/component: server
app.kubernetes.io/instance: spire
app.kubernetes.io/name: server
downstream: true
clusterSPIFFEIDs:
default:
namespaceSelector:
kubernetes.io/metadata.name: spire-server
podSelector:
app.kubernetes.io/component: server
app.kubernetes.io/instance: spire
app.kubernetes.io/name: server
downstream: true
nodeAttestor:
k8sPsat:
serviceAccountAllowList:
Expand Down
4 changes: 4 additions & 0 deletions charts/spire/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ For production installs, please see [the production example](https://github.com/

## Upgrade notes

### 0.16.X

The settings under "spire-server.controllerManager.identities" have all been moved under "spire-server.controllerManager.identities.clusterSPIFFEIDs.default". If you have changed any from the defaults, please update them to the new location during upgradey.
kfox1111 marked this conversation as resolved.
Show resolved Hide resolved

### 0.15.X

The spire-crds chart has been updated. Please ensure you have upgraded spire-crds before upgrading the spire chart.
Expand Down
374 changes: 188 additions & 186 deletions charts/spire/charts/spire-server/README.md

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,42 +1,72 @@
{{- $root := . }}
{{- with .Values.controllerManager }}
{{- if and (eq (.enabled | toString) "true") (eq (.identities.enabled | toString) "true") }}
{{- range $key, $value := .Values.controllerManager.identities.clusterSPIFFEIDs }}
{{- range $skey, $svalue := $value }}
{{- if not (has $skey (list "name" "annotations" "labels" "enabled" "admin" "dnsNameTemplates" "downstream" "federatesWith" "jwtTTL" "namespaceSelector" "podSelector" "spiffeIDTemplate" "ttl" "workloadSelectorTemplates" "autoPopulateDNSNames")) }}
{{- fail (printf "Unsupported property specified: %s" $skey) }}
{{- end }}
{{- end }}
{{- range $rprop := list "spiffeIDTemplate" }}
{{- if not (hasKey $value $rprop) }}
{{- fail (printf "Required property %s was not specified" $rprop) }}
{{- end }}
{{- end }}
{{- if eq ($root.Values.controllerManager.enabled | toString) "true" }}
{{- if or (not (hasKey $value "enabled")) (eq ($value.enabled | toString) "true") }}
---
apiVersion: spire.spiffe.io/v1alpha1
kind: ClusterSPIFFEID
metadata:
name: {{ $root.Release.Namespace }}-{{ include "spire-controller-manager.fullname" $root }}-service-account-based
namespace: {{ include "spire-server.namespace" $root }}
kfox1111 marked this conversation as resolved.
Show resolved Hide resolved
{{- if $value.name }}
name: {{ $value.name }}
{{- else }}
name: {{ $root.Release.Namespace }}-{{ $root.Release.Name }}-{{ $key }}
{{- end }}
{{- with $value.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with $value.labels }}
labels:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
spiffeIDTemplate: {{ .identities.spiffeIDTemplate | quote }}
{{- with .identities.federatesWith }}
className: {{ include "spire-server.controller-manager-class-name" $root | quote }}
spiffeIDTemplate: {{ $value.spiffeIDTemplate | quote }}
{{- with $value.federatesWith }}
federatesWith:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .identities.podSelector }}
{{- with $value.podSelector }}
podSelector:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .identities.namespaceSelector }}
{{- with $value.namespaceSelector }}
namespaceSelector:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .identities.dnsNameTemplates }}
{{- with $value.dnsNameTemplates }}
dnsNameTemplates:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .identities.workloadSelectorTemplates }}
{{- with $value.workloadSelectorTemplates }}
workloadSelectorTemplates:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .identities.ttl }}
{{- with $value.ttl }}
ttl: {{ . | quote }}
{{- end }}
{{- with .identities.jwtTTL }}
{{- with $value.jwtTTL }}
jwtTtl: {{ . | quote }}
{{- end }}
admin: {{ .identities.admin }}
downstream: {{ .identities.downstream }}
autoPopulateDNSNames: {{ .identities.autoPopulateDNSNames }}
className: {{ include "spire-server.controller-manager-class-name" $root | quote}}
{{- end }}
{{- with $value.admin }}
admin: {{ . }}
{{- end }}
{{- with $value.downstream }}
downstream: {{ . }}
{{- end }}
{{- with $value.autoPopulateDNSNames }}
autoPopulateDNSNames: {{ . }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{{- $root := . }}
{{- range $key, $value := .Values.controllerManager.identities.clusterFederatedTrustDomains }}
{{- range $skey, $svalue := $value }}
{{- if not (has $skey (list "name" "annotations" "labels" "enabled" "bundleEndpointProfile" "bundleEndpointURL" "trustDomain" "trustDomainBundle")) }}
{{- fail (printf "Unsupported property specified: %s" $skey) }}
{{- end }}
{{- end }}
{{- range $rprop := list "bundleEndpointProfile" "bundleEndpointURL" "trustDomain" }}
{{- if not (hasKey $value $rprop) }}
{{- fail (printf "Required property %s was not specified" $rprop) }}
{{- end }}
{{- end }}
{{- if eq ($root.Values.controllerManager.enabled | toString) "true" }}
{{- if or (not (hasKey $value "enabled")) (eq ($value.enabled | toString) "true") }}
---
apiVersion: spire.spiffe.io/v1alpha1
kind: ClusterFederatedTrustDomain
metadata:
{{- if $value.name }}
name: {{ $value.name }}
{{- else }}
name: {{ $root.Release.Namespace }}-{{ $root.Release.Name }}-{{ $key }}
{{- end }}
{{- with $value.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with $value.labels }}
labels:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
className: {{ include "spire-server.controller-manager-class-name" $root | quote }}
{{- with $value.bundleEndpointProfile }}
bundleEndpointProfile:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with $value.bundleEndpointURL }}
bundleEndpointURL: {{ . | quote }}
{{- end }}
{{- with $value.trustDomain }}
trustDomain: {{ . | quote }}
{{- end }}
{{- with $value.trustDomainBundle }}
trustDomainBundle: {{ . | quote }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
{{- $root := . }}
{{- range $key, $value := .Values.controllerManager.identities.clusterStaticEntries }}
{{- range $skey, $svalue := $value }}
{{- if not (has $skey (list "name" "annotations" "labels" "enabled" "admin" "dnsNames" "downstream" "federatesWith" "hint" "jwtSVIDTTL" "parentID" "selectors" "spiffeID" "x509SVIDTTL")) }}
{{- fail (printf "Unsupported property specified: %s" $skey) }}
{{- end }}
{{- end }}
{{- range $rprop := list "spiffeID" "selectors" "parentID" }}
{{- if not (hasKey $value $rprop) }}
{{- fail (printf "Required property %s was not specified" $rprop) }}
{{- end }}
{{- end }}
{{- if eq ($root.Values.controllerManager.enabled | toString) "true" }}
{{- if or (not (hasKey $value "enabled")) (eq ($value.enabled | toString) "true") }}
---
apiVersion: spire.spiffe.io/v1alpha1
kind: ClusterStaticEntry
metadata:
{{- if $value.name }}
name: {{ $value.name }}
{{- else }}
name: {{ $root.Release.Namespace }}-{{ $root.Release.Name }}-{{ $key }}
{{- end }}
{{- with $value.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with $value.labels }}
labels:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
className: {{ include "spire-server.controller-manager-class-name" $root | quote }}
spiffeID: {{ $value.spiffeID | quote }}
{{- with $value.federatesWith }}
federatesWith:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with $value.selectors }}
selectors:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with $value.parentID }}
parentID: {{ . | quote }}
{{- end }}
{{- with $value.dnsNames }}
dnsNames:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with $value.hint }}
hint: {{ . | quote }}
{{- end }}
{{- with $value.x509SVIDTTL }}
x509SVIDTTL: {{ . | quote }}
{{- end }}
{{- with $value.jwtSVIDTTL }}
jwtSVIDTTL: {{ . | quote }}
{{- end }}
{{- with $value.admin }}
admin: {{ . }}
{{- end }}
{{- with $value.downstream }}
downstream: {{ . }}
{{- end }}
{{- with $value.autoPopulateDNSNames }}
autoPopulateDNSNames: {{ . }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
92 changes: 60 additions & 32 deletions charts/spire/charts/spire-server/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -445,38 +445,66 @@ controllerManager:
- local-path-storage

identities:
kfox1111 marked this conversation as resolved.
Show resolved Hide resolved
## @param controllerManager.identities.enabled Flag to enable default identities for controller manager
enabled: true

## @param controllerManager.identities.spiffeIDTemplate Spiffe ID template for identities
spiffeIDTemplate: spiffe://{{ .TrustDomain }}/ns/{{ .PodMeta.Namespace }}/sa/{{ .PodSpec.ServiceAccountName }}
## @param controllerManager.identities.podSelector [object] Selector for pods to issue identity
podSelector: {}
# matchLabels:
# spiffe.io/spiffe-id: "true"
## @param controllerManager.identities.namespaceSelector [object] Selector for namespacs to issue identity
namespaceSelector: {}
# matchLabels:
# spiffe.io/spiffe-id: "true"
## @param controllerManager.identities.dnsNameTemplates [array] DNS name template for issued identities
dnsNameTemplates: []
# - '{{ index .PodMeta.Labels "app.kubernetes.io/name" }}.{{ .PodMeta.Namespace }}.svc.cluster.local'
## @param controllerManager.identities.federatesWith [array] Other Spire server URLs for identity federation
federatesWith: []
# - example.io
# - example.ai
## @param controllerManager.identities.workloadSelectorTemplates [array] Templates to produce selectors that apply to a given workload before it will receive an ID
workloadSelectorTemplates: []
## @param controllerManager.identities.ttl Indicates an upper-bound time-to-live for X509 SVIDs. If unset, the cluster default will be chosen.
ttl: ""
## @param controllerManager.identities.jwtTTL Indicates an upper-bound time-to-live for JWT SVIDs. If unset, the cluster default will be chosen.
jwtTTL: ""
## @param controllerManager.identities.admin Indicates any pod matched by this identity will be an admin. Use this with extreme care.
admin: false
## @param controllerManager.identities.downstream Set if this spire instance is a root server and the workloads are downstream servers.
downstream: false
## @param controllerManager.identities.autoPopulateDNSNames Auto populate DNS names from services attached to pods
autoPopulateDNSNames: false
clusterSPIFFEIDs:
Copy link
Collaborator

Choose a reason for hiding this comment

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

What do you think of putting a comment above to mention that you can specify multiple?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

K. Took a first stab it it.

default:
## @param controllerManager.identities.clusterSPIFFEIDs.default.enabled Flag to enable default identities for controller manager
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
## @param controllerManager.identities.clusterSPIFFEIDs.default.enabled Flag to enable default identities for controller manager
## @param controllerManager.identities.clusterSPIFFEIDs.default.enabled Enable this identity for controller manager

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Manually merged suggestion due to conflict.

enabled: true

## @param controllerManager.identities.clusterSPIFFEIDs.default.spiffeIDTemplate Spiffe ID template for identities
spiffeIDTemplate: spiffe://{{ .TrustDomain }}/ns/{{ .PodMeta.Namespace }}/sa/{{ .PodSpec.ServiceAccountName }}
## @param controllerManager.identities.clusterSPIFFEIDs.default.podSelector [object] Selector for pods to issue identity
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is there anyway to have the comments not have default in them; instead have something more generic like [name].

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Maybe. will have a look at the doc tools documentation...

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Dug through the docs and code a bit. I don't see a way to allow anything more generic then specifying the key to something existing.

podSelector: {}
# matchLabels:
# spiffe.io/spiffe-id: "true"
## @param controllerManager.identities.clusterSPIFFEIDs.default.namespaceSelector [object] Selector for namespacs to issue identity
namespaceSelector: {}
# matchLabels:
# spiffe.io/spiffe-id: "true"
## @param controllerManager.identities.clusterSPIFFEIDs.default.dnsNameTemplates [array] DNS name template for issued identities
dnsNameTemplates: []
# - '{{ index .PodMeta.Labels "app.kubernetes.io/name" }}.{{ .PodMeta.Namespace }}.svc.cluster.local'
## @param controllerManager.identities.clusterSPIFFEIDs.default.federatesWith [array] Other Spire server URLs for identity federation
federatesWith: []
# - example.io
# - example.ai
## @param controllerManager.identities.clusterSPIFFEIDs.default.workloadSelectorTemplates [array] Templates to produce selectors that apply to a given workload before it will receive an ID
workloadSelectorTemplates: []
## @param controllerManager.identities.clusterSPIFFEIDs.default.ttl Indicates an upper-bound time-to-live for X509 SVIDs. If unset, the cluster default will be chosen.
ttl: ""
## @param controllerManager.identities.clusterSPIFFEIDs.default.jwtTTL Indicates an upper-bound time-to-live for JWT SVIDs. If unset, the cluster default will be chosen.
jwtTTL: ""
## @param controllerManager.identities.clusterSPIFFEIDs.default.admin Indicates any pod matched by this identity will be an admin. Use this with extreme care.
admin: false
## @param controllerManager.identities.clusterSPIFFEIDs.default.downstream Set if this spire instance is a root server and the workloads are downstream servers.
downstream: false
## @param controllerManager.identities.clusterSPIFFEIDs.default.autoPopulateDNSNames Auto populate DNS names from services attached to pods
autoPopulateDNSNames: false
# foo:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
# foo:
# You can specific additional ClusterSPIFFEIDs following this example.
# foo:

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Manually merged suggestion due to conflict.

# labels:
# foo: bar
# spiffeIDTemplate: spiffe://{{ .TrustDomain }}/foo
# namespaceSelector:
# matchLabels:
# foo: bar
## @param controllerManager.identities.clusterStaticEntries Specify additional ClusterStaticEntry objects.
clusterStaticEntries: {}
# foo:
# labels:
# foo: bar
# parentID: spiffe://example.com/bar
# spiffeID: spiffe://example.com/foo
# selectors:
# - k8s:pod-label:app.kubernetes.io/name:server
## @param controllerManager.identities.clusterFederatedTrustDomains Specify additional ClusterFederatedTrustDomain objects.
clusterFederatedTrustDomains: {}
# foo:
# labels:
# foo: bar
# bundleEndpointProfile:
# endpointSPIFFEID: spiffe://example.com/foo
# type: https_spiffe
# bundleEndpointURL: https://rootserver.example.com:1234
# trustDomain: example.com
Copy link
Collaborator

Choose a reason for hiding this comment

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

The options won't get documented in the readme with everything commented out. Would it be better to have something but disabled for documentation purposes?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Not sure. Would you want something like default: with a simplified example, with enabled: false?


validatingWebhookConfiguration:
## @param controllerManager.validatingWebhookConfiguration.failurePolicy Action when identity is not issued
Expand Down
4 changes: 3 additions & 1 deletion examples/nested/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ spire-server:
controllerManager:
enabled: true
identities:
spiffeIDTemplate: spiffe://{{ .TrustDomain }}/k8s/{{ .ClusterName }}/ns/{{ .PodMeta.Namespace }}/sa/{{ .PodSpec.ServiceAccountName }}
clusterSPIFFEIDs:
default:
spiffeIDTemplate: spiffe://{{ .TrustDomain }}/k8s/{{ .ClusterName }}/ns/{{ .PodMeta.Namespace }}/sa/{{ .PodSpec.ServiceAccountName }}

spiffe-oidc-discovery-provider:
enabled: true
Expand Down
2 changes: 1 addition & 1 deletion examples/production/run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

set -xe

UPGRADE_VERSION=v0.14.0
UPGRADE_VERSION=v0.15.1
UPGRADE_REPO=https://spiffe.github.io/helm-charts-hardened

SCRIPT="$(readlink -f "$0")"
Expand Down
Loading