Skip to content

Commit 02f6e7b

Browse files
Merge pull request #1266 from ehearne-redhat/ensure-cvo-use-bespoke-service-account
OCPBUGS-65621: add dedicated service account to crb, cvo and version pod
2 parents 7cc84ff + 90fd303 commit 02f6e7b

9 files changed

Lines changed: 35 additions & 2 deletions
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
apiVersion: v1
2+
kind: ServiceAccount
3+
metadata:
4+
name: cluster-version-operator
5+
namespace: openshift-cluster-version
6+
annotations:
7+
kubernetes.io/description: Dedicated Service Account for the Cluster Version Operator.
8+
include.release.openshift.io/self-managed-high-availability: "true"
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
apiVersion: v1
2+
kind: ServiceAccount
3+
metadata:
4+
name: update-payload
5+
namespace: openshift-cluster-version
6+
annotations:
7+
kubernetes.io/description: Dedicated Service Account for the Update Payload.
8+
include.release.openshift.io/self-managed-high-availability: "true"
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
apiVersion: rbac.authorization.k8s.io/v1
2+
kind: ClusterRoleBinding
3+
metadata:
4+
name: cluster-version-operator-1
5+
annotations:
6+
include.release.openshift.io/self-managed-high-availability: "true"
7+
subjects:
8+
- kind: ServiceAccount
9+
name: cluster-version-operator
10+
namespace: openshift-cluster-version
11+
roleRef:
12+
kind: ClusterRole
13+
name: cluster-admin
14+
apiGroup: rbac.authorization.k8s.io

install/0000_00_cluster-version-operator_02_roles.yaml renamed to install/0000_00_cluster-version-operator_03_roles-default.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ kind: ClusterRoleBinding
33
metadata:
44
name: cluster-version-operator
55
annotations:
6-
kubernetes.io/description: Grant the cluster-version operator permission to perform cluster-admin actions while managing the OpenShift core.
76
include.release.openshift.io/self-managed-high-availability: "true"
87
roleRef:
98
kind: ClusterRole
109
name: cluster-admin
10+
apiGroup: rbac.authorization.k8s.io
1111
subjects:
1212
- kind: ServiceAccount
1313
namespace: openshift-cluster-version

install/0000_00_cluster-version-operator_03_deployment.yaml renamed to install/0000_00_cluster-version-operator_30_deployment.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ spec:
2323
k8s-app: cluster-version-operator
2424
spec:
2525
automountServiceAccountToken: false
26+
serviceAccountName: cluster-version-operator
2627
containers:
2728
- name: cluster-version-operator
2829
image: '{{.ReleaseImage}}'

install/0000_00_cluster-version-operator_04_service.yaml renamed to install/0000_00_cluster-version-operator_40_service.yaml

File renamed without changes.

pkg/cvo/updatepayload.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,7 @@ func (r *payloadRetriever) fetchUpdatePayloadToDir(ctx context.Context, dir stri
233233
},
234234
},
235235
Spec: corev1.PodSpec{
236+
ServiceAccountName: "update-payload",
236237
ActiveDeadlineSeconds: deadline,
237238
InitContainers: []corev1.Container{
238239
setContainerDefaults(corev1.Container{

pkg/payload/render_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ func TestRenderManifest(t *testing.T) {
2929
ReleaseImage: "quay.io/cvo/release:latest",
3030
ClusterProfile: "some-profile",
3131
},
32-
manifestFile: "../../install/0000_00_cluster-version-operator_03_deployment.yaml",
32+
manifestFile: "../../install/0000_00_cluster-version-operator_30_deployment.yaml",
3333
expectedManifestFile: "./testdata/TestRenderManifest_expected_cvo_deployment.yaml",
3434
},
3535
}

pkg/payload/testdata/TestRenderManifest_expected_cvo_deployment.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ spec:
2323
k8s-app: cluster-version-operator
2424
spec:
2525
automountServiceAccountToken: false
26+
serviceAccountName: cluster-version-operator
2627
containers:
2728
- name: cluster-version-operator
2829
image: 'quay.io/cvo/release:latest'

0 commit comments

Comments
 (0)