-
Notifications
You must be signed in to change notification settings - Fork 43
Feat/spire infrastructure deployment #251
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
Open
mahil-2040
wants to merge
9
commits into
volcano-sh:main
Choose a base branch
from
mahil-2040:feat/spire-infrastructure-deployment
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
3d46102
feat: added optional SPIRE config and RBAC(ServiceAccounts, ClusterRo…
mahil-2040 0c881c0
feat: added SPIRE Server StatefulSet and ConfigMap config for SPIRE c…
mahil-2040 9394345
feat: added SPIRE Agent DaemonSet and ConfigMap config for SPIRE comp…
mahil-2040 b9655aa
feat: added SPIRE Controller Manager Deployment and ClusterSPIFFEID C…
mahil-2040 4d3cb3b
fix:fixed SPIRE Controller Manager to be deplyoed as a sidecar with s…
mahil-2040 f85fb6d
fix: update SPIRE trust domain and router RBAC defaults
mahil-2040 35778a9
fix: deploy spiffe-helper sidecars for mTLS certificates and fix atte…
mahil-2040 4f88c6a
fix: hardened SPIRE deployment with PVCs, headless services, and rele…
mahil-2040 a00006d
fix: removed redundant permissions from router RBAC, set secure SPIRE…
mahil-2040 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,31 +1,29 @@ | ||
| {{- if .Values.router.rbac.create }} | ||
| apiVersion: v1 | ||
| kind: ServiceAccount | ||
| metadata: | ||
| name: {{ .Values.router.serviceAccountName | default "agentcube-router" }} | ||
| namespace: {{ .Release.Namespace }} | ||
| --- | ||
| apiVersion: rbac.authorization.k8s.io/v1 | ||
| kind: Role | ||
| metadata: | ||
| name: {{ .Values.router.serviceAccountName | default "agentcube-router" }} | ||
| namespace: {{ .Release.Namespace }} | ||
| rules: | ||
| - apiGroups: [""] | ||
| resources: ["secrets"] | ||
| verbs: ["get", "list", "watch", "create", "update", "patch", "delete"] | ||
| --- | ||
| apiVersion: rbac.authorization.k8s.io/v1 | ||
| kind: RoleBinding | ||
| metadata: | ||
| name: {{ .Values.router.serviceAccountName | default "agentcube-router" }} | ||
| namespace: {{ .Release.Namespace }} | ||
| subjects: | ||
| - kind: ServiceAccount | ||
| name: {{ .Values.router.serviceAccountName | default "agentcube-router" }} | ||
| namespace: {{ .Release.Namespace }} | ||
| roleRef: | ||
| apiGroup: rbac.authorization.k8s.io | ||
| kind: Role | ||
| name: {{ .Values.router.serviceAccountName | default "agentcube-router" }} | ||
| {{- end }} | ||
| apiVersion: v1 | ||
| kind: ServiceAccount | ||
| metadata: | ||
| name: {{ .Values.router.serviceAccountName | default "agentcube-router" }} | ||
| namespace: {{ .Release.Namespace }} | ||
| --- | ||
| apiVersion: rbac.authorization.k8s.io/v1 | ||
| kind: Role | ||
| metadata: | ||
| name: {{ .Values.router.serviceAccountName | default "agentcube-router" }} | ||
| namespace: {{ .Release.Namespace }} | ||
| rules: | ||
| - apiGroups: [""] | ||
| resources: ["secrets"] | ||
| verbs: ["get", "create"] | ||
| --- | ||
| apiVersion: rbac.authorization.k8s.io/v1 | ||
| kind: RoleBinding | ||
| metadata: | ||
| name: {{ .Values.router.serviceAccountName | default "agentcube-router" }} | ||
| namespace: {{ .Release.Namespace }} | ||
| subjects: | ||
| - kind: ServiceAccount | ||
| name: {{ .Values.router.serviceAccountName | default "agentcube-router" }} | ||
| namespace: {{ .Release.Namespace }} | ||
| roleRef: | ||
| apiGroup: rbac.authorization.k8s.io | ||
| kind: Role | ||
| name: {{ .Values.router.serviceAccountName | default "agentcube-router" }} |
45 changes: 45 additions & 0 deletions
45
manifests/charts/base/templates/spire/cluster-spiffe-ids.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| {{- if .Values.spire.enabled }} | ||
| # Prerequisite: spire.spiffe.io CRDs must be present in the cluster before these resources can be created. | ||
| # The spire-controller-manager sidecar registers them automatically on first boot. | ||
| # For a fresh cluster, run: kubectl apply -f https://github.com/spiffe/spire-controller-manager/releases/download/v{{ .Values.spire.controllerManager.image.tag }}/crds.yaml | ||
| # Router registration | ||
| apiVersion: spire.spiffe.io/v1alpha1 | ||
| kind: ClusterSPIFFEID | ||
| metadata: | ||
| name: {{ .Release.Name }}-agentcube-router | ||
| spec: | ||
mahil-2040 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| spiffeIDTemplate: "spiffe://{{ .Values.spire.trustDomain }}/ns/{{ "{{ .PodMeta.Namespace }}" }}/sa/{{ "{{ .PodSpec.ServiceAccountName }}" }}" | ||
| podSelector: | ||
| matchLabels: | ||
| app: agentcube-router | ||
| namespaceSelector: | ||
| matchLabels: | ||
| kubernetes.io/metadata.name: {{ .Release.Namespace }} | ||
|
|
||
| --- | ||
| # WorkloadManager registration | ||
| apiVersion: spire.spiffe.io/v1alpha1 | ||
| kind: ClusterSPIFFEID | ||
| metadata: | ||
| name: {{ .Release.Name }}-agentcube-workload-manager | ||
| spec: | ||
| spiffeIDTemplate: "spiffe://{{ .Values.spire.trustDomain }}/ns/{{ "{{ .PodMeta.Namespace }}" }}/sa/{{ "{{ .PodSpec.ServiceAccountName }}" }}" | ||
| podSelector: | ||
| matchLabels: | ||
| app: workloadmanager | ||
| namespaceSelector: | ||
| matchLabels: | ||
| kubernetes.io/metadata.name: {{ .Release.Namespace }} | ||
|
|
||
| --- | ||
| # PicoD (Sandbox) registration - namespace-agnostic | ||
| apiVersion: spire.spiffe.io/v1alpha1 | ||
| kind: ClusterSPIFFEID | ||
| metadata: | ||
| name: {{ .Release.Name }}-agentcube-sandbox | ||
| spec: | ||
| spiffeIDTemplate: "spiffe://{{ .Values.spire.trustDomain }}/sa/{{ "{{ .PodSpec.ServiceAccountName }}" }}" | ||
mahil-2040 marked this conversation as resolved.
Show resolved
Hide resolved
mahil-2040 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| podSelector: | ||
| matchLabels: | ||
| app: picod | ||
mahil-2040 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| {{- end }} | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,114 @@ | ||
| {{- if .Values.spire.enabled }} | ||
| # --- SPIRE Server --- | ||
| # Also used by the Controller Manager sidecar running in the same pod | ||
| apiVersion: v1 | ||
| kind: ServiceAccount | ||
| metadata: | ||
| name: spire-server | ||
| namespace: {{ .Release.Namespace }} | ||
| labels: | ||
| app: spire-server | ||
| --- | ||
| apiVersion: rbac.authorization.k8s.io/v1 | ||
| kind: ClusterRole | ||
| metadata: | ||
| name: {{ .Release.Name }}-spire-server | ||
| labels: | ||
| app: spire-server | ||
mahil-2040 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| rules: | ||
| # Required for k8s_psat NodeAttestor to validate projected service account tokens | ||
| - apiGroups: ["authentication.k8s.io"] | ||
| resources: ["tokenreviews"] | ||
| verbs: ["create"] | ||
| # Required for k8s_psat NodeAttestor to query pod identity during attestation | ||
| - apiGroups: [""] | ||
| resources: ["pods"] | ||
| verbs: ["get", "list", "watch"] | ||
| # Required for node attestation and registration entry management | ||
| - apiGroups: [""] | ||
| resources: ["nodes"] | ||
| verbs: ["get", "list", "watch"] | ||
| # Required by Controller Manager sidecar to watch and sync ClusterSPIFFEID CRDs | ||
| - apiGroups: ["spire.spiffe.io"] | ||
| resources: ["clusterspiffeids", "clusterfederatedtrustdomains", "clusterstaticentries"] | ||
| verbs: ["get", "list", "watch", "create", "update", "patch"] | ||
| - apiGroups: ["spire.spiffe.io"] | ||
| resources: ["clusterspiffeids/status", "clusterfederatedtrustdomains/status", "clusterstaticentries/status"] | ||
| verbs: ["get", "update", "patch"] | ||
| # Required by Controller Manager sidecar to resolve namespaces for namespaceSelector | ||
| - apiGroups: [""] | ||
| resources: ["namespaces", "endpoints"] | ||
| verbs: ["get", "list", "watch"] | ||
| # Required by Controller Manager sidecar for leader election | ||
| - apiGroups: ["coordination.k8s.io"] | ||
| resources: ["leases"] | ||
| verbs: ["get", "list", "watch", "create", "update", "patch"] | ||
| - apiGroups: [""] | ||
| resources: ["events"] | ||
| verbs: ["create", "patch"] | ||
| # Required by Controller Manager sidecar to manage its webhook certificate | ||
| - apiGroups: ["admissionregistration.k8s.io"] | ||
| resources: ["validatingwebhookconfigurations"] | ||
| verbs: ["get", "list", "watch", "create"] | ||
| - apiGroups: ["admissionregistration.k8s.io"] | ||
| resources: ["validatingwebhookconfigurations"] | ||
| resourceNames: ["{{ .Release.Name }}-spire-controller-manager-webhook"] | ||
| verbs: ["update", "patch"] | ||
| --- | ||
| apiVersion: rbac.authorization.k8s.io/v1 | ||
| kind: ClusterRoleBinding | ||
| metadata: | ||
| name: {{ .Release.Name }}-spire-server | ||
| labels: | ||
| app: spire-server | ||
| roleRef: | ||
| apiGroup: rbac.authorization.k8s.io | ||
| kind: ClusterRole | ||
| name: {{ .Release.Name }}-spire-server | ||
| subjects: | ||
| - kind: ServiceAccount | ||
| name: spire-server | ||
| namespace: {{ .Release.Namespace }} | ||
| --- | ||
|
|
||
| # --- SPIRE Agent --- | ||
| apiVersion: v1 | ||
| kind: ServiceAccount | ||
| metadata: | ||
| name: spire-agent | ||
| namespace: {{ .Release.Namespace }} | ||
| labels: | ||
| app: spire-agent | ||
| --- | ||
| apiVersion: rbac.authorization.k8s.io/v1 | ||
| kind: ClusterRole | ||
| metadata: | ||
| name: {{ .Release.Name }}-spire-agent | ||
| labels: | ||
| app: spire-agent | ||
mahil-2040 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| rules: | ||
| # Required for k8s workload attestor to query pod metadata from kubelet | ||
| - apiGroups: [""] | ||
| resources: ["pods"] | ||
| verbs: ["get", "list"] | ||
| # Required for workload attestation to resolve node information and proxy requests to kubelet | ||
| - apiGroups: [""] | ||
| resources: ["nodes", "nodes/proxy"] | ||
| verbs: ["get", "list"] | ||
| --- | ||
| apiVersion: rbac.authorization.k8s.io/v1 | ||
| kind: ClusterRoleBinding | ||
| metadata: | ||
| name: {{ .Release.Name }}-spire-agent | ||
| labels: | ||
| app: spire-agent | ||
| roleRef: | ||
| apiGroup: rbac.authorization.k8s.io | ||
| kind: ClusterRole | ||
| name: {{ .Release.Name }}-spire-agent | ||
| subjects: | ||
| - kind: ServiceAccount | ||
| name: spire-agent | ||
| namespace: {{ .Release.Namespace }} | ||
| {{- end }} | ||
|
|
||
19 changes: 19 additions & 0 deletions
19
manifests/charts/base/templates/spire/spiffe-helper-config.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| {{- if .Values.spire.enabled }} | ||
| apiVersion: v1 | ||
| kind: ConfigMap | ||
| metadata: | ||
| name: spiffe-helper-config | ||
| namespace: {{ .Release.Namespace }} | ||
| labels: | ||
| app: spiffe-helper | ||
| data: | ||
| spiffe-helper.conf: | | ||
| agent_address = "/run/spire/sockets/agent.sock" | ||
| cmd = "" | ||
| cmd_args = "" | ||
| cert_dir = "{{ .Values.spire.spiffeHelper.certDir }}" | ||
| renew_signal = "SIGHUP" | ||
| svid_file_name = "{{ .Values.spire.spiffeHelper.certFileName }}" | ||
| svid_key_file_name = "{{ .Values.spire.spiffeHelper.keyFileName }}" | ||
| svid_bundle_file_name = "{{ .Values.spire.spiffeHelper.bundleFileName }}" | ||
| {{- end }} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
This chart creates ClusterSPIFFEID resources, but it doesn’t appear to install the required spire-controller-manager CRDs (no
spire.spiffe.ioCRDs undermanifests/charts/base/crds/). With spire.enabled=true, Helm/Kubernetes will reject these manifests unless the CRDs are pre-installed, causing installation/upgrade to fail. Consider shipping the CRDs (or a dedicated dependency/subchart) and documenting the install order/requirements clearly if they must be applied separately.