-
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 (#945)
Co-authored-by: Andreas Sommer <[email protected]>
- Loading branch information
1 parent
f567402
commit 04da334
Showing
10 changed files
with
124 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
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
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.global.providerSpecific.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,61 @@ | ||
{{/* Default Helm values for the app */}} | ||
{{/* See schema for the appropriate app version here https://github.com/giantswarm/aws-ebs-csi-driver-app/blob/master/helm/aws-ebs-csi-driver-app/values.schema.json */}} | ||
{{- define "defaultAwsNodeTerminationHandlerHelmValues" }} | ||
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: helm.toolkit.fluxcd.io/v2beta1 | ||
kind: HelmRelease | ||
metadata: | ||
name: {{ include "resource.default.name" $ }}-nth-bundle | ||
namespace: {{ $.Release.Namespace }} | ||
annotations: | ||
cluster.giantswarm.io/description: "{{ .Values.global.metadata.description }}" | ||
labels: | ||
cluster-apps-operator.giantswarm.io/watching: "" | ||
{{- include "labels.common" . | nindent 4 }} | ||
spec: | ||
suspend: false # It can be unsuspended by the post-install/post-upgrade hook. Useful if we need to populate some fields later on. | ||
releaseName: aws-nth-bundle | ||
chart: | ||
spec: | ||
chart: aws-nth-bundle | ||
{{- $_ := set $ "appName" "aws-nth-bundle" }} | ||
version: {{ include "cluster.app.version" $ }} | ||
sourceRef: | ||
kind: HelmRepository | ||
name: {{ include "resource.default.name" $ }}-{{ include "cluster.app.catalog" $ }} | ||
kubeConfig: | ||
secretRef: | ||
name: {{ $.Values.global.managementCluster }}-kubeconfig | ||
interval: 5m | ||
install: | ||
remediation: | ||
retries: 30 | ||
{{- $AwsNodeTerminationHandlerHelmValues := (include "defaultAwsNodeTerminationHandlerHelmValues" .) | fromYaml -}} | ||
{{- $customAwsNodeTerminationHandlerHelmValues := $.Values.global.apps.awsNodeTerminationHandler.values -}} | ||
{{- if $customAwsNodeTerminationHandlerHelmValues }} | ||
{{- $AwsNodeTerminationHandlerHelmValues = merge (deepCopy $customAwsNodeTerminationHandlerHelmValues) $AwsNodeTerminationHandlerHelmValues -}} | ||
{{- end }} | ||
{{- if $AwsNodeTerminationHandlerHelmValues }} | ||
values: {{- $AwsNodeTerminationHandlerHelmValues | toYaml | nindent 4 }} | ||
{{- end }} | ||
{{- if $.Values.global.apps.awsNodeTerminationHandler.extraConfigs }} | ||
valuesFrom: | ||
{{- range $config := $.Values.global.apps.awsNodeTerminationHandler.extraConfigs }} | ||
- kind: {{ $config.kind }} | ||
name: {{ $config.name }} | ||
valuesKey: values | ||
optional: {{ $config.optional | default false }} | ||
{{- 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