Prepare RHOSO secrets with Validated Patterns

This chapter prepares every Secret used during the connected RHOSO installation (osp-secret, libvirt-secret, cinder-nfs-config, dataplane SSH keys, subscription manager, and Red Hat registry) by filling a local values-secret.yaml file and loading it with the Validated Patterns framework.

Do not commit secret values to Git. Keep them only in the local secrets file (and optionally encrypt it with Ansible Vault). For the full framework reference, see Secrets management in the Validated Patterns framework.

1. Enable the secrets loader (none backend)

This lab uses the none secrets backend so bootstrap secrets are injected directly into openstack (via targetNamespaces). That matches the filled values-secret.yaml below. On the bastion, in your forked pattern repository:

cd /home/lab-user/rhoso-gitops

Edit values-global.yaml so secret loading is enabled and the backend is none:

vim values-global.yaml
---
[...]
global:
  pattern: rhoso-gitops
  secretLoader:
    disabled: false
  secretStore:
    backend: none
[...]
Do not commit a filled values-secret.yaml. The pattern .gitignore already excludes values-secret.yaml. You may commit the values-global.yaml change above (it contains no secret material).

Commit the files created and push them to your GitHub repo:

git add values-global.yaml
git commit -m "Configure the secrets loader (none backend) in the values-global.yaml file"
git push origin

2. Prepare SSH key material for bootstrap secrets

The pattern expects key files under your home directory. expects key files under your home directory. Create the Nova migration key pair and copy the bastion dataplane keys to those paths:

cp "/home/lab-user/.ssh/{guid}key.pem" ~/dataplane-ansible-ssh-privatekey
cp "/home/lab-user/.ssh/{guid}key.pub" ~/dataplane-ansible-ssh-publickey

ssh-keygen -f ~/nova-migration-ssh-privatekey -t ecdsa-sha2-nistp521 -N ''
cp ~/nova-migration-ssh-privatekey.pub ~/nova-migration-ssh-publickey

3. Create your local values-secret.yaml

The pattern ships an empty template at values-secret.yaml.template. The loader searches for a secrets file in this order and uses the first match:

  1. ~/.config/hybrid-cloud-patterns/values-secret-rhoso-gitops.yaml

  2. ~/.config/validated-patterns/values-secret-rhoso-gitops.yaml

  3. ~/values-secret-rhoso-gitops.yaml

  4. ~/values-secret.yaml

  5. {{ pattern_dir }}/values-secret.yaml.template

For this lab, copy the template next to the pattern and fill it in:

cd /home/lab-user/rhoso-gitops
cp values-secret.yaml.template ~/values-secret.yaml

Write the secrets file. Demo control-plane passwords match the connected lab files (openstack). Replace the Red Hat credential placeholders with your own values.

Add your username and password from the Red Hat Customer Portal for subscription-manager, and a Registry Service Account token for redhat-registry.
This lab uses global.secretStore.backend: none, so OpenStack secrets are injected directly as bootstrap secrets into openstack. The upstream template also documents a vault-approle-secret-id entry for Vault+ESO; omit it here.
cat > ~/values-secret.yaml <<'EOF'
---
# Secrets documentation:
# https://validatedpatterns.io/learn/secrets-management-in-the-validated-patterns-framework/
#
# RHOSO secrets documentation:
# https://docs.redhat.com/en/documentation/red_hat_openstack_services_on_openshift/18.0/html/deploying_red_hat_openstack_services_on_openshift/assembly_preparing-rhocp-for-rhoso#proc_providing-secure-access-to-the-RHOSO-services_preparing
#
# Schema:
# https://github.com/validatedpatterns/rhvp.cluster_utils/tree/main/roles/vault_utils#values-secret-file-format
# Template:
# https://raw.githubusercontent.com/validatedpatterns-sandbox/rhoso-gitops/e887e5f813433d50bc4ea9e5edf78fb3c4eeb753/values-secret.yaml.template
version: "2.0"

