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

Stabilization Improvement for the Helm Charts (for Resource-Limited Environments) #933

Merged
merged 16 commits into from
Apr 24, 2024
4 changes: 2 additions & 2 deletions hack/install-vsecm-to-eks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
helm install vsecm vsecm/vsecm

echo "verifying vsecm installation"
kubectl wait --for=condition=Available deployment -n vsecm-system vsecm-sentinel
kubectl wait --timeout=60s --for=condition=Available deployment -n vsecm-system vsecm-sentinel
echo "vsecm-sentinel: deployment available"
kubectl wait --for=condition=Available deployment -n vsecm-system vsecm-safe
kubectl wait --timeout=60s --for=condition=Available deployment -n vsecm-system vsecm-safe
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Approximately every 1 out of 20 attempts this was taking slightly larger than 30secs (default) on the build server. 60s should be good enough of a limit.

echo "vsecm-safe: deployment available"
echo "vsecm installation successful"
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ spec:
serviceAccountName: {{ include "keystone.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}

priorityClassName: system-cluster-critical

initContainers:
- name: init-container
image: "{{ .Values.global.registry }}/{{ .Values.global.images.initContainer.repository }}:{{ .Values.global.images.initContainer.tag }}"
Expand Down
3 changes: 3 additions & 0 deletions helm-charts/0.24.5/charts/safe/templates/Deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ spec:
serviceAccountName: {{ include "safe.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}

priorityClassName: system-cluster-critical

containers:
- name: main
image: "{{ .Values.global.registry }}/{{- include "safe.repository" .}}:{{ .Values.global.images.safe.tag }}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ spec:
serviceAccountName: {{ include "sentinel.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}

priorityClassName: system-cluster-critical

containers:
- name: main
image: "{{ .Values.global.registry }}/{{- include "sentinel.repository" .}}:{{ .Values.global.images.sentinel.tag }}"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# /*
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Split these to individual files to make it easier to diff/merge with helm-charts-hardened-generated files.

# | Protect your secrets, protect your sensitive data.
# : Explore VMware Secrets Manager docs at https://vsecm.com/
# </
# <>/ keep your secrets... secret
# >/
# <>/' Copyright 2023-present VMware Secrets Manager contributors.
# >/' SPDX-License-Identifier: BSD-2-Clause
# */

# Binds above cluster role to spire-agent service account
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: spire-agent-cluster-role-binding
subjects:
- kind: ServiceAccount
name: spire-agent
namespace: {{ .Values.global.spire.namespace }}
roleRef:
kind: ClusterRole
name: spire-agent-cluster-role
apiGroup: rbac.authorization.k8s.io
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# /*
# | Protect your secrets, protect your sensitive data.
# : Explore VMware Secrets Manager docs at https://vsecm.com/
# </
# <>/ keep your secrets... secret
# >/
# <>/' Copyright 2023-present VMware Secrets Manager contributors.
# >/' SPDX-License-Identifier: BSD-2-Clause
# */

# Required cluster role to allow spire-agent to query k8s API server
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: spire-agent-cluster-role
rules:
- apiGroups: [""]
resources: ["pods","nodes","nodes/proxy"]
verbs: ["get"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# /*
# | Protect your secrets, protect your sensitive data.
# : Explore VMware Secrets Manager docs at https://vsecm.com/
# </
# <>/ keep your secrets... secret
# >/
# <>/' Copyright 2023-present VMware Secrets Manager contributors.
# >/' SPDX-License-Identifier: BSD-2-Clause
# */

# ConfigMap for the SPIRE agent featuring:
# 1) PSAT node attestation
# 2) K8S Workload Attestation over the secure kubelet port
apiVersion: v1
kind: ConfigMap
metadata:
name: spire-agent
namespace: {{ .Values.global.spire.namespace }}
data:
agent.conf: |
agent {
data_dir = "/run/spire"
log_level = {{ .Values.global.spire.logLevel | quote }}
server_address = "spire-server"
server_port = {{ .Values.global.spire.serverPort | quote }}
socket_path = "/run/spire/sockets/agent.sock"
trust_bundle_path = "/run/spire/bundle/bundle.crt"
trust_domain = {{ .Values.global.spire.trustDomain | quote }}
}

health_checks {
bind_address = "0.0.0.0"
bind_port = "9982"
listener_enabled = true
live_path = "/live"
ready_path = "/ready"
}

plugins {
NodeAttestor "k8s_psat" {
plugin_data {
cluster = "vsecm-cluster"
}
}

KeyManager "memory" {
plugin_data {
}
}

WorkloadAttestor "k8s" {
plugin_data {
skip_kubelet_verification = true
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,85 +8,6 @@
# >/' SPDX-License-Identifier: BSD-2-Clause
# */

# ServiceAccount for the SPIRE agent
apiVersion: v1
kind: ServiceAccount
metadata:
name: spire-agent
namespace: {{ .Values.global.spire.namespace }}

---

# Required cluster role to allow spire-agent to query k8s API server
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: spire-agent-cluster-role
rules:
- apiGroups: [""]
resources: ["pods","nodes","nodes/proxy"]
verbs: ["get"]

---

# Binds above cluster role to spire-agent service account
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: spire-agent-cluster-role-binding
subjects:
- kind: ServiceAccount
name: spire-agent
namespace: {{ .Values.global.spire.namespace }}
roleRef:
kind: ClusterRole
name: spire-agent-cluster-role
apiGroup: rbac.authorization.k8s.io


---

# ConfigMap for the SPIRE agent featuring:
# 1) PSAT node attestation
# 2) K8S Workload Attestation over the secure kubelet port
apiVersion: v1
kind: ConfigMap
metadata:
name: spire-agent
namespace: {{ .Values.global.spire.namespace }}
data:
agent.conf: |
agent {
data_dir = "/run/spire"
log_level = {{ .Values.global.spire.logLevel | quote }}
server_address = "spire-server"
server_port = {{ .Values.global.spire.serverPort | quote }}
socket_path = "/run/spire/sockets/agent.sock"
trust_bundle_path = "/run/spire/bundle/bundle.crt"
trust_domain = {{ .Values.global.spire.trustDomain | quote }}
}

plugins {
NodeAttestor "k8s_psat" {
plugin_data {
cluster = "vsecm-cluster"
}
}

KeyManager "memory" {
plugin_data {
}
}

WorkloadAttestor "k8s" {
plugin_data {
skip_kubelet_verification = true
}
}
}

---

apiVersion: apps/v1
kind: DaemonSet
metadata:
Expand Down Expand Up @@ -114,6 +35,7 @@ spec:
hostNetwork: true
dnsPolicy: ClusterFirstWithHostNet
serviceAccountName: spire-agent
priorityClassName: system-node-critical
containers:
- name: spire-agent
image: {{ .Values.global.images.spireAgent.repository }}:{{ .Values.global.images.spireAgent.tag }}
Expand All @@ -123,6 +45,23 @@ spec:
requests:
memory: {{ .Values.resources.agent.requests.memory }}
cpu: {{ .Values.resources.agent.requests.cpu }}

ports:
- containerPort: 9982
name: healthz
livenessProbe:
httpGet:
path: /live
port: healthz
initialDelaySeconds: 15
periodSeconds: 60
readinessProbe:
httpGet:
path: /ready
port: healthz
initialDelaySeconds: 10
periodSeconds: 30

volumeMounts:
- name: spire-config
mountPath: /run/spire/config
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# /*
# | Protect your secrets, protect your sensitive data.
# : Explore VMware Secrets Manager docs at https://vsecm.com/
# </
# <>/ keep your secrets... secret
# >/
# <>/' Copyright 2023-present VMware Secrets Manager contributors.
# >/' SPDX-License-Identifier: BSD-2-Clause
# */

# ServiceAccount for the SPIRE agent
apiVersion: v1
kind: ServiceAccount
metadata:
name: spire-agent
namespace: {{ .Values.global.spire.namespace }}
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ data:
kind: ControllerManagerConfig
metrics:
bindAddress: 127.0.0.1:8082
healthProbe:
bindAddress: 127.0.0.1:8083
health:
healthProbeBindAddress: 0.0.0.0:8083
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure about the 0.0.0.0 binding; I’l take a note to test it with 127.0.0.1 too

leaderElection:
leaderElect: true
resourceName: 98c9c988.spiffe.io
Expand Down
Loading