Skip to content

Commit

Permalink
Merge pull request #612 from catenax-ng/fix/trivy_scan_on_charts
Browse files Browse the repository at this point in the history
fix(Charts): Fix trivy scan on chart orchestrator
  • Loading branch information
nicoprow authored Nov 10, 2023
2 parents 78bd4cc + 3994a01 commit 44fcec5
Show file tree
Hide file tree
Showing 16 changed files with 104 additions and 153 deletions.
6 changes: 3 additions & 3 deletions charts/bpdm/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ apiVersion: v2
name: bpdm
type: application
description: A Helm chart for Kubernetes that deploys the BPDM applications
version: 3.1.0
version: 3.1.1
appVersion: "4.1.0"
home: https://github.com/eclipse-tractusx/bpdm
sources:
Expand All @@ -45,11 +45,11 @@ dependencies:
alias: bpdm-bridge-dummy
condition: bpdm-bridge-dummy.enabled
- name: bpdm-cleaning-service-dummy
version: 1.0.0
version: 1.0.1
alias: bpdm-cleaning-service-dummy
condition: bpdm-cleaning-service-dummy.enabled
- name: bpdm-orchestrator
version: 1.0.0
version: 1.0.1
alias: bpdm-orchestrator
condition: bpdm-orchestrator.enabled
- name: opensearch
Expand Down
4 changes: 2 additions & 2 deletions charts/bpdm/charts/bpdm-cleaning-service-dummy/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ apiVersion: v2
type: application
name: bpdm-cleaning-service-dummy
appVersion: "4.1.0"
version: 1.0.0
description: A Helm chart for deploying the BPDM bridge dummy service
version: 1.0.1
description: A Helm chart for deploying the BPDM cleaning service
home: https://eclipse-tractusx.github.io/docs/kits/Business%20Partner%20Kit/Adoption%20View
sources:
- https://github.com/eclipse-tractusx/bpdm
Expand Down
8 changes: 3 additions & 5 deletions charts/bpdm/charts/bpdm-cleaning-service-dummy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ This Helm Chart deploys the BPDM service to a Kubernetes environment.
In an existing Kubernetes cluster the application can be deployed with the following command:

```bash
helm install release_name ./charts/bpdm-bridge-dummy --namespace your_namespace -f /path/to/my_release-values.yaml
helm install release_name ./charts/bpdm-cleanning-service-dummy --namespace your_namespace -f /path/to/my_release-values.yaml
```

