-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1400 from porter-dev/main
Move karpenter to production
- Loading branch information
Showing
23 changed files
with
1,053 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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 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,23 @@ | ||
# Patterns to ignore when building packages. | ||
# This supports shell glob matching, relative path matching, and | ||
# negation (prefixed with !). Only one pattern per line. | ||
.DS_Store | ||
# Common VCS dirs | ||
.git/ | ||
.gitignore | ||
.bzr/ | ||
.bzrignore | ||
.hg/ | ||
.hgignore | ||
.svn/ | ||
# Common backup files | ||
*.swp | ||
*.bak | ||
*.tmp | ||
*.orig | ||
*~ | ||
# Various IDEs | ||
.project | ||
.idea/ | ||
*.tmproj | ||
.vscode/ |
This file contains 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,3 @@ | ||
dependencies: [] | ||
digest: sha256:5595919ac269b4105dd65d20eb27cb271b8976c1d10903e0b504d349df30f017 | ||
generated: "2020-12-02T11:48:25.741819-08:00" |
This file contains 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,34 @@ | ||
apiVersion: v2 | ||
name: karpenter | ||
description: A Helm chart for Karpenter, an open-source node provisioning project built for Kubernetes. | ||
type: application | ||
version: 1.0.0 | ||
appVersion: 1.0.0 | ||
keywords: | ||
- cluster | ||
- node | ||
- scheduler | ||
- autoscaling | ||
- lifecycle | ||
home: https://karpenter.sh/ | ||
icon: https://repository-images.githubusercontent.com/278480393/dab059c8-caa1-4b55-aaa7-3d30e47a5616 | ||
sources: | ||
- https://github.com/aws/karpenter-provider-aws/ | ||
annotations: | ||
artifacthub.io/alternativeName: karpenter-provider-aws | ||
artifacthub.io/crds: | | ||
- kind: EC2NodeClass | ||
version: v1beta1 | ||
name: ec2nodeclasses.karpenter.k8s.aws | ||
displayName: EC2NodeClass | ||
description: EC2NodeClass is the Schema for the EC2NodeClass API. | ||
- kind: NodeClaim | ||
version: v1beta1 | ||
name: nodeclaims.karpenter.sh | ||
displayName: NodeClaim | ||
description: NodeClaim is the Schema for the NodeClaims API. | ||
- kind: NodePool | ||
version: v1beta1 | ||
name: nodepools.karpenter.sh | ||
displayName: NodePool | ||
description: NodePool is the Schema for the NodePools API. |
This file contains 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,103 @@ | ||
# karpenter | ||
|
||
A Helm chart for Karpenter, an open-source node provisioning project built for Kubernetes. | ||
|
||
![Version: 1.0.0](https://img.shields.io/badge/Version-1.0.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 1.0.0](https://img.shields.io/badge/AppVersion-1.0.0-informational?style=flat-square) | ||
|
||
## Documentation | ||
|
||
For full Karpenter documentation please checkout [https://karpenter.sh](https://karpenter.sh/docs/). | ||
|
||
## Installing the Chart | ||
|
||
You can follow the detailed installation instruction in the [documentation](https://karpenter.sh/docs/getting-started/getting-started-with-karpenter) which covers the Karpenter prerequisites and installation options. The outcome of these instructions should result in something like the following command. | ||
|
||
```bash | ||
helm upgrade --install --namespace karpenter --create-namespace \ | ||
karpenter oci://public.ecr.aws/karpenter/karpenter \ | ||
--version 1.0.0 \ | ||
--set "serviceAccount.annotations.eks\.amazonaws\.com/role-arn=${KARPENTER_IAM_ROLE_ARN}" \ | ||
--set settings.clusterName=${CLUSTER_NAME} \ | ||
--set settings.interruptionQueue=${CLUSTER_NAME} \ | ||
--wait | ||
``` | ||
|
||
### Verification | ||
|
||
As the OCI Helm chart is signed by [Cosign](https://github.com/sigstore/cosign) as part of the release process you can verify the chart before installing it by running the following command. | ||
|
||
```shell | ||
cosign verify public.ecr.aws/karpenter/karpenter:1.0.0 \ | ||
--certificate-oidc-issuer=https://token.actions.githubusercontent.com \ | ||
--certificate-identity-regexp='https://github\.com/aws/karpenter-provider-aws/\.github/workflows/release\.yaml@.+' \ | ||
--certificate-github-workflow-repository=aws/karpenter-provider-aws \ | ||
--certificate-github-workflow-name=Release \ | ||
--certificate-github-workflow-ref=refs/tags/v1.0.0 \ | ||
--annotations version=1.0.0 | ||
``` | ||
|
||
## Values | ||
|
||
| Key | Type | Default | Description | | ||
|-----|------|---------|-------------| | ||
| additionalAnnotations | object | `{}` | Additional annotations to add into metadata. | | ||
| additionalClusterRoleRules | list | `[]` | Specifies additional rules for the core ClusterRole. | | ||
| additionalLabels | object | `{}` | Additional labels to add into metadata. | | ||
| affinity | object | `{"nodeAffinity":{"requiredDuringSchedulingIgnoredDuringExecution":{"nodeSelectorTerms":[{"matchExpressions":[{"key":"karpenter.sh/nodepool","operator":"DoesNotExist"}]}]}},"podAntiAffinity":{"requiredDuringSchedulingIgnoredDuringExecution":[{"topologyKey":"kubernetes.io/hostname"}]}}` | Affinity rules for scheduling the pod. If an explicit label selector is not provided for pod affinity or pod anti-affinity one will be created from the pod selector labels. | | ||
| controller.env | list | `[]` | Additional environment variables for the controller pod. | | ||
| controller.envFrom | list | `[]` | | | ||
| controller.extraVolumeMounts | list | `[]` | Additional volumeMounts for the controller pod. | | ||
| controller.healthProbe.port | int | `8081` | The container port to use for http health probe. | | ||
| controller.image.digest | string | `"sha256:1eb1073b9f4ed804634aabf320e4d6e822bb61c0f5ecfd9c3a88f05f1ca4c5c5"` | SHA256 digest of the controller image. | | ||
| controller.image.repository | string | `"public.ecr.aws/karpenter/controller"` | Repository path to the controller image. | | ||
| controller.image.tag | string | `"1.0.0"` | Tag of the controller image. | | ||
| controller.metrics.port | int | `8080` | The container port to use for metrics. | | ||
| controller.resources | object | `{}` | Resources for the controller pod. | | ||
| controller.sidecarContainer | list | `[]` | Additional sidecarContainer config | | ||
| controller.sidecarVolumeMounts | list | `[]` | Additional volumeMounts for the sidecar - this will be added to the volume mounts on top of extraVolumeMounts | | ||
| dnsConfig | object | `{}` | Configure DNS Config for the pod | | ||
| dnsPolicy | string | `"ClusterFirst"` | Configure the DNS Policy for the pod | | ||
| extraVolumes | list | `[]` | Additional volumes for the pod. | | ||
| fullnameOverride | string | `""` | Overrides the chart's computed fullname. | | ||
| hostNetwork | bool | `false` | Bind the pod to the host network. This is required when using a custom CNI. | | ||
| imagePullPolicy | string | `"IfNotPresent"` | Image pull policy for Docker images. | | ||
| imagePullSecrets | list | `[]` | Image pull secrets for Docker images. | | ||
| logErrorOutputPaths | list | `["stderr"]` | Log errorOutputPaths - defaults to stderr only | | ||
| logLevel | string | `"info"` | Global log level, defaults to 'info' | | ||
| logOutputPaths | list | `["stdout"]` | Log outputPaths - defaults to stdout only | | ||
| nameOverride | string | `""` | Overrides the chart's name. | | ||
| nodeSelector | object | `{"kubernetes.io/os":"linux"}` | Node selectors to schedule the pod to nodes with labels. | | ||
| podAnnotations | object | `{}` | Additional annotations for the pod. | | ||
| podDisruptionBudget.maxUnavailable | int | `1` | | | ||
| podDisruptionBudget.name | string | `"karpenter"` | | | ||
| podLabels | object | `{}` | Additional labels for the pod. | | ||
| podSecurityContext | object | `{"fsGroup":65532}` | SecurityContext for the pod. | | ||
| priorityClassName | string | `"system-cluster-critical"` | PriorityClass name for the pod. | | ||
| replicas | int | `2` | Number of replicas. | | ||
| revisionHistoryLimit | int | `10` | The number of old ReplicaSets to retain to allow rollback. | | ||
| serviceAccount.annotations | object | `{}` | Additional annotations for the ServiceAccount. | | ||
| serviceAccount.create | bool | `true` | Specifies if a ServiceAccount should be created. | | ||
| serviceAccount.name | string | `""` | The name of the ServiceAccount to use. If not set and create is true, a name is generated using the fullname template. | | ||
| serviceMonitor.additionalLabels | object | `{}` | Additional labels for the ServiceMonitor. | | ||
| serviceMonitor.enabled | bool | `false` | Specifies whether a ServiceMonitor should be created. | | ||
| serviceMonitor.endpointConfig | object | `{}` | Configuration on `http-metrics` endpoint for the ServiceMonitor. Not to be used to add additional endpoints. See the Prometheus operator documentation for configurable fields https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/api.md#endpoint | | ||
| settings | object | `{"batchIdleDuration":"1s","batchMaxDuration":"10s","clusterCABundle":"","clusterEndpoint":"","clusterName":"","featureGates":{"spotToSpotConsolidation":false},"interruptionQueue":"","isolatedVPC":false,"reservedENIs":"0","vmMemoryOverheadPercent":0.075}` | Global Settings to configure Karpenter | | ||
| settings.batchIdleDuration | string | `"1s"` | The maximum amount of time with no new ending pods that if exceeded ends the current batching window. If pods arrive faster than this time, the batching window will be extended up to the maxDuration. If they arrive slower, the pods will be batched separately. | | ||
| settings.batchMaxDuration | string | `"10s"` | The maximum length of a batch window. The longer this is, the more pods we can consider for provisioning at one time which usually results in fewer but larger nodes. | | ||
| settings.clusterCABundle | string | `""` | Cluster CA bundle for TLS configuration of provisioned nodes. If not set, this is taken from the controller's TLS configuration for the API server. | | ||
| settings.clusterEndpoint | string | `""` | Cluster endpoint. If not set, will be discovered during startup (EKS only) | | ||
| settings.clusterName | string | `""` | Cluster name. | | ||
| settings.featureGates | object | `{"spotToSpotConsolidation":false}` | Feature Gate configuration values. Feature Gates will follow the same graduation process and requirements as feature gates in Kubernetes. More information here https://kubernetes.io/docs/reference/command-line-tools-reference/feature-gates/#feature-gates-for-alpha-or-beta-features | | ||
| settings.featureGates.spotToSpotConsolidation | bool | `false` | spotToSpotConsolidation is ALPHA and is disabled by default. Setting this to true will enable spot replacement consolidation for both single and multi-node consolidation. | | ||
| settings.interruptionQueue | string | `""` | Interruption queue is the name of the SQS queue used for processing interruption events from EC2 Interruption handling is disabled if not specified. Enabling interruption handling may require additional permissions on the controller service account. Additional permissions are outlined in the docs. | | ||
| settings.isolatedVPC | bool | `false` | If true then assume we can't reach AWS services which don't have a VPC endpoint This also has the effect of disabling look-ups to the AWS pricing endpoint | | ||
| settings.reservedENIs | string | `"0"` | Reserved ENIs are not included in the calculations for max-pods or kube-reserved This is most often used in the VPC CNI custom networking setup https://docs.aws.amazon.com/eks/latest/userguide/cni-custom-network.html | | ||
| settings.vmMemoryOverheadPercent | float | `0.075` | The VM memory overhead as a percent that will be subtracted from the total memory for all instance types | | ||
| strategy | object | `{"rollingUpdate":{"maxUnavailable":1}}` | Strategy for updating the pod. | | ||
| terminationGracePeriodSeconds | string | `nil` | Override the default termination grace period for the pod. | | ||
| tolerations | list | `[{"key":"CriticalAddonsOnly","operator":"Exists"}]` | Tolerations to allow the pod to be scheduled to nodes with taints. | | ||
| topologySpreadConstraints | list | `[{"maxSkew":1,"topologyKey":"topology.kubernetes.io/zone","whenUnsatisfiable":"DoNotSchedule"}]` | Topology spread constraints to increase the controller resilience by distributing pods across the cluster zones. If an explicit label selector is not provided one will be created from the pod selector labels. | | ||
|
||
---------------------------------------------- | ||
|
||
Autogenerated from chart metadata using [helm-docs](https://github.com/norwoodj/helm-docs/). |
This file contains 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,44 @@ | ||
{{ template "chart.header" . }} | ||
{{ template "chart.description" . }} | ||
|
||
{{ template "chart.versionBadge" . }}{{ template "chart.typeBadge" . }}{{ template "chart.appVersionBadge" . }} | ||
|
||
## Documentation | ||
|
||
For full Karpenter documentation please checkout [https://karpenter.sh](https://karpenter.sh/docs/). | ||
|
||
## Installing the Chart | ||
|
||
You can follow the detailed installation instruction in the [documentation](https://karpenter.sh/docs/getting-started/getting-started-with-karpenter) which covers the Karpenter prerequisites and installation options. The outcome of these instructions should result in something like the following command. | ||
|
||
```bash | ||
helm upgrade --install --namespace karpenter --create-namespace \ | ||
karpenter oci://public.ecr.aws/karpenter/{{ template "chart.name" . }} \ | ||
--version {{ template "chart.version" . }} \ | ||
--set "serviceAccount.annotations.eks\.amazonaws\.com/role-arn=${KARPENTER_IAM_ROLE_ARN}" \ | ||
--set settings.clusterName=${CLUSTER_NAME} \ | ||
--set settings.interruptionQueue=${CLUSTER_NAME} \ | ||
--wait | ||
``` | ||
|
||
### Verification | ||
|
||
As the OCI Helm chart is signed by [Cosign](https://github.com/sigstore/cosign) as part of the release process you can verify the chart before installing it by running the following command. | ||
|
||
```shell | ||
cosign verify public.ecr.aws/karpenter/karpenter:{{ template "chart.version" . }} \ | ||
--certificate-oidc-issuer=https://token.actions.githubusercontent.com \ | ||
--certificate-identity-regexp='https://github\.com/aws/karpenter-provider-aws/\.github/workflows/release\.yaml@.+' \ | ||
--certificate-github-workflow-repository=aws/karpenter-provider-aws \ | ||
--certificate-github-workflow-name=Release \ | ||
--certificate-github-workflow-ref=refs/tags/v{{ template "chart.version" . }} \ | ||
--annotations version={{ template "chart.version" . }} | ||
``` | ||
|
||
{{ template "chart.requirementsSection" . }} | ||
|
||
{{ template "chart.valuesSection" . }} | ||
|
||
---------------------------------------------- | ||
|
||
Autogenerated from chart metadata using [helm-docs](https://github.com/norwoodj/helm-docs/). |
This file contains 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,7 @@ | ||
repositoryID: 356cb63f-9ee3-4956-9c20-003e416715c7 | ||
owners: [] | ||
# - name: awsadmin1 | ||
# email: [email protected] | ||
ignore: | ||
- name: karpenter | ||
version: (?:^\d+$)|(?:^v?0\.0\.0)|(?:^v?\d+\-) |
1 change: 1 addition & 0 deletions
1
addons/karpenter-aws/crds/karpenter.k8s.aws_ec2nodeclasses.yaml
This file contains 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 @@ | ||
../../../pkg/apis/crds/karpenter.k8s.aws_ec2nodeclasses.yaml |
This file contains 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 @@ | ||
../../../pkg/apis/crds/karpenter.sh_nodeclaims.yaml |
This file contains 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 @@ | ||
../../../pkg/apis/crds/karpenter.sh_nodepools.yaml |
This file contains 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,142 @@ | ||
{{/* | ||
Expand the name of the chart. | ||
*/}} | ||
{{- define "karpenter.name" -}} | ||
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} | ||
{{- end }} | ||
|
||
{{/* | ||
Create a default fully qualified app name. | ||
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). | ||
If release name contains chart name it will be used as a full name. | ||
*/}} | ||
{{- define "karpenter.fullname" -}} | ||
{{- if .Values.fullnameOverride }} | ||
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} | ||
{{- else }} | ||
{{- $name := default .Chart.Name .Values.nameOverride }} | ||
{{- if contains $name .Release.Name }} | ||
{{- .Release.Name | trunc 63 | trimSuffix "-" }} | ||
{{- else }} | ||
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} | ||
|
||
{{/* | ||
Create chart name and version as used by the chart label. | ||
*/}} | ||
{{- define "karpenter.chart" -}} | ||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} | ||
{{- end }} | ||
|
||
{{/* | ||
Common labels | ||
*/}} | ||
{{- define "karpenter.labels" -}} | ||
helm.sh/chart: {{ include "karpenter.chart" . }} | ||
{{ include "karpenter.selectorLabels" . }} | ||
{{- if .Chart.AppVersion }} | ||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} | ||
{{- end }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
{{- with .Values.additionalLabels }} | ||
{{ toYaml . }} | ||
{{- end }} | ||
{{- end }} | ||
|
||
{{/* | ||
Selector labels | ||
*/}} | ||
{{- define "karpenter.selectorLabels" -}} | ||
app.kubernetes.io/name: {{ include "karpenter.name" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
{{- end }} | ||
|
||
{{/* | ||
Create the name of the service account to use | ||
*/}} | ||
{{- define "karpenter.serviceAccountName" -}} | ||
{{- if .Values.serviceAccount.create }} | ||
{{- default (include "karpenter.fullname" .) .Values.serviceAccount.name }} | ||
{{- else }} | ||
{{- default "default" .Values.serviceAccount.name }} | ||
{{- end }} | ||
{{- end }} | ||
|
||
{{/* | ||
Karpenter image to use | ||
*/}} | ||
{{- define "karpenter.controller.image" -}} | ||
{{- if .Values.controller.image.digest }} | ||
{{- printf "%s:%s@%s" .Values.controller.image.repository (default (printf "v%s" .Chart.AppVersion) .Values.controller.image.tag) .Values.controller.image.digest }} | ||
{{- else }} | ||
{{- printf "%s:%s" .Values.controller.image.repository (default (printf "v%s" .Chart.AppVersion) .Values.controller.image.tag) }} | ||
{{- end }} | ||
{{- end }} | ||
|
||
|
||
{{/* Get PodDisruptionBudget API Version */}} | ||
{{- define "karpenter.pdb.apiVersion" -}} | ||
{{- if and (.Capabilities.APIVersions.Has "policy/v1") (semverCompare ">= 1.21-0" .Capabilities.KubeVersion.Version) -}} | ||
{{- print "policy/v1" -}} | ||
{{- else -}} | ||
{{- print "policy/v1beta1" -}} | ||
{{- end -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Patch the label selector on an object | ||
This template will add a labelSelector using matchLabels to the object referenced at _target if there is no labelSelector specified. | ||
The matchLabels are created with the selectorLabels template. | ||
This works because Helm treats dictionaries as mutable objects and allows passing them by reference. | ||
*/}} | ||
{{- define "karpenter.patchLabelSelector" -}} | ||
{{- if not (hasKey ._target "labelSelector") }} | ||
{{- $selectorLabels := (include "karpenter.selectorLabels" .) | fromYaml }} | ||
{{- $_ := set ._target "labelSelector" (dict "matchLabels" $selectorLabels) }} | ||
{{- end }} | ||
{{- end }} | ||
|
||
{{/* | ||
Patch pod affinity | ||
This template uses the patchLabelSelector template to add a labelSelector to pod affinity objects if there is no labelSelector specified. | ||
This works because Helm treats dictionaries as mutable objects and allows passing them by reference. | ||
*/}} | ||
{{- define "karpenter.patchPodAffinity" -}} | ||
{{- if (hasKey ._podAffinity "requiredDuringSchedulingIgnoredDuringExecution") }} | ||
{{- range $term := ._podAffinity.requiredDuringSchedulingIgnoredDuringExecution }} | ||
{{- include "karpenter.patchLabelSelector" (merge (dict "_target" $term) $) }} | ||
{{- end }} | ||
{{- end }} | ||
{{- if (hasKey ._podAffinity "preferredDuringSchedulingIgnoredDuringExecution") }} | ||
{{- range $weightedTerm := ._podAffinity.preferredDuringSchedulingIgnoredDuringExecution }} | ||
{{- include "karpenter.patchLabelSelector" (merge (dict "_target" $weightedTerm.podAffinityTerm) $) }} | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} | ||
|
||
{{/* | ||
Patch affinity | ||
This template uses patchPodAffinity template to add a labelSelector to podAffinity & podAntiAffinity if one isn't specified. | ||
This works because Helm treats dictionaries as mutable objects and allows passing them by reference. | ||
*/}} | ||
{{- define "karpenter.patchAffinity" -}} | ||
{{- if (hasKey .Values.affinity "podAffinity") }} | ||
{{- include "karpenter.patchPodAffinity" (merge (dict "_podAffinity" .Values.affinity.podAffinity) .) }} | ||
{{- end }} | ||
{{- if (hasKey .Values.affinity "podAntiAffinity") }} | ||
{{- include "karpenter.patchPodAffinity" (merge (dict "_podAffinity" .Values.affinity.podAntiAffinity) .) }} | ||
{{- end }} | ||
{{- end }} | ||
{{/* | ||
Patch topology spread constraints | ||
This template uses the patchLabelSelector template to add a labelSelector to topologySpreadConstraints if one isn't specified. | ||
This works because Helm treats dictionaries as mutable objects and allows passing them by reference. | ||
*/}} | ||
{{- define "karpenter.patchTopologySpreadConstraints" -}} | ||
{{- range $constraint := .Values.topologySpreadConstraints }} | ||
{{- include "karpenter.patchLabelSelector" (merge (dict "_target" $constraint) $) }} | ||
{{- end }} | ||
{{- end }} |
Oops, something went wrong.