Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,4 @@ $(test_instances):

.PHONY: clean
clean: ## Clean the project
rm -rf .cache compiled dependencies vendor helmcharts jsonnetfile*.json || true
rm -rf .cache compiled dependencies vendor helmcharts manifests jsonnetfile*.json || true
Comment thread
thobens marked this conversation as resolved.
Outdated
44 changes: 43 additions & 1 deletion class/capi-provider-talos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,46 @@ parameters:
- input_paths:
- ${_base_directory}/component/main.jsonnet
input_type: jsonnet
output_path: capi-provider-talos/
output_path: .
- input_paths:
- ${_base_directory}/component/bootstrap-provider.jsonnet
input_type: jsonnet
output_path: ${_base_directory}/manifests/capi-bootstrap-provider-talos/
- input_type: external
output_path: .
input_paths:
- ${_kustomize_wrapper}
env_vars:
INPUT_DIR: ${_base_directory}/manifests/capi-bootstrap-provider-talos/
args:
- ${_base_directory}/manifests/capi-bootstrap-provider-talos-rendered/
- input_type: external
output_path: .
input_paths:
- ${_base_directory}/scripts/envsubst-dir
# map env vars from parameters as needed
env_vars: {}
Comment thread
thobens marked this conversation as resolved.
Outdated
args:
- ${_base_directory}/manifests/capi-bootstrap-provider-talos-rendered
- \${compiled_target_dir}/capi-provider-talos/bootstrap/10_kustomize
- input_paths:
- ${_base_directory}/component/controlplane-provider.jsonnet
input_type: jsonnet
output_path: ${_base_directory}/manifests/capi-controlplane-provider-talos/
- input_type: external
output_path: .
input_paths:
- ${_kustomize_wrapper}
env_vars:
INPUT_DIR: ${_base_directory}/manifests/capi-controlplane-provider-talos/
args:
- ${_base_directory}/manifests/capi-controlplane-provider-talos-rendered/
- input_type: external
output_path: .
input_paths:
- ${_base_directory}/scripts/envsubst-dir
# map env vars from parameters as needed
env_vars: {}
args:
- ${_base_directory}/manifests/capi-controlplane-provider-talos-rendered
- \${compiled_target_dir}/capi-provider-talos/controlplane/10_kustomize
35 changes: 34 additions & 1 deletion class/defaults.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,37 @@ parameters:
capi_provider_talos:
=_metadata:
multi_tenant: true
namespace: syn-capi-provider-talos
# The component assumes that this namespace already exists via dependency `component-capi-core`
namespace: syn-cluster-api

images:
capi-bootstrap-provider-talos:
registry: ghcr.io
image: siderolabs/cluster-api-bootstrap-talos-controller
tag: v0.6.12
capi-controlplane-provider-talos:
registry: ghcr.io
image: siderolabs/cluster-api-control-plane-talos-controller
tag: v0.5.13

bootstrap:
kustomize:
# The root path of the kustomize manifests. This path is relative to the root of the repository.
manifest_path: config/default
Comment thread
thobens marked this conversation as resolved.
Outdated

# An object with variables that the generated manifests will be templated with.
# They should be specified in the format:
# variables:
# my_variable: bar
variables: {}

controlplane:
kustomize:
# The root path of the kustomize manifests. This path is relative to the root of the repository.
manifest_path: config/default
Comment thread
thobens marked this conversation as resolved.
Outdated

# An object with variables that the generated manifests will be templated with.
# They should be specified in the format:
# variables:
# my_variable: bar
Comment thread
thobens marked this conversation as resolved.
Outdated
variables: {}
41 changes: 41 additions & 0 deletions component/bootstrap-provider.jsonnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// main template for capi-provider-cloudscale
Comment thread
thobens marked this conversation as resolved.
Outdated
local com = import 'lib/commodore.libjsonnet';
local kap = import 'lib/kapitan.libjsonnet';
local kube = import 'lib/kube.libjsonnet';
local inv = kap.inventory();
// The hiera parameters for the component
local params = inv.parameters.capi_provider_talos;

