Skip to content

Commit

Permalink
Configure installation profiles
Browse files Browse the repository at this point in the history
Fixes gh-19
Fixes gh-20
Fixes gh-21
  • Loading branch information
ThomasVitale committed Sep 3, 2023
1 parent 25d3bf1 commit d1b93b0
Show file tree
Hide file tree
Showing 28 changed files with 57 additions and 26 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ The Engineering Platform package can be customized via a `values.yml` file.
```yaml
platform:
platform:
profile: serving
profile: run
ingress:
domain: thomasvitale.com
```
Expand All @@ -98,7 +98,7 @@ The Engineering Platform package has the following configurable properties.

| Config | Default | Description |
|-------|-------------------|-------------|
| `platform.profile` | `full` | The platform profile to install. Options: `full`, `serving`. |
| `platform.profile` | `run` | The platform profile to install. Options: `full`, `dev`, `build`, `run`. |
| `platform.supply_chain` | `basic` | The type of supply chain to deploy. Options: `basic`, `advanced`. |
| `platform.namespace` | `kadras-packages` | The namespace where to install the platform. |
| `platform.excluded_packages` | `[]` | A list of packages to exclude from being installed. |
Expand Down
2 changes: 1 addition & 1 deletion package/config/components/buildpacks-catalog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#@ load("@ytt:yaml", "yaml")
#@ load("/helpers.star", "is_any_profile_enabled", "is_package_enabled", "profiles")

#@ if is_package_enabled("buildpacks-catalog") and is_any_profile_enabled([profiles.full]):
#@ if is_package_enabled("buildpacks-catalog") and is_any_profile_enabled([profiles.full, profiles.dev, profiles.build]):

#@ def compute_package_values():
#@ values = struct.decode(data.values.buildpacks.catalog)
Expand Down
2 changes: 1 addition & 1 deletion package/config/components/cartographer-blueprints.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#@ load("@ytt:yaml", "yaml")
#@ load("/helpers.star", "is_any_profile_enabled", "is_package_enabled", "profiles")

#@ if is_package_enabled("cartographer-blueprints") and is_any_profile_enabled([profiles.full]):
#@ if is_package_enabled("cartographer-blueprints") and is_any_profile_enabled([profiles.full, profiles.dev, profiles.build, profiles.run]):

#@ def compute_package_values():
#@ return data.values.cartographer.blueprints
Expand Down
2 changes: 1 addition & 1 deletion package/config/components/cartographer-delivery.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#@ load("@ytt:yaml", "yaml")
#@ load("/helpers.star", "is_any_profile_enabled", "is_package_enabled", "profiles")

#@ if is_package_enabled("cartographer-delivery") and is_any_profile_enabled([profiles.full]):
#@ if is_package_enabled("cartographer-delivery") and is_any_profile_enabled([profiles.full, profiles.run]):

#@ def compute_package_values():
#@ values = struct.decode(data.values.cartographer.delivery)
Expand Down
2 changes: 1 addition & 1 deletion package/config/components/cartographer-supply-chains.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#@ load("@ytt:yaml", "yaml")
#@ load("/helpers.star", "is_any_profile_enabled", "is_package_enabled", "profiles")

#@ if is_package_enabled("cartographer-supply-chains") and is_any_profile_enabled([profiles.full]):
#@ if is_package_enabled("cartographer-supply-chains") and is_any_profile_enabled([profiles.full, profiles.dev, profiles.build]):

#@ def compute_package_values():
#@ values = struct.decode(data.values.cartographer.supply_chains)
Expand Down
10 changes: 9 additions & 1 deletion package/config/components/cartographer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#@ load("@ytt:yaml", "yaml")
#@ load("/helpers.star", "is_any_profile_enabled", "is_package_enabled", "profiles")

#@ if is_package_enabled("cartographer") and is_any_profile_enabled([profiles.full]):
#@ if is_package_enabled("cartographer") and is_any_profile_enabled([profiles.full, profiles.dev, profiles.build, profiles.run]):

#@ def compute_package_values():
#@ values = struct.decode(data.values.cartographer.core)
Expand All @@ -13,6 +13,14 @@
#@ values["ca_cert_data"] = values["ca_cert_data"] + data.values.platform.ca_cert_data
#@ end
#@
#@ #! Disable Cartographer Conventions based on profile
#@ if is_any_profile_enabled([profiles.run]):
#@ if not hasattr(data.values.cartographer.core, "optional_components") or not data.values.cartographer.core.optional_components or not hasattr(data.values.cartographer.core.optional_components, "cartographer_conventions") or not data.values.cartographer.core.optional_components.cartographer_conventions:
#@ values["optional_components"] = {}
#@ values["optional_components"]["cartographer_conventions"] = "false"
#@ end
#@ end
#@
#@ return struct.encode(values)
#@ end

