Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions files/chart/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -3207,6 +3207,9 @@
},
"version": {
"type": "string"
},
"enableCleanupMonitoring": {
"type": "boolean"
}
},
"required": [
Expand Down
2 changes: 2 additions & 0 deletions files/chart/values.yaml.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ app:
istioIngressGatewayLabels:
istio: ingressgateway
app: istio-ingressgateway
# -- Enable cleanup monitoring for CAPApplication versions
enableCleanupMonitoring: true

btp:
# -- BTP Provider sub-account identifier where the application is hosted
Expand Down
3 changes: 3 additions & 0 deletions files/configurableTemplatesChart/values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,9 @@
},
"version": {
"type": "string"
},
"enableCleanupMonitoring": {
"type": "boolean"
}
},
"required": [
Expand Down
2 changes: 2 additions & 0 deletions files/configurableTemplatesChart/values.yaml.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ app:
istioIngressGatewayLabels:
istio: ingressgateway
app: istio-ingressgateway
# -- Enable cleanup monitoring for CAPApplication versions
enableCleanupMonitoring: true

btp:
# -- BTP Provider sub-account identifier where the application is hosted
Expand Down
1 change: 1 addition & 0 deletions hack/schema-generation.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ type app struct {
Domains Domains `json:"domains"`
IstioIngressGatewayLabels map[string]string `json:"istioIngressGatewayLabels"`
Version string `json:"version,omitempty"`
EnableCleanupMonitoring bool `json:"enableCleanupMonitoring,omitempty"`
}

type serviceInstanceExt struct {
Expand Down
51 changes: 29 additions & 22 deletions lib/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,9 +251,14 @@
'sme.sap.com/vs-route-request-header-set: |',
' {',
' "x-forwarded-client-cert": "%DOWNSTREAM_PEER_CERT%"',
' }'
' }',
'sme.sap.com/enable-cleanup-monitoring: "{{ .Values.app.enableCleanupMonitoring }}"'
])
})
} else {
yaml.block(['annotations:'], () => {
yaml.push('sme.sap.com/enable-cleanup-monitoring: "{{ .Values.app.enableCleanupMonitoring }}"')
})
}
})

Expand Down Expand Up @@ -457,6 +462,7 @@
yaml.push([
'type: TenantOperation',
'image: {{ .Values.workloads.tenantJob.image }}',
`ttlSecondsAfterFinished: 300`,
'{{- if .Values.hanaInstanceId }}',
'env:',
'- name: CDS_CONFIG',
Expand All @@ -480,7 +486,8 @@
yaml.block(['jobDefinition:'], () => {
yaml.push([
'type: Content',
'image: {{ .Values.workloads.contentDeploy.image }}'
'image: {{ .Values.workloads.contentDeploy.image }}',
'ttlSecondsAfterFinished: 300'
])
})
})
Expand All @@ -497,14 +504,25 @@
yaml.block(['jobDefinition:'], () => {
yaml.push([
'type: Content',
'image: {{ .Values.workloads.amsDeployer.image }}'
'image: {{ .Values.workloads.amsDeployer.image }}',
'ttlSecondsAfterFinished: 300'
])
})
})
}

yaml.dec() // unindent workloads

// -- Content Jobs ---
if (hasAms) {
yaml.block([' contentJobs:'], () => {
yaml.push([
'- content-deploy',
'- ams-deployer'
])
})
}

// --- Service Exposure ---
if (isService) {
yaml.block([' serviceExposures:'], () => {
Expand All @@ -519,16 +537,6 @@
})
}

// -- Content Jobs ---
if (hasAms) {
yaml.block([' contentJobs:'], () => {
yaml.push([
'- content-deploy',
'- ams-deployer'
])
})
}

return yaml.toString()
}

Expand Down Expand Up @@ -580,7 +588,8 @@
' {{- end }}',
'\n',
' {{- if $v.jobDefinition }}',
' jobDefinition: {{- toYaml $v.jobDefinition | trim | nindent 6 }}',
' {{- $jobDef := merge $v.jobDefinition (dict "ttlSecondsAfterFinished" 300) }}',
' jobDefinition: {{- toYaml $jobDef | trim | nindent 6 }}',
' {{- end }}',
'{{- end }}'
])
Expand All @@ -603,14 +612,12 @@
])