com.Kustomization(
'https://github.com/siderolabs/cluster-api-bootstrap-provider-talos/' + params.bootstrap.kustomize.manifest_path,
params.images['capi-bootstrap-provider-talos'].tag,
{
'ghcr.io/siderolabs/cluster-api-bootstrap-talos-controller': {
local image = params.images['capi-bootstrap-provider-talos'],
newTag: image.tag,
newName: '%(registry)s/%(image)s' % image,
},
},
{
namespace: params.namespace,
labels+: [
{
pairs: {
'app.kubernetes.io/managed-by': 'commodore',
},
},
],
patchesStrategicMerge: [ 'rm-namespace.yaml' ],
},
) {
'rm-namespace': [
{
'$patch': 'delete',
apiVersion: 'v1',
kind: 'Namespace',
metadata: {
name: 'cabpt-system',
},
},
],
}
41 changes: 41 additions & 0 deletions component/controlplane-provider.jsonnet
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// main template for capi-provider-cloudscale
local com = import 'lib/commodore.libjsonnet';
local kap = import 'lib/kapitan.libjsonnet';
local kube = import 'lib/kube.libjsonnet';
local inv = kap.inventory();
// The hiera parameters for the component
local params = inv.parameters.capi_provider_talos;

com.Kustomization(
'https://github.com/siderolabs/cluster-api-control-plane-provider-talos/' + params.controlplane.kustomize.manifest_path,
params.images['capi-controlplane-provider-talos'].tag,
{
'ghcr.io/siderolabs/cluster-api-control-plane-talos-controller': {
local image = params.images['capi-controlplane-provider-talos'],
newTag: image.tag,
newName: '%(registry)s/%(image)s' % image,
},
},
{
namespace: params.namespace,
labels+: [
{
pairs: {
'app.kubernetes.io/managed-by': 'commodore',
},
},
],
patchesStrategicMerge: [ 'rm-namespace.yaml' ],
},
) {
'rm-namespace': [
{
'$patch': 'delete',
apiVersion: 'v1',
kind: 'Namespace',
metadata: {
name: 'cacppt-system',
},
},
],
}
2 changes: 2 additions & 0 deletions component/main.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ local inv = kap.inventory();
// The hiera parameters for the component
local params = inv.parameters.capi_provider_talos;

assert std.member(inv.applications, 'capi-core') : 'Application capi-core is not available';
Comment thread
thobens marked this conversation as resolved.
Outdated

// Define outputs below
{
}
20 changes: 20 additions & 0 deletions scripts/envsubst-dir
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/usr/bin/env bash
set -euo pipefail

src="$1"
dst="$2"

mkdir -p "$dst"

find "$src" -type f -name '*.yaml' -print0 |
while IFS= read -r -d '' file; do
relative="${file#$src/}"
output="$dst/$relative"

mkdir -p "$(dirname "$output")"

envsubst \
-no-unset \
-i "$file" \
-o "$output"
done
3 changes: 3 additions & 0 deletions tests/defaults.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Overwrite parameters here

applications:
- capi-core

# parameters: {...}
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
apiVersion: admissionregistration.k8s.io/v1
kind: ValidatingWebhookConfiguration
metadata:
annotations:
cert-manager.io/inject-ca-from: syn-cluster-api/cabpt-serving-cert
labels:
app.kubernetes.io/managed-by: commodore
cluster.x-k8s.io/provider: bootstrap-talos
name: cabpt-validating-webhook-configuration
webhooks:
- admissionReviewVersions:
- v1
clientConfig:
service:
name: cabpt-webhook-service
namespace: syn-cluster-api
path: /validate-bootstrap-cluster-x-k8s-io-v1alpha3-talosconfig
failurePolicy: Fail
name: vtalosconfig.cluster.x-k8s.io
rules:
- apiGroups:
- bootstrap.cluster.x-k8s.io
apiVersions:
- v1alpha3
operations:
- CREATE
- UPDATE
resources:
- talosconfigs
sideEffects: None
- admissionReviewVersions:
- v1
clientConfig:
service:
name: cabpt-webhook-service
namespace: syn-cluster-api
path: /validate-bootstrap-cluster-x-k8s-io-v1alpha3-talosconfigtemplate
failurePolicy: Fail
name: vtalosconfigtemplate.cluster.x-k8s.io
rules:
- apiGroups:
- bootstrap.cluster.x-k8s.io
apiVersions:
- v1alpha3
operations:
- UPDATE
resources:
- talosconfigtemplates
sideEffects: None
Loading
Loading