-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add extendeddaemonset-check helper (#53)
* Add extendeddaemonset-check helper * add new cmd binary: `check-eds` * add new `app-example` chart * update ci to deliver the `datadog/extendeddaemonset-check` container image
- Loading branch information
1 parent
b98cd7a
commit 1b59ab0
Showing
21 changed files
with
639 additions
and
24 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
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,23 @@ | ||
apiVersion: v2 | ||
name: app-example | ||
description: A Helm chart for Kubernetes | ||
|
||
# A chart can be either an 'application' or a 'library' chart. | ||
# | ||
# Application charts are a collection of templates that can be packaged into versioned archives | ||
# to be deployed. | ||
# | ||
# Library charts provide useful utilities or functions for the chart developer. They're included as | ||
# a dependency of application charts to inject those utilities and functions into the rendering | ||
# pipeline. Library charts do not define any templates and therefore cannot be deployed. | ||
type: application | ||
|
||
# This is the chart version. This version number should be incremented each time you make changes | ||
# to the chart and its templates, including the app version. | ||
# Versions are expected to follow Semantic Versioning (https://semver.org/) | ||
version: 0.1.0 | ||
|
||
# This is the version number of the application being deployed. This version number should be | ||
# incremented each time you make changes to the application. Versions are not expected to | ||
# follow Semantic Versioning. They should reflect the version the application is using. | ||
appVersion: 1.16.0 |
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 @@ | ||
# APP Example | ||
|
||
## Introduction | ||
|
||
This chart allows you to deploy a "dummy" application that uses the ExtendedDaemonset. | ||
|
||
Thanks to this chart you can test several ExtendedDaemonset features, such as: | ||
|
||
* The Canary deployment strategy | ||
* The `extendeddaemonset-check` util pod with the `helm test` command. | ||
* The possibility to override a `Pod` resources for a specific `Node` thanks to an | ||
`ExtendedDaemonsetSettings` resource. | ||
|
||
## Deployment | ||
|
||
Before deploying this chart, you should have deployed the `ExtendedDaemonset` Controller with the following command: `helm install eds-controller ./chart/extendeddaemonset`. | ||
|
||
Now you can deploy the `app-example` with default values this: `helm install foo ./chart/app-example`. | ||
|
||
### Canary deployment | ||
|
||
### Check if a canary deployment finished | ||
|
||
Helm3 introduces the `helm test` command, which can be used to validate a "complex" deployment, was looking only | ||
at the state if the pod is not enough. It is also useful when the chart contains CRDs because Helm is not aware | ||
of how to understand the status of a CRD. | ||
|
||
This chart contains a test "Pod" (manifests present in `app-example/templates/tests`) that can check if a | ||
Extendedaemonset update is finished. | ||
|
||
To simulate an update, the following command will update the docker image tag for the "foo" application: | ||
`helm upgrade foo ./chart/app-example --set image.tag=stable`. | ||
|
||
The `ExtendedDaemonset` status should have been moved to `canary` | ||
|
||
```console | ||
$ kubectl get eds | ||
NAME DESIRED CURRENT READY UP-TO-DATE AVAILABLE IGNORED UNRESPONSIVE NODES STATUS REASON ACTIVE RS CANARY RS AGE | ||
foo-app-example 3 3 3 3 3 Canary foo-app-example-db2sk foo-app-example-76kz8 1h | ||
``` | ||
|
||
With the default configuration, the Canary deployment is set to 3min. During this period only one pod has been updated. | ||
|
||
The command `helm test foo` starts a Pod with a specific container that checks the `ExtendedDaemonset` status. The command returns when the canary deployment and the rolling-up are finished. |
Empty file.
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,62 @@ | ||
{{/* | ||
Expand the name of the chart. | ||
*/}} | ||
{{- define "app-example.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 "app-example.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 "app-example.chart" -}} | ||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} | ||
{{- end }} | ||
|
||
{{/* | ||
Common labels | ||
*/}} | ||
{{- define "app-example.labels" -}} | ||
helm.sh/chart: {{ include "app-example.chart" . }} | ||
{{ include "app-example.selectorLabels" . }} | ||
{{- if .Chart.AppVersion }} | ||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} | ||
{{- end }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
{{- end }} | ||
|
||
{{/* | ||
Selector labels | ||
*/}} | ||
{{- define "app-example.selectorLabels" -}} | ||
app.kubernetes.io/name: {{ include "app-example.name" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
{{- end }} | ||
|
||
{{/* | ||
Create the name of the service account to use | ||
*/}} | ||
{{- define "app-example.serviceAccountName" -}} | ||
{{- if .Values.serviceAccount.create }} | ||
{{- default (include "app-example.fullname" .) .Values.serviceAccount.name }} | ||
{{- else }} | ||
{{- default "default" .Values.serviceAccount.name }} | ||
{{- 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
apiVersion: datadoghq.com/v1alpha1 | ||
kind: ExtendedDaemonSet | ||
metadata: | ||
name: {{ include "app-example.fullname" . }} | ||
labels: | ||
{{- include "app-example.labels" . | nindent 4 }} | ||
spec: | ||
strategy: | ||
{{- toYaml .Values.strategy | nindent 4 }} | ||
template: | ||
spec: | ||
{{- with .Values.imagePullSecrets }} | ||
imagePullSecrets: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
serviceAccountName: {{ include "app-example.serviceAccountName" . }} | ||
securityContext: | ||
{{- toYaml .Values.podSecurityContext | nindent 8 }} | ||
containers: | ||
- name: {{ .Chart.Name }} | ||
securityContext: | ||
{{- toYaml .Values.securityContext | nindent 12 }} | ||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" | ||
imagePullPolicy: {{ .Values.image.pullPolicy }} | ||
resources: | ||
{{- toYaml .Values.resources | nindent 12 }} | ||
{{- with .Values.tolerations }} | ||
tolerations: | ||
{{- toYaml . | nindent 6 }} | ||
{{- 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{{- if .Values.serviceAccount.create -}} | ||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
name: {{ include "app-example.serviceAccountName" . }} | ||
labels: | ||
{{- include "app-example.labels" . | nindent 4 }} | ||
{{- with .Values.serviceAccount.annotations }} | ||
annotations: | ||
{{- toYaml . | nindent 4 }} | ||
{{- 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
{{- if .Values.rbac.create -}} | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: Role | ||
metadata: | ||
name: "{{ include "app-example.fullname" . }}-test" | ||
labels: | ||
{{- include "app-example.labels" . | nindent 4 }} | ||
annotations: | ||
"helm.sh/hook": test | ||
rules: | ||
- apiGroups: | ||
- datadoghq.com | ||
resources: | ||
- 'extendeddaemonsets' | ||
- 'extendeddaemonsets/status' | ||
verbs: | ||
- 'get' | ||
--- | ||
kind: RoleBinding | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
metadata: | ||
name: "{{ include "app-example.fullname" . }}-test" | ||
labels: | ||
{{- include "app-example.labels" . | nindent 4 }} | ||
annotations: | ||
"helm.sh/hook": test | ||
subjects: | ||
- kind: ServiceAccount | ||
name: "{{ include "app-example.serviceAccountName" . }}-test" | ||
roleRef: | ||
kind: Role | ||
name: "{{ include "app-example.fullname" . }}-test" | ||
apiGroup: rbac.authorization.k8s.io | ||
{{- 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{{- if .Values.serviceAccount.create -}} | ||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
name: {{ include "app-example.serviceAccountName" . }}-test | ||
labels: | ||
{{- include "app-example.labels" . | nindent 4 }} | ||
{{- with .Values.serviceAccount.annotations }} | ||
annotations: | ||
{{- toYaml . | nindent 4 }} | ||
{{- end }} | ||
{{- end }} |
Oops, something went wrong.