From 7e0e0ffec6a2380efdf976a0ab4f751016a1b96e Mon Sep 17 00:00:00 2001 From: Kostya Date: Sun, 26 Apr 2020 13:22:31 +0800 Subject: [PATCH] Cleanup. Add values.yaml, skaffold.yaml --- README.md | 6 ++- charts/basic/Chart.yaml | 2 +- charts/basic/templates/cronjob.yaml | 82 ++++++++++++++--------------- charts/basic/values.yaml | 12 +---- skaffold.yaml | 17 ++++++ values.yaml | 34 ++++++++++++ 6 files changed, 100 insertions(+), 53 deletions(-) create mode 100644 skaffold.yaml create mode 100644 values.yaml diff --git a/README.md b/README.md index c1b3e64..8724659 100644 --- a/README.md +++ b/README.md @@ -1 +1,5 @@ -# test-cronjob-helm \ No newline at end of file +# test-cronjob-helm + +```bash +helm repo add test-cronjob https://kostyaplis.github.io/test-cronjob-helm +``` \ No newline at end of file diff --git a/charts/basic/Chart.yaml b/charts/basic/Chart.yaml index 04b48cd..3407fce 100644 --- a/charts/basic/Chart.yaml +++ b/charts/basic/Chart.yaml @@ -2,4 +2,4 @@ apiVersion: v1 appVersion: "1.0" description: A Helm chart for Kubernetes name: basic -version: 0.0.2 +version: 0.0.3 diff --git a/charts/basic/templates/cronjob.yaml b/charts/basic/templates/cronjob.yaml index 5dbc28a..487b08c 100644 --- a/charts/basic/templates/cronjob.yaml +++ b/charts/basic/templates/cronjob.yaml @@ -31,38 +31,38 @@ spec: imagePullPolicy: {{ $.Values.image.pullPolicy }} command: {{- toYaml .command | trim | nindent 16 }} - {{- if or ($.Values.app.env) (.env) }} - env: - - name: PROMETHEUS_EXPORTER_REQUEST_STATS - value: "false" - - name: PROMETHEUS_EXPORTER_PROCESS_STATS - value: "false" - {{- range $name, $value := $.Values.app.env }} - - name: {{ $name | quote }} - value: {{ $value | quote }} - {{- end }} - {{- range $name, $value := .env }} - - name: {{ $name | quote }} - value: {{ $value | quote }} - {{- end }} - {{- end }} - {{- if or ($.Values.app.envFromSecrets) ($.Values.app.envFromConfigMaps) }} - envFrom: - {{- range $.Values.app.envFromConfigMaps }} - - configMapRef: - name: {{ . | quote }} - {{- end }} - {{- range $.Values.app.envFromSecrets }} - - secretRef: - name: {{ . | quote }} - {{- end }} - {{- end }} - volumeMounts: - {{- if $.Values.app.settingsYmlSecret.enabled }} - - mountPath: {{ $.Values.app.home }}/config/{{ $.Values.app.settingsYmlSecret.key }} - name: settings-yml-volume - subPath: {{ $.Values.app.settingsYmlSecret.key }} - {{- end }} + # {{- if or ($.Values.app.env) (.env) }} + # env: + # - name: PROMETHEUS_EXPORTER_REQUEST_STATS + # value: "false" + # - name: PROMETHEUS_EXPORTER_PROCESS_STATS + # value: "false" + # {{- range $name, $value := $.Values.app.env }} + # - name: {{ $name | quote }} + # value: {{ $value | quote }} + # {{- end }} + # {{- range $name, $value := .env }} + # - name: {{ $name | quote }} + # value: {{ $value | quote }} + # {{- end }} + # {{- end }} + # {{- if or ($.Values.app.envFromSecrets) ($.Values.app.envFromConfigMaps) }} + # envFrom: + # {{- range $.Values.app.envFromConfigMaps }} + # - configMapRef: + # name: {{ . | quote }} + # {{- end }} + # {{- range $.Values.app.envFromSecrets }} + # - secretRef: + # name: {{ . | quote }} + # {{- end }} + # {{- end }} + # volumeMounts: + # {{- if $.Values.app.settingsYmlSecret.enabled }} + # - mountPath: {{ $.Values.app.home }}/config/{{ $.Values.app.settingsYmlSecret.key }} + # name: settings-yml-volume + # subPath: {{ $.Values.app.settingsYmlSecret.key }} + # {{- end }} {{- with .resources }} resources: {{- toYaml . | trim | nindent 16 }} @@ -72,15 +72,15 @@ spec: imagePullSecrets: {{- toYaml . | trim | nindent 12}} {{- end }} - volumes: - {{- if $.Values.app.settingsYmlSecret.enabled }} - - name: settings-yml-volume - secret: - secretName: {{ $.Values.app.settingsYmlSecret.name | quote }} - items: - - key: {{ $.Values.app.settingsYmlSecret.key | quote }} - path: {{ $.Values.app.settingsYmlSecret.key | quote }} - {{- end }} + # volumes: + # {{- if $.Values.app.settingsYmlSecret.enabled }} + # - name: settings-yml-volume + # secret: + # secretName: {{ $.Values.app.settingsYmlSecret.name | quote }} + # items: + # - key: {{ $.Values.app.settingsYmlSecret.key | quote }} + # path: {{ $.Values.app.settingsYmlSecret.key | quote }} + # {{- end }} {{- with $.Values.nodeSelector }} nodeSelector: {{- toYaml . | nindent 12 }} diff --git a/charts/basic/values.yaml b/charts/basic/values.yaml index d43c33d..b58d966 100644 --- a/charts/basic/values.yaml +++ b/charts/basic/values.yaml @@ -5,8 +5,8 @@ replicaCount: 1 image: - repository: - tag: latest + repository: alpine + tag: 3.11 pullPolicy: IfNotPresent imagePullSecrets: [] @@ -18,12 +18,6 @@ containerArgs: [] nameOverride: "" fullnameOverride: "" -service: - enabled: false - type: ClusterIP - port: 80 - annotations: {} - # environment variables, not a list of objects with keys name and value # but directly an object of key and value env: {} @@ -32,8 +26,6 @@ envFromSecrets: [] # existing k8s configMaps for environment variables envFromConfigMaps: [] -# httpProbePath: / - 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 diff --git a/skaffold.yaml b/skaffold.yaml new file mode 100644 index 0000000..460d884 --- /dev/null +++ b/skaffold.yaml @@ -0,0 +1,17 @@ +apiVersion: skaffold/v2alpha4 +kind: Config +profiles: +- name: test-cronjob + deploy: + helm: + flags: + install: ['--atomic'] + upgrade: ['--atomic'] + releases: + - name: cronjob + namespace: default + chartPath: test-cronjob/basic + remote: true + wait: true + valuesFiles: + - "values.yaml" diff --git a/values.yaml b/values.yaml new file mode 100644 index 0000000..98bdd5f --- /dev/null +++ b/values.yaml @@ -0,0 +1,34 @@ +cronjobs: +- command: + - bash + - -c + - | + sleep 10s + failedJobsHistoryLimit: 1 + successfulJobsHistoryLimit: 1 + name: super-long-resource-name-that-exceeds-63-characters-and-should-fail + schedule: '* * * * *' + resources: + limits: + cpu: 100m + memory: 128Mi + requests: + cpu: 100m + memory: 128Mi + +- command: + - bash + - -c + - | + sleep 10s + failedJobsHistoryLimit: 1 + successfulJobsHistoryLimit: 1 + name: another-cronjob-name + schedule: '* * * * *' + resources: + limits: + cpu: 100m + memory: 128Mi + requests: + cpu: 100m + memory: 128Mi \ No newline at end of file