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

Support setting tolerations, nodeSelector, and affinity during helm install #8

Merged
merged 4 commits into from
Jan 31, 2024
Merged
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
21 changes: 17 additions & 4 deletions deploy/parameter/helm-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,31 @@ securityContext:

resources:
limits:
cpu: 500m
memory: 128Mi
cpu: 100m
memory: 256Mi
requests:
cpu: 10m
cpu: 20m
Copy link
Contributor

Choose a reason for hiding this comment

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

Have you checked when the controller is running without any provider yaml being deployed, how many resource it take?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

image

memory: 64Mi

autoscaling:
enabled: false
minReplicas: 1
maxReplicas: 5
targetCPUUtilizationPercentage: 80
targetMemoryUtilizationPercentage: 80

env:
azureClientId: ""
azureTenantId: ""
azureTenantId: ""

# Pod scheduling preferences
# ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity
affinity: {}

# Node labels for pod assignment
# ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#nodeselector
nodeSelector: {}

# Tolerations for nodes that have taints on them.
# ref: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration
tolerations: []
26 changes: 26 additions & 0 deletions deploy/templates/autoscaling.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{{- if .Values.autoscaling.enabled }}
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: {{ include "az-appconfig-k8s-provider.fullname" . }}-hpa
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: {{ include "az-appconfig-k8s-provider.fullname" . }}
minReplicas: {{ .Values.autoscaling.minReplicas }}
maxReplicas: {{ .Values.autoscaling.maxReplicas }}
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }}
- type: Resource
resource:
name: memory
target:
type: Utilization
averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }}
{{- end }}
12 changes: 12 additions & 0 deletions deploy/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,18 @@ spec:
labels:
{{- include "az-appconfig-k8s-provider.selectorLabels" . | nindent 8 }}
spec:
{{- if .Values.nodeSelector }}
nodeSelector:
{{- toYaml .Values.nodeSelector | nindent 8 }}
{{- end }}
{{- if .Values.affinity }}
affinity:
{{- toYaml .Values.affinity | nindent 8 }}
{{- end }}
{{- if .Values.tolerations }}
tolerations:
{{- toYaml .Values.tolerations | nindent 8 }}
{{- end }}
containers:
- args:
- --leader-elect
Expand Down
Loading