Skip to content

Commit 900821a

Browse files
authored
Improve Secrets handling across install profiles (#34)
Fixes gh-22
1 parent 256b6d1 commit 900821a

File tree

5 files changed

+37
-47
lines changed

5 files changed

+37
-47
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -108,14 +108,14 @@ The Engineering Platform package has the following configurable properties.
108108
| `platform.ingress.issuer.type` | `private` | The type of ClusterIssuer the platform will use to enable TLS communications. Options: `private`, `letsencrypt_staging`, `letsencrypt`, `custom`. |
109109
| `platform.ingress.issuer.name` | `""` | A reference to a custom ClusterIssuer previously created on the cluster where the platform will be installed. Required when the type is `custom`. |
110110
| `platform.ingress.issuer.email` | `""` | The email address that Let's Encrypt will use to send info on expiring certificates or other issues. Required when the type is `letsencrypt_staging` or `letsencrypt`. |
111-
| `platform.oci_registry.server` | `""` | The server of the OCI Registry where the platform will publish and consume OCI images. |
112-
| `platform.oci_registry.repository` | `""` | The repository in the OCI Registry where the platform will publish and consume OCI images. |
113-
| `platform.oci_registry.secret.name` | `supply-chain-registry-credentials` | The name of the Secret holding the credentials to access the OCI registry. |
111+
| `platform.oci_registry.server` | `""` | The server of the OCI Registry where the platform will publish OCI images. Example: "ghcr.io". |
112+
| `platform.oci_registry.repository` | `""` | The repository in the OCI Registry where the platform will publish OCI images. Example: "my-org". |
113+
| `platform.oci_registry.secret.name` | `""` | The name of the Secret holding the credentials to access the OCI registry. The credentials should provide read-only access to the OCI registry except when installing the platform with one of these profiles: `full`, `dev`, `build`. |
114114
| `platform.oci_registry.secret.namespace` | `kadras-packages` | The namespace of the Secret holding the credentials to access the OCI registry. |
115-
| `platform.cosign.secret.name` | `supply-chain-cosign-key-pair` | The name of the Secret holding the Cosign key pair. |
115+
| `platform.cosign.secret.name` | `""` | The name of the Secret holding the Cosign key pair. |
116116
| `platform.cosign.secret.namespace` | `kadras-packages` | The namespace of the Secret holding the Cosign key pair. |
117117
| `platform.git.server` | `https://github.com` | The server hosting the Git repositories used by the plaform. |
118-
| `platform.git.secret.name` | `supply-chain-git-credentials` | The name of the Secret holding the credentials to access the Git server. |
118+
| `platform.git.secret.name` | `""` | The name of the Secret holding the credentials to access the Git server. The credentials should provide read-only access to the Git server except when installing the platform with one of these profiles: `full`, `build`. |
119119
| `platform.git.secret.namespace` | `kadras-packages` | The namespace of the Secret holding the credentials to access the Git server. |
120120

121121
Each Kadras package included in the platform can be configured independently.

package/config/cartographer-delivery.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,9 @@
99
#@ values = struct.decode(data.values.cartographer.delivery)
1010
#@
1111
#@ #! Compute values for Git server
12-
#@ if is_any_profile_enabled([profiles.full]):
13-
#@ if data.values.platform.git.server and data.values.platform.git.secret.name and data.values.platform.git.secret.namespace:
14-
#@ if not hasattr(data.values.cartographer.delivery, "git_credentials_secret") or not data.values.cartographer.delivery.git_credentials_secret:
15-
#@ values["git_credentials_secret"] = data.values.platform.git.secret.name
16-
#@ end
12+
#@ if data.values.platform.git.server and data.values.platform.git.secret.name and data.values.platform.git.secret.namespace:
13+
#@ if not hasattr(data.values.cartographer.delivery, "git_credentials_secret") or not data.values.cartographer.delivery.git_credentials_secret:
14+
#@ values["git_credentials_secret"] = data.values.platform.git.secret.name
1715
#@ end
1816
#@ end
1917
#@

package/config/cartographer-supply-chains.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,9 @@
3030
#@ end
3131
#@
3232
#@ #! Compute values for Git server
33-
#@ if is_any_profile_enabled([profiles.full]):
34-
#@ if data.values.platform.git.server and data.values.platform.git.secret.name and data.values.platform.git.secret.namespace:
35-
#@ if not hasattr(data.values.cartographer.supply_chains, "git_credentials_secret") or not data.values.cartographer.supply_chains.git_credentials_secret:
36-
#@ values["git_credentials_secret"] = data.values.platform.git.secret.name
37-
#@ end
33+
#@ if data.values.platform.git.server and data.values.platform.git.secret.name and data.values.platform.git.secret.namespace:
34+
#@ if not hasattr(data.values.cartographer.supply_chains, "git_credentials_secret") or not data.values.cartographer.supply_chains.git_credentials_secret:
35+
#@ values["git_credentials_secret"] = data.values.platform.git.secret.name
3836
#@ end
3937
#@ end
4038
#@

package/config/values-schema.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,16 +42,16 @@ platform:
4242

4343
#@schema/desc "Settings for the OCI registry that the platform will use."
4444
oci_registry:
45-
#@schema/desc "The server of the OCI Registry where the platform will publish and consume OCI images."
45+
#@schema/desc "The server of the OCI Registry where the platform will publish OCI images."
4646
#@schema/examples ("GitHub Container Registry", "ghcr.io")
4747
server: ""
48-
#@schema/desc "The repository in the OCI Registry where the platform will publish and consume OCI images."
48+
#@schema/desc "The repository in the OCI Registry where the platform will publish OCI images."
4949
#@schema/examples ("Repository on GitHub Container Registry", "my-org")
5050
repository: ""
5151
#@schema/desc "Configuration for the Secret holding the credentials to access the OCI registry."
5252
secret:
53-
#@schema/desc "The name of the Secret holding the credentials to access the OCI registry."
54-
name: supply-chain-registry-credentials
53+
#@schema/desc "The name of the Secret holding the credentials to access the OCI registry. The credentials should provide read-only access to the OCI registry except when installing the platform with one of these profiles: `full`, `dev`, `build`."
54+
name: ""
5555
#@schema/desc "The namespace of the Secret holding the credentials to access the OCI registry."
5656
namespace: kadras-packages
5757

@@ -60,7 +60,7 @@ platform:
6060
#@schema/desc "Configuration for the Secret holding the Cosign key pair."
6161
secret:
6262
#@schema/desc "The name of the Secret holding the Cosign key pair."
63-
name: supply-chain-cosign-key-pair
63+
name: ""
6464
#@schema/desc "The namespace of the Secret holding the Cosign key pair."
6565
namespace: kadras-packages
6666

@@ -71,8 +71,8 @@ platform:
7171
server: https://github.com
7272
#@schema/desc "Configuration for the Secret holding the credentials to access the Git server."
7373
secret:
74-
#@schema/desc "The name of the Secret holding the credentials to access the Git server."
75-
name: supply-chain-git-credentials
74+
#@schema/desc "The name of the Secret holding the credentials to access the Git server. The credentials should provide read-only access to the Git server except when installing the platform with one of these profiles: `full`, `build`."
75+
name: ""
7676
#@schema/desc "The namespace of the Secret holding the credentials to access the Git server."
7777
namespace: kadras-packages
7878

package/config/workspace-provisioner.yml

Lines changed: 19 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -9,39 +9,33 @@
99
#@ values = struct.decode(data.values.workspace_provisioner)
1010
#@
1111
#@ #! Compute values for OCI Registry server
12-
#@ if is_any_profile_enabled([profiles.full]):
13-
#@ if data.values.platform.oci_registry.secret.name and data.values.platform.oci_registry.secret.namespace:
14-
#@ if not hasattr(data.values.workspace_provisioner, "oci_registry") or not hasattr(data.values.workspace_provisioner.oci_registry, "secret") or not hasattr(data.values.workspace_provisioner.oci_registry.secret, "name") or not hasattr(data.values.workspace_provisioner.oci_registry.secret, "namespace") or not data.values.workspace_provisioner.oci_registry.secret.name or not data.values.workspace_provisioner.oci_registry.secret.namespace:
15-
#@ values["oci_registry"] = {}
16-
#@ values["oci_registry"]["secret"] = {}
17-
#@ values["oci_registry"]["secret"]["name"] = data.values.platform.oci_registry.secret.name
18-
#@ values["oci_registry"]["secret"]["namespace"] = data.values.platform.oci_registry.secret.namespace
19-
#@ end
12+
#@ if data.values.platform.oci_registry.secret.name and data.values.platform.oci_registry.secret.namespace:
13+
#@ if not hasattr(data.values.workspace_provisioner, "oci_registry") or not hasattr(data.values.workspace_provisioner.oci_registry, "secret") or not hasattr(data.values.workspace_provisioner.oci_registry.secret, "name") or not hasattr(data.values.workspace_provisioner.oci_registry.secret, "namespace") or not data.values.workspace_provisioner.oci_registry.secret.name or not data.values.workspace_provisioner.oci_registry.secret.namespace:
14+
#@ values["oci_registry"] = {}
15+
#@ values["oci_registry"]["secret"] = {}
16+
#@ values["oci_registry"]["secret"]["name"] = data.values.platform.oci_registry.secret.name
17+
#@ values["oci_registry"]["secret"]["namespace"] = data.values.platform.oci_registry.secret.namespace
2018
#@ end
2119
#@ end
2220
#@
2321
#@ #! Compute values for Cosign
24-
#@ if is_any_profile_enabled([profiles.full]):
25-
#@ if data.values.platform.cosign.secret.name and data.values.platform.cosign.secret.namespace:
26-
#@ if not hasattr(data.values.workspace_provisioner, "cosign") or not hasattr(data.values.workspace_provisioner.cosign, "secret") or not hasattr(data.values.workspace_provisioner.cosign.secret, "name") or not hasattr(data.values.workspace_provisioner.cosign.secret, "namespace") or not data.values.workspace_provisioner.cosign.secret.name or not data.values.workspace_provisioner.cosign.secret.namespace:
27-
#@ values["cosign"] = {}
28-
#@ values["cosign"]["secret"] = {}
29-
#@ values["cosign"]["secret"]["name"] = data.values.platform.cosign.secret.name
30-
#@ values["cosign"]["secret"]["namespace"] = data.values.platform.cosign.secret.namespace
31-
#@ end
22+
#@ if data.values.platform.cosign.secret.name and data.values.platform.cosign.secret.namespace:
23+
#@ if not hasattr(data.values.workspace_provisioner, "cosign") or not hasattr(data.values.workspace_provisioner.cosign, "secret") or not hasattr(data.values.workspace_provisioner.cosign.secret, "name") or not hasattr(data.values.workspace_provisioner.cosign.secret, "namespace") or not data.values.workspace_provisioner.cosign.secret.name or not data.values.workspace_provisioner.cosign.secret.namespace:
24+
#@ values["cosign"] = {}
25+
#@ values["cosign"]["secret"] = {}
26+
#@ values["cosign"]["secret"]["name"] = data.values.platform.cosign.secret.name
27+
#@ values["cosign"]["secret"]["namespace"] = data.values.platform.cosign.secret.namespace
3228
#@ end
3329
#@ end
3430
#@
3531
#@ #! Compute values for Git server
36-
#@ if is_any_profile_enabled([profiles.full]):
37-
#@ if data.values.platform.git.server and data.values.platform.git.secret.name and data.values.platform.git.secret.namespace:
38-
#@ if not hasattr(data.values.workspace_provisioner, "git") or not hasattr(data.values.workspace_provisioner.git, "server") or not hasattr(data.values.workspace_provisioner.git, "secret") or not hasattr(data.values.workspace_provisioner.cosign.secret, "name") or not hasattr(data.values.workspace_provisioner.cosign.secret, "namespace") or not data.values.workspace_provisioner.git.server or not data.values.workspace_provisioner.cosign.secret.name or not data.values.workspace_provisioner.cosign.secret.namespace:
39-
#@ values["git"] = {}
40-
#@ values["git"]["server"] = data.values.platform.git.server
41-
#@ values["git"]["secret"] = {}
42-
#@ values["git"]["secret"]["name"] = data.values.platform.git.secret.name
43-
#@ values["git"]["secret"]["namespace"] = data.values.platform.git.secret.namespace
44-
#@ end
32+
#@ if data.values.platform.git.server and data.values.platform.git.secret.name and data.values.platform.git.secret.namespace:
33+
#@ if not hasattr(data.values.workspace_provisioner, "git") or not hasattr(data.values.workspace_provisioner.git, "server") or not hasattr(data.values.workspace_provisioner.git, "secret") or not hasattr(data.values.workspace_provisioner.cosign.secret, "name") or not hasattr(data.values.workspace_provisioner.cosign.secret, "namespace") or not data.values.workspace_provisioner.git.server or not data.values.workspace_provisioner.cosign.secret.name or not data.values.workspace_provisioner.cosign.secret.namespace:
34+
#@ values["git"] = {}
35+
#@ values["git"]["server"] = data.values.platform.git.server
36+
#@ values["git"]["secret"] = {}
37+
#@ values["git"]["secret"]["name"] = data.values.platform.git.secret.name
38+
#@ values["git"]["secret"]["namespace"] = data.values.platform.git.secret.namespace
4539
#@ end
4640
#@ end
4741
#@

0 commit comments

Comments
 (0)