Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 4 additions & 0 deletions helm/kmcp/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ spec:
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.topologySpreadConstraints }}
topologySpreadConstraints:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
Expand Down
85 changes: 85 additions & 0 deletions helm/kmcp/tests/__snapshot__/deployment_test.yaml.snap
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,91 @@ should include tolerations when specified:
operator: Equal
value: value
volumes: []
should include topologySpreadConstraints when specified:
1: |
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: kmcp
control-plane: controller-manager
helm.sh/chart: kmcp-1.0.0
name: RELEASE-NAME-controller-manager
namespace: NAMESPACE
spec:
replicas: 1
selector:
matchLabels:
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/name: kmcp
control-plane: controller-manager
template:
metadata:
annotations:
kubectl.kubernetes.io/default-container: manager
labels:
app.kubernetes.io/instance: RELEASE-NAME
app.kubernetes.io/name: kmcp
control-plane: controller-manager
spec:
containers:
- args:
- --leader-elect
- --health-probe-bind-address=:8081
- --metrics-bind-address=:8443
command:
- /manager
image: test-repo:v1.0.0
imagePullPolicy: IfNotPresent
livenessProbe:
httpGet:
path: /healthz
port: health
initialDelaySeconds: 15
periodSeconds: 20
name: manager
ports:
- containerPort: 8443
name: metrics
protocol: TCP
- containerPort: 8081
name: health
protocol: TCP
readinessProbe:
httpGet:
path: /readyz
port: health
initialDelaySeconds: 5
periodSeconds: 10
resources:
limits:
cpu: 500m
memory: 128Mi
requests:
cpu: 10m
memory: 64Mi
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
volumeMounts: []
securityContext:
runAsNonRoot: true
seccompProfile:
type: RuntimeDefault
serviceAccountName: RELEASE-NAME-controller-manager
terminationGracePeriodSeconds: 10
topologySpreadConstraints:
- labelSelector:
matchLabels:
app.kubernetes.io/name: kmcp
maxSkew: 1
topologyKey: topology.kubernetes.io/zone
whenUnsatisfiable: DoNotSchedule
volumes: []
should set custom replica count:
1: |
apiVersion: apps/v1
Expand Down
17 changes: 17 additions & 0 deletions helm/kmcp/tests/deployment_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,23 @@ tests:
count: 1
- matchSnapshot: {}

- it: should include topologySpreadConstraints when specified
template: deployment.yaml
set:
topologySpreadConstraints:
- maxSkew: 1
topologyKey: topology.kubernetes.io/zone
whenUnsatisfiable: DoNotSchedule
labelSelector:
matchLabels:
app.kubernetes.io/name: kmcp
image.repository: test-repo
image.tag: v1.0.0
asserts:
- hasDocuments:
count: 1
- matchSnapshot: {}

- it: should set security context
template: deployment.yaml
set:
Expand Down
3 changes: 3 additions & 0 deletions helm/kmcp/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ tolerations: []
# Affinity
affinity: {}

# Topology Spread Constraints
topologySpreadConstraints: []

# Service account configuration
serviceAccount:
# Specifies whether a service account should be created
Expand Down