// --- Service Exposure ---
if (isService) {
yaml.push([
'\n',
' {{- if .Values.serviceExposures }}',
' serviceExposures: {{- toYaml .Values.serviceExposures | trim | nindent 4 }}',
' {{- end }}'
])
}
yaml.push([

Check warning on line 615 in lib/util.js

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Do not call `Array#push()` multiple times.

See more on https://sonarcloud.io/project/issues?id=cap-js_cap-operator-plugin&issues=AZ3ACmqghFkLk-eZyOUs&open=AZ3ACmqghFkLk-eZyOUs&pullRequest=97
'\n',
' {{- if .Values.serviceExposures }}',
' serviceExposures: {{- toYaml .Values.serviceExposures | trim | nindent 4 }}',
' {{- end }}'
])

return yaml.toString()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ metadata:
{
"x-forwarded-client-cert": "%DOWNSTREAM_PEER_CERT%"
}
sme.sap.com/enable-cleanup-monitoring: "{{ .Values.app.enableCleanupMonitoring }}"
spec:
domainRefs:
- kind: Domain
Expand Down Expand Up @@ -92,7 +93,8 @@ spec:
{{- end }}

{{- if $v.jobDefinition }}
jobDefinition: {{- toYaml $v.jobDefinition | trim | nindent 6 }}
{{- $jobDef := merge $v.jobDefinition (dict "ttlSecondsAfterFinished" 300) }}
jobDefinition: {{- toYaml $jobDef | trim | nindent 6 }}
{{- end }}
{{- end }}

Expand All @@ -103,3 +105,7 @@ spec:
{{- if .Values.contentJobs }}
contentJobs: {{- toYaml .Values.contentJobs | trim | nindent 4 }}
{{- end }}

