Skip to content

Commit 09fe37a

Browse files
authored
Consolidate RBAC for supply chains (#9)
* Consolidate RBAC for supply chains * Update tests * Consolidate RBAC for GitOps
1 parent f930838 commit 09fe37a

File tree

8 files changed

+66
-21
lines changed

8 files changed

+66
-21
lines changed

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,6 @@ jobs:
1818
registry-server: ghcr.io
1919
registry-username: ${{ github.actor }}
2020
image: ${{ github.repository }}
21-
version: 0.2.1
21+
version: 0.3.0
2222
secrets:
2323
pull-request-token: ${{ secrets.GH_ORG_PAT }}

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
name: Integration Tests
1515
strategy:
1616
matrix:
17-
k8s_version: [v1.25, v1.26, v1.27]
17+
k8s_version: [v1.26, v1.27, v1.28]
1818
permissions:
1919
contents: read
2020
uses: kadras-io/github-reusable-workflows/.github/workflows/carvel-package-test-integration.yml@main

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
K8S_VERSION=v1.27
1+
K8S_VERSION=v1.28
22

33
# Build package configuration
44
build: package

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ A Carvel package for provisioning and configuring workspaces (namespaces or virt
1212

1313
### Prerequisites
1414

15-
* Kubernetes 1.25+
15+
* Kubernetes 1.26+
1616
* Carvel [`kctrl`](https://carvel.dev/kapp-controller/docs/latest/install/#installing-kapp-controller-cli-kctrl) CLI.
1717
* Carvel [kapp-controller](https://carvel.dev/kapp-controller) deployed in your Kubernetes cluster. You can install it with Carvel [`kapp`](https://carvel.dev/kapp/docs/latest/install) (recommended choice) or `kubectl`.
1818

@@ -107,7 +107,7 @@ The Workspace Provisioner package has the following configurable properties.
107107
| Config | Default | Description |
108108
|-------|-------------------|-------------|
109109
| `namespaces` | `[]` | Configuration for the namespaces the platform will provision and manage. |
110-
| `service_account` | `default` | The `ServiceAccount` to be configured with credentials and roles in each workspace. |
110+
| `service_account` | `supply-chain` | The `ServiceAccount` to be configured with credentials and roles in each workspace. |
111111
| `oci_registry.secret.name` | `""` | The name of the Secret holding the credentials to access the OCI registry. |
112112
| `oci_registry.secret.namespace` | `""` | The namespace of the Secret holding the credentials to access the OCI registry. |
113113
| `cosign.secret.name` | `""` | The name of the Secret holding the Cosign key pair. |

package/config/setup-namespaces.yml

Lines changed: 28 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ metadata:
126126
spec:
127127
fromNamespace: #@ data.values.git.secret.namespace
128128

129-
#! RBAC
129+
#! Supply Chains RBAC
130130

131131
---
132132
apiVersion: v1
@@ -152,14 +152,14 @@ imagePullSecrets:
152152
apiVersion: rbac.authorization.k8s.io/v1
153153
kind: RoleBinding
154154
metadata:
155-
name: default-workload
155+
name: supply-chain-workload
156156
namespace: #@ namespace.name
157157
annotations:
158158
kapp.k14s.io/create-strategy: fallback-on-update
159159
roleRef:
160160
apiGroup: rbac.authorization.k8s.io
161161
kind: ClusterRole
162-
name: workload
162+
name: supply-chain-workload
163163
subjects:
164164
- kind: ServiceAccount
165165
name: #@ data.values.service_account
@@ -168,16 +168,39 @@ subjects:
168168
apiVersion: rbac.authorization.k8s.io/v1
169169
kind: RoleBinding
170170
metadata:
171-
name: default-deliverable
171+
name: supply-chain-deliverable
172172
namespace: #@ namespace.name
173173
annotations:
174174
kapp.k14s.io/create-strategy: fallback-on-update
175175
roleRef:
176176
apiGroup: rbac.authorization.k8s.io
177177
kind: ClusterRole
178-
name: deliverable
178+
name: supply-chain-deliverable
179179
subjects:
180180
- kind: ServiceAccount
181181
name: #@ data.values.service_account
182182

183+
#! GitOps RBAC
184+
185+
---
186+
apiVersion: v1
187+
kind: ServiceAccount
188+
metadata:
189+
name: gitops-reconciler
190+
namespace: #@ namespace.name
191+
192+
---
193+
apiVersion: rbac.authorization.k8s.io/v1
194+
kind: RoleBinding
195+
metadata:
196+
name: gitops-reconciler
197+
namespace: #@ namespace.name
198+
roleRef:
199+
apiGroup: rbac.authorization.k8s.io
200+
kind: ClusterRole
201+
name: cluster-admin
202+
subjects:
203+
- kind: ServiceAccount
204+
name: gitops-reconciler
205+
183206
#@ end

package/config/values-schema.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ namespaces:
77
- name: ""
88

99
#@schema/desc "The `ServiceAccount` to be configured with credentials and roles in each workspace."
10-
service_account: default
10+
service_account: supply-chain
1111

1212
#@schema/desc "Settings for the OCI registry that the workspace will use."
1313
oci_registry:

test/integration/default/01-assert.yaml

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,12 @@ metadata:
5353
tekton.dev/git-0: https://github.com
5454
kapp.k14s.io/create-strategy: fallback-on-update
5555

56-
#! RBAC
56+
#! Supply Chains RBAC
5757
---
5858
apiVersion: v1
5959
kind: ServiceAccount
6060
metadata:
61-
name: default
61+
name: supply-chain
6262
namespace: test-default
6363
annotations:
6464
kapp.k14s.io/create-strategy: fallback-on-update
@@ -74,30 +74,52 @@ imagePullSecrets:
7474
apiVersion: rbac.authorization.k8s.io/v1
7575
kind: RoleBinding
7676
metadata:
77-
name: default-workload
77+
name: supply-chain-workload
7878
namespace: test-default
7979
annotations:
8080
kapp.k14s.io/create-strategy: fallback-on-update
8181
roleRef:
8282
apiGroup: rbac.authorization.k8s.io
8383
kind: ClusterRole
84-
name: workload
84+
name: supply-chain-workload
8585
subjects:
8686
- kind: ServiceAccount
87-
name: default
87+
name: supply-chain
8888

8989
---
9090
apiVersion: rbac.authorization.k8s.io/v1
9191
kind: RoleBinding
9292
metadata:
93-
name: default-deliverable
93+
name: supply-chain-deliverable
9494
namespace: test-default
9595
annotations:
9696
kapp.k14s.io/create-strategy: fallback-on-update
9797
roleRef:
9898
apiGroup: rbac.authorization.k8s.io
9999
kind: ClusterRole
100-
name: deliverable
100+
name: supply-chain-deliverable
101101
subjects:
102102
- kind: ServiceAccount
103-
name: default
103+
name: supply-chain
104+
105+
#! GitOps RBAC
106+
---
107+
apiVersion: v1
108+
kind: ServiceAccount
109+
metadata:
110+
name: gitops-reconciler
111+
namespace: test-default
112+
113+
---
114+
apiVersion: rbac.authorization.k8s.io/v1
115+
kind: RoleBinding
116+
metadata:
117+
name: gitops-reconciler
118+
namespace: test-default
119+
roleRef:
120+
apiGroup: rbac.authorization.k8s.io
121+
kind: ClusterRole
122+
name: cluster-admin
123+
subjects:
124+
- kind: ServiceAccount
125+
name: gitops-reconciler

test/setup/kind/v1.25/kind-config.yml renamed to test/setup/kind/v1.28/kind-config.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ kind: Cluster
33
apiVersion: kind.x-k8s.io/v1alpha4
44
nodes:
55
- role: control-plane
6-
image: kindest/node:v1.25.11
6+
image: kindest/node:v1.28.0
77
- role: worker
8-
image: kindest/node:v1.25.11
8+
image: kindest/node:v1.28.0

0 commit comments

Comments
 (0)