This will install a new release of the BPDM Cleaning Service in the given namespace.
Expand Down Expand Up @@ -57,7 +57,7 @@ ingress:
hosts:
- host: business-partners.your-domain.net
paths:
- path: /bridge
- path: /cleaning-service
pathType: Prefix
```
Expand All @@ -73,9 +73,7 @@ effect.
```yaml
applicationConfig:
bpdm:
pool:
base-url: http://remote.domain.net/api/catena
gate:
orchestrator:
base-url: http://remote.domain.net/api/catena
```
-->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,41 +61,23 @@ app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{- define "bpdm-cleaning-service-dummy.poolServiceName" -}}
{{- $config := .Values.applicationConfig -}}
{{- if and $config (not (empty $config.bpdm)) -}}
{{- $bpdm := $config.bpdm -}}
{{- if and $bpdm (not (empty $bpdm.pool)) -}}
{{- $pool := $bpdm.pool -}}
{{- if and $pool (not (empty (index $pool "base-url"))) -}}
{{- index $pool "base-url" -}}
{{- else -}}
{{- print "http://" (printf "%s-bpdm-pool" .Release.Name) ":8080" -}}
{{- end -}}
{{- else -}}
{{- print "http://" (printf "%s-bpdm-pool" .Release.Name) ":8080" -}}
{{- end -}}
{{- else -}}
{{- print "http://" (printf "%s-bpdm-pool" .Release.Name) ":8080" -}}
{{- end -}}
{{- end }}

{{- define "bpdm-cleaning-service-dummy.gateServiceName" -}}
{{- define "bpdm-cleaning-service-dummy.orchestratorServiceName" -}}
{{- $config := .Values.applicationConfig -}}
{{- if and $config (not (empty $config.bpdm)) -}}
{{- $bpdm := $config.bpdm -}}
{{- if and $bpdm (not (empty $bpdm.gate)) -}}
{{- $gate := $bpdm.gate -}}
{{- if and $gate (not (empty (index $gate "base-url"))) -}}
{{- index $gate "base-url" -}}
{{- if and $bpdm (not (empty $bpdm.orchestrator)) -}}
{{- $orchestrator := $bpdm.orchestrator -}}
{{- if and $orchestrator (not (empty (index $orchestrator "base-url"))) -}}
{{- index $orchestrator "base-url" -}}
{{- else -}}
{{- print "http://" (printf "%s-bpdm-gate" .Release.Name) ":8080" -}}
{{- print "http://" (printf "%s-bpdm-orchestrator" .Release.Name) ":8080" -}}
{{- end -}}
{{- else -}}
{{- print "http://" (printf "%s-bpdm-gate" .Release.Name) ":8080" -}}
{{- print "http://" (printf "%s-bpdm-orchestrator" .Release.Name) ":8080" -}}
{{- end -}}
{{- else -}}
{{- print "http://" (printf "%s-bpdm-gate" .Release.Name) ":8080" -}}
{{- print "http://" (printf "%s-bpdm-orchestrator" .Release.Name) ":8080" -}}
{{- end -}}
{{- end }}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,14 @@ kind: ConfigMap
metadata:
name: {{include "bpdm.fullname" .}}
labels:
{{- include "bpdm.labels" . | nindent 4}}
{{- include "bpdm.labels" . | nindent 4 }}
data:
deployment.yml: |-
# Place for putting standard deployment configuration
# which can be overwritten by external.yml
bpdm:
orchestrator:
base-url: {{include "bpdm-cleaning-service-dummy.orchestratorServiceName" .}}
external.yml: |-
# External properties for overwriting application config
{{- if .Values.applicationConfig }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,16 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{include "bpdm.fullname" .}}
name: {{ include "bpdm.fullname" . }}
labels:
{{- include "bpdm.labels" . | nindent 4}}
{{- include "bpdm.labels" . | nindent 4 }}
spec:
{{- if not .Values.autoscaling.enabled}}
replicas: {{.Values.replicaCount}}
{{- end}}
{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.replicaCount }}
{{- end }}
selector:
matchLabels:
{{- include "bpdm.selectorLabels" . | nindent 6}}
{{- include "bpdm.selectorLabels" . | nindent 6 }}
template:
metadata:
annotations:
Expand All @@ -40,23 +40,23 @@ spec:
labels:
{{- include "bpdm.selectorLabels" . | nindent 8}}
spec:
{{- with .Values.imagePullSecrets}}
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8}}
{{- end}}
{{- toYaml . | nindent 8 }}
{{- end }}
# @url: https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/#use-the-default-service-account-to-access-the-api-server
automountServiceAccountToken: false
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8}}
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: {{.Chart.Name}}
- name: {{ .Chart.Name }}
securityContext:
{{- toYaml .Values.securityContext | nindent 12}}
{{- toYaml .Values.securityContext | nindent 12 }}
image: "{{ .Values.image.registry }}/{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{.Values.image.pullPolicy}}
imagePullPolicy: {{ .Values.image.pullPolicy }}
env:
- name: SPRING_PROFILES_ACTIVE
value: {{.Values.springProfiles | join "," }}
value: {{ .Values.springProfiles | join "," }}
- name: SPRING_CONFIG_IMPORT
value: "/etc/conf/deployment.yml,/etc/conf/external.yml,/etc/conf/secrets.yml"
ports:
Expand All @@ -65,34 +65,34 @@ spec:
protocol: TCP
# @url: https://cloud.google.com/blog/products/containers-kubernetes/kubernetes-best-practices-setting-up-health-checks-with-readiness-and-liveness-probes
livenessProbe:
{{- toYaml .Values.livenessProbe | nindent 12}}
{{- toYaml .Values.livenessProbe | nindent 12 }}
readinessProbe:
{{- toYaml .Values.readinessProbe | nindent 12}}
{{- toYaml .Values.readinessProbe | nindent 12 }}
startupProbe:
{{- toYaml .Values.startupProbe | nindent 12}}
{{- toYaml .Values.startupProbe | nindent 12 }}
resources:
{{- toYaml .Values.resources | nindent 12}}
{{- toYaml .Values.resources | nindent 12 }}
volumeMounts:
- mountPath: /etc/conf
name: config
readOnly: true
{{- with .Values.nodeSelector}}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8}}
{{- end}}
{{- with .Values.affinity}}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8}}
{{- end}}
{{- with .Values.tolerations}}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8}}
{{- end}}
{{- toYaml . | nindent 8 }}
{{- end }}
volumes:
- name: config
projected:
sources:
- configMap:
name: {{include "bpdm.fullname" .}}
name: {{ include "bpdm.fullname" . }}
- secret:
name: {{include "bpdm.fullname" .}}
name: {{ include "bpdm.fullname" . }}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
apiVersion: v1
kind: Secret
metadata:
name: {{include "bpdm.fullname" .}}
name: {{ include "bpdm.fullname" . }}

Check warning on line 23 in charts/bpdm/charts/bpdm-cleaning-service-dummy/templates/secret.yaml

View workflow job for this annotation

GitHub Actions / Analyze

[MEDIUM] Using Unrecommended Namespace

Namespaces like 'default', 'kube-system' or 'kube-public' should not be used

Check warning on line 23 in charts/bpdm/charts/bpdm-cleaning-service-dummy/templates/secret.yaml

View workflow job for this annotation

GitHub Actions / Analyze

[INFO] Using Kubernetes Native Secret Management

Kubernetes External Secret Storage and Management System usage should be considered if you have more complex secret management needs, rather than using Kubernetes Secrets directly. Additionally, ensure that access to secrets is carefully limited

Check warning on line 23 in charts/bpdm/charts/bpdm-cleaning-service-dummy/templates/secret.yaml

View workflow job for this annotation

GitHub Actions / Analyze

[MEDIUM] Using Unrecommended Namespace

Namespaces like 'default', 'kube-system' or 'kube-public' should not be used

Check warning on line 23 in charts/bpdm/charts/bpdm-cleaning-service-dummy/templates/secret.yaml

View workflow job for this annotation

GitHub Actions / Analyze

[INFO] Using Kubernetes Native Secret Management

Kubernetes External Secret Storage and Management System usage should be considered if you have more complex secret management needs, rather than using Kubernetes Secrets directly. Additionally, ensure that access to secrets is carefully limited

Check warning on line 23 in charts/bpdm/charts/bpdm-cleaning-service-dummy/templates/secret.yaml

View workflow job for this annotation

GitHub Actions / Analyze

[MEDIUM] Using Unrecommended Namespace

Namespaces like 'default', 'kube-system' or 'kube-public' should not be used

Check warning on line 23 in charts/bpdm/charts/bpdm-cleaning-service-dummy/templates/secret.yaml

View workflow job for this annotation

GitHub Actions / Analyze

[INFO] Using Kubernetes Native Secret Management

Kubernetes External Secret Storage and Management System usage should be considered if you have more complex secret management needs, rather than using Kubernetes Secrets directly. Additionally, ensure that access to secrets is carefully limited

Check warning on line 23 in charts/bpdm/charts/bpdm-cleaning-service-dummy/templates/secret.yaml

View workflow job for this annotation

GitHub Actions / Analyze

[MEDIUM] Using Unrecommended Namespace

Namespaces like 'default', 'kube-system' or 'kube-public' should not be used

Check warning on line 23 in charts/bpdm/charts/bpdm-cleaning-service-dummy/templates/secret.yaml

View workflow job for this annotation

GitHub Actions / Analyze

[INFO] Using Kubernetes Native Secret Management

Kubernetes External Secret Storage and Management System usage should be considered if you have more complex secret management needs, rather than using Kubernetes Secrets directly. Additionally, ensure that access to secrets is carefully limited

Check warning on line 23 in charts/bpdm/charts/bpdm-cleaning-service-dummy/templates/secret.yaml

View workflow job for this annotation

GitHub Actions / Analyze

[MEDIUM] Using Unrecommended Namespace

Namespaces like 'default', 'kube-system' or 'kube-public' should not be used

Check warning on line 23 in charts/bpdm/charts/bpdm-cleaning-service-dummy/templates/secret.yaml

View workflow job for this annotation

GitHub Actions / Analyze

[INFO] Using Kubernetes Native Secret Management

Kubernetes External Secret Storage and Management System usage should be considered if you have more complex secret management needs, rather than using Kubernetes Secrets directly. Additionally, ensure that access to secrets is carefully limited

Check warning on line 23 in charts/bpdm/charts/bpdm-cleaning-service-dummy/templates/secret.yaml

View workflow job for this annotation

GitHub Actions / Analyze

[MEDIUM] Using Unrecommended Namespace

Namespaces like 'default', 'kube-system' or 'kube-public' should not be used

Check warning on line 23 in charts/bpdm/charts/bpdm-cleaning-service-dummy/templates/secret.yaml

View workflow job for this annotation

GitHub Actions / Analyze

[INFO] Using Kubernetes Native Secret Management

Kubernetes External Secret Storage and Management System usage should be considered if you have more complex secret management needs, rather than using Kubernetes Secrets directly. Additionally, ensure that access to secrets is carefully limited

Check warning on line 23 in charts/bpdm/charts/bpdm-cleaning-service-dummy/templates/secret.yaml

View workflow job for this annotation

GitHub Actions / Analyze

[MEDIUM] Using Unrecommended Namespace

Namespaces like 'default', 'kube-system' or 'kube-public' should not be used

Check warning on line 23 in charts/bpdm/charts/bpdm-cleaning-service-dummy/templates/secret.yaml

View workflow job for this annotation

GitHub Actions / Analyze

[INFO] Using Kubernetes Native Secret Management

Kubernetes External Secret Storage and Management System usage should be considered if you have more complex secret management needs, rather than using Kubernetes Secrets directly. Additionally, ensure that access to secrets is carefully limited

Check warning on line 23 in charts/bpdm/charts/bpdm-cleaning-service-dummy/templates/secret.yaml

View workflow job for this annotation

GitHub Actions / Analyze

[MEDIUM] Using Unrecommended Namespace

Namespaces like 'default', 'kube-system' or 'kube-public' should not be used

Check warning on line 23 in charts/bpdm/charts/bpdm-cleaning-service-dummy/templates/secret.yaml

View workflow job for this annotation

GitHub Actions / Analyze

[INFO] Using Kubernetes Native Secret Management

Kubernetes External Secret Storage and Management System usage should be considered if you have more complex secret management needs, rather than using Kubernetes Secrets directly. Additionally, ensure that access to secrets is carefully limited
type: Opaque
stringData:
secrets.yml: |-
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@
apiVersion: v1
kind: Service
metadata:
name: {{include "bpdm.fullname" .}}
name: {{ include "bpdm.fullname" . }}
labels:
{{- include "bpdm.labels" . | nindent 4}}
{{- include "bpdm.labels" . | nindent 4 }}
spec:
type: {{.Values.service.type}}
type: {{ .Values.service.type }}
ports:
- port: {{.Values.service.port}}
targetPort: {{.Values.service.targetPort}}
- port: {{ .Values.service.port }}
targetPort: {{ .Values.service.targetPort }}
selector:
{{- include "bpdm.selectorLabels" . | nindent 4}}
{{- include "bpdm.selectorLabels" . | nindent 4 }}
4 changes: 3 additions & 1 deletion charts/bpdm/charts/bpdm-cleaning-service-dummy/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ podAnnotations: {}
springProfiles: []

securityContext:
seccompProfile:
type: RuntimeDefault
allowPrivilegeEscalation: false
runAsNonRoot: true
runAsUser: 10001
Expand Down Expand Up @@ -110,7 +112,7 @@ startupProbe:
# Used to overwrite the default property values of the application configuration
applicationConfig:
# bpdm:
# pool:
# orchestrator:
# base-url: ...

# Used to overwrite the secret property values of the application configuration
Expand Down
2 changes: 1 addition & 1 deletion charts/bpdm/charts/bpdm-orchestrator/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ apiVersion: v2
type: application
name: bpdm-orchestrator
appVersion: "4.1.0"
version: 1.0.0
version: 1.0.1
description: A Helm chart for deploying the BPDM Orchestrator service
home: https://eclipse-tractusx.github.io/docs/kits/Business%20Partner%20Kit/Adoption%20View
sources:
Expand Down
36 changes: 0 additions & 36 deletions charts/bpdm/charts/bpdm-orchestrator/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -61,43 +61,7 @@ app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{- define "bpdm-orchestrator.poolServiceName" -}}
{{- $config := .Values.applicationConfig -}}
{{- if and $config (not (empty $config.bpdm)) -}}
{{- $bpdm := $config.bpdm -}}
{{- if and $bpdm (not (empty $bpdm.pool)) -}}
{{- $pool := $bpdm.pool -}}
{{- if and $pool (not (empty (index $pool "base-url"))) -}}
{{- index $pool "base-url" -}}
{{- else -}}
{{- print "http://" (printf "%s-bpdm-pool" .Release.Name) ":8080" -}}
{{- end -}}
{{- else -}}
{{- print "http://" (printf "%s-bpdm-pool" .Release.Name) ":8080" -}}
{{- end -}}
{{- else -}}
{{- print "http://" (printf "%s-bpdm-pool" .Release.Name) ":8080" -}}
{{- end -}}
{{- end }}

{{- define "bpdm-orchestrator.gateServiceName" -}}
{{- $config := .Values.applicationConfig -}}
{{- if and $config (not (empty $config.bpdm)) -}}
{{- $bpdm := $config.bpdm -}}
{{- if and $bpdm (not (empty $bpdm.gate)) -}}
{{- $gate := $bpdm.gate -}}
{{- if and $gate (not (empty (index $gate "base-url"))) -}}
{{- index $gate "base-url" -}}
{{- else -}}
{{- print "http://" (printf "%s-bpdm-gate" .Release.Name) ":8080" -}}
{{- end -}}
{{- else -}}
{{- print "http://" (printf "%s-bpdm-gate" .Release.Name) ":8080" -}}
{{- end -}}
{{- else -}}
{{- print "http://" (printf "%s-bpdm-gate" .Release.Name) ":8080" -}}
{{- end -}}
{{- end }}



Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ kind: ConfigMap
metadata:
name: {{include "bpdm.fullname" .}}
labels:
{{- include "bpdm.labels" . | nindent 4}}
{{- include "bpdm.labels" . | nindent 4 }}
data:
deployment.yml: |-
# Place for putting standard deployment configuration
Expand Down
Loading

0 comments on commit 44fcec5

Please sign in to comment.