-
Notifications
You must be signed in to change notification settings - Fork 0
Basic implementation of the capi-core component #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 7 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
f132b1f
Use kustomize as a compile step and substitute capi variables in post…
thobens 5e0ed88
Use jsonnet kustomize helper to generate cluster-api manifests
thobens e34fe7f
Move variable substitution to library
thobens 4e58518
Use https://github.com/a8m/envsubst to substitute variables instead o…
thobens c536205
Simpler kustomize configuration in defaults
thobens f7edb7b
Ignore linting for golden tests as output is from envsubst
thobens 0a8b03f
Use hardcoded path to kustomize folder
thobens 8d0badd
Patch correct controller image
thobens e8869f8
Select kustomize path based on capi version
thobens 7efce02
Download envsubst dependency local to component
thobens File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -22,3 +22,4 @@ ignore: | | |
| manifests/ | ||
| vendor/ | ||
| compiled/ | ||
| tests/golden/** | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| // main template for capi-core | ||
| local com = import 'lib/commodore.libjsonnet'; | ||
| local kap = import 'lib/kapitan.libjsonnet'; | ||
| local inv = kap.inventory(); | ||
| // The hiera parameters for the component | ||
| local params = inv.parameters.capi_core; | ||
|
|
||
| local manifest_path = 'config/default'; | ||
|
|
||
| com.Kustomization( | ||
| 'https://github.com/kubernetes-sigs/cluster-api/' + manifest_path, | ||
| params.images['cluster-api'].tag, | ||
| { | ||
| 'registry.k8s.io/cluster-api/cluster-api-controller': { | ||
| local image = params.images['cluster-api'], | ||
| 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: 'capi-system', | ||
| }, | ||
| }, | ||
| ], | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,10 +1,11 @@ | ||
| // main template for capi-core | ||
| 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_core; | ||
|
|
||
| // Define outputs below | ||
| { | ||
| '00_namespace': kube.Namespace(params.namespace), | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 \ | ||
|
thobens marked this conversation as resolved.
Outdated
|
||
| -no-unset \ | ||
| -i "$file" \ | ||
| -o "$output" | ||
| done | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,9 @@ | ||
| # Overwrite parameters here | ||
| applications: | ||
| - capi-core | ||
|
|
||
| # parameters: {...} | ||
| parameters: | ||
| components: | ||
| capi-core: | ||
| url: https://github.com/projectsyn/component-capi-core.git | ||
| version: alde-262/implement-capi-core-component |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| apiVersion: v1 | ||
| kind: Namespace | ||
| metadata: | ||
| annotations: {} | ||
| labels: | ||
| name: syn-cluster-api | ||
| name: syn-cluster-api |
178 changes: 178 additions & 0 deletions
178
...istration.k8s.io_v1_mutatingwebhookconfiguration_capi-mutating-webhook-configuration.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,178 @@ | ||
| apiVersion: admissionregistration.k8s.io/v1 | ||
| kind: MutatingWebhookConfiguration | ||
| metadata: | ||
| annotations: | ||
| cert-manager.io/inject-ca-from: capi-system/capi-serving-cert | ||
| labels: | ||
| app.kubernetes.io/managed-by: commodore | ||
| cluster.x-k8s.io/provider: cluster-api | ||
| name: capi-mutating-webhook-configuration | ||
| webhooks: | ||
| - admissionReviewVersions: | ||
| - v1 | ||
| clientConfig: | ||
| service: | ||
| name: capi-webhook-service | ||
| namespace: syn-cluster-api | ||
| path: /mutate-cluster-x-k8s-io-v1beta2-cluster | ||
| failurePolicy: Fail | ||
| matchPolicy: Equivalent | ||
| name: default.cluster.cluster.x-k8s.io | ||
| rules: | ||
| - apiGroups: | ||
| - cluster.x-k8s.io | ||
| apiVersions: | ||
| - v1beta2 | ||
| operations: | ||
| - CREATE | ||
| - UPDATE | ||
| resources: | ||
| - clusters | ||
| sideEffects: None | ||
| - admissionReviewVersions: | ||
| - v1 | ||
| clientConfig: | ||
| service: | ||
| name: capi-webhook-service | ||
| namespace: syn-cluster-api | ||
| path: /mutate-addons-cluster-x-k8s-io-v1beta2-clusterresourceset | ||
| failurePolicy: Fail | ||
| matchPolicy: Equivalent | ||
| name: default.clusterresourceset.addons.cluster.x-k8s.io | ||
| rules: | ||
| - apiGroups: | ||
| - addons.cluster.x-k8s.io | ||
| apiVersions: | ||
| - v1beta2 | ||
| operations: | ||
| - CREATE | ||
| - UPDATE | ||
| resources: | ||
| - clusterresourcesets | ||
| sideEffects: None | ||
| - admissionReviewVersions: | ||
| - v1 | ||
| clientConfig: | ||
| service: | ||
| name: capi-webhook-service | ||
| namespace: syn-cluster-api | ||
| path: /mutate-runtime-cluster-x-k8s-io-v1beta2-extensionconfig | ||
| failurePolicy: Fail | ||
| matchPolicy: Equivalent | ||
| name: default.extensionconfig.runtime.addons.cluster.x-k8s.io | ||
| rules: | ||
| - apiGroups: | ||
| - runtime.cluster.x-k8s.io | ||
| apiVersions: | ||
| - v1beta2 | ||
| operations: | ||
| - CREATE | ||
| - UPDATE | ||
| resources: | ||
| - extensionconfigs | ||
| sideEffects: None | ||
| - admissionReviewVersions: | ||
| - v1 | ||
| clientConfig: | ||
| service: | ||
| name: capi-webhook-service | ||
| namespace: syn-cluster-api | ||
| path: /mutate-cluster-x-k8s-io-v1beta2-machine | ||
| failurePolicy: Fail | ||
| matchPolicy: Equivalent | ||
| name: default.machine.cluster.x-k8s.io | ||
| rules: | ||
| - apiGroups: | ||
| - cluster.x-k8s.io | ||
| apiVersions: | ||
| - v1beta2 | ||
| operations: | ||
| - CREATE | ||
| - UPDATE | ||
| resources: | ||
| - machines | ||
| sideEffects: None | ||
| - admissionReviewVersions: | ||
| - v1 | ||
| clientConfig: | ||
| service: | ||
| name: capi-webhook-service | ||
| namespace: syn-cluster-api | ||
| path: /mutate-cluster-x-k8s-io-v1beta2-machinedeployment | ||
| failurePolicy: Fail | ||
| matchPolicy: Equivalent | ||
| name: default.machinedeployment.cluster.x-k8s.io | ||
| rules: | ||
| - apiGroups: | ||
| - cluster.x-k8s.io | ||
| apiVersions: | ||
| - v1beta2 | ||
| operations: | ||
| - CREATE | ||
| - UPDATE | ||
| resources: | ||
| - machinedeployments | ||
| sideEffects: None | ||
| - admissionReviewVersions: | ||
| - v1 | ||
| clientConfig: | ||
| service: | ||
| name: capi-webhook-service | ||
| namespace: syn-cluster-api | ||
| path: /mutate-cluster-x-k8s-io-v1beta2-machinehealthcheck | ||
| failurePolicy: Fail | ||
| matchPolicy: Equivalent | ||
| name: default.machinehealthcheck.cluster.x-k8s.io | ||
| rules: | ||
| - apiGroups: | ||
| - cluster.x-k8s.io | ||
| apiVersions: | ||
| - v1beta2 | ||
| operations: | ||
| - CREATE | ||
| - UPDATE | ||
| resources: | ||
| - machinehealthchecks | ||
| sideEffects: None | ||
| - admissionReviewVersions: | ||
| - v1 | ||
| clientConfig: | ||
| service: | ||
| name: capi-webhook-service | ||
| namespace: syn-cluster-api | ||
| path: /mutate-cluster-x-k8s-io-v1beta2-machinepool | ||
| failurePolicy: Fail | ||
| matchPolicy: Equivalent | ||
| name: default.machinepool.cluster.x-k8s.io | ||
| rules: | ||
| - apiGroups: | ||
| - cluster.x-k8s.io | ||
| apiVersions: | ||
| - v1beta2 | ||
| operations: | ||
| - CREATE | ||
| - UPDATE | ||
| resources: | ||
| - machinepools | ||
| sideEffects: None | ||
| - admissionReviewVersions: | ||
| - v1 | ||
| clientConfig: | ||
| service: | ||
| name: capi-webhook-service | ||
| namespace: syn-cluster-api | ||
| path: /mutate-cluster-x-k8s-io-v1beta2-machineset | ||
| failurePolicy: Fail | ||
| matchPolicy: Equivalent | ||
| name: default.machineset.cluster.x-k8s.io | ||
| rules: | ||
| - apiGroups: | ||
| - cluster.x-k8s.io | ||
| apiVersions: | ||
| - v1beta2 | ||
| operations: | ||
| - CREATE | ||
| - UPDATE | ||
| resources: | ||
| - machinesets | ||
| sideEffects: None |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.