Skip to content

Commit 02dd57b

Browse files
authored
devsecops update (#98)
* removing helm chart for spring-petclinic app * using kustomize for the spring-petclinic app * Updated values-development to update spring-petclinic application * updated cosign app * updated spring app to use overlay path * updated typo apiversion * updating volumeMount.name * updating volumeMount.name * Updated cosign app with fixed key generate command and working on rbac * adding signing-secrets to rbac * fixing template and removing resourceNames * updating script * adding serversideapply sync-option to cm * make test
1 parent aac50ce commit 02dd57b

27 files changed

Lines changed: 284 additions & 110 deletions
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
apiVersion: v1
2+
kind: ConfigMap
3+
metadata:
4+
name: create-cosign-pubkey
5+
namespace: openshift-pipelines
6+
data:
7+
cosign.sh: |
8+
#!/bin/bash
9+
# check for signing-secrets in openshift-pipelines
10+
SECRET=$(oc get secret signing-secrets -n openshift-pipelines)
11+
if [[ $? -ne 0 ]]
12+
then
13+
export COSIGN_PASSWORD=$(openssl rand -base64 32)
14+
cosign generate-key-pair k8s://openshift-pipelines/signing-secrets --output-file /tmp/cosign.pub
15+
oc create secret generic cosign-pubkey --from-file=/tmp/cosign.pub
16+
else
17+
echo "the signing-secrets secret exists in openshift-pipelines"
18+
fi

charts/region/cosign/templates/cosign_pubkey-job.yaml

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,19 @@ spec:
1414
- /bin/bash
1515
- -c
1616
- |
17-
export COSIGN_PASSWORD=$(openssl rand -base64 32)
18-
cosign key-generate k8s://openshift-pipelines/signing-secrets
19-
oc create secret generic cosign-pubkey --from-file=cosign.pub
17+
'/tmp/cosign.sh'
2018
name: create-cosign-pubkey
19+
volumeMounts:
20+
- mountPath: /tmp/cosign.sh
21+
name: cosign
22+
subPath: cosign.sh
23+
volumes:
24+
- name: cosign
25+
configMap:
26+
name: create-cosign-pubkey
27+
defaultMode: 0755
2128
dnsPolicy: ClusterFirst
2229
restartPolicy: Never
23-
serviceAccount: pipeline
24-
serviceAccountName: pipeline
25-
terminationGracePeriodSeconds: 60
30+
serviceAccount: cosign-sa
31+
serviceAccountName: cosign-sa
32+
terminationGracePeriodSeconds: 60

charts/region/cosign/templates/rbac/role.yaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,15 @@ rules:
2222
resources:
2323
{{- range $value.resources }}
2424
- {{ . }}
25+
{{- end }}
26+
{{- if $value.resourceNames }}
27+
resourceNames:
28+
{{- range $value.resourceNames }}
29+
- {{ . }}
30+
{{- end }}
2531
{{- end }}
2632
verbs:
2733
{{- range $value.verbs }}
2834
- {{ . }}
2935
{{- end }}
30-
{{- end }}
36+
{{- end }}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
apiVersion: v1
2+
kind: ServiceAccount
3+
metadata:
4+
name: cosign-sa
5+
namespace: openshift-pipelines
6+
annotations: {}

charts/region/cosign/values.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,15 @@ rbac:
3131
- "patch"
3232
- "create"
3333
- "update"
34+
- "delete"
3435
roleBindings:
3536
- name: cosign-mgmt
3637
scope:
3738
cluster: false
3839
namespace: openshift-pipelines
3940
subjects:
4041
kind: ServiceAccount
41-
name: pipelines
42+
name: cosign-sa
4243
namespace: openshift-pipelines
4344
apiGroup: '""'
4445
roleRef:

charts/region/pipelines/templates/chains/tekton-chains-configmap.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@ metadata:
55
namespace: openshift-pipelines
66
annotations:
77
argocd.argoproj.io/sync-options: PruneLast=true
8+
argocd.argoproj.io/sync-options: ServerSideApply=true
89
data:
910
artifacts.oci.storage: 'oci'
1011
artifacts.taskrun.format: tekton
1112
artifacts.taskrun.storage: tekton
1213
artifacts.oci.format: simplesigning
13-
artifacts.oci.signer: cosign
14+
artifacts.oci.signer: cosign

charts/region/spring-petclinic-config/.helmignore

Lines changed: 0 additions & 23 deletions
This file was deleted.

charts/region/spring-petclinic-config/Chart.yaml

Lines changed: 0 additions & 24 deletions
This file was deleted.

charts/region/spring-petclinic-config/values.yaml

Lines changed: 0 additions & 10 deletions
This file was deleted.

charts/region/spring-petclinic-config/templates/app/deployment.yaml renamed to charts/region/spring-petclinic/app/deployment.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ spec:
2323
containers:
2424
- name: spring-petclinic
2525
imagePullPolicy: Always
26-
image: quay-registry-quay-quay-enterprise.{{ .Values.global.localClusterDomain }}/{{ .Values.quay.org.name }}/{{ .Values.quay.repo }}:latest
26+
image: quay.io/hybridcloudpatterns/spring-petclinic:latest
2727
livenessProbe:
2828
failureThreshold: 3
2929
httpGet:

0 commit comments

Comments
 (0)