bootstrap_secrets:

  - name: dataplane-ansible-ssh-private-key-secret
    targetNamespaces:
      - openstack
    fields:
      - name: ssh-privatekey
        path: ~/dataplane-ansible-ssh-privatekey
        onMissingValue: error
      - name: ssh-publickey
        path: ~/dataplane-ansible-ssh-publickey
        onMissingValue: error
      - name: authorized_keys
        path: ~/dataplane-ansible-ssh-publickey
        onMissingValue: error

  - name: libvirt-secret
    targetNamespaces:
      - openstack
    fields:
      - name: LibvirtPassword
        value: "openstack"
        onMissingValue: error

  - name: nova-migration-ssh-key
    targetNamespaces:
      - openstack
    fields:
      - name: ssh-privatekey
        path: ~/nova-migration-ssh-privatekey
        onMissingValue: error
      - name: ssh-publickey
        path: ~/nova-migration-ssh-publickey
        onMissingValue: error

  - name: osp-secret
    targetNamespaces:
      - openstack
    fields:
      - name: AdminPassword
        value: "openstack"
        onMissingValue: error
      - name: AodhDatabasePassword
        value: "openstack"
        onMissingValue: error
      - name: AodhPassword
        value: "openstack"
        onMissingValue: error
      - name: BarbicanDatabasePassword
        value: "openstack"
        onMissingValue: error
      - name: BarbicanPassword
        value: "openstack"
        onMissingValue: error
      - name: BarbicanSimpleCryptoKEK
        value: "openstack"
        onMissingValue: error
      - name: CeilometerPassword
        value: "openstack"
        onMissingValue: error
      - name: CinderDatabasePassword
        value: "openstack"
        onMissingValue: error
      - name: CinderPassword
        value: "openstack"
        onMissingValue: error
      - name: DatabasePassword
        value: "openstack"
        onMissingValue: error
      - name: DbRootPassword
        value: "openstack"
        onMissingValue: error
      - name: DesignateDatabasePassword
        value: "openstack"
        onMissingValue: error
      - name: DesignatePassword
        value: "openstack"
        onMissingValue: error
      - name: GlanceDatabasePassword
        value: "openstack"
        onMissingValue: error
      - name: GlancePassword
        value: "openstack"
        onMissingValue: error
      - name: HeatAuthEncryptionKey
        value: "LQAgfMCHTxyTVQEab49MKCNaS5GBLyFd"
        onMissingValue: error
      - name: HeatDatabasePassword
        value: "openstack"
        onMissingValue: error
      - name: HeatPassword
        value: "openstack"
        onMissingValue: error
      - name: IronicDatabasePassword
        value: "openstack"
        onMissingValue: error
      - name: IronicInspectorDatabasePassword
        value: "openstack"
        onMissingValue: error
      - name: IronicInspectorPassword
        value: "openstack"
        onMissingValue: error
      - name: IronicPassword
        value: "openstack"
        onMissingValue: error
      - name: KeystoneDatabasePassword
        value: "openstack"
        onMissingValue: error
      - name: ManilaDatabasePassword
        value: "openstack"
        onMissingValue: error
      - name: ManilaPassword
        value: "openstack"
        onMissingValue: error
      - name: MetadataSecret
        value: "openstack"
        onMissingValue: error
      - name: NeutronDatabasePassword
        value: "openstack"
        onMissingValue: error
      - name: NeutronPassword
        value: "openstack"
        onMissingValue: error
      - name: NovaAPIDatabasePassword
        value: "openstack"
        onMissingValue: error
      - name: NovaCell0DatabasePassword
        value: "openstack"
        onMissingValue: error
      - name: NovaCell1DatabasePassword
        value: "openstack"
        onMissingValue: error
      - name: NovaPassword
        value: "openstack"
        onMissingValue: error
      - name: OctaviaDatabasePassword
        value: "openstack"
        onMissingValue: error
      - name: OctaviaHeartbeatKey
        value: "openstack"
        onMissingValue: error
      - name: OctaviaPassword
        value: "openstack"
        onMissingValue: error
      - name: PlacementDatabasePassword
        value: "openstack"
        onMissingValue: error
      - name: PlacementPassword
        value: "openstack"
        onMissingValue: error
      - name: SwiftPassword
        value: "openstack"
        onMissingValue: error
      - name: WatcherPassword
        value: "openstack"
        onMissingValue: error

  - name: cinder-nfs-config
    targetNamespaces:
      - openstack
    fields:
      - name: nfs-cinder-conf
        value: |
          [nfs]
          nas_host=172.18.0.13
          nas_share_path=/nfs/cinder
        onMissingValue: error

  - name: redhat-registry
    targetNamespaces:
      - openstack
    fields:
      - name: edpm_container_registry_logins
        value: '{"registry.redhat.io": {"<username>": "<password>"}}'
        onMissingValue: error

  - name: subscription-manager
    targetNamespaces:
      - openstack
    fields:
      - name: rhc_auth
        value: '{"login": {"username": "your_username", "password": "your_password"}}'
        onMissingValue: error

secrets: []
EOF

Field values can use value (literal), path (file contents, with ~ expansion), or ini_file / ini_key. See the Validated Patterns fields sub-parameters documentation. Optionally encrypt the file at rest with ansible-vault encrypt ~/values-secret.yaml.

Configure the secrets validated patterns section in the values-rhoso-gitops.yaml file

On the bastion, in your forked pattern repository:

cd /home/lab-user/rhoso-gitops

Edit overrides/values-rhoso-gitops.yaml so secrets is disabled since we are using the none backend and secrets are injected directly as bootstrap secrets into openstack.

cat >> overrides/values-rhoso-gitops.yaml <<EOF
  openstack-secrets:
    enabled: false
EOF

Commit the files created and push them to your GitHub repo:

git add overrides/values-rhoso-gitops.yaml
git commit -m "Configure secrets validated patterns section in the values-rhoso-gitops.yaml file"
git push origin