Skip to content

Commit 9c03261

Browse files
authored
Improve the platform API and add docs (#3)
* Improve the platform API and add docs
1 parent ea7be5a commit 9c03261

29 files changed

+664
-124
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.8.0
21+
version: 0.9.0
2222
secrets:
2323
pull-request-token: ${{ secrets.GH_ORG_PAT }}

README.md

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,12 @@ Documentation, tutorials and examples for this package are available in the [doc
7474
The Engineering Platform package can be customized via a `values.yml` file.
7575

7676
```yaml
77-
excluded_blueprints:
78-
- "config-template"
77+
platform:
78+
ingress:
79+
domain: thomasvitale.com
80+
oci_registry:
81+
server: ghcr.io
82+
repository: thomasvitale
7983
```
8084
8185
Reference the `values.yml` file from the `kctrl` command when installing or upgrading the package.
@@ -96,23 +100,41 @@ The Engineering Platform package has the following configurable properties.
96100

97101
| Config | Default | Description |
98102
|-------|-------------------|-------------|
99-
| `packages.namespace` | `""` | The namespace where to install the platform. |
100-
| `packages.exclusions` | `[]` | A list of packages to exclude from being installed. |
103+
| `platform.namespace` | `kadras-packages` | The namespace where to install the platform. |
104+
| `platform.excluded_packages` | `[]` | A list of packages to exclude from being installed. |
105+
| `platform.ca_cert_data` | `""` | PEM-encoded certificate data to trust TLS connections with a custom CA. |
106+
| `platform.ingress.domain.issuer.type` | `private` | The type of ClusterIssuer the platform will use to enable TLS communications. Options: `private`, `letsencrypt_staging`, `letsencrypt`, `custom`. |
107+
| `platform.ingress.domain.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`. |
108+
| `platform.oci_registry.server` | `""` | The server of the OCI Registry where the platform will publish and consume OCI images. |
109+
| `platform.oci_registry.repository` | `""` | The repository in the OCI Registry where the platform will publish and consume OCI images. |
110+
| `platform.oci_registry.credentials.username` | `""` | Username to access the OCI registry. Note: Use `_json_key` for GCR. |
111+
| `platform.oci_registry.credentials.password` | `""` | Token to access the OCI registry. Note: Use contents of service account key json for GCR. |
112+
| `platform.oci_registry.secret.name` | `supply-chain-registry-credentials` | The name of the Secret holding the credentials to access the OCI registry. |
113+
| `platform.oci_registry.secret.namespace` | `kadras-packages` | The namespace of the Secret holding the credentials to access the OCI registry. |
114+
| `platform.cosign.secret.name` | `supply-chain-cosign-key-pair` | The name of the Secret holding the Cosign key pair. |
115+
| `platform.cosign.secret.namespace` | `kadras-packages` | The namespace of the Secret holding the Cosign key pair. |
116+
117+
Each Kadras package included in the platform can be configured independently.
118+
119+
| Config | Default | Description |
120+
|-------|-------------------|-------------|
101121
| `buildpacks.catalog` | `{}` | Configuration for the Buildpacks Catalog package. |
102122
| `buildpacks.kpack` | `{}` | Configuration for the Kpack package. |
123+
| `cartographer.core` | `{}` | Configuration for the Cartographer Core package including Cartographer and Cartographer Conventions. |
103124
| `cartographer.blueprints` | `{}` | Configuration for the Cartographer Blueprints package. |
104125
| `cartographer.delivery` | `{}` | Configuration for the Cartographer Delivery package. |
105126
| `cartographer.supply_chains` | `{}` | Configuration for the Cartographer Supply Chains package. |
106-
| `cert_manager` | `{}` | Configuration for the Cert Manager package. |
127+
| `cert_manager.core` | `{}` | Configuration for the Cert Manager package. |
128+
| `cert_manager.issuers` | `{}` | Configuration for the Cert Manager Issuers package. |
107129
| `contour` | `{}` | Configuration for the Contour package. |
108130
| `conventions.spring_boot` | `{}` | Configuration for the Spring Boot Conventions package. |
109131
| `flux.source_controller` | `{}` | Configuration for the FluxCD Source Controller package. |
110132
| `knative.serving` | `{}` | Configuration for the Knative Serving package. |
111133
| `metrics_server` | `{}` | Configuration for the Metrics Server package. |
112-
| `namespace_setup` | `{}` | Configuration for the Namespace Setup package. |
113134
| `secretgen_controller` | `{}` | Configuration for the Secretgen Controller package. |
114135
| `tekton.catalog` | `{}` | Configuration for the Tekton Catalog package. |
115136
| `tekton.pipelines` | `{}` | Configuration for the Tekton Pipelines package. |
137+
| `workspace_provisioner` | `{}` | Configuration for the Workspace Provisioner package. |
116138

117139
</details>
118140

docs/install.md

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
# Install the Kadras Engineering Platform
2+
3+
## 1. Prerequisites
4+
5+
* Kubernetes 1.24+
6+
* Carvel [`kctrl`](https://carvel.dev/kapp-controller/docs/latest/install/#installing-kapp-controller-cli-kctrl) CLI.
7+
* Sigstore [`cosign`](https://docs.sigstore.dev/cosign/installation/) CLI.
8+
* 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`.
9+
10+
```shell
11+
kapp deploy -a kapp-controller -y \
12+
-f https://github.com/carvel-dev/kapp-controller/releases/latest/download/release.yml
13+
```
14+
15+
## 2. Add the Kadras Repository
16+
17+
Add the Kadras repository to make all Kadras packages available to the cluster.
18+
19+
```shell
20+
kubectl create namespace kadras-packages
21+
kctrl package repository add -r kadras-packages \
22+
--url ghcr.io/kadras-io/kadras-packages \
23+
-n kadras-packages
24+
```
25+
26+
You can check the full list of available packages as follows.
27+
28+
```shell
29+
kctrl package available list -n kadras-packages
30+
```
31+
32+
## 3. Create Secret for OCI Registry
33+
34+
First, create a Secret with the credentials to access your container registry in read/write mode. It will be used by the platform to publish and consume OCI artifacts.
35+
36+
```shell
37+
export SUPPLY_CHAIN_REGISTRY_HOSTNAME=<hostname>
38+
export SUPPLY_CHAIN_REGISTRY_USERNAME=<username>
39+
export SUPPLY_CHAIN_REGISTRY_TOKEN=<token>
40+
```
41+
42+
* `<hostname>` is the server hosting the OCI registry. For example, `ghcr.io`, `gcr.io`, `quay.io`, `index.docker.io`.
43+
* `<username>` is the username to access the OCI registry. Use `_json_key` if the hostname is `gcr.io`.
44+
* `<token>` is a token with read/write permissions to access the OCI registry. Use the contents of the service account key json if the hostname is `gcr.io`.
45+
46+
```shell
47+
kubectl create secret docker-registry supply-chain-registry-credentials \
48+
--docker-server="${SUPPLY_CHAIN_REGISTRY_HOSTNAME}" \
49+
--docker-username="${SUPPLY_CHAIN_REGISTRY_USERNAME}" \
50+
--docker-password="${SUPPLY_CHAIN_REGISTRY_TOKEN}" \
51+
--namespace=kadras-packages
52+
```
53+
54+
## 4. Create Secret for Cosign
55+
56+
Next, use Cosign to generate a key-pair that will be used by the platform to sign and verify OCI artifacts.
57+
58+
```shell
59+
cosign generate-key-pair k8s://kadras-packages/supply-chain-cosign-key-pair
60+
```
61+
62+
The previous command will create a cosign.pub file in the current directory. That's the public key you can use the verify OCI artifacts built and signed by the platform.
63+
64+
## 5. Configure the Platform
65+
66+
The installation of the Kadras Engineering Platform can be configured via YAML. Create a `values.yml` file with any configuration you need for the platform. The following is a minimal configuration example.
67+
68+
```yaml
69+
platform:
70+
ingress:
71+
domain: <domain>
72+
73+
oci_registry:
74+
server: <oci-server>
75+
repository: <oci-repository>
76+
77+
workspace_provisioner:
78+
namespaces:
79+
- name: default
80+
git:
81+
credentials:
82+
username: <github-username>
83+
password: <github-token>
84+
```
85+
86+
* `<domain>` is the base domain name the platform will use to configure the Ingress controller. It must be a valid DNS name. For example, `lab.thomasvitale.com`.
87+
* `<oci-server>` is the server of the OCI registry where the platform will publish and consume OCI images. It must be the same used in step 3 when creating a Secret with the OCI registry credentials. For example, `ghcr.io`, `gcr.io`, `quay.io`, `index.docker.io`.
88+
* `<oci-repository>` is the repository in the OCI registry where the platform will publish and consume OCI images. It must be the same used in step 3 when creating a Secret with the OCI registry credentials. For example, it might be your username or organization name depending on which OCI server you're using.
89+
* `<github-username>` is your username to access your Git repositories on GitHub. It's not needed if you won't use the GitOps workflows offered by the platform and only use public Git repositories.
90+
* `<github-token>` is a token with read/write permissions to access your Git repositories on GitHub. It's not needed if you won't use the GitOps workflows offered by the platform and only use public Git repositories.
91+
92+
## 6. Install the Platform
93+
94+
Reference the `values.yml` file you created in the previous step and install the Kadras Engineering Platform.
95+
96+
```shell
97+
kctrl package install -i engineering-platform \
98+
-p engineering-platform.packages.kadras.io \
99+
-v ${VERSION} \
100+
-n kadras-packages \
101+
--values-file values.yml
102+
```
103+
104+
You can find the `${VERSION}` value by retrieving the list of package versions available in the Kadras package repository installed on your cluster.
105+
106+
```shell
107+
kctrl package available list -p engineering-platform.packages.kadras.io -n kadras-packages
108+
```
109+
110+
## 7. Verify the Installation
111+
112+
Verify that all the platform components have been installed and properly reconciled.
113+
114+
```shell
115+
kctrl package installed list -n kadras-packages
116+
```

docs/verify-release.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Verifying the Tekton Pipelines Package Release
1+
# Verifying the Package Release
22

33
This package is published as an OCI artifact, signed with Sigstore [Cosign](https://docs.sigstore.dev/cosign/overview), and associated with a [SLSA Provenance](https://slsa.dev/provenance) attestation.
44

package/config/buildpacks-catalog.yml

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,41 @@
11
#@ load("@ytt:data", "data")
2+
#@ load("@ytt:struct", "struct")
23
#@ load("@ytt:yaml", "yaml")
34
#@ load("/helpers.star", "is_package_enabled")
45

56
#@ if is_package_enabled("buildpacks-catalog"):
67

8+
#@ def build_package_values():
9+
#@ values = {
10+
#@ "kp_default_repository": {}
11+
#@ }
12+
#@
13+
#@ if data.values.buildpacks.catalog:
14+
#@ values.update(struct.decode(data.values.buildpacks.catalog))
15+
#@ end
16+
#@ if data.values.platform.oci_registry.server and data.values.platform.oci_registry.repository and (not hasattr(data.values.buildpacks.catalog, "kp_default_repository") or not hasattr(data.values.buildpacks.catalog.kp_default_repository, "name") or not data.values.buildpacks.catalog.kp_default_repository.name):
17+
#@ values["kp_default_repository"]["name"] = data.values.platform.oci_registry.server.rstrip("/") + "/" + data.values.platform.oci_registry.repository.rstrip("/") + "/buildpacks"
18+
#@ end
19+
#@
20+
#@ return struct.encode(values)
21+
#@ end
22+
723
---
824
apiVersion: packaging.carvel.dev/v1alpha1
925
kind: PackageInstall
1026
metadata:
1127
name: buildpacks-catalog
12-
namespace: #@ data.values.packages.namespace
28+
namespace: #@ data.values.platform.namespace
1329
annotations:
1430
kapp.k14s.io/change-group: buildpacks-catalog
15-
kapp.k14s.io/change-rule.buildpacks-catalog: upsert after upserting kpack
31+
kapp.k14s.io/change-rule.kpack: upsert after upserting kpack
1632
kapp.k14s.io/change-rule.service-account: delete before deleting serviceaccount
1733
spec:
1834
serviceAccountName: kadras-install-sa
1935
packageRef:
2036
refName: buildpacks-catalog.packages.kadras.io
2137
versionSelection:
22-
constraints: 0.6.0
38+
constraints: 0.6.1
2339
prereleases: {}
2440
values:
2541
- secretRef:
@@ -29,8 +45,8 @@ apiVersion: v1
2945
kind: Secret
3046
metadata:
3147
name: buildpacks-catalog-values
32-
namespace: #@ data.values.packages.namespace
48+
namespace: #@ data.values.platform.namespace
3349
stringData:
34-
values.yaml: #@ yaml.encode(data.values.buildpacks.catalog)
50+
values.yaml: #@ yaml.encode(build_package_values())
3551

3652
#@ end

package/config/cartographer-blueprints.yml

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,26 @@
11
#@ load("@ytt:data", "data")
2+
#@ load("@ytt:struct", "struct")
23
#@ load("@ytt:yaml", "yaml")
34
#@ load("/helpers.star", "is_package_enabled")
45

56
#@ if is_package_enabled("cartographer-blueprints"):
67

8+
#@ def build_package_values():
9+
#@ values = {}
10+
#@
11+
#@ if data.values.cartographer.blueprints:
12+
#@ values.update(struct.decode(data.values.cartographer.blueprints))
13+
#@ end
14+
#@
15+
#@ return struct.encode(values)
16+
#@ end
17+
718
---
819
apiVersion: packaging.carvel.dev/v1alpha1
920
kind: PackageInstall
1021
metadata:
1122
name: cartographer-blueprints
12-
namespace: #@ data.values.packages.namespace
23+
namespace: #@ data.values.platform.namespace
1324
annotations:
1425
kapp.k14s.io/change-group: cartographer-blueprints
1526
kapp.k14s.io/change-rule.cartographer: upsert after upserting cartographer
@@ -21,7 +32,7 @@ spec:
2132
packageRef:
2233
refName: cartographer-blueprints.packages.kadras.io
2334
versionSelection:
24-
constraints: 0.5.0
35+
constraints: 0.5.1
2536
prereleases: {}
2637
values:
2738
- secretRef:
@@ -31,8 +42,8 @@ apiVersion: v1
3142
kind: Secret
3243
metadata:
3344
name: cartographer-blueprints-values
34-
namespace: #@ data.values.packages.namespace
45+
namespace: #@ data.values.platform.namespace
3546
stringData:
36-
values.yaml: #@ yaml.encode(data.values.cartographer.blueprints)
47+
values.yaml: #@ yaml.encode(build_package_values())
3748

3849
#@ end

package/config/cartographer-delivery.yml

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,26 @@
11
#@ load("@ytt:data", "data")
2+
#@ load("@ytt:struct", "struct")
23
#@ load("@ytt:yaml", "yaml")
34
#@ load("/helpers.star", "is_package_enabled")
45

56
#@ if is_package_enabled("cartographer-delivery"):
67

8+
#@ def build_package_values():
9+
#@ values = {}
10+
#@
11+
#@ if data.values.cartographer.delivery:
12+
#@ values.update(struct.decode(data.values.cartographer.delivery))
13+
#@ end
14+
#@
15+
#@ return struct.encode(values)
16+
#@ end
17+
718
---
819
apiVersion: packaging.carvel.dev/v1alpha1
920
kind: PackageInstall
1021
metadata:
1122
name: cartographer-delivery
12-
namespace: #@ data.values.packages.namespace
23+
namespace: #@ data.values.platform.namespace
1324
annotations:
1425
kapp.k14s.io/change-group: cartographer-delivery
1526
kapp.k14s.io/change-rule.cartographer: upsert after upserting cartographer
@@ -20,7 +31,7 @@ spec:
2031
packageRef:
2132
refName: cartographer-delivery.packages.kadras.io
2233
versionSelection:
23-
constraints: 0.4.0
34+
constraints: 0.4.1
2435
prereleases: {}
2536
values:
2637
- secretRef:
@@ -30,8 +41,8 @@ apiVersion: v1
3041
kind: Secret
3142
metadata:
3243
name: cartographer-delivery-values
33-
namespace: #@ data.values.packages.namespace
44+
namespace: #@ data.values.platform.namespace
3445
stringData:
35-
values.yaml: #@ yaml.encode(data.values.cartographer.delivery)
46+
values.yaml: #@ yaml.encode(build_package_values())
3647

3748
#@ end

package/config/cartographer-supply-chains.yml

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,32 @@
11
#@ load("@ytt:data", "data")
2+
#@ load("@ytt:struct", "struct")
23
#@ load("@ytt:yaml", "yaml")
34
#@ load("/helpers.star", "is_package_enabled")
45

56
#@ if is_package_enabled("cartographer-supply-chains"):
67

8+
#@ def build_package_values():
9+
#@ values = {
10+
#@ "registry": {}
11+
#@ }
12+
#@
13+
#@ if data.values.cartographer.supply_chains:
14+
#@ values.update(struct.decode(data.values.cartographer.supply_chains))
15+
#@ end
16+
#@ if data.values.platform.oci_registry.server and data.values.platform.oci_registry.repository and (not hasattr(data.values.cartographer.supply_chains, "registry") or not hasattr(data.values.cartographer.supply_chains.registry, "server") or not hasattr(data.values.cartographer.supply_chains.registry, "repository") or not data.values.cartographer.supply_chains.registry.server or not data.values.cartographer.supply_chains.registry.repository):
17+
#@ values["registry"]["server"] = data.values.platform.oci_registry.server.rstrip("/")
18+
#@ values["registry"]["repository"] = data.values.platform.oci_registry.repository.rstrip("/") + "/workloads"
19+
#@ end
20+
#@
21+
#@ return struct.encode(values)
22+
#@ end
23+
724
---
825
apiVersion: packaging.carvel.dev/v1alpha1
926
kind: PackageInstall
1027
metadata:
1128
name: cartographer-supply-chains
12-
namespace: #@ data.values.packages.namespace
29+
namespace: #@ data.values.platform.namespace
1330
annotations:
1431
kapp.k14s.io/change-group: cartographer-supply-chains
1532
kapp.k14s.io/change-rule.cartographer: upsert after upserting cartographer
@@ -20,7 +37,7 @@ spec:
2037
packageRef:
2138
refName: cartographer-supply-chains.packages.kadras.io
2239
versionSelection:
23-
constraints: 0.5.0
40+
constraints: 0.5.1
2441
prereleases: {}
2542
values:
2643
- secretRef:
@@ -30,8 +47,8 @@ apiVersion: v1
3047
kind: Secret
3148
metadata:
3249
name: cartographer-supply-chains-values
33-
namespace: #@ data.values.packages.namespace
50+
namespace: #@ data.values.platform.namespace
3451
stringData:
35-
values.yaml: #@ yaml.encode(data.values.cartographer.supply_chains)
52+
values.yaml: #@ yaml.encode(build_package_values())
3653

3754
#@ end

0 commit comments

Comments
 (0)