-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
commit 8f311c1daa1c2cc652186348ca4bf3bb93ff55e3 Author: Andrei Pohilko <andrei.pokhilko@gmail.com> Date: Sat Oct 19 21:08:26 2024 +0100 Move dir commit af537004201e7c01ea7f2aa8cf0f18825d56d840 Author: Andrei Pohilko <andrei.pokhilko@gmail.com> Date: Sat Oct 19 20:54:11 2024 +0100 Add some more comments commit cb26c4264c2cd51ae4fcb8fb38ac09521dc213c9 Author: Andrei Pohilko <andrei.pokhilko@gmail.com> Date: Fri Oct 18 16:59:47 2024 +0100 Commit commit 5da0a25f6696a57089b1f055bac193862ac450e5 Author: Andrei Pohilko <andrei.pokhilko@gmail.com> Date: Fri Oct 18 16:21:44 2024 +0100 Testing commit e8c5c0375751d008fa594ecaed42be68059fb32a Author: Andrei Pohilko <andrei.pokhilko@gmail.com> Date: Fri Oct 18 14:35:06 2024 +0100 Working on mega commit 0bcfcce163e97da62f6ad4ca0da12465016b85b9 Author: Andrei Pohilko <andrei.pokhilko@gmail.com> Date: Fri Oct 18 14:17:30 2024 +0100 Progress commit a981d46c521fda13b43523bb888ccb0524848ff4 Author: Andrei Pohilko <andrei.pokhilko@gmail.com> Date: Fri Oct 18 13:38:56 2024 +0100 Composing commit 02323e22a0de4eefb0c455ae65e1f6fe81e8f431 Author: Andrei Pohilko <andrei.pokhilko@gmail.com> Date: Fri Oct 18 13:14:05 2024 +0100 Workshop draft
- Loading branch information
Showing
15 changed files
with
537 additions
and
4 deletions.
There are no files selected for viewing
This file contains 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 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,35 @@ | ||
--- | ||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
name: providers-sa | ||
namespace: crossplane-system | ||
--- | ||
kind: ClusterRole | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
metadata: | ||
name: providers-cr | ||
rules: | ||
- apiGroups: ["*"] | ||
resources: ["*"] | ||
verbs: ["get", "list", "watch", "create", "delete", "patch", "update"] | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRoleBinding | ||
metadata: | ||
name: providers-cr | ||
roleRef: | ||
apiGroup: rbac.authorization.k8s.io | ||
kind: ClusterRole | ||
name: providers-cr | ||
subjects: | ||
- kind: ServiceAccount | ||
name: providers-sa | ||
namespace: crossplane-system | ||
--- | ||
apiVersion: pkg.crossplane.io/v1alpha1 | ||
kind: ControllerConfig | ||
metadata: | ||
name: providers-cc | ||
spec: | ||
serviceAccountName: providers-sa |
This file contains 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,9 @@ | ||
--- | ||
apiVersion: pkg.crossplane.io/v1 | ||
kind: Provider | ||
metadata: | ||
name: provider-kubernetes | ||
spec: | ||
package: xpkg.upbound.io/crossplane-contrib/provider-kubernetes:v0.15.0 | ||
controllerConfigRef: | ||
name: providers-cc # gives it in-cluster write access to create namespaces and other resources |
This file contains 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,8 @@ | ||
--- | ||
apiVersion: kubernetes.crossplane.io/v1alpha1 | ||
kind: ProviderConfig | ||
metadata: | ||
name: k8s-provider-pc | ||
spec: | ||
credentials: | ||
source: InjectedIdentity |
This file contains 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,54 @@ | ||
--- | ||
apiVersion: kubernetes.crossplane.io/v1alpha2 | ||
kind: Object | ||
metadata: | ||
name: ns-for-jobs | ||
spec: | ||
providerConfigRef: | ||
name: k8s-provider-pc | ||
forProvider: | ||
manifest: | ||
apiVersion: v1 | ||
kind: Namespace | ||
metadata: | ||
name: workshop-provider-k8s | ||
|
||
--- | ||
apiVersion: kubernetes.crossplane.io/v1alpha2 | ||
kind: Object | ||
metadata: | ||
name: stray-pod | ||
spec: | ||
providerConfigRef: | ||
name: k8s-provider-pc | ||
forProvider: | ||
manifest: | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
namespace: workshop-provider-k8s | ||
name: pod-orphan-or-stray | ||
spec: | ||
restartPolicy: Always | ||
containers: | ||
- name: demo-dates | ||
image: busybox:latest | ||
imagePullPolicy: IfNotPresent | ||
command: | ||
- /bin/sh | ||
- -c | ||
- ping -w 60 -i 5 localhost && exit $((RANDOM % 2)) | ||
|
||
|
||
# Generic template for K8s Managed Resource: | ||
# --- | ||
# apiVersion: kubernetes.crossplane.io/v1alpha2 | ||
# kind: Object | ||
# metadata: | ||
# name: <MR name> | ||
# spec: | ||
# providerConfigRef: | ||
# name: k8s-provider-pc | ||
# forProvider: | ||
# manifest: | ||
# <any k8s resource manifest goes here> |
This file contains 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,9 @@ | ||
--- | ||
apiVersion: pkg.crossplane.io/v1 | ||
kind: Provider | ||
metadata: | ||
name: provider-helm | ||
spec: | ||
package: xpkg.upbound.io/crossplane-contrib/provider-helm:v0.19.0 | ||
controllerConfigRef: | ||
name: providers-cc # gives it in-cluster write access to create namespaces and other resources |
This file contains 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,8 @@ | ||
--- | ||
apiVersion: helm.crossplane.io/v1beta1 | ||
kind: ProviderConfig | ||
metadata: | ||
name: helm-provider-pc | ||
spec: | ||
credentials: | ||
source: InjectedIdentity |
This file contains 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 @@ | ||
--- | ||
apiVersion: helm.crossplane.io/v1beta1 | ||
kind: Release | ||
metadata: | ||
name: apache-example-mr | ||
spec: | ||
providerConfigRef: | ||
name: helm-provider-pc | ||
forProvider: | ||
chart: | ||
repository: https://charts.bitnami.com/bitnami | ||
name: apache | ||
version: 11.2.21 | ||
namespace: workshop-provider-helm | ||
set: | ||
- name: param1 | ||
value: value1 | ||
values: | ||
service: | ||
type: ClusterIP |
This file contains 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,31 @@ | ||
--- | ||
apiVersion: apiextensions.crossplane.io/v1 | ||
kind: CompositeResourceDefinition | ||
metadata: | ||
name: xkomodorchartsets.xrd.komodor.com | ||
spec: | ||
group: xrd.komodor.com | ||
names: | ||
kind: XKomodorChartSet | ||
plural: xkomodorchartsets | ||
claimNames: | ||
kind: KomodorChartSet | ||
plural: komodorchartsets | ||
versions: | ||
- name: v1alpha1 | ||
served: true | ||
referenceable: true | ||
schema: | ||
openAPIV3Schema: | ||
type: object | ||
properties: | ||
spec: | ||
type: object | ||
properties: | ||
hdashboardVer: | ||
type: string | ||
komoplaneVer: | ||
type: string | ||
required: | ||
- hdashboardVer | ||
- komoplaneVer |
45 changes: 45 additions & 0 deletions
45
examples/workshop/08-composite-step2-define-composition.yaml
This file contains 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,45 @@ | ||
--- | ||
apiVersion: apiextensions.crossplane.io/v1 | ||
kind: Composition | ||
metadata: | ||
name: example-komodorset-composition | ||
spec: | ||
compositeTypeRef: | ||
apiVersion: xrd.komodor.com/v1alpha1 | ||
kind: XKomodorChartSet | ||
resources: | ||
- name: khd-instance | ||
base: | ||
apiVersion: helm.crossplane.io/v1beta1 | ||
kind: Release | ||
spec: | ||
providerConfigRef: | ||
name: helm-provider-pc | ||
forProvider: | ||
chart: | ||
repository: https://helm-charts.komodor.io | ||
name: helm-dashboard | ||
version: 0.1.10 | ||
namespace: komodor | ||
patches: | ||
- type: FromCompositeFieldPath | ||
fromFieldPath: spec.hdashboardVer | ||
toFieldPath: spec.forProvider.chart.version | ||
|
||
- name: komoplane-instance | ||
base: | ||
apiVersion: helm.crossplane.io/v1beta1 | ||
kind: Release | ||
spec: | ||
providerConfigRef: | ||
name: helm-provider-pc | ||
forProvider: | ||
chart: | ||
repository: https://helm-charts.komodor.io | ||
name: komoplane | ||
version: 0.1.5 | ||
namespace: komodor | ||
patches: | ||
- type: FromCompositeFieldPath | ||
fromFieldPath: spec.komoplaneVer | ||
toFieldPath: spec.forProvider.chart.version |
This file contains 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,8 @@ | ||
--- | ||
apiVersion: xrd.komodor.com/v1alpha1 | ||
kind: XKomodorChartSet # Direct XR-style | ||
metadata: | ||
name: my-test-set1 | ||
spec: | ||
hdashboardVer: 0.1.8 | ||
komoplaneVer: 0.1.4 |
This file contains 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,19 @@ | ||
--- | ||
apiVersion: xrd.komodor.com/v1alpha1 | ||
kind: KomodorChartSet # Claim-style | ||
metadata: | ||
namespace: default | ||
name: my-test-set2 | ||
spec: | ||
hdashboardVer: 0.1.10 | ||
komoplaneVer: 0.1.5 | ||
|
||
--- | ||
apiVersion: xrd.komodor.com/v1alpha1 | ||
kind: KomodorChartSet # Claim-style | ||
metadata: | ||
namespace: workshop-provider-helm | ||
name: my-test-set3 | ||
spec: | ||
hdashboardVer: 0.1.9 | ||
komoplaneVer: 0.1.3 # would not exist, causing troubleshooting |
This file contains 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,87 @@ | ||
--- | ||
apiVersion: apiextensions.crossplane.io/v1 | ||
kind: CompositeResourceDefinition | ||
metadata: | ||
name: xmegas.xrd.komodor.com | ||
spec: | ||
group: xrd.komodor.com | ||
names: | ||
kind: XMega | ||
plural: xmegas | ||
claimNames: | ||
kind: Mega | ||
plural: megas | ||
versions: | ||
- name: v1alpha1 | ||
served: true | ||
referenceable: true | ||
schema: | ||
openAPIV3Schema: | ||
type: object | ||
properties: | ||
spec: | ||
type: object | ||
properties: | ||
namespace: | ||
type: string | ||
required: | ||
- namespace | ||
--- | ||
apiVersion: apiextensions.crossplane.io/v1 | ||
kind: Composition | ||
metadata: | ||
name: mega-composition | ||
spec: | ||
compositeTypeRef: | ||
apiVersion: xrd.komodor.com/v1alpha1 | ||
kind: XMega | ||
resources: | ||
- name: provider-k8s-resource | ||
base: | ||
apiVersion: kubernetes.crossplane.io/v1alpha2 | ||
kind: Object | ||
spec: | ||
providerConfigRef: | ||
name: k8s-provider-pc | ||
forProvider: | ||
manifest: | ||
apiVersion: v1 | ||
kind: Namespace | ||
metadata: | ||
name: "" # will be set via patches | ||
patches: | ||
- type: FromCompositeFieldPath | ||
fromFieldPath: spec.namespace | ||
toFieldPath: spec.forProvider.manifest.metadata.name | ||
|
||
- name: provider-helm-release | ||
base: | ||
apiVersion: helm.crossplane.io/v1beta1 | ||
kind: Release | ||
spec: | ||
providerConfigRef: | ||
name: helm-provider-pc | ||
forProvider: | ||
chart: | ||
repository: https://charts.bitnami.com/bitnami | ||
name: apache | ||
version: 11.2.21 | ||
namespace: "default" # This will be dynamically overwritten | ||
skipCreateNamespace: true | ||
patches: | ||
- type: FromCompositeFieldPath | ||
fromFieldPath: spec.namespace | ||
toFieldPath: spec.forProvider.namespace | ||
- name: composition-of-compositions | ||
base: | ||
apiVersion: xrd.komodor.com/v1alpha1 | ||
kind: XKomodorChartSet | ||
metadata: | ||
namespace: "" | ||
spec: | ||
hdashboardVer: 0.1.10 | ||
komoplaneVer: 0.1.5 | ||
patches: | ||
- type: FromCompositeFieldPath | ||
fromFieldPath: spec.namespace | ||
toFieldPath: metadata.namespace |
This file contains 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,8 @@ | ||
--- | ||
apiVersion: xrd.komodor.com/v1alpha1 | ||
kind: Mega | ||
metadata: | ||
namespace: default | ||
name: mega-composition-instance1 | ||
spec: | ||
namespace: test1 |
Oops, something went wrong.