From 0833de1b1cfbb8883d646b54249f58710ca3d057 Mon Sep 17 00:00:00 2001 From: Fumigatus Date: Wed, 27 Nov 2024 14:00:36 +0300 Subject: [PATCH] Update providerconfig.yaml and secret.yaml.tmpl. Added datacenter example. --- examples/datacenter/README.md | 10 ++++++++++ examples/datacenter/datacenter.yaml | 11 +++++++++++ examples/datacenter/providerconfig.yaml | 11 +++++++++++ examples/datacenter/secret.yaml.tmpl | 13 +++++++++++++ examples/providerconfig/providerconfig.yaml | 4 ++-- examples/providerconfig/secret.yaml.tmpl | 5 +++-- 6 files changed, 50 insertions(+), 4 deletions(-) create mode 100644 examples/datacenter/README.md create mode 100644 examples/datacenter/datacenter.yaml create mode 100644 examples/datacenter/providerconfig.yaml create mode 100644 examples/datacenter/secret.yaml.tmpl diff --git a/examples/datacenter/README.md b/examples/datacenter/README.md new file mode 100644 index 0000000..a0bab1b --- /dev/null +++ b/examples/datacenter/README.md @@ -0,0 +1,10 @@ +# Datacenter Example +First we need to create vSphere secret and provider. +``` +kubectl create -f secret.yaml +kubectl create -f providerconfig.yaml +``` +After that we can create 'Datacenter' resource via Crossplane. +``` +kubectl create -f datacenter.yaml +``` diff --git a/examples/datacenter/datacenter.yaml b/examples/datacenter/datacenter.yaml new file mode 100644 index 0000000..61aaecd --- /dev/null +++ b/examples/datacenter/datacenter.yaml @@ -0,0 +1,11 @@ +apiVersion: inventory.crossplane.io/v1alpha1 +kind: VSphereDatacenter +metadata: + name: example-datacenter +spec: + forProvider: + name: my-datacenter + providerRef: + name: vsphere + providerConfigRef: + name: vsphere diff --git a/examples/datacenter/providerconfig.yaml b/examples/datacenter/providerconfig.yaml new file mode 100644 index 0000000..1116802 --- /dev/null +++ b/examples/datacenter/providerconfig.yaml @@ -0,0 +1,11 @@ +apiVersion: vsphere.crossplane.io/v1beta1 +kind: ProviderConfig +metadata: + name: vsphere +spec: + credentials: + source: Secret + secretRef: + name: example-creds + namespace: crossplane-system + key: credentials diff --git a/examples/datacenter/secret.yaml.tmpl b/examples/datacenter/secret.yaml.tmpl new file mode 100644 index 0000000..74035c3 --- /dev/null +++ b/examples/datacenter/secret.yaml.tmpl @@ -0,0 +1,13 @@ +apiVersion: v1 +kind: Secret +metadata: + name: example-creds + namespace: crossplane-system +type: Opaque +stringData: + credentials: | + { + "user": "admin", + "password": "t0ps3cr3t11", + "vsphere_server": "my_excellent_vsphere_server" + } diff --git a/examples/providerconfig/providerconfig.yaml b/examples/providerconfig/providerconfig.yaml index 50cf400..1116802 100644 --- a/examples/providerconfig/providerconfig.yaml +++ b/examples/providerconfig/providerconfig.yaml @@ -1,7 +1,7 @@ -apiVersion: vsphere.upbound.io/v1beta1 +apiVersion: vsphere.crossplane.io/v1beta1 kind: ProviderConfig metadata: - name: default + name: vsphere spec: credentials: source: Secret diff --git a/examples/providerconfig/secret.yaml.tmpl b/examples/providerconfig/secret.yaml.tmpl index 6dfa5c8..74035c3 100644 --- a/examples/providerconfig/secret.yaml.tmpl +++ b/examples/providerconfig/secret.yaml.tmpl @@ -7,6 +7,7 @@ type: Opaque stringData: credentials: | { - "username": "admin", - "password": "t0ps3cr3t11" + "user": "admin", + "password": "t0ps3cr3t11", + "vsphere_server": "my_excellent_vsphere_server" }