Creating the RHOSO Control Plane Base Configuration

Creating the initial overlay

Change directory to your base forked gitops repo, in your bastion:

cd /home/lab-user/labrepo/content/files/manifests

Create the environment/base directory

mkdir -p environments/base
cat > environments/base/kustomization.yaml <<EOF
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

components:
  - https://github.com/openstack-gitops/rhoso-gitops/base/initialize/gitops/components/annotations?ref=main

resources:
  - https://github.com/rh-osp-demo/showroom_osp-on-ocp-day2/content/files/manifests/base/controlplane/?ref=main
EOF

Validate the base configuration can be generated with kustomize build:

kustomize build environments/base

Creating the Control plane Environment Overlay

Configuring OpenShift Networking for RHOS

Creating the environment overlay configuration

Create an environment directory to store the managed cluster overlay configuration:

mkdir -p environments/demo-env/controlplane/

Create the kustomization.yaml for the demo-env environment overlay configuration:

cat > environments/demo-env/controlplane/kustomization.yaml <<EOF
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

resources:
  - ../../../base/controlplane
EOF

Validate the base configuration can be generated with kustomize build:

kustomize build environments/demo-env/controlplane

Patching the NodeNetworkConfigurationPolicy

Update the NodeNetworkConfigurationPolicy manifests in our base configuration, including updating the nodeSelector hostname. For more information about the NodeNetworkConfigurationPolicy manifest and retrieving the OpenShift worker nodes, see Use the information provided by the procedure in the Preparing RHOCP with isolated network interfaces guide for the patches being added to the kustomization.yaml configuration. In our worked example, all changes will be applied to the environments/demo-env/kustomization.yaml file unless stated otherwise.

Create a kustomization patch to update the nodeSelector hostnames and NodeNetworkConfigurationPolicy object name:

Edit the kustomization.yaml created in the previous step:

vim environments/demo-env/controlplane/kustomization.yaml

And add the patches, for example to match nnpc of every worker to the the hostname of our cluster:

apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

resources:
  - ../../../base/controlplane

patches:
  - target:
      group: nmstate.io
      version: v1
      kind: NodeNetworkConfigurationPolicy
      name: osp-multi-nic-worker-ocp4-worker1
    patch: |-
      - op: replace
        path: /metadata/name
        value: "control-plane-cluster-my-guid-1"
      - op: replace
        path: /spec/nodeSelector/kubernetes.io~1hostname
        value: "control-plane-cluster-my-guid-1"

  - target:
      group: nmstate.io
      version: v1
      kind: NodeNetworkConfigurationPolicy
      name: osp-multi-nic-worker-ocp4-worker2
    patch: |-
      - op: replace
        path: /metadata/name
        value: "control-plane-cluster-my-guid-2"
      - op: replace
        path: /spec/nodeSelector/kubernetes.io~1hostname
        value: "control-plane-cluster-my-guid-2"

  - target:
      group: nmstate.io
      version: v1
      kind: NodeNetworkConfigurationPolicy
      name: osp-multi-nic-worker-ocp4-worker3
    patch: |-
      - op: replace
        path: /metadata/name
        value: "control-plane-cluster-my-guid-3"
      - op: replace
        path: /spec/nodeSelector/kubernetes.io~1hostname
        value: "control-plane-cluster-my-guid-3"

  - target:
      kind: NetConfig
      name: openstacknetconfig
    patch: |-
      - op: replace
        path: /spec/networks/0/dnsDomain
        value: ctlplane.sandbox-my-guid-ocp4-cluster.svc.cluster.local
      - op: replace
        path: /spec/networks/1/dnsDomain
        value: internalapi.sandbox-my-guid-ocp4-cluster.svc.cluster.local
      - op: replace
        path: /spec/networks/2/dnsDomain
        value: tenant.sandbox-my-guid-ocp4-cluster.svc.cluster.local
      - op: replace
        path: /spec/networks/3/dnsDomain
        value: storage.sandbox-my-guid-ocp4-cluster.svc.cluster.local
      - op: replace
        path: /spec/networks/4/dnsDomain
        value: external.sandbox-my-guid-ocp4-cluster.svc.cluster.local

Validate the base configuration can be generated with kustomize build:

kustomize build environments/demo-env/controlplane/

Commit the files created and push it to your github repo:

git add .
git commit -m "Base and demo-env environment controlplane"
git push origin

Deploying the control plane overlay using a GitOps Application

Deploy the RHOSO control plane using a GitOps Application which will be deployed using sync-waves, resulting in the automated deployment of the environment on OpenShift.

Make a directory to hold the Application manifest:

mkdir -p applications/rhoso

Create the Application manifest:

replace $your_github_id string with your Github id
cat > applications/rhoso/application-environment-demo-env-controlplane.yaml <<EOF
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
  finalizers:
  - resources-finalizer.argocd.argoproj.io
  name: environment-rhoso-demo-env-controlplane
  namespace: openshift-gitops
spec:
  destination:
    server: https://kubernetes.default.svc
  project: default
  source:
    path: content/files/manifests/environments/demo-env/controlplane/
    repoURL: https://github.com/$your_github_id/showroom_osp-on-ocp-day2.git
    targetRevision: HEAD
  syncPolicy:
    automated: {}
EOF

Deploy the RHOSO control plane with the GitOps Application:

oc create --save-config -f applications/rhoso/application-environment-demo-env-controlplane.yaml

Wait for the Application to deploy successfully:

oc wait --timeout=600s -nopenshift-gitops applications.argoproj.io/environment-rhoso-demo-env-controlplane --for jsonpath='{.status.health.status}'=Healthy

Wait for the Application to deploy successfully. Type Control + C, to exit the wait command:

oc get -n openshift-gitops application.argoproj.io environment-rhoso-demo-env-controlplane -w

Wait until the OpenStack control plane deployment is completed:

oc get openstackcontrolplane -n openstack -w
This can take several minutes.

Type Control + C, to exit the wait command when you see message "Setup Complete"

Sample Output
NAME                                 STATUS   MESSAGE
openstack-control-plane   True     Setup complete