Skip to content

Commit

Permalink
Merge pull request #271 from stakater/fix/multiple-cronjob
Browse files Browse the repository at this point in the history
fix: allow multiple cronjobs
  • Loading branch information
rasheedamir authored Sep 26, 2023
2 parents ef85f85 + d4cea32 commit d58de36
Show file tree
Hide file tree
Showing 27 changed files with 51 additions and 36 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
8 changes: 8 additions & 0 deletions application/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
1 change: 1 addition & 0 deletions application/templates/alertmanagerconfig.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{{- if and (.Values.alertmanagerConfig).enabled (.Capabilities.APIVersions.Has "monitoring.coreos.com/v1alpha1") -}}
---
apiVersion: monitoring.coreos.com/v1alpha1
kind: AlertmanagerConfig
metadata:
Expand Down
3 changes: 2 additions & 1 deletion application/templates/certificate.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{{- if and (.Values.certificate).enabled (.Capabilities.APIVersions.Has "cert-manager.io/v1") }}
---
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
Expand Down Expand Up @@ -76,4 +77,4 @@ spec:
name: {{ include "application.tplvalues.render" ( dict "value" .Values.certificate.keystores.pkcs12.name "context" $ ) }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
4 changes: 2 additions & 2 deletions application/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{{- if (.Values.configMap).enabled }}
{{- range $nameSuffix, $data := .Values.configMap.files }}
---
apiVersion: v1
kind: ConfigMap
metadata:
Expand All @@ -16,6 +17,5 @@ metadata:
{{- end }}
data:
{{ include "application.tplvalues.render" ( dict "value" $data "context" $ ) | indent 2 }}
---
{{- end }}
{{- end }}
{{- end }}
1 change: 1 addition & 0 deletions application/templates/cronjob.yaml
Original file line number Diff line number Diff line change
@@ -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 -}}
Expand Down
1 change: 1 addition & 0 deletions application/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{{- if .Values.deployment.enabled }}
---
apiVersion: apps/v1
kind: Deployment
metadata:
Expand Down
3 changes: 2 additions & 1 deletion application/templates/endpointmonitor.yaml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down Expand Up @@ -27,4 +28,4 @@ spec:
{{- if .Values.endpointMonitor.additionalConfig }}
{{ toYaml .Values.endpointMonitor.additionalConfig | indent 2 }}
{{- end }}
{{- end }}
{{- end }}
6 changes: 3 additions & 3 deletions application/templates/externalsecrets.yaml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down Expand Up @@ -48,6 +49,5 @@ spec:
{{ toYaml $data.labels | indent 10 }}
{{- end }}
{{- end }}
---
{{- end}}
{{- end}}
{{- end }}
{{- end }}
3 changes: 2 additions & 1 deletion application/templates/forecastle.yaml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down Expand Up @@ -26,4 +27,4 @@ spec:
properties:
{{ toYaml .Values.forecastle.properties | indent 4 }}
{{- end }}
{{- end -}}
{{- end -}}
4 changes: 2 additions & 2 deletions application/templates/grafanadashboard.yaml
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -24,6 +25,5 @@ spec:
{{- if $content.url }}
url: {{ $content.url }}
{{- end }}
---
{{- end }}
{{- end }}
{{- end }}
3 changes: 1 addition & 2 deletions application/templates/hpa.yaml
Original file line number Diff line number Diff line change
@@ -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" . }}
Expand Down
1 change: 1 addition & 0 deletions application/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{{- if (.Values.ingress).enabled -}}
---
{{- $servicePort := .Values.ingress.servicePort -}}
{{- $pathType := .Values.ingress.pathType -}}
{{- $applicationNameTpl := include "application.name" . -}}
Expand Down
3 changes: 2 additions & 1 deletion application/templates/networkpolicy.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{{- if (.Values.networkPolicy).enabled }}
---
apiVersion: "networking.k8s.io/v1"
kind: NetworkPolicy
metadata:
Expand Down Expand Up @@ -37,4 +38,4 @@ spec:
ingress:
{{ toYaml .Values.networkPolicy.ingress | indent 4 }}
{{- end }}
{{- end }}
{{- end }}
3 changes: 1 addition & 2 deletions application/templates/pdb.yaml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
3 changes: 2 additions & 1 deletion application/templates/prometheusrule.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{{- if and (.Values.prometheusRule).enabled (.Capabilities.APIVersions.Has "monitoring.coreos.com/v1") -}}
---
apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
metadata:
Expand All @@ -12,4 +13,4 @@ metadata:
spec:
groups:
{{ toYaml .Values.prometheusRule.groups | indent 4 }}
{{- end -}}
{{- end -}}
3 changes: 2 additions & 1 deletion application/templates/pvc.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{{- if and (.Values.persistence).enabled (not .Values.persistence.existingClaim) }}
---
kind: PersistentVolumeClaim
apiVersion: v1
metadata:
Expand Down Expand Up @@ -36,4 +37,4 @@ spec:
{{- if .Values.persistence.volumeName }}
volumeName: "{{ .Values.persistence.volumeName }}"
{{- end }}
{{- end }}
{{- end }}
4 changes: 2 additions & 2 deletions application/templates/role.yaml
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -16,6 +17,5 @@ metadata:
{{- end }}
rules:
{{ toYaml .rules | indent 2 }}
---
{{- end }}
{{- end }}
{{- end }}
2 changes: 1 addition & 1 deletion application/templates/rolebinding.yaml
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -26,6 +27,5 @@ subjects:
name: {{ template "application.name" $ }}
{{- end }}
namespace: {{ $.Release.Namespace }}
---
{{- end }}
{{- end }}
3 changes: 2 additions & 1 deletion application/templates/route.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{{- if and (.Values.route).enabled (.Capabilities.APIVersions.Has "route.openshift.io/v1") -}}
---
apiVersion: route.openshift.io/v1
kind: Route
metadata:
Expand Down Expand Up @@ -44,4 +45,4 @@ spec:
name: {{ .Values.route.alternateBackends.name }}
weight: {{ .Values.route.alternateBackends.weight }}
{{- end -}}
{{- end -}}
{{- end -}}
4 changes: 2 additions & 2 deletions application/templates/sealedsecrets.yaml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down Expand Up @@ -56,6 +57,5 @@ spec:
{{ toYaml $.Values.sealedSecret.additionalLabels | indent 2 }}
{{- end }}
{{- end }}
---
{{- end }}
{{- end }}
{{- end }}
4 changes: 2 additions & 2 deletions application/templates/secret.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{{- if (.Values.secret).enabled }}
{{- range $nameSuffix, $data := .Values.secret.files }}
---
apiVersion: v1
kind: Secret
metadata:
Expand All @@ -18,6 +19,5 @@ data:
{{- range $key, $value := .data }}
{{ $key }}: {{ $value | b64enc }}
{{- end }}
---
{{- end }}
{{- end }}
{{- end }}
3 changes: 2 additions & 1 deletion application/templates/secretproviderclass.yaml
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -25,4 +26,4 @@ spec:
type: {{ $value.type }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
1 change: 1 addition & 0 deletions application/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{{- if (.Values.service).enabled }}
---
apiVersion: v1
kind: Service
metadata:
Expand Down
11 changes: 1 addition & 10 deletions application/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -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 }}
Expand Down
1 change: 1 addition & 0 deletions application/templates/servicemonitor.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{{- if and (.Values.serviceMonitor).enabled (.Capabilities.APIVersions.Has "monitoring.coreos.com/v1") }}
---
apiVersion: "monitoring.coreos.com/v1"
kind: ServiceMonitor
metadata:
Expand Down
1 change: 1 addition & 0 deletions application/templates/vpa.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit d58de36

Please sign in to comment.