-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add aws-node-termination-handler bundle (#966)
Co-authored-by: paurosello <[email protected]>
- Loading branch information
1 parent
53cb71b
commit b907a77
Showing
14 changed files
with
209 additions
and
0 deletions.
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
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
File renamed without changes.
24 changes: 24 additions & 0 deletions
24
helm/cluster-aws/ci/test-lifecycle-hook-heartbeattimeout-values.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,24 @@ | ||
global: | ||
release: | ||
version: v27.0.0-alpha.1 | ||
metadata: | ||
name: test-wc-minimal | ||
organization: test | ||
servicePriority: lowest | ||
connectivity: | ||
baseDomain: example.com | ||
nodePools: | ||
pool0: | ||
maxSize: 2 | ||
minSize: 2 | ||
awsNodeTerminationHandler: | ||
heartbeatTimeoutSeconds: 60 | ||
providerSpecific: | ||
region: "eu-west-1" | ||
managementCluster: test | ||
|
||
cluster: | ||
internal: | ||
ephemeralConfiguration: | ||
offlineTesting: | ||
renderWithoutReleaseResource: true |
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
File renamed without changes.
File renamed without changes.
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,25 @@ | ||
{{- /* | ||
Extracts the AWS partition from an ARN string. | ||
Example usage: {{ include "extractAWSPartition" "arn:aws:iam::1234567890:role/example-role" }} | ||
|
||
Input: An ARN string | ||
Output: The AWS partition (e.g., "aws", "aws-cn") | ||
*/ -}} | ||
{{- define "extractAWSPartition" -}} | ||
{{- $parts := (split ":" .) -}} | ||
{{- if ge (len $parts) 5 -}}{{- $parts._1 -}}{{- end -}} | ||
{{- end -}} | ||
|
||
{{- define "aws-partition" -}} | ||
{{- $roleName := .Values.global.providerSpecific.awsClusterRoleIdentityName -}} | ||
{{- $partition := .Values.internal.awsPartition -}} | ||
{{- $role := (lookup "infrastructure.cluster.x-k8s.io/v1beta2" "AWSClusterRoleIdentity" "" $roleName) -}} | ||
{{- if $role -}} | ||
{{- $partition = (include "extractAWSPartition" $role.spec.roleARN) -}} | ||
{{- end -}} | ||
{{- if eq $partition "" -}} | ||
{{- fail "failed to extract AWS Partition from AWSClusterRoleIdentity" -}} | ||
{{- else -}} | ||
{{- $partition -}} | ||
{{- end -}} | ||
{{- end -}} |
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,92 @@ | ||
{{/* Default Helm values for the app */}} | ||
{{/* See schema for the appropriate app version here https://github.com/giantswarm/aws-nth-bundle/blob/main/helm/aws-nth-bundle/values.schema.json */}} | ||
{{- define "defaultAwsNodeTerminationHandlerHelmValues" }} | ||
awsNodeTerminationHandler: | ||
values: | ||
image: | ||
registry: {{ include "awsContainerImageRegistry" $ }} | ||
|
||
# Allow running on control plane nodes. On deletion, CAPI will first delete the worker nodes | ||
# and we still want aws-node-termination-handler, if it's even still running and the HelmRelease | ||
# not deleted yet, to take care of the last workers' EC2 lifecycle hooks since they otherwise | ||
# won't be completed, resulting in unnecessary waiting time before AWS can terminate the | ||
# instances (see `AWSMachinePool.spec.lifecycleHooks["aws-node-termination-handler"].heartbeatTimeout`). | ||
# This runs on workers by default but allows moving pods to control plane nodes. Requires | ||
# queue processing mode i.e. running as `Deployment`, not `DaemonSet`. | ||
affinity: | ||
nodeAffinity: | ||
preferredDuringSchedulingIgnoredDuringExecution: | ||
- preference: | ||
matchExpressions: | ||
- key: node-role.kubernetes.io/control-plane | ||
operator: DoesNotExist | ||
weight: 10 | ||
tolerations: | ||
- effect: NoSchedule | ||
operator: Exists | ||
key: node-role.kubernetes.io/control-plane | ||
|
||
clusterID: {{ include "resource.default.name" $ }} | ||
{{- if (.Values.global.connectivity.proxy).enabled }} | ||
proxy: | ||
noProxy: "{{ include "cluster.connectivity.proxy.noProxy" (dict "global" $.Values.global "providerIntegration" $.Values.cluster.providerIntegration) }}" | ||
http: {{ .Values.global.connectivity.proxy.httpProxy | quote }} | ||
https: {{ .Values.global.connectivity.proxy.httpsProxy | quote }} | ||
{{- end }} | ||
global: | ||
image: | ||
registry: {{ include "awsContainerImageRegistry" $ }} | ||
podSecurityStandards: | ||
enforced: {{ .Values.global.podSecurityStandards.enforced }} | ||
{{- end }} | ||
--- | ||
apiVersion: v1 | ||
data: | ||
{{- $awsNodeTerminationHandlerHelmValues := (include "defaultAwsNodeTerminationHandlerHelmValues" .) | fromYaml -}} | ||
{{- $customAwsNodeTerminationHandlerHelmValues := $.Values.global.apps.awsNodeTerminationHandler.values -}} | ||
{{- if $customAwsNodeTerminationHandlerHelmValues }} | ||
{{- $awsNodeTerminationHandlerHelmValues = merge (deepCopy $customAwsNodeTerminationHandlerHelmValues) $awsNodeTerminationHandlerHelmValues -}} | ||
{{- end }} | ||
values: | {{- $awsNodeTerminationHandlerHelmValues | toYaml | nindent 4 }} | ||
kind: ConfigMap | ||
metadata: | ||
labels: | ||
app-operator.giantswarm.io/version: 0.0.0 | ||
{{- include "labels.common" $ | nindent 4 }} | ||
name: {{ printf "%s-aws-nth-bundle-user-values" (include "resource.default.name" $) | quote }} | ||
namespace: {{ $.Release.Namespace | quote }} | ||
--- | ||
apiVersion: application.giantswarm.io/v1alpha1 | ||
kind: App | ||
metadata: | ||
labels: | ||
app-operator.giantswarm.io/version: 0.0.0 | ||
{{- include "labels.common" $ | nindent 4 }} | ||
name: {{ printf "%s-aws-nth-bundle" (include "resource.default.name" $) | quote }} | ||
namespace: {{ $.Release.Namespace | quote }} | ||
spec: | ||
catalog: {{ include "cluster.app.catalog" $ | quote }} | ||
install: | ||
timeout: "10m" | ||
upgrade: | ||
timeout: "10m" | ||
kubeConfig: | ||
inCluster: true # in management cluster context | ||
name: aws-nth-bundle | ||
namespace: {{ $.Release.Namespace | quote }} | ||
{{- $_ := set $ "appName" "aws-nth-bundle" }} | ||
{{- $appVersion := include "cluster.app.version" $ }} | ||
version: {{ $appVersion }} | ||
extraConfigs: | ||
# See above | ||
- kind: configMap | ||
name: {{ printf "%s-aws-nth-bundle-user-values" (include "resource.default.name" $) | quote }} | ||
namespace: {{ $.Release.Namespace | quote }} | ||
{{- if .Values.global.apps.awsNodeTerminationHandler.extraConfigs }} | ||
{{- range .Values.global.apps.awsNodeTerminationHandler.extraConfigs }} | ||
- kind: {{ .kind }} | ||
name: {{ .name }} | ||
namespace: {{ .namespace | default $.Release.Namespace }} | ||
priority: {{ .priority }} | ||
{{- end }} | ||
{{- end }} |
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