{{- if .Values.serviceExposures }}
serviceExposures: {{- toYaml .Values.serviceExposures | trim | nindent 4 }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ metadata:
{
"x-forwarded-client-cert": "%DOWNSTREAM_PEER_CERT%"
}
sme.sap.com/enable-cleanup-monitoring: "{{ .Values.app.enableCleanupMonitoring }}"
spec:
domainRefs:
- kind: Domain
Expand Down Expand Up @@ -89,7 +90,8 @@ spec:
{{- end }}

{{- if $v.jobDefinition }}
jobDefinition: {{- toYaml $v.jobDefinition | trim | nindent 6 }}
{{- $jobDef := merge $v.jobDefinition (dict "ttlSecondsAfterFinished" 300) }}
jobDefinition: {{- toYaml $jobDef | trim | nindent 6 }}
{{- end }}
{{- end }}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ apiVersion: sme.sap.com/v1alpha1
kind: CAPApplication
metadata:
name: {{ include "appName" $ }}
annotations:
sme.sap.com/enable-cleanup-monitoring: "{{ .Values.app.enableCleanupMonitoring }}"
spec:
domainRefs:
- kind: Domain
Expand Down Expand Up @@ -84,7 +86,8 @@ spec:
{{- end }}

{{- if $v.jobDefinition }}
jobDefinition: {{- toYaml $v.jobDefinition | trim | nindent 6 }}
{{- $jobDef := merge $v.jobDefinition (dict "ttlSecondsAfterFinished" 300) }}
jobDefinition: {{- toYaml $jobDef | trim | nindent 6 }}
{{- end }}
{{- end }}

Expand Down
9 changes: 8 additions & 1 deletion test/files/expectedChart/templates/cap-operator-cros.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ apiVersion: sme.sap.com/v1alpha1
kind: CAPApplication
metadata:
name: {{ include "appName" $ }}
annotations:
sme.sap.com/enable-cleanup-monitoring: "{{ .Values.app.enableCleanupMonitoring }}"
spec:
domainRefs:
- kind: Domain
Expand Down Expand Up @@ -87,7 +89,8 @@ spec:
{{- end }}

{{- if $v.jobDefinition }}
jobDefinition: {{- toYaml $v.jobDefinition | trim | nindent 6 }}
{{- $jobDef := merge $v.jobDefinition (dict "ttlSecondsAfterFinished" 300) }}
jobDefinition: {{- toYaml $jobDef | trim | nindent 6 }}
{{- end }}
{{- end }}

Expand All @@ -98,3 +101,7 @@ spec:
{{- if .Values.contentJobs }}
contentJobs: {{- toYaml .Values.contentJobs | trim | nindent 4 }}
{{- end }}

{{- if .Values.serviceExposures }}
serviceExposures: {{- toYaml .Values.serviceExposures | trim | nindent 4 }}
{{- end }}
1 change: 1 addition & 0 deletions test/files/expectedChart/values-ias.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ app:
istioIngressGatewayLabels:
istio: ingressgateway
app: istio-ingressgateway
enableCleanupMonitoring: true
btp:
providerSubaccountId: null
provider:
Expand Down
1 change: 1 addition & 0 deletions test/files/expectedChart/values-svc-ias.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ app:
istioIngressGatewayLabels:
istio: ingressgateway
app: istio-ingressgateway
enableCleanupMonitoring: true
btp:
providerSubaccountId: null
imagePullSecrets: []
Expand Down
1 change: 1 addition & 0 deletions test/files/expectedChart/values-svc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ app:
istioIngressGatewayLabels:
istio: ingressgateway
app: istio-ingressgateway
enableCleanupMonitoring: true
btp:
providerSubaccountId: null
imagePullSecrets: []
Expand Down
1 change: 1 addition & 0 deletions test/files/expectedChart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ app:
istioIngressGatewayLabels:
istio: ingressgateway
app: istio-ingressgateway
enableCleanupMonitoring: true
btp:
providerSubaccountId: null
provider:
Expand Down
1 change: 1 addition & 0 deletions test/files/expectedChart/valuesWithDestination.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ app:
istioIngressGatewayLabels:
istio: ingressgateway
app: istio-ingressgateway
enableCleanupMonitoring: true
btp:
providerSubaccountId: null
provider:
Expand Down
1 change: 1 addition & 0 deletions test/files/expectedChart/valuesWithMTA.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ app:
istioIngressGatewayLabels:
istio: ingressgateway
app: istio-ingressgateway
enableCleanupMonitoring: true
btp:
providerSubaccountId: null
provider:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ metadata:
{
"x-forwarded-client-cert": "%DOWNSTREAM_PEER_CERT%"
}
sme.sap.com/enable-cleanup-monitoring: "{{ .Values.app.enableCleanupMonitoring }}"
spec:
domainRefs:
- kind: Domain
Expand Down Expand Up @@ -104,6 +105,7 @@ spec:
jobDefinition:
type: TenantOperation
image: {{ .Values.workloads.tenantJob.image }}
ttlSecondsAfterFinished: 300
{{- if .Values.hanaInstanceId }}
env:
- name: CDS_CONFIG
Expand All @@ -118,6 +120,7 @@ spec:
jobDefinition:
type: Content
image: {{ .Values.workloads.contentDeploy.image }}
ttlSecondsAfterFinished: 300
- name: ams-deployer
labels:
sme.sap.com/app-type: {{ include "appName" $ }}
Expand All @@ -126,6 +129,7 @@ spec:
jobDefinition:
type: Content
image: {{ .Values.workloads.amsDeployer.image }}
ttlSecondsAfterFinished: 300
contentJobs:
- content-deploy
- ams-deployer
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ apiVersion: sme.sap.com/v1alpha1
kind: CAPApplication
metadata:
name: {{ include "appName" $ }}
annotations:
sme.sap.com/enable-cleanup-monitoring: "{{ .Values.app.enableCleanupMonitoring }}"
spec:
domainRefs:
- kind: Domain
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ apiVersion: sme.sap.com/v1alpha1
kind: CAPApplication
metadata:
name: {{ include "appName" $ }}
annotations:
sme.sap.com/enable-cleanup-monitoring: "{{ .Values.app.enableCleanupMonitoring }}"
spec:
domainRefs:
- kind: Domain
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ apiVersion: sme.sap.com/v1alpha1
kind: CAPApplication
metadata:
name: {{ include "appName" $ }}
annotations:
sme.sap.com/enable-cleanup-monitoring: "{{ .Values.app.enableCleanupMonitoring }}"
spec:
domainRefs:
- kind: Domain
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ metadata:
{
"x-forwarded-client-cert": "%DOWNSTREAM_PEER_CERT%"
}
sme.sap.com/enable-cleanup-monitoring: "{{ .Values.app.enableCleanupMonitoring }}"
spec:
domainRefs:
- kind: Domain
Expand Down Expand Up @@ -85,6 +86,7 @@ spec:
jobDefinition:
type: Content
image: {{ .Values.workloads.contentDeploy.image }}
ttlSecondsAfterFinished: 300
- name: ams-deployer
labels:
sme.sap.com/app-type: {{ include "appName" $ }}
Expand All @@ -93,11 +95,12 @@ spec:
jobDefinition:
type: Content
image: {{ .Values.workloads.amsDeployer.image }}
ttlSecondsAfterFinished: 300
contentJobs:
- content-deploy
- ams-deployer
serviceExposures:
- subDomain: {{ include "appName" $ }}
routes:
- workloadName: server
port: 4004
contentJobs:
- content-deploy
- ams-deployer
Loading
Loading