Expand Down
2 changes: 1 addition & 1 deletion package/config/components/cert-manager-issuers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#@ load("@ytt:yaml", "yaml")
#@ load("/helpers.star", "is_any_profile_enabled", "is_package_enabled", "profiles")

#@ if is_package_enabled("cert-manager-issuers") and is_any_profile_enabled([profiles.full, profiles.serving]):
#@ if is_package_enabled("cert-manager-issuers"):

#@ def is_letsencrypt_issuer(issuer):
#@ return issuer.type == "letsencrypt_staging" or issuer.type == "letsencrypt"
Expand Down
2 changes: 1 addition & 1 deletion package/config/components/cert-manager.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#@ load("@ytt:yaml", "yaml")
#@ load("/helpers.star", "is_any_profile_enabled", "is_package_enabled", "profiles")

#@ if is_package_enabled("cert-manager") and is_any_profile_enabled([profiles.full, profiles.serving]):
#@ if is_package_enabled("cert-manager"):

#@ def compute_package_values():
#@ return data.values.cert_manager.core
Expand Down
2 changes: 1 addition & 1 deletion package/config/components/contour.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#@ load("@ytt:yaml", "yaml")
#@ load("/helpers.star", "is_any_profile_enabled", "is_package_enabled", "profiles")

#@ if is_package_enabled("contour") and is_any_profile_enabled([profiles.full, profiles.serving]):
#@ if is_package_enabled("contour"):

#@ def compute_package_values():
#@ values = struct.decode(data.values.contour)
Expand Down
2 changes: 1 addition & 1 deletion package/config/components/flux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#@ load("@ytt:yaml", "yaml")
#@ load("/helpers.star", "is_any_profile_enabled", "is_package_enabled", "profiles")

#@ if is_package_enabled("flux") and is_any_profile_enabled([profiles.full, profiles.serving]):
#@ if is_package_enabled("flux"):

#@ def compute_package_values():
#@ return data.values.flux
Expand Down
2 changes: 1 addition & 1 deletion package/config/components/knative-serving.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#@ load("@ytt:yaml", "yaml")
#@ load("/helpers.star", "get_issuer_name", "is_any_profile_enabled", "is_package_enabled", "profiles")

#@ if is_package_enabled("knative-serving") and is_any_profile_enabled([profiles.full, profiles.serving]):
#@ if is_package_enabled("knative-serving") and is_any_profile_enabled([profiles.full, profiles.dev, profiles.run]):

#@ def compute_package_values():
#@ values = struct.decode(data.values.knative.serving)
Expand Down
2 changes: 1 addition & 1 deletion package/config/components/kpack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#@ load("@ytt:yaml", "yaml")
#@ load("/helpers.star", "is_any_profile_enabled", "is_package_enabled", "profiles")

#@ if is_package_enabled("kpack") and is_any_profile_enabled([profiles.full]):
#@ if is_package_enabled("kpack") and is_any_profile_enabled([profiles.full, profiles.dev, profiles.build]):

#@ def compute_package_values():
#@ values = {
Expand Down
2 changes: 1 addition & 1 deletion package/config/components/metrics-server.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#@ load("@ytt:yaml", "yaml")
#@ load("/helpers.star", "is_any_profile_enabled", "is_package_enabled", "profiles")

#@ if is_package_enabled("metrics-server") and is_any_profile_enabled([profiles.full, profiles.serving]):
#@ if is_package_enabled("metrics-server"):

#@ def compute_package_values():
#@ return data.values.metrics_server
Expand Down
2 changes: 1 addition & 1 deletion package/config/components/secretgen-controller.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#@ load("@ytt:yaml", "yaml")
#@ load("/helpers.star", "is_any_profile_enabled", "is_package_enabled", "profiles")

#@ if is_package_enabled("secretgen-controller") and is_any_profile_enabled([profiles.full, profiles.serving]):
#@ if is_package_enabled("secretgen-controller"):

#@ def compute_package_values():
#@ return data.values.secretgen_controller
Expand Down
2 changes: 1 addition & 1 deletion package/config/components/spring-boot-conventions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#@ load("@ytt:yaml", "yaml")
#@ load("/helpers.star", "is_any_profile_enabled", "is_package_enabled", "profiles")

