Skip to content

Commit cb44b95

Browse files
Roming22openshift-cherrypick-robot
authored andcommitted
fix: default TektonConfig causing trouble
Despite the subscription configuration, the default TektonConfig is instanciated, causing the deployment to fail. So we change the configuration so that it is created, and then patched during the deployment. cf RHTAP-5228
1 parent 0ff8ccc commit cb44b95

File tree

8 files changed

+58
-181
lines changed

8 files changed

+58
-181
lines changed

installer/charts/tssc-infrastructure/templates/openshift-pipelines/tektonconfig/default._tpl

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

installer/charts/tssc-infrastructure/templates/openshift-pipelines/tektonconfig/tektonconfig.yaml

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

installer/charts/tssc-pipelines/templates/service-account.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,5 @@
22
{{- include "common.serviceAccount" . }}
33
---
44
{{- include "common.clusterRoleBindingClusterAdmin" . }}
5+
---
6+
{{- include "pipelines.TektonConfigRbac" . }}

installer/charts/tssc-infrastructure/templates/openshift-pipelines/tektonconfig/patch._tpl renamed to installer/charts/tssc-pipelines/templates/tektonconfig/patch._tpl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
{{- define "pipelines.TektonConfigPatch" -}}
2+
metadata:
3+
annotations:
4+
meta.helm.sh/release-name: {{ .Chart.Name }}
5+
meta.helm.sh/release-namespace: {{ .Release.Namespace }}
6+
labels:
7+
app.kubernetes.io/managed-by: Helm
28
spec:
39
chain:
410
transparency.enabled: 'true'
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
apiVersion: batch/v1
2+
kind: Job
3+
metadata:
4+
name: patch-tekton-config
5+
namespace: {{ .Release.Namespace }}
6+
annotations:
7+
"helm.sh/hook": post-install
8+
"helm.sh/hook-delete-policy": hook-succeeded
9+
spec:
10+
backoffLimit: 30
11+
template:
12+
spec:
13+
serviceAccountName: {{ .Release.Name }}
14+
restartPolicy: OnFailure
15+
containers:
16+
- name: patch-tekton-config
17+
image: quay.io/openshift/origin-cli:latest
18+
resources:
19+
ephemeral-storage: 100Mi
20+
limits:
21+
memory: 128Mi
22+
requests:
23+
memory: 100Mi
24+
cpu: 0.1
25+
command:
26+
- /bin/bash
27+
- -c
28+
- |
29+
if [[ "{{ .Values.subscriptions.openshiftPipelines.managed }}" != "true" ]]; then
30+
echo "Skipping TektonConfig resource as pipeline subscription is not managed"
31+
echo "Success"
32+
exit 0
33+
fi
34+
35+
if ! oc get tektonconfig config >/dev/null; then
36+
echo "Waiting for the default TektonConfig to be instanciated"
37+
sleep 10
38+
exit 1
39+
fi
40+
41+
echo "Patching the TektonConfig resource"
42+
oc patch tektonconfig config --type=merge -p '{{ fromYaml (include "pipelines.TektonConfigPatch" .) | toJson }}'
43+
echo "Success"

installer/charts/tssc-subscriptions/templates/openshift-pipelines/post-install-hook-rbac.yaml renamed to installer/charts/tssc-pipelines/templates/tektonconfig/tektonconfig-rbac.yaml

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,25 @@
1-
apiVersion: v1
2-
kind: ServiceAccount
3-
metadata:
4-
name: delete-tekton-config-sa
5-
namespace: {{ .Release.Namespace }}
6-
labels: {{- include "common.postDeployDeleteLabels" . | nindent 4 }}
7-
---
1+
{{- define "pipelines.TektonConfigRbac" -}}
82
apiVersion: rbac.authorization.k8s.io/v1
93
kind: ClusterRole
104
metadata:
11-
name: delete-tekton-config-role
5+
name: patch-tekton-config-role
126
labels: {{- include "common.postDeployDeleteLabels" . | nindent 4 }}
137
rules:
148
- apiGroups: ["operator.tekton.dev"]
159
resources: ["tektonconfigs"]
16-
verbs: ["get", "delete"]
10+
verbs: ["get", "patch"]
1711
---
1812
apiVersion: rbac.authorization.k8s.io/v1
1913
kind: ClusterRoleBinding
2014
metadata:
21-
name: delete-tekton-config-rolebinding
15+
name: patch-tekton-config-rolebinding
2216
labels: {{- include "common.postDeployDeleteLabels" . | nindent 4 }}
2317
subjects:
2418
- kind: ServiceAccount
25-
name: delete-tekton-config-sa
19+
name: patch-tekton-config-sa
2620
namespace: {{ .Release.Namespace }}
2721
roleRef:
2822
kind: ClusterRole
29-
name: delete-tekton-config-role
23+
name: patch-tekton-config-role
3024
apiGroup: rbac.authorization.k8s.io
25+
{{- end -}}

installer/charts/tssc-subscriptions/templates/openshift-pipelines/delete_tekton_config.yaml

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

installer/charts/tssc-subscriptions/values.yaml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,6 @@ subscriptions:
4040
channel: pipelines-1.18
4141
source: redhat-operators
4242
sourceNamespace: openshift-marketplace
43-
config:
44-
env:
45-
- name: AUTOINSTALL_COMPONENTS
46-
value: "false"
4743
openshiftTrustedArtifactSigner:
4844
enabled: false
4945
description: Red Hat Trusted Artifact Signer Operator

0 commit comments

Comments
 (0)