Skip to content

Commit

Permalink
[FEAT] chart enhancements for version monitoring (#83)
Browse files Browse the repository at this point in the history
* [FEAT] chart enhancements for version monitoring

* [BUILD] publish artefacts

* Revert "[BUILD] publish artefacts"

This reverts commit 0e267bf.

* configurable volumes and mounts for controller and subscription server

* adjust helm-docs
  • Loading branch information
skrishnan-sap authored Sep 25, 2024
1 parent f48e81c commit 65812ac
Show file tree
Hide file tree
Showing 6 changed files with 118 additions and 9 deletions.
8 changes: 7 additions & 1 deletion chart/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,12 @@ Helm chart to deploy CAP Operator https://sap.github.io/cap-operator/
| controller.resources.limits.cpu | float | `0.2` | CPU limit |
| controller.resources.requests.memory | string | `"50Mi"` | Memory request |
| controller.resources.requests.cpu | float | `0.02` | CPU request |
| controller.volumes | list | `[]` | Optionally specify list of additional volumes for the controller pod(s) |
| controller.volumeMounts | list | `[]` | Optionally specify list of additional volumeMounts for the controller container(s) |
| controller.dnsTarget | string | `""` | The dns target mentioned on the public ingress gateway service used in the cluster |
| controller.versionMonitoring.prometheusAddress | string | `""` | The URL of the Prometheus server from which metrics related to managed application versions can be queried |
| controller.versionMonitoring.metricsEvaluationInterval | string | `"1h"` | The duration (example 2h) after which versions are evaluated for deletion; based on specified workload metrics |
| controller.versionMonitoring.promClientAcquireRetryDelay | string | `"1h"` | The duration (example 10m) to wait before retrying to acquire Prometheus client and verify connection, after a failed attempt |
| subscriptionServer.replicas | int | `1` | Replicas |
| subscriptionServer.image.repository | string | `"ghcr.io/sap/cap-operator/server"` | Image repository |
| subscriptionServer.image.tag | string | `""` | Image tag |
Expand All @@ -50,6 +55,8 @@ Helm chart to deploy CAP Operator https://sap.github.io/cap-operator/
| subscriptionServer.resources.limits.cpu | float | `0.1` | CPU limit |
| subscriptionServer.resources.requests.memory | string | `"20Mi"` | Memory request |
| subscriptionServer.resources.requests.cpu | float | `0.01` | CPU request |
| subscriptionServer.volumes | list | `[]` | Optionally specify list of additional volumes for the server pod(s) |
| subscriptionServer.volumeMounts | list | `[]` | Optionally specify list of additional volumeMounts for the server container(s) |
| subscriptionServer.port | int | `4000` | Service port |
| subscriptionServer.istioSystemNamespace | string | `"istio-system"` | The namespace in the cluster where istio system components are installed |
| subscriptionServer.ingressGatewayLabels | object | `{"app":"istio-ingressgateway","istio":"ingressgateway"}` | Labels used to identify the istio ingress-gateway component |
Expand All @@ -76,4 +83,3 @@ Helm chart to deploy CAP Operator https://sap.github.io/cap-operator/
| webhook.service.type | string | `"ClusterIP"` | Service type |
| webhook.service.port | int | `443` | Service port |
| webhook.service.targetPort | int | `1443` | Target port |

51 changes: 51 additions & 0 deletions chart/crds/sme.sap.com_capapplicationversions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1375,6 +1375,57 @@ spec:
format: int32
type: integer
type: object
monitoring:
properties:
deletionRules:
oneOf:
- required:
- metrics
- required:
- expression
properties:
expression:
type: string
metrics:
items:
properties:
calculationPeriod:
pattern: ^(0|(([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?)$
type: string
name:
type: string
thresholdValue:
format: double
type: string
type:
enum:
- Gauge
- Counter
type: string
required:
- calculationPeriod
- name
- thresholdValue
- type
type: object
type: array
type: object
scrapeConfig:
properties:
interval:
pattern: ^(0|(([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?)$
type: string
path:
type: string
port:
type: string
scrapeTimeout:
pattern: ^(0|(([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?)$
type: string
required:
- port
type: object
type: object
nodeName:
type: string
nodeSelector:
Expand Down
36 changes: 29 additions & 7 deletions chart/templates/controller-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ spec:
topologySpreadConstraints:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.controller.volumes }}
volumes:
{{- toYaml . | nindent 8 }}
{{- end }}
containers:
- name: controller
image: {{ .Values.controller.image.repository }}:{{ .Values.controller.image.tag | default .Values.image.tag | default .Chart.AppVersion }}
Expand All @@ -58,12 +62,30 @@ spec:
resources:
{{- toYaml .Values.controller.resources | nindent 12 }}
env:
- name: CERT_MANAGER
value: {{ .Capabilities.APIVersions.Has "cert.gardener.cloud/v1alpha1" | ternary "gardener" "cert-manager.io" }}
- name: DNS_MANAGER
value: {{ .Capabilities.APIVersions.Has "dns.gardener.cloud/v1alpha1" | ternary "gardener" "kubernetes" }}
{{- if .Values.controller.dnsTarget }}
- name: DNS_TARGET
value: {{ .Values.controller.dnsTarget }}
- name: CERT_MANAGER
value: {{ .Capabilities.APIVersions.Has "cert.gardener.cloud/v1alpha1" | ternary "gardener" "cert-manager.io" }}
- name: DNS_MANAGER
value: {{ .Capabilities.APIVersions.Has "dns.gardener.cloud/v1alpha1" | ternary "gardener" "kubernetes" }}
{{- if .Values.controller.dnsTarget }}
- name: DNS_TARGET
value: {{ .Values.controller.dnsTarget }}
{{- end }}
{{- with .Values.controller.versionMonitoring }}
{{- if .prometheusAddress }}
- name: PROMETHEUS_ADDRESS
value: {{ .prometheusAddress }}
{{- end }}
{{- if .metricsEvaluationInterval }}
- name: METRICS_EVAL_INTERVAL
value: {{ .metricsEvaluationInterval }}
{{- end }}
{{- if .promClientAcquireRetryDelay }}
- name: PROM_ACQUIRE_CLIENT_RETRY_DELAY
value: {{ .promClientAcquireRetryDelay }}
{{- end }}
{{- end }}
{{- with .Values.controller.volumeMounts }}
volumeMounts:
{{- toYaml . | nindent 12 }}
{{- end }}
serviceAccountName: {{.Release.Name}}-controller
6 changes: 6 additions & 0 deletions chart/templates/controller-rbac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,12 @@ rules:
- apiGroups: ["coordination.k8s.io"]
resources: ["leases"]
verbs: ["get", "list", "watch", "create", "update", "patch", "delete"]
- apiGroups: ["monitoring.coreos.com"]
resources: ["servicemonitors"]
verbs: ["get", "list", "watch", "create", "update", "patch", "delete"]
- apiGroups: ["apiextensions.k8s.io"]
resources: ["customresourcedefinitions"]
verbs: ["get"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
Expand Down
8 changes: 8 additions & 0 deletions chart/templates/server-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ spec:
topologySpreadConstraints:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.subscriptionServer.volumes }}
volumes:
{{- toYaml . | nindent 8 }}
{{- end }}
containers:
- name: server
image: {{ .Values.subscriptionServer.image.repository }}:{{ .Values.subscriptionServer.image.tag | default .Values.image.tag | default .Chart.AppVersion }}
Expand All @@ -58,6 +62,10 @@ spec:
{{- end }}
resources:
{{- toYaml .Values.subscriptionServer.resources | nindent 12 }}
{{- with .Values.subscriptionServer.volumeMounts }}
volumeMounts:
{{- toYaml . | nindent 12 }}
{{- end }}
ports:
- name: server-port
containerPort: 4000
Expand Down
18 changes: 17 additions & 1 deletion chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,20 @@ controller:
memory: 50Mi
# -- CPU request
cpu: 0.02
# -- Optionally specify list of additional volumes for the controller pod(s)
volumes: []
# -- Optionally specify list of additional volumeMounts for the controller container(s)
volumeMounts: []
# -- The dns target mentioned on the public ingress gateway service used in the cluster
dnsTarget: ""

versionMonitoring:
# -- The URL of the Prometheus server from which metrics related to managed application versions can be queried
prometheusAddress: ""
# -- The duration (example 2h) after which versions are evaluated for deletion; based on specified workload metrics
metricsEvaluationInterval: "1h"
# -- The duration (example 10m) to wait before retrying to acquire Prometheus client and verify connection, after a failed attempt
promClientAcquireRetryDelay: "1h"

subscriptionServer:
# -- Replicas
replicas: 1
Expand Down Expand Up @@ -95,6 +106,10 @@ subscriptionServer:
memory: 20Mi
# -- CPU request
cpu: 0.01
# -- Optionally specify list of additional volumes for the server pod(s)
volumes: []
# -- Optionally specify list of additional volumeMounts for the server container(s)
volumeMounts: []
# -- Service port
port: 4000
# -- The namespace in the cluster where istio system components are installed
Expand All @@ -107,6 +122,7 @@ subscriptionServer:
dnsTarget: public-ingress.clusters.cs.services.sap # replace with the actual cluster domain
# -- The domain under which the cap operator subscription server would be available
domain: cap-operator.clusters.cs.services.sap # replace with actual cluster domain

webhook:
# -- Side car to mount admission review
sidecar: false
Expand Down

0 comments on commit 65812ac

Please sign in to comment.