-
Notifications
You must be signed in to change notification settings - Fork 2
Initial ctrlc-sync helm chart
#27
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 all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
f48f7b9
feat: Initial ctrlc-sync helm chart
dacbd a280f96
update reference link
dacbd 17458ac
restart policy
dacbd c79fd8b
correct spot
dacbd 9b64714
nil check for int values
dacbd b389556
remove some default wording
dacbd 2742efb
secure defaults
dacbd 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 |
|---|---|---|
| @@ -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 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,11 @@ | ||
| apiVersion: v2 | ||
| name: ctrlc-sync | ||
| description: A Helm chart for ctrlc sync jobs in Kubernetes | ||
| type: application | ||
| version: 0.1.0 | ||
| appVersion: "v0.16.2" | ||
|
|
||
| maintainers: | ||
| - name: ctrlplane | ||
| email: support@ctrlplane.com | ||
| url: https://ctrlplane.dev |
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,46 @@ | ||
| {{- define "ctrlc-sync.envs" -}} | ||
| {{- if kindIs "map" .Values.ctrlc.apiKey -}} | ||
| - name: CTRLPLANE_API_KEY | ||
| {{- toYaml .Values.ctrlc.apiKey | nindent 2 }} | ||
| {{- else -}} | ||
| - name: CTRLPLANE_API_KEY | ||
| valueFrom: | ||
| secretKeyRef: | ||
| name: "{{ include "ctrlc-sync.secretname" . }}" | ||
| key: "apiKey" | ||
| {{- end }} | ||
|
|
||
| {{- if kindIs "map" .Values.ctrlc.workspaceID }} | ||
| - name: CTRLPLANE_WORKSPACE | ||
| {{- toYaml .Values.ctrlc.workspaceID | nindent 2 }} | ||
| {{- else }} | ||
| - name: CTRLPLANE_WORKSPACE | ||
| value: "{{ .Values.ctrlc.workspaceID }}" | ||
| {{- end }} | ||
|
|
||
| {{- if kindIs "map" .Values.ctrlc.apiURL }} | ||
| - name: CTRLPLANE_URL | ||
| {{- toYaml .Values.ctrlc.apiURL | nindent 2 }} | ||
| {{- else }} | ||
| - name: CTRLPLANE_URL | ||
| value: "{{ .Values.ctrlc.apiURL }}" | ||
| {{- end }} | ||
|
|
||
| {{- if kindIs "map" .Values.ctrlc.identifier }} | ||
| - name: CTRLPLANE_CLUSTER_IDENTIFIER | ||
| {{- toYaml .Values.ctrlc.identifier | nindent 2 }} | ||
| {{- else }} | ||
| - name: CTRLPLANE_CLUSTER_IDENTIFIER | ||
| value: "{{ .Values.ctrlc.identifier }}" | ||
| {{- end }} | ||
|
|
||
| {{- if kindIs "map" .Values.ctrlc.logLevel }} | ||
| - name: CTRLPLANE_LOG_LEVEL | ||
| {{- toYaml .Values.ctrlc.logLevel | nindent 2 }} | ||
| {{- else }} | ||
| - name: CTRLPLANE_LOG_LEVEL | ||
| value: "{{ .Values.ctrlc.logLevel }}" | ||
| {{- 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,75 @@ | ||
| {{/* | ||
| Expand the name of the chart. | ||
| */}} | ||
| {{- define "ctrlc-sync.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 "ctrlc-sync.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 "ctrlc-sync.chart" -}} | ||
| {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} | ||
| {{- end }} | ||
|
|
||
| {{- define "ctrlc-sync.secretname" -}} | ||
| {{- printf "%s-secret" (include "ctrlc-sync.fullname" .) | trunc 63 | trimSuffix "-" }} | ||
| {{- end }} | ||
|
|
||
|
|
||
| {{/* | ||
| Common labels | ||
| */}} | ||
| {{- define "ctrlc-sync.labels" -}} | ||
| helm.sh/chart: {{ include "ctrlc-sync.chart" . }} | ||
| {{ include "ctrlc-sync.selectorLabels" . }} | ||
| {{- if .Chart.AppVersion }} | ||
| app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} | ||
| {{- end }} | ||
| app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
| {{- end }} | ||
|
|
||
| {{/* | ||
| Selector labels | ||
| */}} | ||
| {{- define "ctrlc-sync.selectorLabels" -}} | ||
| app.kubernetes.io/name: {{ include "ctrlc-sync.name" . }} | ||
| app.kubernetes.io/instance: {{ .Release.Name }} | ||
| {{- end }} | ||
|
|
||
| {{/* | ||
| Create the name of the service account to use | ||
| */}} | ||
| {{- define "ctrlc-sync.serviceAccountName" -}} | ||
| {{- if .Values.serviceAccount.create }} | ||
| {{- default (include "ctrlc-sync.fullname" .) .Values.serviceAccount.name }} | ||
| {{- else }} | ||
| {{- default "default" .Values.serviceAccount.name }} | ||
| {{- end }} | ||
| {{- end }} | ||
|
|
||
| {{- define "ctrlc-sync.clusterRole.k8s" -}} | ||
| {{- printf "%s-k8s-sync-role" (include "ctrlc-sync.fullname" .) | trunc 63 | trimSuffix "-" }} | ||
| {{- end }} | ||
|
|
||
| {{- define "ctrlc-sync.clusterRoleBinding.k8s" -}} | ||
| {{- printf "%s-k8s-sync-rolebinding" (include "ctrlc-sync.fullname" .) | trunc 63 | trimSuffix "-" }} | ||
| {{- 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,16 @@ | ||
| {{- if .Values.rbac.enabled }} | ||
| apiVersion: rbac.authorization.k8s.io/v1 | ||
| kind: ClusterRoleBinding | ||
| metadata: | ||
| name: {{ include "ctrlc-sync.clusterRoleBinding.k8s" . }} | ||
| labels: | ||
| {{- include "ctrlc-sync.labels" . | nindent 4 }} | ||
| subjects: | ||
| - kind: ServiceAccount | ||
| name: {{ include "ctrlc-sync.serviceAccountName" . }} | ||
| namespace: {{ .Release.Namespace }} | ||
| roleRef: | ||
| kind: ClusterRole | ||
| name: {{ include "ctrlc-sync.clusterRole.k8s" . }} | ||
| apiGroup: rbac.authorization.k8s.io | ||
| {{- 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,15 @@ | ||
| {{- if .Values.rbac.enabled -}} | ||
| apiVersion: rbac.authorization.k8s.io/v1 | ||
| kind: ClusterRole | ||
| metadata: | ||
| name: {{ include "ctrlc-sync.clusterRole.k8s" . }} | ||
| labels: | ||
| {{- include "ctrlc-sync.labels" . | nindent 4 }} | ||
| rules: | ||
| - apiGroups: ["apps"] | ||
| resources: ["statefulsets", "deployments"] | ||
| verbs: ["get", "list", "watch"] | ||
| - apiGroups: [""] | ||
| resources: ["namespaces"] | ||
| verbs: ["get", "list", "watch"] | ||
| {{- 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,95 @@ | ||
| apiVersion: batch/v1 | ||
| kind: CronJob | ||
| metadata: | ||
| name: {{ include "ctrlc-sync.fullname" . }} | ||
| labels: | ||
| {{- include "ctrlc-sync.labels" . | nindent 4 }} | ||
| spec: | ||
| schedule: "{{ .Values.cron.schedule }}" | ||
| {{- if .Values.cron.timeZone }} | ||
| timeZone: "{{ .Values.cron.timeZone }}" | ||
| {{- end }} | ||
| concurrencyPolicy: "{{ .Values.cron.concurrencyPolicy }}" | ||
| {{- if ne .Values.cron.startingDeadlineSeconds nil }} | ||
| startingDeadlineSeconds: {{ .Values.cron.startingDeadlineSeconds }} | ||
| {{- end }} | ||
| successfulJobsHistoryLimit: {{ .Values.cron.successfulJobsHistoryLimit }} | ||
| failedJobsHistoryLimit: {{ .Values.cron.failedJobsHistoryLimit }} | ||
| jobTemplate: | ||
| metadata: | ||
| {{- with .Values.jobAnnotations }} | ||
| annotations: | ||
| {{- toYaml . | nindent 8 }} | ||
| {{- end }} | ||
| labels: | ||
| {{- include "ctrlc-sync.labels" . | nindent 8 }} | ||
| {{- with .Values.jobLabels }} | ||
| {{- toYaml . | nindent 8 }} | ||
| {{- end }} | ||
| spec: | ||
| backoffLimit: {{ .Values.job.backoffLimit }} | ||
| {{- if ne .Values.job.activeDeadlineSeconds nil }} | ||
| activeDeadlineSeconds: {{ .Values.job.activeDeadlineSeconds }} | ||
| {{- end }} | ||
| {{- if ne .Values.job.ttlSecondsAfterFinished nil }} | ||
| ttlSecondsAfterFinished: {{ .Values.job.ttlSecondsAfterFinished }} | ||
| {{- end }} | ||
| template: | ||
| metadata: | ||
| {{- with .Values.podAnnotations }} | ||
| annotations: | ||
| {{- toYaml . | nindent 12 }} | ||
| {{- end }} | ||
| labels: | ||
| {{- include "ctrlc-sync.labels" . | nindent 12 }} | ||
| {{- with .Values.podLabels }} | ||
| {{- toYaml . | nindent 12 }} | ||
| {{- end }} | ||
| spec: | ||
| {{- with .Values.imagePullSecrets }} | ||
| imagePullSecrets: | ||
| {{- toYaml . | nindent 12 }} | ||
| {{- end }} | ||
| serviceAccountName: {{ include "ctrlc-sync.serviceAccountName" . }} | ||
| {{- with .Values.podSecurityContext }} | ||
| securityContext: | ||
| {{- toYaml . | nindent 12 }} | ||
| {{- end }} | ||
| restartPolicy: OnFailure | ||
| containers: | ||
| - name: {{ .Chart.Name }} | ||
| {{- with .Values.securityContext }} | ||
| securityContext: | ||
| {{- toYaml . | nindent 16 }} | ||
| {{- end }} | ||
| image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" | ||
| imagePullPolicy: {{ .Values.image.pullPolicy }} | ||
| command: ["ctrlc"] | ||
| args: ["sync", "kubernetes"] | ||
| env: | ||
| {{- include "ctrlc-sync.envs" . | nindent 16 }} | ||
| {{- with .Values.resources }} | ||
| resources: | ||
| {{- toYaml . | nindent 16 }} | ||
| {{- end }} | ||
| {{- 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,10 @@ | ||
| {{- if not (kindIs "map" .Values.ctrlc.apiKey ) }} | ||
| apiVersion: v1 | ||
| kind: Secret | ||
| metadata: | ||
| name: {{ include "ctrlc-sync.secretname" . }} | ||
| labels: | ||
| {{- include "ctrlc-sync.labels" . | nindent 4 }} | ||
| data: | ||
| apiKey: {{ .Values.ctrlc.apiKey | b64enc }} | ||
| {{- 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 "ctrlc-sync.serviceAccountName" . }} | ||
| labels: | ||
| {{- include "ctrlc-sync.labels" . | nindent 4 }} | ||
| {{- with .Values.serviceAccount.annotations }} | ||
| annotations: | ||
| {{- toYaml . | nindent 4 }} | ||
| {{- end }} | ||
| automountServiceAccountToken: {{ .Values.serviceAccount.automount }} | ||
| {{- end }} |
Oops, something went wrong.
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.