#@ if is_package_enabled("spring-boot-conventions") and is_any_profile_enabled([profiles.full]):
#@ if is_package_enabled("spring-boot-conventions") and is_any_profile_enabled([profiles.full, profiles.dev, profiles.build]):

#@ def compute_package_values():
#@ return data.values.conventions.spring_boot
Expand Down
2 changes: 1 addition & 1 deletion package/config/components/tekton-catalog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#@ load("@ytt:yaml", "yaml")
#@ load("/helpers.star", "is_any_profile_enabled", "is_package_enabled", "profiles")

#@ if is_package_enabled("tekton-catalog") and is_any_profile_enabled([profiles.full]):
#@ if is_package_enabled("tekton-catalog") and is_any_profile_enabled([profiles.full, profiles.dev, profiles.build]):

#@ def compute_package_values():
#@ return data.values.tekton.catalog
Expand Down
2 changes: 1 addition & 1 deletion package/config/components/tekton-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#@ load("@ytt:yaml", "yaml")
#@ load("/helpers.star", "is_any_profile_enabled", "is_package_enabled", "profiles")

#@ if is_package_enabled("tekton-pipelines") and is_any_profile_enabled([profiles.full]):
#@ if is_package_enabled("tekton-pipelines") and is_any_profile_enabled([profiles.full, profiles.dev, profiles.build]):

#@ def compute_package_values():
#@ values = struct.decode(data.values.tekton.pipelines)
Expand Down
2 changes: 1 addition & 1 deletion package/config/components/workspace-provisioner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#@ load("@ytt:yaml", "yaml")
#@ load("/helpers.star", "is_any_profile_enabled", "is_package_enabled", "profiles")

#@ if is_package_enabled("workspace-provisioner") and is_any_profile_enabled([profiles.full, profiles.serving]):
#@ if is_package_enabled("workspace-provisioner"):

#@ def compute_package_values():
#@ values = struct.decode(data.values.workspace_provisioner)
Expand Down
4 changes: 3 additions & 1 deletion package/config/helpers.star
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ load("@ytt:struct", "struct")

profiles = struct.make(
full="full",
serving="serving"
dev="dev",
build="build",
run="run"
)

def is_package_enabled(name):
Expand Down
10 changes: 10 additions & 0 deletions package/config/profiles/platform-info.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#@ load("@ytt:data", "data")

---
apiVersion: v1
kind: ConfigMap
metadata:
name: platform-info
namespace: #@ data.values.platform.namespace
data:
profile: #@ data.values.platform.profile
6 changes: 3 additions & 3 deletions package/config/values-schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

#@schema/desc "Configuration for the platform packages."
platform:
#@schema/desc "The platform profile to install. Options: `full`, `serving`."
#@schema/validation one_of=["full", "serving"]
profile: full
#@schema/desc "The platform profile to install. Options: `full`, `dev`, `build`, `run`."
#@schema/validation one_of=["full", "dev", "build", "run"]
profile: run
#@schema/desc "The type of supply chain to deploy. Options: `basic`, `advanced`."
#@schema/validation one_of=["basic", "advanced"]
supply_chain: basic
Expand Down
8 changes: 8 additions & 0 deletions test/integration/run/00-assert.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
apiVersion: v1
kind: ConfigMap
metadata:
name: platform-info
namespace: kadras-packages
data:
profile: run
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ commands:
- script: |
cd ../../../package && \
kubectl config set-context --current --namespace=tests && \
ytt -f ../test/integration/serving/config -f package-resources.yml | kctrl dev -f- --local -y
ytt -f ../test/integration/run/config -f package-resources.yml | kctrl dev -f- --local -y
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ commands:
- script: |
cd ../../../package && \
kubectl config set-context --current --namespace=tests && \
ytt -f ../test/integration/serving/config -f package-resources.yml | kctrl dev -f- --local --delete -y
ytt -f ../test/integration/run/config -f package-resources.yml | kctrl dev -f- --local --delete -y
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,13 @@ metadata:
stringData:
values.yaml: |
platform:
profile: serving
profile: run
infrastructure_provider: local
ingress:
domain: 127.0.0.1.sslip.io
excluded_packages:
- cartographer-blueprints
- cartographer-delivery
- cartographer
- flux
- kyverno

0 comments on commit d1b93b0

Please sign in to comment.