generated from helm/charts-repo-actions-demo
-
Notifications
You must be signed in to change notification settings - Fork 0
MSP-72 Converted to dns-canary to helm chart #29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
3503503
MSP-72 Converted to dns-canary to helm chart
chad-moonswitch 2784d07
MSP-72 Updated Helm chart with best practices
chad-moonswitch 44db38e
MSP-72 Updated AWS CLI Image version
chad-moonswitch 156fd45
MSP-72 Renamed dns_canary to dns-canary and updated helm chart to use…
chad-moonswitch 76b38a3
MSP-72 Updates to cronjob.yaml
chad-moonswitch File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -2,3 +2,4 @@ | |
| /charts/*/charts | ||
| .idea | ||
| test.yaml | ||
| .DS_Store | ||
This file contains hidden or 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 @@ | ||
| apiVersion: v2 | ||
| name: dns-canary | ||
| 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. | ||
| # It is recommended to use it with quotes. | ||
| appVersion: "1.16.0" |
This file contains hidden or 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,9 @@ | ||
| # DNS Canary Helm Chart | ||
|
|
||
| This Helm chart deploys a DNS Canary CronJob to your Kubernetes cluster. | ||
| The canary continuously tests internal service discovery and optionally pushes logs to CloudWatch and sends alerts via SNS. | ||
|
|
||
| ## Installation Example | ||
|
|
||
| ```bash | ||
| helm install dns-canary ./dns-canary -f values.yaml |
This file contains hidden or 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 "dns-canary.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 "dns-canary.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 "dns-canary.chart" -}} | ||
| {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} | ||
| {{- end }} | ||
|
|
||
| {{/* | ||
| Common labels | ||
| */}} | ||
| {{- define "dns-canary.labels" -}} | ||
| helm.sh/chart: {{ include "dns-canary.chart" . }} | ||
| {{ include "dns-canary.selectorLabels" . }} | ||
| {{- if .Chart.AppVersion }} | ||
| app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} | ||
| {{- end }} | ||
| app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
| {{- end }} | ||
|
|
||
| {{/* | ||
| Selector labels | ||
| */}} | ||
| {{- define "dns-canary.selectorLabels" -}} | ||
| app.kubernetes.io/name: {{ include "dns-canary.name" . }} | ||
| app.kubernetes.io/instance: {{ .Release.Name }} | ||
| {{- end }} | ||
|
|
||
| {{/* | ||
| Create the name of the service account to use | ||
| */}} | ||
| {{- define "dns-canary.serviceAccountName" -}} | ||
| {{- if .Values.serviceAccount.create }} | ||
| {{- default (include "dns-canary.fullname" .) .Values.serviceAccount.name }} | ||
| {{- else }} | ||
| {{- default "default" .Values.serviceAccount.name }} | ||
| {{- end }} | ||
| {{- end }} |
This file contains hidden or 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,88 @@ | ||
| apiVersion: batch/v1 | ||
| kind: CronJob | ||
| metadata: | ||
| name: {{ include "dns-canary.fullname" . }} | ||
| labels: | ||
| {{- include "dns-canary.labels" . | nindent 4 }} | ||
| app: {{ .Values.name }} | ||
| spec: | ||
| schedule: {{ .Values.schedule | quote }} | ||
| concurrencyPolicy: Allow | ||
| failedJobsHistoryLimit: 1 | ||
| successfulJobsHistoryLimit: 3 | ||
| suspend: false | ||
| jobTemplate: | ||
| spec: | ||
| backoffLimit: 6 | ||
| completions: 1 | ||
| parallelism: 1 | ||
| template: | ||
| metadata: | ||
| labels: | ||
| {{- include "dns-canary.selectorLabels" . | nindent 12 }} | ||
| app: {{ .Values.name }} | ||
chad-moonswitch marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| spec: | ||
| restartPolicy: OnFailure | ||
| {{- with .Values.imagePullSecrets }} | ||
| imagePullSecrets: | ||
| {{- toYaml . | nindent 12 }} | ||
| {{- end }} | ||
| serviceAccountName: {{ include "dns-canary.serviceAccountName" . }} | ||
| securityContext: | ||
| {{- toYaml .Values.podSecurityContext | nindent 12 }} | ||
| containers: | ||
| - name: {{ .Chart.Name }} | ||
| securityContext: | ||
| {{- toYaml .Values.securityContext | nindent 16 }} | ||
| image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" | ||
| imagePullPolicy: {{ .Values.image.pullPolicy }} | ||
| command: | ||
| - /bin/sh | ||
| - -c | ||
| - | | ||
| set -e | ||
| TARGET="{{ .Values.targetService }}" | ||
| echo "$(date) Checking DNS resolution for $TARGET" | ||
|
|
||
| if nslookup $TARGET; then | ||
| echo "$(date) DNS Canary check passed for $TARGET" | ||
| else | ||
| echo "$(date) DNS Canary check failed for $TARGET" >&2 | ||
chad-moonswitch marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| if [ -n "{{`{{ .Values.cloudwatchLogGroup }}`}}" ]; then | ||
| echo "Sending failure log to CloudWatch" | ||
| aws logs put-log-events \ | ||
| --log-group-name "{{`{{ .Values.cloudwatchLogGroup }}`}}" \ | ||
| --log-stream-name "dns-canary-{{`{{ .Values.name }}`}}" \ | ||
| --log-events "timestamp=$(date +%s%3N),message=\"DNS Canary failure: $TARGET\"" | ||
| fi | ||
|
|
||
| if [ -n "{{`{{ .Values.alertSnsTopicArn }}`}}" ]; then | ||
| echo "Triggering SNS alert" | ||
| aws sns publish \ | ||
| --topic-arn "{{`{{ .Values.alertSnsTopicArn }}`}}" \ | ||
| --message "DNS Canary failure detected for $TARGET in cluster {{`{{ .Values.clusterName }}`}}" | ||
| fi | ||
chad-moonswitch marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| fi | ||
| resources: | ||
| {{- toYaml .Values.resources | nindent 16 }} | ||
| {{- with .Values.volumeMounts }} | ||
| volumeMounts: | ||
| {{- toYaml . | nindent 16 }} | ||
| {{- end }} | ||
| {{- with .Values.volumes }} | ||
| volumes: | ||
| {{- toYaml . | nindent 12 }} | ||
| {{- end }} | ||
| {{- with .Values.nodeSelector }} | ||
| nodeSelector: | ||
| {{- toYaml . | nindent 12 }} | ||
| {{- end }} | ||
| {{- with .Values.affinity }} | ||
| affinity: | ||
| {{- toYaml . | nindent 12 }} | ||
| {{- end }} | ||
| {{- with .Values.tolerations }} | ||
| tolerations: | ||
| {{- toYaml . | nindent 12 }} | ||
| {{- end }} | ||
This file contains hidden or 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,13 @@ | ||
| {{- if .Values.serviceAccount.create -}} | ||
| apiVersion: v1 | ||
| kind: ServiceAccount | ||
| metadata: | ||
| name: {{ include "dns-canary.serviceAccountName" . }} | ||
| labels: | ||
| {{- include "dns-canary.labels" . | nindent 4 }} | ||
| {{- with .Values.serviceAccount.annotations }} | ||
| annotations: | ||
| {{- toYaml . | nindent 4 }} | ||
| {{- end }} | ||
| automountServiceAccountToken: {{ .Values.serviceAccount.automount }} | ||
| {{- end }} |
This file contains hidden or 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,86 @@ | ||
| # Default values for dns-canary. | ||
| # This is a YAML-formatted file. | ||
| # Declare variables to be passed into your templates. | ||
|
|
||
| targetService: kubernetes.default.svc.cluster.local | ||
|
|
||
| # Scheduled to run cronjob every 20 minutes. | ||
| schedule: "*/20 * * * *" | ||
|
|
||
| # This will set the replicaset count more information can be found here: https://kubernetes.io/docs/concepts/workloads/controllers/replicaset/ | ||
| replicaCount: 1 | ||
|
|
||
| # This sets the container image more information can be found here: https://kubernetes.io/docs/concepts/containers/images/ | ||
| image: | ||
| repository: busybox | ||
| # This sets the pull policy for images. | ||
| pullPolicy: IfNotPresent | ||
| # Overrides the image tag whose default is the chart appVersion. | ||
| tag: "1.37" | ||
|
|
||
| # This is for the secretes for pulling an image from a private repository more information can be found here: https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/ | ||
| imagePullSecrets: [] | ||
| # This is to override the chart name. | ||
| nameOverride: "" | ||
| fullnameOverride: "" | ||
|
|
||
| # This section builds out the service account more information can be found here: https://kubernetes.io/docs/concepts/security/service-accounts/ | ||
| serviceAccount: | ||
| # Specifies whether a service account should be created | ||
| create: true | ||
| # Automatically mount a ServiceAccount's API credentials? | ||
| automount: true | ||
| # Annotations to add to the service account | ||
| annotations: {} | ||
| # The name of the service account to use. | ||
| # If not set and create is true, a name is generated using the fullname template | ||
| name: "" | ||
|
|
||
| # This is for setting Kubernetes Annotations to a Pod. | ||
| # For more information checkout: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/ | ||
| podAnnotations: {} | ||
| # This is for setting Kubernetes Labels to a Pod. | ||
| # For more information checkout: https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/ | ||
| podLabels: {} | ||
|
|
||
| podSecurityContext: {} | ||
| # fsGroup: 2000 | ||
|
|
||
| securityContext: {} | ||
| # capabilities: | ||
| # drop: | ||
| # - ALL | ||
| # readOnlyRootFilesystem: true | ||
| # runAsNonRoot: true | ||
| # runAsUser: 1000 | ||
|
|
||
| resources: {} | ||
| # We usually recommend not to specify default resources and to leave this as a conscious | ||
| # choice for the user. This also increases chances charts run on environments with little | ||
| # resources, such as Minikube. If you do want to specify resources, uncomment the following | ||
| # lines, adjust them as necessary, and remove the curly braces after 'resources:'. | ||
| # limits: | ||
| # cpu: 100m | ||
| # memory: 128Mi | ||
| # requests: | ||
| # cpu: 100m | ||
| # memory: 128Mi | ||
|
|
||
| # Additional volumes on the output Deployment definition. | ||
| volumes: [] | ||
| # - name: foo | ||
| # secret: | ||
| # secretName: mysecret | ||
| # optional: false | ||
|
|
||
| # Additional volumeMounts on the output Deployment definition. | ||
| volumeMounts: [] | ||
| # - name: foo | ||
| # mountPath: "/etc/foo" | ||
| # readOnly: true | ||
|
|
||
| nodeSelector: {} | ||
|
|
||
| tolerations: [] | ||
|
|
||
| affinity: {} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.