Skip to content

Commit

Permalink
Merge branch 'main' into getDependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
anirudhprasad-sap committed Sep 26, 2024
2 parents d4745d6 + ca9669f commit 156575b
Show file tree
Hide file tree
Showing 15 changed files with 200 additions and 117 deletions.
3 changes: 2 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@ You are welcome to contribute code in order to fix a bug or to implement a new f

The following rule governs code contributions:

* Contributions must be licensed under the [Apache 2.0 License](./LICENSE)
* Contributions must be licensed under the [Apache 2.0 License](./LICENSE).
* Due to legal reasons, contributors will be asked to accept a Developer Certificate of Origin (DCO) when they create the first pull request to this project. This happens in an automated fashion during the submission process. SAP uses [the standard DCO text of the Linux Foundation](https://developercertificate.org/).
* Contributions must follow our [guidelines on AI-generated code](https://github.com/SAP/.github/blob/main/CONTRIBUTING_USING_GENAI.md) in case you are using such tools.

## Issues and Planning

Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build the manager binary
FROM golang:1.23.0 as builder
FROM golang:1.23.1 as builder
ARG TARGETOS
ARG TARGETARCH
ENV CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH}
Expand Down
10 changes: 8 additions & 2 deletions chart/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# cap-operator

![Version: 0.8.0](https://img.shields.io/badge/Version-0.8.0-informational?style=flat-square) ![AppVersion: 0.8.0](https://img.shields.io/badge/AppVersion-0.8.0-informational?style=flat-square)
![Version: 0.10.0](https://img.shields.io/badge/Version-0.10.0-informational?style=flat-square) ![AppVersion: 0.10.0](https://img.shields.io/badge/AppVersion-0.10.0-informational?style=flat-square)

Helm chart to deploy CAP Operator https://sap.github.io/cap-operator/

Expand Down 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 |

2 changes: 1 addition & 1 deletion chart/crds/sme.sap.com_capapplications.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.16.1
controller-gen.kubebuilder.io/version: v0.16.2
name: capapplications.sme.sap.com
spec:
group: sme.sap.com
Expand Down
53 changes: 52 additions & 1 deletion chart/crds/sme.sap.com_capapplicationversions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.16.1
controller-gen.kubebuilder.io/version: v0.16.2
name: capapplicationversions.sme.sap.com
spec:
group: sme.sap.com
Expand Down 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
2 changes: 1 addition & 1 deletion chart/crds/sme.sap.com_captenantoperations.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.16.1
controller-gen.kubebuilder.io/version: v0.16.2
name: captenantoperations.sme.sap.com
spec:
group: sme.sap.com
Expand Down
2 changes: 1 addition & 1 deletion chart/crds/sme.sap.com_captenantoutputs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.16.1
controller-gen.kubebuilder.io/version: v0.16.2
name: captenantoutputs.sme.sap.com
spec:
group: sme.sap.com
Expand Down
2 changes: 1 addition & 1 deletion chart/crds/sme.sap.com_captenants.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.16.1
controller-gen.kubebuilder.io/version: v0.16.2
name: captenants.sme.sap.com
spec:
group: sme.sap.com
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
1 change: 1 addition & 0 deletions chart/templates/webhook-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ webhooks:
- capapplications
- captenants
- capapplicationversions
- captenantoutputs
sideEffects: NoneOnDryRun
timeoutSeconds: 15 # https://github.com/gardener/gardener/pull/6090
failurePolicy: Fail
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
43 changes: 22 additions & 21 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
module github.com/sap/cap-operator-lifecycle

go 1.23.0
go 1.23.1

require (
github.com/pkg/errors v0.9.1
github.com/sap/component-operator-runtime v0.3.33
k8s.io/api v0.31.0
k8s.io/apiextensions-apiserver v0.31.0
k8s.io/apimachinery v0.31.0
k8s.io/client-go v0.31.0
k8s.io/kube-aggregator v0.31.0
github.com/sap/component-operator-runtime v0.3.38
k8s.io/api v0.31.1
k8s.io/apiextensions-apiserver v0.31.1
k8s.io/apimachinery v0.31.1
k8s.io/client-go v0.31.1
k8s.io/kube-aggregator v0.31.1
sigs.k8s.io/controller-runtime v0.19.0
)

require (
dario.cat/mergo v1.0.1 // indirect
github.com/Masterminds/goutils v1.1.1 // indirect
github.com/Masterminds/semver/v3 v3.2.1 // indirect
github.com/Masterminds/sprig/v3 v3.2.3 // indirect
github.com/Masterminds/semver/v3 v3.3.0 // indirect
github.com/Masterminds/sprig/v3 v3.3.0 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
Expand Down Expand Up @@ -50,24 +51,24 @@ require (
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/prometheus/client_golang v1.20.0 // indirect
github.com/prometheus/client_golang v1.20.4 // indirect
github.com/prometheus/client_model v0.6.1 // indirect
github.com/prometheus/common v0.55.0 // indirect
github.com/prometheus/common v0.59.1 // indirect
github.com/prometheus/procfs v0.15.1 // indirect
github.com/sap/go-generics v0.2.17 // indirect
github.com/sap/go-generics v0.2.19 // indirect
github.com/shopspring/decimal v1.4.0 // indirect
github.com/spf13/cast v1.7.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/x448/float16 v0.8.4 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.27.0 // indirect
golang.org/x/crypto v0.26.0 // indirect
golang.org/x/exp v0.0.0-20240808152545-0cdaa3abc0fa // indirect
golang.org/x/net v0.28.0 // indirect
golang.org/x/oauth2 v0.22.0 // indirect
golang.org/x/sys v0.24.0 // indirect
golang.org/x/term v0.23.0 // indirect
golang.org/x/text v0.17.0 // indirect
golang.org/x/crypto v0.27.0 // indirect
golang.org/x/exp v0.0.0-20240909161429-701f63a606c0 // indirect
golang.org/x/net v0.29.0 // indirect
golang.org/x/oauth2 v0.23.0 // indirect
golang.org/x/sys v0.25.0 // indirect
golang.org/x/term v0.24.0 // indirect
golang.org/x/text v0.18.0 // indirect
golang.org/x/time v0.6.0 // indirect
gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect
google.golang.org/protobuf v1.34.2 // indirect
Expand All @@ -76,8 +77,8 @@ require (
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/klog/v2 v2.130.1 // indirect
k8s.io/kube-openapi v0.0.0-20240812233141-91dab695df6f // indirect
k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 // indirect
k8s.io/kube-openapi v0.0.0-20240903163716-9e1beecbcb38 // indirect
k8s.io/utils v0.0.0-20240902221715-702e33fdd3c3 // indirect
sigs.k8s.io/cli-utils v0.37.2 // indirect
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect
Expand Down
Loading

0 comments on commit 156575b

Please sign in to comment.