-
Notifications
You must be signed in to change notification settings - Fork 150
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2989 from steveworley/issue-2988-python-pv
- Loading branch information
Showing
10 changed files
with
487 additions
and
1 deletion.
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
22 changes: 22 additions & 0 deletions
22
images/kubectl-build-deploy-dind/helmcharts/python-persistent/.helmignore
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,22 @@ | ||
# 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 | ||
*~ | ||
# Various IDEs | ||
.project | ||
.idea/ | ||
*.tmproj | ||
.vscode/ |
17 changes: 17 additions & 0 deletions
17
images/kubectl-build-deploy-dind/helmcharts/python-persistent/Chart.yaml
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,17 @@ | ||
apiVersion: v2 | ||
name: python-persistent | ||
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. | ||
version: 0.1.0 |
115 changes: 115 additions & 0 deletions
115
images/kubectl-build-deploy-dind/helmcharts/python-persistent/templates/_helpers.tpl
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,115 @@ | ||
{{/* vim: set filetype=mustache: */}} | ||
{{/* | ||
Expand the name of the chart. | ||
*/}} | ||
{{- define "python-persistent.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). | ||
*/}} | ||
{{- define "python-persistent.fullname" -}} | ||
{{- .Release.Name | trunc 63 | trimSuffix "-" -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Create chart name and version as used by the chart label. | ||
*/}} | ||
{{- define "python-persistent.chart" -}} | ||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Create full hostname for autogenerated hosts | ||
*/}} | ||
{{- define "python-persistent.autogeneratedHost" -}} | ||
{{- if .root.Values.autogeneratedRouteDomain -}} | ||
{{ if not .prefix }} | ||
{{- printf "%s" .root.Values.autogeneratedRouteDomain | trimSuffix "-" -}} | ||
{{- else -}} | ||
{{- printf "%s.%s" .prefix .root.Values.autogeneratedRouteDomain | trimSuffix "-" -}} | ||
{{- end -}} | ||
{{- else -}} | ||
{{ if not .prefix }} | ||
{{- printf "%s.%s" .root.Release.Name .root.Values.routesAutogenerateSuffix | trimSuffix "-" -}} | ||
{{- else -}} | ||
{{- printf "%s.%s.%s" .prefix .root.Release.Name .root.Values.routesAutogenerateSuffix | trimSuffix "-" -}} | ||
{{- end -}} | ||
{{- end -}} | ||
{{- end -}} | ||
|
||
{{/* | ||
Create short hostname for autogenerated hosts. | ||
This is used to work around problems with long CN fields in certificates. | ||
*/}} | ||
{{- define "python-persistent.autogeneratedShortHost" -}} | ||
{{- if .root.Values.shortAutogeneratedRouteDomain -}} | ||
{{- printf "%s" .root.Values.shortAutogeneratedRouteDomain }} | ||
{{- else -}} | ||
{{- printf "%s.%s" .root.Release.Name .root.Values.routesAutogenerateShortSuffix }} | ||
{{- end -}} | ||
{{- end }} | ||
|
||
{{/* | ||
Generate name of Persistent Storage | ||
Uses the Release Name (Lagoon Service Name) unless it's overwritten via .Values.persistentStorage.name | ||
*/}} | ||
{{- define "python-persistent.persistentStorageName" -}} | ||
{{- default .Release.Name .Values.persistentStorage.name | trunc 63 | trimSuffix "-" -}} | ||
{{- end -}} | ||
{{/* | ||
Common labels | ||
*/}} | ||
{{- define "python-persistent.labels" -}} | ||
helm.sh/chart: {{ include "python-persistent.chart" . }} | ||
{{ include "python-persistent.selectorLabels" . }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
{{ include "python-persistent.lagoonLabels" . }} | ||
{{- end -}} | ||
{{/* | ||
Selector labels | ||
*/}} | ||
{{- define "python-persistent.selectorLabels" -}} | ||
app.kubernetes.io/name: {{ include "python-persistent.name" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
{{- end -}} | ||
{{/* | ||
Create a PriorityClassName. | ||
(this is based on the Lagoon Environment Type)). | ||
*/}} | ||
{{- define "python-persistent.lagoonPriority" -}} | ||
{{- printf "lagoon-priority-%s" .Values.environmentType }} | ||
{{- end -}} | ||
{{/* | ||
Lagoon Labels | ||
*/}} | ||
{{- define "python-persistent.lagoonLabels" -}} | ||
lagoon.sh/service: {{ .Release.Name }} | ||
lagoon.sh/service-type: {{ .Chart.Name }} | ||
lagoon.sh/project: {{ .Values.project }} | ||
lagoon.sh/environment: {{ .Values.environment }} | ||
lagoon.sh/environmentType: {{ .Values.environmentType }} | ||
lagoon.sh/buildType: {{ .Values.buildType }} | ||
{{- end -}} | ||
{{/* | ||
Annotations | ||
*/}} | ||
{{- define "python-persistent.annotations" -}} | ||
lagoon.sh/version: {{ .Values.lagoonVersion | quote }} | ||
{{- if .Values.branch }} | ||
lagoon.sh/branch: {{ .Values.branch | quote }} | ||
{{- end }} | ||
{{- if .Values.prNumber }} | ||
lagoon.sh/prNumber: {{ .Values.prNumber | quote }} | ||
lagoon.sh/prHeadBranch: {{ .Values.prHeadBranch | quote }} | ||
lagoon.sh/prBaseBranch: {{ .Values.prBaseBranch | quote }} | ||
{{- end }} | ||
{{- end -}} |
86 changes: 86 additions & 0 deletions
86
images/kubectl-build-deploy-dind/helmcharts/python-persistent/templates/cronjob.yaml
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,86 @@ | ||
{{- range $cronjobName, $cronjobConfig := .Values.nativeCronjobs }} | ||
--- | ||
apiVersion: batch/v1beta1 | ||
kind: CronJob | ||
metadata: | ||
name: cronjob-{{ $.Release.Name }}-{{ $cronjobName }} | ||
labels: | ||
{{- include "python-persistent.labels" $ | nindent 4 }} | ||
annotations: | ||
{{- include "python-persistent.annotations" $ | nindent 4 }} | ||
spec: | ||
schedule: {{ $cronjobConfig.schedule | quote }} | ||
concurrencyPolicy: Forbid | ||
successfulJobsHistoryLimit: 0 | ||
failedJobsHistoryLimit: 1 | ||
startingDeadlineSeconds: 240 | ||
jobTemplate: | ||
metadata: | ||
labels: | ||
{{- include "python-persistent.labels" $ | nindent 8 }} | ||
annotations: | ||
{{- include "python-persistent.annotations" $ | nindent 8 }} | ||
spec: | ||
backoffLimit: 0 | ||
template: | ||
metadata: | ||
labels: | ||
{{- include "python-persistent.labels" $ | nindent 12 }} | ||
annotations: | ||
{{- include "python-persistent.annotations" $ | nindent 12 }} | ||
spec: | ||
{{- with $.Values.imagePullSecrets }} | ||
imagePullSecrets: | ||
{{- toYaml . | nindent 12 }} | ||
{{- end }} | ||
priorityClassName: {{ include "python-persistent.lagoonPriority" $ }} | ||
enableServiceLinks: false | ||
securityContext: | ||
{{- toYaml $.Values.podSecurityContext | nindent 12 }} | ||
volumes: | ||
- name: lagoon-sshkey | ||
secret: | ||
defaultMode: 420 | ||
secretName: lagoon-sshkey | ||
- name: {{ $.Values.persistentStorage.name }} | ||
persistentVolumeClaim: | ||
claimName: {{ $.Values.persistentStorage.name }} | ||
containers: | ||
- image: {{ $.Values.image | quote }} | ||
name: cronjob-{{ $.Release.Name }}-{{ $cronjobName }} | ||
securityContext: | ||
{{- toYaml $.Values.securityContext | nindent 16 }} | ||
imagePullPolicy: {{ $.Values.imagePullPolicy }} | ||
command: | ||
- /lagoon/cronjob.sh | ||
- {{ $cronjobConfig.command }} | ||
env: | ||
- name: LAGOON_GIT_SHA | ||
value: {{ $.Values.gitSha | quote }} | ||
- name: SERVICE_NAME | ||
value: {{ $.Release.Name | quote }} | ||
envFrom: | ||
- configMapRef: | ||
name: lagoon-env | ||
resources: | ||
{{- toYaml $.Values.resources | nindent 16 }} | ||
volumeMounts: | ||
- mountPath: /var/run/secrets/lagoon/sshkey/ | ||
name: lagoon-sshkey | ||
readOnly: true | ||
- name: {{ $.Values.persistentStorage.name }} | ||
mountPath: {{ $.Values.persistentStorage.path | quote }} | ||
restartPolicy: Never | ||
{{- with $.Values.nodeSelector }} | ||
nodeSelector: | ||
{{- toYaml $ | nindent 12 }} | ||
{{- end }} | ||
{{- with $.Values.affinity }} | ||
affinity: | ||
{{- toYaml $ | nindent 12 }} | ||
{{- end }} | ||
{{- with $.Values.tolerations }} | ||
tolerations: | ||
{{- toYaml $ | nindent 12 }} | ||
{{- end }} | ||
{{- end }} |
81 changes: 81 additions & 0 deletions
81
images/kubectl-build-deploy-dind/helmcharts/python-persistent/templates/deployment.yaml
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,81 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: {{ include "python-persistent.fullname" . }} | ||
labels: | ||
{{- include "python-persistent.labels" . | nindent 4 }} | ||
annotations: | ||
{{- include "python-persistent.annotations" . | nindent 4 }} | ||
spec: | ||
replicas: {{ .Values.replicaCount }} | ||
selector: | ||
matchLabels: | ||
{{- include "python-persistent.selectorLabels" . | nindent 6 }} | ||
template: | ||
metadata: | ||
labels: | ||
{{- include "python-persistent.labels" . | nindent 8 }} | ||
annotations: | ||
{{- include "python-persistent.annotations" . | nindent 8 }} | ||
lagoon.sh/configMapSha: {{ .Values.configMapSha | quote }} | ||
spec: | ||
{{- with .Values.imagePullSecrets }} | ||
imagePullSecrets: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
volumes: | ||
- name: {{ include "python-persistent.persistentStorageName" . }} | ||
persistentVolumeClaim: | ||
claimName: {{ include "python-persistent.persistentStorageName" . }} | ||
priorityClassName: {{ include "python-persistent.lagoonPriority" . }} | ||
enableServiceLinks: false | ||
securityContext: | ||
{{- toYaml .Values.podSecurityContext | nindent 8 }} | ||
containers: | ||
- image: {{ .Values.image | quote }} | ||
name: {{ .Chart.Name }} | ||
securityContext: | ||
{{- toYaml .Values.securityContext | nindent 12 }} | ||
imagePullPolicy: {{ .Values.imagePullPolicy }} | ||
ports: | ||
- name: http | ||
containerPort: 8800 | ||
protocol: TCP | ||
readinessProbe: | ||
tcpSocket: | ||
port: 8800 | ||
initialDelaySeconds: 15 | ||
timeoutSeconds: 1 | ||
livenessProbe: | ||
tcpSocket: | ||
port: 8800 | ||
initialDelaySeconds: 60 | ||
periodSeconds: 5 | ||
env: | ||
## LAGOON_GIT_SHA is injected directly and not loaded via `lagoon-env` config | ||
## This will cause the pod to redeploy on every deployment, even the files have not changed | ||
- name: LAGOON_GIT_SHA | ||
value: {{ .Values.gitSha | quote }} | ||
- name: CRONJOBS | ||
value: | | ||
{{- toYaml .Values.inPodCronjobs | nindent 16 }} | ||
envFrom: | ||
- configMapRef: | ||
name: lagoon-env | ||
volumeMounts: | ||
- name: {{ include "python-persistent.persistentStorageName" . }} | ||
mountPath: {{ .Values.persistentStorage.path | quote }} | ||
resources: | ||
{{- toYaml .Values.resources | nindent 12 }} | ||
{{- with .Values.nodeSelector }} | ||
nodeSelector: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- with .Values.affinity }} | ||
affinity: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- with .Values.tolerations }} | ||
tolerations: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} |
Oops, something went wrong.