From 9efb2a0a1559bd82a01253eab042d659786f66df Mon Sep 17 00:00:00 2001 From: Simon Belmas <22192134+simbelmas@users.noreply.github.com> Date: Mon, 29 Jul 2024 16:19:08 +0200 Subject: [PATCH] Use tsp instad of podaffinity + version optional quotas --- deployment.yaml | 45 +++++++++++++++++++-------------------------- kustomization.yaml | 1 + resourceQuotas.yaml | 8 ++++++++ 3 files changed, 28 insertions(+), 26 deletions(-) create mode 100644 resourceQuotas.yaml diff --git a/deployment.yaml b/deployment.yaml index 5ba082a..5950b3e 100644 --- a/deployment.yaml +++ b/deployment.yaml @@ -7,22 +7,27 @@ spec: replicas: 1 template: spec: - affinity: - podAntiAffinity: - preferredDuringSchedulingIgnoredDuringExecution: - - weight: 100 - podAffinityTerm: - labelSelector: - matchExpressions: - - key: app.kubernetes.io/instance - operator: In - values: - - html-kube-tester - topologyKey: kubernetes.io/hostname securityContext: runAsNonRoot: true seccompProfile: type: RuntimeDefault + topologySpreadConstraints: + - maxSkew: 1 + topologyKey: topology.kubernetes.io/zone + whenUnsatisfiable: DoNotSchedule + labelSelector: + matchLabels: + app.kubernetes.io/instance: html-kube-tester + matchLabelKeys: + - pod-template-hash + - maxSkew: 1 + topologyKey: kubernetes.io/hostname + whenUnsatisfiable: ScheduleAnyway + labelSelector: + matchLabels: + app.kubernetes.io/instance: html-kube-tester + matchLabelKeys: + - pod-template-hash initContainers: - name: content-generator image: quay.io/simbelmas/alpine-tools:stable @@ -61,21 +66,9 @@ spec: protocol: TCP resources: requests: - cpu: 1m - memory: 10Mi + cpu: 10m limits: - cpu: 100m - memory: 50Mi - livenessProbe: &html-kube-tester-probe - httpGet: - path: / - port: 8080 - timeoutSeconds: 5 - periodSeconds: 15 - failureThreshold: 10 - readinessProbe: - <<: *html-kube-tester-probe - periodSeconds: 2 + cpu: 40m volumes: - name: init configMap: diff --git a/kustomization.yaml b/kustomization.yaml index b878c96..13ba1ec 100644 --- a/kustomization.yaml +++ b/kustomization.yaml @@ -18,6 +18,7 @@ resources: - deployment.yaml - service.yaml - ingress.yaml +#- resourceQuotas.yaml replacements: - source: diff --git a/resourceQuotas.yaml b/resourceQuotas.yaml new file mode 100644 index 0000000..1136719 --- /dev/null +++ b/resourceQuotas.yaml @@ -0,0 +1,8 @@ +apiVersion: v1 +kind: ResourceQuota +metadata: + name: compute-resources +spec: + hard: + requests.cpu: "100m" + limits.cpu: "50m" \ No newline at end of file