diff --git a/CHANGELOG.md b/CHANGELOG.md index 9164c1a3..fed4007d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,9 @@ All notable changes to this project will be documented here. +### v2.2.6 +- fix: allow multiple cronjobs [PR-271](https://github.com/stakater/application/pull/271) + ### v2.2.5 - fix: Namespace selector fixed for service monitor [PR-270](https://github.com/stakater/application/pull/270) diff --git a/application/templates/_helpers.tpl b/application/templates/_helpers.tpl index 48f8166d..d678c846 100644 --- a/application/templates/_helpers.tpl +++ b/application/templates/_helpers.tpl @@ -60,3 +60,11 @@ Allow the release namespace to be overridden {{- define "application.namespace" -}} {{- default .Release.Namespace .Values.namespaceOverride -}} {{- end -}} + +{{- define "application.sa.oauth-redirectreference" }} +apiVersion: v1 +kind: OAuthRedirectReference +reference: + kind: Route + name: {{ include "application.name" . }} +{{- end }} diff --git a/application/templates/alertmanagerconfig.yaml b/application/templates/alertmanagerconfig.yaml index 766373a9..122c4e03 100644 --- a/application/templates/alertmanagerconfig.yaml +++ b/application/templates/alertmanagerconfig.yaml @@ -1,4 +1,5 @@ {{- if and (.Values.alertmanagerConfig).enabled (.Capabilities.APIVersions.Has "monitoring.coreos.com/v1alpha1") -}} +--- apiVersion: monitoring.coreos.com/v1alpha1 kind: AlertmanagerConfig metadata: diff --git a/application/templates/certificate.yaml b/application/templates/certificate.yaml index bffce90e..c9601031 100644 --- a/application/templates/certificate.yaml +++ b/application/templates/certificate.yaml @@ -1,4 +1,5 @@ {{- if and (.Values.certificate).enabled (.Capabilities.APIVersions.Has "cert-manager.io/v1") }} +--- apiVersion: cert-manager.io/v1 kind: Certificate metadata: @@ -76,4 +77,4 @@ spec: name: {{ include "application.tplvalues.render" ( dict "value" .Values.certificate.keystores.pkcs12.name "context" $ ) }} {{- end }} {{- end }} -{{- end }} \ No newline at end of file +{{- end }} diff --git a/application/templates/configmap.yaml b/application/templates/configmap.yaml index ff1cb3e9..84598996 100644 --- a/application/templates/configmap.yaml +++ b/application/templates/configmap.yaml @@ -1,5 +1,6 @@ {{- if (.Values.configMap).enabled }} {{- range $nameSuffix, $data := .Values.configMap.files }} +--- apiVersion: v1 kind: ConfigMap metadata: @@ -16,6 +17,5 @@ metadata: {{- end }} data: {{ include "application.tplvalues.render" ( dict "value" $data "context" $ ) | indent 2 }} ---- {{- end }} -{{- end }} \ No newline at end of file +{{- end }} diff --git a/application/templates/cronjob.yaml b/application/templates/cronjob.yaml index a796ab96..d21a878a 100644 --- a/application/templates/cronjob.yaml +++ b/application/templates/cronjob.yaml @@ -1,5 +1,6 @@ {{- if (.Values.cronJob).enabled }} {{- range $name, $job := .Values.cronJob.jobs }} +--- {{ if $.Capabilities.APIVersions.Has "batch/v1/CronJob" -}} apiVersion: batch/v1 {{- else -}} diff --git a/application/templates/deployment.yaml b/application/templates/deployment.yaml index 8e03b7dc..efd9a7e5 100644 --- a/application/templates/deployment.yaml +++ b/application/templates/deployment.yaml @@ -1,4 +1,5 @@ {{- if .Values.deployment.enabled }} +--- apiVersion: apps/v1 kind: Deployment metadata: diff --git a/application/templates/endpointmonitor.yaml b/application/templates/endpointmonitor.yaml index 1e7c92f0..52cbf62b 100644 --- a/application/templates/endpointmonitor.yaml +++ b/application/templates/endpointmonitor.yaml @@ -1,4 +1,5 @@ {{- if and (.Values.endpointMonitor).enabled (.Capabilities.APIVersions.Has "endpointmonitor.stakater.com/v1alpha1") (or (and .Values.route .Values.route.enabled) (and .Values.ingress .Values.ingress.enabled))}} +--- apiVersion: endpointmonitor.stakater.com/v1alpha1 kind: EndpointMonitor metadata: @@ -27,4 +28,4 @@ spec: {{- if .Values.endpointMonitor.additionalConfig }} {{ toYaml .Values.endpointMonitor.additionalConfig | indent 2 }} {{- end }} -{{- end }} \ No newline at end of file +{{- end }} diff --git a/application/templates/externalsecrets.yaml b/application/templates/externalsecrets.yaml index d6c369e2..682510c5 100644 --- a/application/templates/externalsecrets.yaml +++ b/application/templates/externalsecrets.yaml @@ -1,5 +1,6 @@ {{- if and (.Values.externalSecret).enabled (.Capabilities.APIVersions.Has "external-secrets.io/v1beta1") }} {{- range $nameSuffix, $data := .Values.externalSecret.files }} +--- apiVersion: external-secrets.io/v1beta1 kind: ExternalSecret metadata: @@ -48,6 +49,5 @@ spec: {{ toYaml $data.labels | indent 10 }} {{- end }} {{- end }} ---- -{{- end}} -{{- end}} \ No newline at end of file +{{- end }} +{{- end }} diff --git a/application/templates/forecastle.yaml b/application/templates/forecastle.yaml index 3ac748d0..1a72296c 100644 --- a/application/templates/forecastle.yaml +++ b/application/templates/forecastle.yaml @@ -1,4 +1,5 @@ {{- if and (.Values.forecastle).enabled (.Capabilities.APIVersions.Has "forecastle.stakater.com/v1alpha1") (or .Values.ingress.enabled .Values.route.enabled) }} +--- apiVersion: forecastle.stakater.com/v1alpha1 kind: ForecastleApp metadata: @@ -26,4 +27,4 @@ spec: properties: {{ toYaml .Values.forecastle.properties | indent 4 }} {{- end }} -{{- end -}} \ No newline at end of file +{{- end -}} diff --git a/application/templates/grafanadashboard.yaml b/application/templates/grafanadashboard.yaml index eec15dc9..d498b474 100644 --- a/application/templates/grafanadashboard.yaml +++ b/application/templates/grafanadashboard.yaml @@ -1,5 +1,6 @@ {{- if and (.Values.grafanaDashboard).enabled (.Capabilities.APIVersions.Has "integreatly.org/v1alpha1") -}} {{- range $name, $content := .Values.grafanaDashboard.contents }} +--- apiVersion: integreatly.org/v1alpha1 kind: GrafanaDashboard metadata: @@ -24,6 +25,5 @@ spec: {{- if $content.url }} url: {{ $content.url }} {{- end }} ---- {{- end }} -{{- end }} \ No newline at end of file +{{- end }} diff --git a/application/templates/hpa.yaml b/application/templates/hpa.yaml index 7e4c946d..fdbe67cf 100644 --- a/application/templates/hpa.yaml +++ b/application/templates/hpa.yaml @@ -1,11 +1,10 @@ {{- if and .Values.autoscaling.enabled .Values.deployment.enabled }} - +--- {{- if .Capabilities.APIVersions.Has "autoscaling/v2/HorizontalPodAutoscaler" }} apiVersion: autoscaling/v2 {{- else }} apiVersion: autoscaling/v2beta2 {{- end }} - kind: HorizontalPodAutoscaler metadata: name: {{ template "application.name" . }} diff --git a/application/templates/ingress.yaml b/application/templates/ingress.yaml index 760439f1..bef3de8c 100644 --- a/application/templates/ingress.yaml +++ b/application/templates/ingress.yaml @@ -1,4 +1,5 @@ {{- if (.Values.ingress).enabled -}} +--- {{- $servicePort := .Values.ingress.servicePort -}} {{- $pathType := .Values.ingress.pathType -}} {{- $applicationNameTpl := include "application.name" . -}} diff --git a/application/templates/networkpolicy.yaml b/application/templates/networkpolicy.yaml index bb3f537e..92394199 100644 --- a/application/templates/networkpolicy.yaml +++ b/application/templates/networkpolicy.yaml @@ -1,4 +1,5 @@ {{- if (.Values.networkPolicy).enabled }} +--- apiVersion: "networking.k8s.io/v1" kind: NetworkPolicy metadata: @@ -37,4 +38,4 @@ spec: ingress: {{ toYaml .Values.networkPolicy.ingress | indent 4 }} {{- end }} -{{- end }} \ No newline at end of file +{{- end }} diff --git a/application/templates/pdb.yaml b/application/templates/pdb.yaml index 50a4d240..7e97266a 100644 --- a/application/templates/pdb.yaml +++ b/application/templates/pdb.yaml @@ -1,11 +1,10 @@ {{- if or .Values.pdb.minAvailable .Values.pdb.maxUnavailable | and .Values.pdb.enabled }} - +--- {{- if .Capabilities.APIVersions.Has "policy/v1/PodDisruptionBudget" }} apiVersion: policy/v1 {{- else }} apiVersion: policy/v1beta1 {{- end }} - kind: PodDisruptionBudget metadata: labels: diff --git a/application/templates/prometheusrule.yaml b/application/templates/prometheusrule.yaml index 9d257825..46831b83 100644 --- a/application/templates/prometheusrule.yaml +++ b/application/templates/prometheusrule.yaml @@ -1,4 +1,5 @@ {{- if and (.Values.prometheusRule).enabled (.Capabilities.APIVersions.Has "monitoring.coreos.com/v1") -}} +--- apiVersion: monitoring.coreos.com/v1 kind: PrometheusRule metadata: @@ -12,4 +13,4 @@ metadata: spec: groups: {{ toYaml .Values.prometheusRule.groups | indent 4 }} -{{- end -}} \ No newline at end of file +{{- end -}} diff --git a/application/templates/pvc.yaml b/application/templates/pvc.yaml index 2db1ebfe..a6940981 100644 --- a/application/templates/pvc.yaml +++ b/application/templates/pvc.yaml @@ -1,4 +1,5 @@ {{- if and (.Values.persistence).enabled (not .Values.persistence.existingClaim) }} +--- kind: PersistentVolumeClaim apiVersion: v1 metadata: @@ -36,4 +37,4 @@ spec: {{- if .Values.persistence.volumeName }} volumeName: "{{ .Values.persistence.volumeName }}" {{- end }} -{{- end }} \ No newline at end of file +{{- end }} diff --git a/application/templates/role.yaml b/application/templates/role.yaml index f531e380..2351a709 100644 --- a/application/templates/role.yaml +++ b/application/templates/role.yaml @@ -1,5 +1,6 @@ {{- if and (.Values.rbac).enabled .Values.rbac.roles }} {{- range .Values.rbac.roles }} +--- apiVersion: rbac.authorization.k8s.io/v1 kind: Role metadata: @@ -16,6 +17,5 @@ metadata: {{- end }} rules: {{ toYaml .rules | indent 2 }} ---- {{- end }} -{{- end }} \ No newline at end of file +{{- end }} diff --git a/application/templates/rolebinding.yaml b/application/templates/rolebinding.yaml index e247d51b..d32a4acd 100644 --- a/application/templates/rolebinding.yaml +++ b/application/templates/rolebinding.yaml @@ -1,5 +1,6 @@ {{- if and (.Values.rbac).enabled .Values.rbac.roles }} {{- range .Values.rbac.roles }} +--- apiVersion: rbac.authorization.k8s.io/v1 kind: RoleBinding metadata: @@ -26,6 +27,5 @@ subjects: name: {{ template "application.name" $ }} {{- end }} namespace: {{ $.Release.Namespace }} ---- {{- end }} {{- end }} diff --git a/application/templates/route.yaml b/application/templates/route.yaml index 123efd8c..396a3db1 100644 --- a/application/templates/route.yaml +++ b/application/templates/route.yaml @@ -1,4 +1,5 @@ {{- if and (.Values.route).enabled (.Capabilities.APIVersions.Has "route.openshift.io/v1") -}} +--- apiVersion: route.openshift.io/v1 kind: Route metadata: @@ -44,4 +45,4 @@ spec: name: {{ .Values.route.alternateBackends.name }} weight: {{ .Values.route.alternateBackends.weight }} {{- end -}} -{{- end -}} \ No newline at end of file +{{- end -}} diff --git a/application/templates/sealedsecrets.yaml b/application/templates/sealedsecrets.yaml index 002d1cb2..64c2979b 100644 --- a/application/templates/sealedsecrets.yaml +++ b/application/templates/sealedsecrets.yaml @@ -1,5 +1,6 @@ {{- if and (.Values.sealedSecret) (.Capabilities.APIVersions.Has "bitnami.com/v1alpha1") }} {{- range $nameSuffix, $config := .Values.sealedSecret.files }} +--- apiVersion: bitnami.com/v1alpha1 kind: SealedSecret metadata: @@ -56,6 +57,5 @@ spec: {{ toYaml $.Values.sealedSecret.additionalLabels | indent 2 }} {{- end }} {{- end }} ---- {{- end }} -{{- end }} \ No newline at end of file +{{- end }} diff --git a/application/templates/secret.yaml b/application/templates/secret.yaml index 5e5d2791..08636ae3 100644 --- a/application/templates/secret.yaml +++ b/application/templates/secret.yaml @@ -1,5 +1,6 @@ {{- if (.Values.secret).enabled }} {{- range $nameSuffix, $data := .Values.secret.files }} +--- apiVersion: v1 kind: Secret metadata: @@ -18,6 +19,5 @@ data: {{- range $key, $value := .data }} {{ $key }}: {{ $value | b64enc }} {{- end }} ---- {{- end }} -{{- end }} \ No newline at end of file +{{- end }} diff --git a/application/templates/secretproviderclass.yaml b/application/templates/secretproviderclass.yaml index 0a3a06e2..a70486d9 100644 --- a/application/templates/secretproviderclass.yaml +++ b/application/templates/secretproviderclass.yaml @@ -1,4 +1,5 @@ {{- if and (.Values.secretProviderClass).enabled (.Capabilities.APIVersions.Has "secrets-store.csi.x-k8s.io/v1alpha1") }} +--- apiVersion: secrets-store.csi.x-k8s.io/v1alpha1 kind: SecretProviderClass metadata: @@ -25,4 +26,4 @@ spec: type: {{ $value.type }} {{- end }} {{- end }} -{{- end }} \ No newline at end of file +{{- end }} diff --git a/application/templates/service.yaml b/application/templates/service.yaml index 5a7c17d1..49b3493f 100644 --- a/application/templates/service.yaml +++ b/application/templates/service.yaml @@ -1,4 +1,5 @@ {{- if (.Values.service).enabled }} +--- apiVersion: v1 kind: Service metadata: diff --git a/application/templates/serviceaccount.yaml b/application/templates/serviceaccount.yaml index ed8430b7..deebd2b3 100644 --- a/application/templates/serviceaccount.yaml +++ b/application/templates/serviceaccount.yaml @@ -1,12 +1,5 @@ -{{- define "application.sa.oauth-redirectreference" }} -apiVersion: v1 -kind: OAuthRedirectReference -reference: - kind: Route - name: {{ include "application.name" . }} -{{- end }} - {{- if and .Values.rbac.enabled .Values.rbac.serviceAccount.enabled }} +--- apiVersion: v1 kind: ServiceAccount metadata: @@ -17,12 +10,10 @@ metadata: {{- with .Values.rbac.serviceAccount.additionalLabels }} {{- toYaml . | nindent 4 }} {{- end }} - annotations: {{- with .Values.rbac.serviceAccount.annotations }} {{- toYaml . | nindent 4 }} {{- end }} - {{- if .Values.deployment.openshiftOAuthProxy.enabled }} serviceaccounts.openshift.io/oauth-redirectreference.primary: {{- $reference := include "application.sa.oauth-redirectreference" . | fromYaml }} diff --git a/application/templates/servicemonitor.yaml b/application/templates/servicemonitor.yaml index ae4b8ef5..293a56a1 100644 --- a/application/templates/servicemonitor.yaml +++ b/application/templates/servicemonitor.yaml @@ -1,4 +1,5 @@ {{- if and (.Values.serviceMonitor).enabled (.Capabilities.APIVersions.Has "monitoring.coreos.com/v1") }} +--- apiVersion: "monitoring.coreos.com/v1" kind: ServiceMonitor metadata: diff --git a/application/templates/vpa.yaml b/application/templates/vpa.yaml index 36fc32f4..cd65fce0 100644 --- a/application/templates/vpa.yaml +++ b/application/templates/vpa.yaml @@ -2,6 +2,7 @@ {{- if not (.Capabilities.APIVersions.Has "autoscaling.k8s.io/v1/VerticalPodAutoscaler") }} {{- fail "There is no VerticalPodAutoscaler resource definition in the target cluster!" }} {{- end }} +--- apiVersion: "autoscaling.k8s.io/v1" kind: VerticalPodAutoscaler metadata: