Skip to content
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
19 changes: 19 additions & 0 deletions stable/aws-node-termination-handler-2/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: v2
name: aws-node-termination-handler-2
description: A Helm chart for aws-node-termination-handler, an open-source component for gracefully handling termination events for node hosted in AWS.
type: application
version: "0.1.0"
appVersion: "2.0.0-alpha"
kubeVersion: ">=1.16-0"
keywords:
- aws
- ec2
- ec2-spot
- eks
- node
- node-termination
- spot
home: https://github.com/aws/eks-charts
sources:
- https://github.com/aws/aws-node-termination-handler
- https://github.com/aws/eks-charts
65 changes: 65 additions & 0 deletions stable/aws-node-termination-handler-2/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# AWS Node Termination Handler

AWS Node Termination Handler Helm chart for Kubernetes. For more information on this project see the project repo at [github.com/aws/aws-node-termination-handler](https://github.com/aws/aws-node-termination-handler).

## Prerequisites

- _Kubernetes_ >= 1.16

## Installing the Chart

Before you can install the chart you will need to add the `eks` repo to [Helm](https://helm.sh/).

```shell
helm repo add eks https://aws.github.io/eks-charts/
```

### Configuration

* `annotations` - Annotation names and values to add to objects in the Helm release. Default: `{}`.
* `aws.region` - AWS region name (e.g. "us-east-1") to use when making API calls. Default: `""`.
* `controller.env` - List of environment variables to set in the controller container. See [core/v1 Pod.spec.containers.env](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.19/#container-v1-core) Default: `[]`.
* `controller.image` - Image repository for the controller.
* `controller.logLevel` - Override the global logging level for the controller container. Default: `""`.
* `controller.resources` - Resource requests and limits for controller container. See [core/v1 ResourceRequests](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.19/#resourcerequirements-v1-core) for further information. Default: `{"requests":{"cpu": 1, "memory": "1Gi"}, "limits":{"cpu": 1, "memory": "1Gi"}}`
* `controller.securityContext` - Controller container security context configuration. See [core/v1 Pod.spec.securityContext](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.19/#podsecuritycontext-v1-core) for further information. Default: `{}`.
* `fullnameOverride` - Override the Helm release name. Name will be truncated if longer than 63 characters. Default is generated from the release name and chart name.
* `imagePullPolicy` - Policy for when to pull images. See [core/v1 Container.imagePullPolicy](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.19/#container-v1-core) for further information. Default: `"IfNotPresent"`.
* `imagePullSecrets` - List of secrets to use when pulling images. See [apps/v1 Deployment.spec.template.spec.imagePullSecrets](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.19/#podspec-v1-core) for further information. Default: `[]`.
* `labels` - Label names and values to add to objects in the Helm release. Default: `{}`.
* `logging.development` - Enable "debug mode" in logging module. May be useful during development. Default: `false`.
* `logging.disableCaller` - Disable annotating log messages with calling function's file name and line number. Default: `true`.
* `logging.disableStacktrace` - Disable stacktrace captures for all message levels. Default: `true`.
* `logging.encoding` - Logging module encoding mode. Possible values: `console`, `json`. Default: `console`.
* `logging.encoderConfig.callerKey` - Name of the caller field. Default: `"caller"`.
* `logging.encoderConfig.levelEncoder` - Level encoder name. Possible values: `capital`, `capitalColor`, `color`; otherwise the level name will be encoded as lowercase. Default: `"capital"`.
* `logging.encoderConfig.levelKey` - Name of the level field. Default: `"level"`.
* `logging.encoderConfig.messageKey` - Name of the message field. Default: `"message"`.
* `logging.encoderConfig.nameKey` - Name of the logger name field. Default: `"logger"`.
* `logging.encoderConfig.stacktraceKey` - Name of the stacktrace field. Default: `"stacktrace"`.
* `logging.encoderConfig.timeEncoder` - Time encoder name. Possible values: `iso8601`, `millis`, `nano`, `rfc3339`, `rfc3339nano`; otherwise the time will be encoded in epoch format. Default: `"iso8601"`.
* `logging.encoderConfig.timeKey` - Name of the time field. Default: `"time"`.
* `logging.errorOutputPaths` - List of paths to output internal errors from the logging module. Possible values: `stderr`, `stdout`; otherwise a valid file path. Default: `["stderr"]`.
* `logging.level` - Minimum message level to include in the log. Possible values: `debug`, `info`, `warn`, `error`, `panic`, `fatal`. Default: `info`.
* `logging.outputPaths` - List of additional output paths. Possible values: `stderr`, `stdout`; otherwise a valid file path. Default: `["stdout"]`.
* `logging.sampling.initial` - Limit of initial messages per second to accept. Default: `100`.
* `logging.sampling.thereafter` - Limit of messages per second to accept after initial phase. Default: `100`.
* `nameOverride` - Override the Helm chart name. Name will be truncated if longer than 63 characters. Default: `.Chart.Name`.
* `pod.annotations` - Annotation to apply to deployed pod. Default: `{}`.
* `pod.hostNetwork` - Request host network for pod. See [core/v1 Pod.spec.hostNetwork](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.19/#podspec-v1-core) for futher information. Default: `false`.
* `pod.labels` - Labels to apply to deployed pod. Default: `{}`.
* `pod.nodeSelector` - Node selector labels. Default: `{"kubernetes.io/os": "linux"}`
* `pod.priorityClassName` - Pod priority class. See [core/v1 Pod.spec.priorityClassName](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.19/#podspec-v1-core) for futher information. Default: `"system-cluster-critical"`.
* `pod.replicas` - Number of instances to create. Default: `1`.
* `pod.securityContext` - Pod security context configuration. See documentation for [core/v1 Pod.spec.securityContext](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.19/#podsecuritycontext-v1-core) for available properties. Default: `{"fsGroup": 1000}`.
* `pod.updateStrategy` - Deployment update strategy configuration. See documentation for [apps/v1 Deployment.spec.strategy](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.19/#deploymentstrategy-v1-apps) for available properties. Default: `{"type": "Recreate"}`.
* `rbac.create` - Enable creation of RBAC objects. Helm release may fail is RBAC objects already exist. Default: `true`.
* `serviceAccount.annotations` - Annotation names and values to add to service account. Default: `{}`.
* `serviceAccount.create` - Enable creation of service account. Helm release may fail if service account already exists. Default: `true`.
* `serviceAccount.name` - Name of the service account. If `serviceAccount.create` is enabled then the default will be generated from the release name and chart name. If `serviceAccount.create` is disabled then the default is `"default"`.
* `webhook.env` - List of environment variables to set in the webhook container. See [core/v1 Pod.spec.containers.env](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.19/#container-v1-core) Default: `[]`.
* `webhook.image` - Image repository for the webhook controller.
* `webhook.logLevel` - Override the global logging level for the webhook container. Default: `""`.
* `webhook.port` - List on port. Default: `8443`.
* `webhook.resources` - Resource requests and limits for webhook container. See [core/v1 ResourceRequests](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.19/#resourcerequirements-v1-core) for further information. Default: `{"requests":{"cpu": 1, "memory": "1Gi"}, "limits":{"cpu": 1, "memory": "1Gi"}}`
* `webhook.securityContext` - Controller container security context configuration. See [core/v1 Pod.spec.securityContext](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.19/#podsecuritycontext-v1-core) for further information. Default: `{}`.
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.8.0
creationTimestamp: null
name: terminators.node.k8s.aws
spec:
group: node.k8s.aws
names:
kind: Terminator
listKind: TerminatorList
plural: terminators
singular: terminator
categories:
- all
scope: Namespaced
versions:
- name: v1alpha1
schema:
openAPIV3Schema:
description: Terminator is the Schema for the terminators API
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
description: TerminatorSpec defines the desired state of Terminator
type: object
properties:
matchLabels:
description: Action will only be taken if the target node has all the matching labels and values.
type: object
additionalProperties:
type: string
sqs:
description: AWS SQS queue configuration.
type: object
required:
- queueURL
properties:
queueURL:
description: |
The URL of the Amazon SQS queue from which messages are received.

* Queue URLs and names are case-sensitive.

* QueueURL is a required field
type: string
drain:
description: Configuration for the cordon and drain actions.
type: object
properties:
force:
description: Enable termination of pods without a controller.
type: boolean
default: true
gracePeriodSeconds:
description: Wait time for pods to terminate. If negative then the pod's configured gracetime will be used.
type: integer
default: -1
ignoreAllDaemonSets:
description: Enable ignoring pods managed by a DaemonSet.
type: boolean
default: true
deleteEmptyDirData:
description: Enable termination of pods with local data that will be deleted.
type: boolean
default: true
timeoutSeconds:
description: Wait time before failing the action. If zero, then wait forever.
type: integer
default: 120
events:
description: Specify what action should be taken when a particular message type is received.
type: object
properties:
autoScalingTermination:
type: string
enum:
- CordonAndDrain
- Cordon
- NoAction
default: CordonAndDrain
rebalanceRecommendation:
type: string
enum:
- CordonAndDrain
- Cordon
- NoAction
default: CordonAndDrain
scheduledChange:
type: string
enum:
- CordonAndDrain
- Cordon
- NoAction
default: CordonAndDrain
spotInterruption:
type: string
enum:
- CordonAndDrain
- Cordon
- NoAction
default: CordonAndDrain
stateChange:
type: string
enum:
- CordonAndDrain
- Cordon
- NoAction
default: CordonAndDrain
webhook:
description: Send notification of handled events.
type: object
properties:
url:
description: URL to send notifications.
type: string
proxyURL:
description: Proxy URL to use to send notifications.
type: string
headers:
description: HTTP headers to include when sending notifications.
type: array
items:
type: object
properties:
name:
description: Header name.
type: string
value:
description: Header value.
type: string
required:
- name
- value
default:
- name: "Content-Type"
value: "application/json"
template:
description: |
Used to generate the request payload. Template used to generate webhook request body.
The template may reference fields EventID, Kind, InstanceID, NodeName, and StartTime.
See https://pkg.go.dev/text/template documentation for template format examples and explanation.
type: string
default: '{"text":"[NTH][Instance Interruption] EventID: {{ .EventID }} - Kind: {{ .Kind }} - Instance: {{ .InstanceID }} - Node: {{ .NodeName }} - Start Time: {{ .StartTime }}"}'
status:
description: TerminatorStatus defines the observed state of Terminator
type: object
type: object
served: true
storage: true
subresources:
status: {}
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []
65 changes: 65 additions & 0 deletions stable/aws-node-termination-handler-2/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "aws-node-termination-handler.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 "aws-node-termination-handler.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 "aws-node-termination-handler.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Common labels
*/}}
{{- define "aws-node-termination-handler.labels" -}}
helm.sh/chart: {{ include "aws-node-termination-handler.chart" . | quote }}
{{ include "aws-node-termination-handler.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service | quote }}
{{- with .Values.labels }}
{{ toYaml . }}
{{- end }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "aws-node-termination-handler.selectorLabels" -}}
app.kubernetes.io/name: {{ include "aws-node-termination-handler.name" . | quote }}
app.kubernetes.io/instance: {{ .Release.Name | quote }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "aws-node-termination-handler.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "aws-node-termination-handler.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
50 changes: 50 additions & 0 deletions stable/aws-node-termination-handler-2/templates/clusterrole.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{{- if .Values.rbac.create -}}
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: {{ include "aws-node-termination-handler.fullname" . }}
labels:
{{- include "aws-node-termination-handler.labels" . | nindent 8 }}
{{- with .Values.annotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
rules:
- apiGroups: ["node.k8s.aws"]
resources: ["terminators"]
verbs: ["get", "list", "watch"]

- apiGroups: ["node.k8s.aws"]
resources: ["terminators/status"]
verbs: ["create", "delete", "patch", "get", "list", "watch"]

- apiGroups: [""]
resources: ["nodes"]
verbs: ["get", "list", "patch", "update", "watch"]

- apiGroups: [""]
resources: ["pods"]
verbs: ["get", "list", "watch"]

- apiGroups: [""]
resources: ["configmaps"]
verbs: ["get", "list", "watch"]

- apiGroups: [""]
resources: ["pods/eviction"]
verbs: ["create"]

- apiGroups: ["apps", "extensions"]
resources: ["daemonsets"]
verbs: ["get"]

- apiGroups: ["admissionregistration.k8s.io"]
resources: ["validatingwebhookconfigurations", "mutatingwebhookconfigurations"]
verbs: ["get", "list", "watch", "update"]

{{- if .Values.emitKubernetesEvents }}
- apiGroups: [""]
resources: ["events"]
verbs: ["create", "patch"]
{{- end }}
{{- end -}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{{- if .Values.rbac.create -}}
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: {{ include "aws-node-termination-handler.fullname" . }}
labels:
{{- include "aws-node-termination-handler.labels" . | nindent 8 }}
{{- with .Values.annotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: {{ include "aws-node-termination-handler.fullname" . }}
subjects:
- kind: ServiceAccount
name: {{ template "aws-node-termination-handler.serviceAccountName" . }}
namespace: {{ .Release.Namespace }}
{{- end }}
Loading