Skip to content

Commit 7b4e6af

Browse files
committed
feat: Support configuring OCI Pull Secret
1 parent 6026db9 commit 7b4e6af

File tree

7 files changed

+20
-52
lines changed

7 files changed

+20
-52
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.3.0
21+
version: 0.4.0
2222
secrets:
2323
pull-request-token: ${{ secrets.GH_ORG_PAT }}

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ The Workspace Provisioner package can be customized via a `values.yml` file.
8282
- name: qa
8383
- name: staging
8484

85-
oci_registry:
86-
secret:
85+
oci:
86+
pull_secret:
8787
name: supply-chain-registry-credentials
8888
namespace: kadras-system
8989
```
@@ -108,8 +108,8 @@ The Workspace Provisioner package has the following configurable properties.
108108
|-------|-------------------|-------------|
109109
| `namespaces` | `[]` | Configuration for the namespaces the platform will provision and manage. |
110110
| `service_account` | `supply-chain` | The `ServiceAccount` to be configured with credentials and roles in each workspace. |
111-
| `oci_registry.secret.name` | `""` | The name of the Secret holding the credentials to access the OCI registry. |
112-
| `oci_registry.secret.namespace` | `""` | The namespace of the Secret holding the credentials to access the OCI registry. |
111+
| `oci.pull_secret.name` | `""` | The name of the Secret holding the credentials to pull images from the OCI registry. |
112+
| `oci.pull_secret.namespace` | `""` | The namespace of the Secret holding the credentials to pull images from the OCI registry. |
113113
| `cosign.secret.name` | `""` | The name of the Secret holding the Cosign key pair. |
114114
| `cosign.secret.namespace` | `""` | The namespace of the Secret holding the Cosign key pair. |
115115
| `git.server` | `https://github.com` | The Git server hosting the Git repositories used by the platform. |

package/config/setup-namespaces.yml

Lines changed: 5 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
#@ image_pull_secret_name = "canonical-registry-credentials"
44

5-
#@ def is_oci_registry_secret_available():
6-
#@ return data.values.oci_registry.secret.name != "" and data.values.oci_registry.secret.namespace != ""
5+
#@ def is_oci_pull_secret_available():
6+
#@ return data.values.oci.pull_secret.name != "" and data.values.oci.pull_secret.namespace != ""
77
#@ end
88

99
#@ def is_cosign_secret_available():
@@ -16,16 +16,15 @@
1616

1717
#! SECRET EXPORTS
1818

19-
#@ if/end is_oci_registry_secret_available():
19+
#@ if/end is_oci_pull_secret_available():
2020
---
2121
apiVersion: secretgen.carvel.dev/v1alpha1
2222
kind: SecretExport
2323
metadata:
24-
name: #@ data.values.oci_registry.secret.name
25-
namespace: #@ data.values.oci_registry.secret.namespace
24+
name: #@ data.values.oci.pull_secret.name
25+
namespace: #@ data.values.oci.pull_secret.namespace
2626
spec:
2727
toNamespaces:
28-
- kpack #! Used by kpack to publish Buildpacks artifacts.
2928
#@ for namespace in data.values.namespaces:
3029
- #@ namespace.name
3130
#@ end
@@ -83,20 +82,6 @@ type: kubernetes.io/dockerconfigjson
8382
data:
8483
.dockerconfigjson: e30K
8584

86-
#! OCI Registry
87-
88-
#@ if/end is_oci_registry_secret_available():
89-
---
90-
apiVersion: secretgen.carvel.dev/v1alpha1
91-
kind: SecretImport
92-
metadata:
93-
name: #@ data.values.oci_registry.secret.name
94-
namespace: #@ namespace.name
95-
annotations:
96-
kapp.k14s.io/create-strategy: fallback-on-update
97-
spec:
98-
fromNamespace: #@ data.values.oci_registry.secret.namespace
99-
10085
#! Cosign
10186

10287
#@ if/end is_cosign_secret_available():
@@ -137,16 +122,12 @@ metadata:
137122
annotations:
138123
kapp.k14s.io/create-strategy: fallback-on-update
139124
secrets:
140-
#@ if/end is_oci_registry_secret_available():
141-
- name: #@ data.values.oci_registry.secret.name
142125
#@ if/end is_cosign_secret_available():
143126
- name: #@ data.values.cosign.secret.name
144127
#@ if/end is_git_secret_available():
145128
- name: #@ data.values.git.secret.name
146129
imagePullSecrets:
147130
- name: #@ image_pull_secret_name
148-
#@ if/end is_oci_registry_secret_available():
149-
- name: #@ data.values.oci_registry.secret.name
150131

151132
---
152133
apiVersion: rbac.authorization.k8s.io/v1

package/config/values-schema.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@ namespaces:
99
#@schema/desc "The `ServiceAccount` to be configured with credentials and roles in each workspace."
1010
service_account: supply-chain
1111

12-
#@schema/desc "Settings for the OCI registry that the workspace will use."
13-
oci_registry:
14-
#@schema/desc "Configuration for the Secret holding the credentials to access the OCI registry."
15-
secret:
16-
#@schema/desc "The name of the Secret holding the credentials to access the OCI registry."
12+
#@schema/desc "Settings for accessing the OCI registry that the workspace will use."
13+
oci:
14+
#@schema/desc "Configuration for the Secret holding the credentials to pull images from the OCI registry."
15+
pull_secret:
16+
#@schema/desc "The name of the Secret holding the credentials to pull images from the OCI registry."
1717
name: ""
18-
#@schema/desc "The namespace of the Secret holding the credentials to access the OCI registry."
18+
#@schema/desc "The namespace of the Secret holding the credentials to pull images from the OCI registry."
1919
namespace: ""
2020

2121
#@schema/desc "Settings for Cosign, used for signing and verifying OCI artifacts."

test/integration/default/01-assert.yaml

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,6 @@ metadata:
1919
kapp.k14s.io/create-strategy: fallback-on-update
2020
type: kubernetes.io/dockerconfigjson
2121

22-
#! OCI Registry
23-
24-
---
25-
apiVersion: v1
26-
kind: Secret
27-
metadata:
28-
name: supply-chain-registry-credentials
29-
namespace: test-default
30-
annotations:
31-
kapp.k14s.io/create-strategy: fallback-on-update
32-
3322
#! Cosign
3423

3524
---
@@ -63,12 +52,10 @@ metadata:
6352
annotations:
6453
kapp.k14s.io/create-strategy: fallback-on-update
6554
secrets:
66-
- name: supply-chain-registry-credentials
6755
- name: supply-chain-cosign-key-pair
6856
- name: supply-chain-git-credentials
6957
imagePullSecrets:
7058
- name: canonical-registry-credentials
71-
- name: supply-chain-registry-credentials
7259

7360
---
7461
apiVersion: rbac.authorization.k8s.io/v1

test/integration/default/config/values.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ stringData:
99
namespaces:
1010
- name: test-default
1111
12-
oci_registry:
13-
secret:
12+
oci:
13+
pull_secret:
1414
name: supply-chain-registry-credentials
1515
namespace: kadras-system
1616

test/unit/config/values.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ namespaces:
44
- name: quo
55
- name: qua
66

7-
oci_registry:
8-
secret:
7+
oci:
8+
pull_secret:
99
name: supply-chain-registry-credentials
1010
namespace: kadras-system
1111

0 commit comments

Comments
 (0)