From 0564433f12535c15a1435304ca89630eb01e1feb Mon Sep 17 00:00:00 2001 From: Doug Goldstein Date: Tue, 15 Oct 2024 15:09:51 -0500 Subject: [PATCH 1/3] feat: add crossplane to be deployed deploy crossplane with the openstack provider to help bootstrap our OpenStack. --- apps/appsets/operators.yaml | 17 +++++++++++++++++ components/crossplane/kustomization.yaml | 4 ++++ components/crossplane/provider-openstack.yaml | 6 ++++++ 3 files changed, 27 insertions(+) create mode 100644 components/crossplane/kustomization.yaml create mode 100644 components/crossplane/provider-openstack.yaml diff --git a/apps/appsets/operators.yaml b/apps/appsets/operators.yaml index a3ab99c3e..01d69e96c 100644 --- a/apps/appsets/operators.yaml +++ b/apps/appsets/operators.yaml @@ -88,6 +88,23 @@ spec: - repoURL: '{{index .metadata.annotations "uc_deploy_git_url"}}' targetRevision: '{{index .metadata.annotations "uc_deploy_ref"}}' ref: deploy + - component: crossplane + skipComponent: '{{has "crossplane" ((default "[]" (index .metadata.annotations "uc_skip_components") | fromJson))}}' + sources: + - repoURL: https://charts.crossplane.io/stable + chart: crossplane + targetRevision: 1.17.1 + helm: + releaseName: crossplane + valueFiles: + - $deploy/helm-configs/{{.name}}/crossplane.yaml + ignoreMissingValueFiles: true + - repoURL: '{{index .metadata.annotations "uc_repo_git_url"}}' + targetRevision: '{{index .metadata.annotations "uc_repo_ref"}}' + path: 'components/crossplane' + - repoURL: '{{index .metadata.annotations "uc_deploy_git_url"}}' + targetRevision: '{{index .metadata.annotations "uc_deploy_ref"}}' + ref: deploy selector: # by setting the key in the elements 'skipComponent' to 'true' it will skip installing it # ArgoCD's templating operates with strings so it's the string "true" diff --git a/components/crossplane/kustomization.yaml b/components/crossplane/kustomization.yaml new file mode 100644 index 000000000..531743fc2 --- /dev/null +++ b/components/crossplane/kustomization.yaml @@ -0,0 +1,4 @@ +apiVersion: kustomize.config.k8s.io/v1beta1 +kind: Kustomization +resources: +- provider-openstack.yaml diff --git a/components/crossplane/provider-openstack.yaml b/components/crossplane/provider-openstack.yaml new file mode 100644 index 000000000..5fcd88b54 --- /dev/null +++ b/components/crossplane/provider-openstack.yaml @@ -0,0 +1,6 @@ +apiVersion: pkg.crossplane.io/v1 +kind: Provider +metadata: + name: provider-openstack +spec: + package: xpkg.upbound.io/crossplane-contrib/provider-openstack:v0.4.0 From 6440da78e4d3513ffa56c0ab6eba7c199f777924 Mon Sep 17 00:00:00 2001 From: Doug Goldstein Date: Mon, 21 Oct 2024 09:29:18 -0500 Subject: [PATCH 2/3] feat: setup crossplane openstack provider with keystone admin Configure the crossplane openstack provider with the keystone admin account for bootstrap purposes. --- components/keystone/kustomization.yaml | 2 ++ .../keystone/provider-openstack-config.yaml | 11 +++++++ .../secret-keystone-admin-crossplane.yaml | 31 +++++++++++++++++++ 3 files changed, 44 insertions(+) create mode 100644 components/keystone/provider-openstack-config.yaml create mode 100644 components/keystone/secret-keystone-admin-crossplane.yaml diff --git a/components/keystone/kustomization.yaml b/components/keystone/kustomization.yaml index 2883fd294..365ec3fcd 100644 --- a/components/keystone/kustomization.yaml +++ b/components/keystone/kustomization.yaml @@ -6,3 +6,5 @@ resources: - keystone-mariadb-db.yaml - keystone-rabbitmq-queue.yaml - external-secret-keystone-sso.yaml + - secret-keystone-admin-crossplane.yaml + - provider-openstack-config.yaml diff --git a/components/keystone/provider-openstack-config.yaml b/components/keystone/provider-openstack-config.yaml new file mode 100644 index 000000000..c6a675cad --- /dev/null +++ b/components/keystone/provider-openstack-config.yaml @@ -0,0 +1,11 @@ +apiVersion: openstack.crossplane.io/v1beta1 +kind: ProviderConfig +metadata: + name: provider-openstack-config +spec: + credentials: + source: Secret + secretRef: + key: config + name: keystone-admin-crossplane + namespace: openstack diff --git a/components/keystone/secret-keystone-admin-crossplane.yaml b/components/keystone/secret-keystone-admin-crossplane.yaml new file mode 100644 index 000000000..a180a6719 --- /dev/null +++ b/components/keystone/secret-keystone-admin-crossplane.yaml @@ -0,0 +1,31 @@ +apiVersion: external-secrets.io/v1beta1 +kind: ExternalSecret +metadata: + name: keystone-admin-crossplane +spec: + refreshInterval: 1h + secretStoreRef: + kind: ClusterSecretStore + name: openstack + target: + name: keystone-admin-crossplane + template: + engineVersion: v2 + data: + config: | + { + "auth_url": "{{ .OS_AUTH_URL }}", + "user_domain_name": "{{ .OS_USER_DOMAIN_NAME }}", + "user_name": "{{ .OS_USERNAME }}", + "password": "{{ .OS_PASSWORD }}", + "project_domain_name": "{{ .OS_PROJECT_DOMAIN_NAME }}", + "tenant_name": "{{ .OS_PROJECT_NAME }}", + "insecure": "false" + } + dataFrom: + - extract: + key: keystone-keystone-admin + # necessary to avoid argoproj/argo-cd#13004 + conversionStrategy: Default + decodingStrategy: None + metadataPolicy: None From be21e7827645a480f42d50bb8d1f33532edc7a7d Mon Sep 17 00:00:00 2001 From: Doug Goldstein Date: Mon, 21 Oct 2024 09:56:52 -0500 Subject: [PATCH 3/3] feat(nova): disable flavors from bootstrap script Disabled flavors being set from the bootstrap script and document how to create them via a crossplane openstack config. --- components/nova/aio-values.yaml | 6 ++++++ docs/deploy-guide/define-flavors.md | 30 +++++++++++++++++++++++++++++ mkdocs.yml | 1 + 3 files changed, 37 insertions(+) create mode 100644 docs/deploy-guide/define-flavors.md diff --git a/components/nova/aio-values.yaml b/components/nova/aio-values.yaml index b41829b7c..3c0622666 100644 --- a/components/nova/aio-values.yaml +++ b/components/nova/aio-values.yaml @@ -45,6 +45,12 @@ conf: project_domain_name: infra project_name: baremetal +bootstrap: + # disable using the bootstrap script for flavors since it is too limited for our needs + # we'll use crossplane at this time and eventually an operator + structured: + flavors: + enabled: false console: # we are working with baremetal nodes and not QEMU so we don't need novnc or spice diff --git a/docs/deploy-guide/define-flavors.md b/docs/deploy-guide/define-flavors.md new file mode 100644 index 000000000..f87e5e167 --- /dev/null +++ b/docs/deploy-guide/define-flavors.md @@ -0,0 +1,30 @@ +# Defining OpenStack Nova Flavors + +Flavors are used to advertise to the user what hardware types are available +for consumption. Flavors must be defined and configured to map to Ironic +hardware types that are available. + +## Flavor Definition with Crossplane + +Create the following YAML to load. + +```yaml +apiVersion: compute.openstack.crossplane.io/v1alpha1 +kind: FlavorV2 +metadata: + name: gp1-small +spec: + forProvider: + name: gp1.small + vcpus: 16 + ram: 98304 + disk: 480 + isPublic: true + extraSpecs: + 'resources:CUSTOM_BAREMETAL_GP1SMALL': '1' + 'resources:DISK_GB': '0' + 'resources:MEMORY_MB': '0' + 'resources:VCPU': '0' + providerConfigRef: + name: provider-openstack-config +``` diff --git a/mkdocs.yml b/mkdocs.yml index 3765eb248..ff43ff277 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -118,6 +118,7 @@ nav: - deploy-guide/extra-regions.md - deploy-guide/external-argocd.md - deploy-guide/add-remove-app.md + - deploy-guide/define-flavors.md - 'User Guide': - user-guide/index.md - user-guide/openstack-cli.md