|
1 | | -# rhoso-gitops |
| 1 | +# Deploying and managing Red Hat OpenStack Services on OpenShift with GitOps |
2 | 2 |
|
3 | | -An implementation of Red Hat GitOps (GitOps, ArgoCD) for managing the |
| 3 | +This repository contains an implementation of Red Hat GitOps (GitOps, ArgoCD) for managing the |
4 | 4 | deployment of Red Hat OpenStack Services on OpenShift (RHOSO). |
5 | 5 |
|
6 | | -**WARNING**: _Contents of this repository are a work in progress and not yet |
7 | | -ready for usage in a production environment. The organization or contents of |
8 | | -this repository may change drastically at any time._ |
9 | | - |
10 | | -## Repository Layout |
| 6 | +**WARNING**: _This repository is provided as a Developer Preview for testing environments only, |
| 7 | +before all features have been implemented and tested. Therefore, some functionality may be absent, |
| 8 | +incomplete, or not work as expected, and is subject to change until the official release. |
| 9 | +Red Hat encourages customers to use the Developer Preview release to provide feedback._ |
11 | 10 |
|
12 | | -* `applications/` |
13 | | - * contains the base GitOps Operator (ArgoCD) Application manifests for |
14 | | - ArgoCD to manage push-install from the hub cluster to the managed cluster |
15 | | -* `base/` |
16 | | - * contains base deployment knowledge not (yet) contained in the validated |
17 | | - architectures repository in support of OpenStack deployments with RHOSO |
18 | | -* `orchestration/` (deprecated) |
19 | | - * contains the configuration to deploy for OpenShift GitOps (ArgoCD) |
20 | | - for cluster-scoped management on both the hub cluster and managed cluster |
| 11 | +## Prerequisites: Use pinned resources |
21 | 12 |
|
22 | | -## Deployment |
| 13 | +In your `kustomization.yaml` and related resources, make sure to use |
| 14 | +a fixed reference `?ref=VALUE`, where `VALUE` is a hash or a tag. |
23 | 15 |
|
24 | | -Manifests are managed with _kustomize_ (https://kustomize.io/) and can be |
25 | | -applied directly with `oc apply -k <directory>`. |
| 16 | +## Deploy the OpenShift GitOps Operator |
26 | 17 |
|
27 | | -Expected order of operations is: |
| 18 | +### Option 1: Deploy automatically with the included helper playbook |
| 19 | +We provide a light playbook to facilitate the operator deployment and |
| 20 | +subsequent ArgoCD instance configuration. |
28 | 21 |
|
29 | | -* (optional) Deploy Red Hat Advanced Cluster Manager (RHACM) and configure it |
30 | | - so deployment of OpenShift clusters is possible (the hub cluster). |
31 | | -* Deploy ArgoCD to the hub cluster or unmanaged cluster. |
32 | | - * Use the `base/initialize/gitops/` directory to deploy Red Hat OpenShift |
33 | | - GitOps and the initial ArgoCD deployment. |
34 | | -* Create the base Applications from `applications/` to the hub or unmanaged cluster. |
35 | | -* Create your [environments](https://github.com/openstack-gitops/environments) |
36 | | - in a private repository for deployment. |
37 | | -* Deploy `environments/`. |
| 22 | +[Read the playbook documentation](./openshift-gitops.deploy/README.md). |
38 | 23 |
|
39 | | -### Bootstrap Red Hat GitOps |
| 24 | +### Option 2: Deploy manually with `oc apply` commands |
| 25 | +1. Create the namespace, operatorgroup and subscription: |
| 26 | + ```shell |
| 27 | + oc apply -k openshift-gitops.deploy/subscribe |
| 28 | + ``` |
| 29 | +1. Ensure that the namespace is present: |
| 30 | + ```shell |
| 31 | + oc get namespace openshift-gitops |
| 32 | + ``` |
| 33 | +1. Configure the RBAC and ArgoCD instance: |
| 34 | + ```shell |
| 35 | + oc apply -k openshift-gitops.deploy/enable |
| 36 | + ``` |
| 37 | +1. Ensure that the ArgoCD instance is running: |
| 38 | + ```shell |
| 39 | + oc -n openshift-gitops get argocd/openshift-gitops |
| 40 | + ``` |
40 | 41 |
|
41 | | -You must first install Red Hat GitOps (GitOps) to provide the automation system |
42 | | -for deploying RHOSO. Installation of GitOps can be done on a hub cluster or an |
43 | | -unmanaged cluster. If installed on the hub cluster, you can use a GitOps |
44 | | -Application to deploy GitOps on the managed cluster. If you are not using a hub |
45 | | -cluster, then installation of GitOps on the unmanaged cluster must done first. |
| 42 | +## Deploy the Vault Secrets Operator (VSO) |
46 | 43 |
|
47 | | -_Prerequisites_ |
| 44 | +HashiCorp Vault is used to store secrets, and VaultStaticSecret are used to |
| 45 | +pull those secrets into OCP. |
48 | 46 |
|
49 | | -* You have installed Ansible on the workstation. |
50 | | -* You have installed the Ansible collection `kubernetes.core.k8s`. |
51 | | -* You have installed Kustomize on the workstation. |
52 | | -* You have logged into the OpenShift cluster as the kubeadmin user you want GitOps to be deployed to. |
| 47 | +**Procedure** |
| 48 | +1. Create the subscription using ArgoCD: |
| 49 | + ```shell |
| 50 | + oc apply -f applications/vault-secrets-operator.yaml |
| 51 | + ``` |
53 | 52 |
|
54 | | -_Procedure_ |
| 53 | +**Links** |
| 54 | +* [Learn more about VSO](https://developer.hashicorp.com/vault/docs/deploy/kubernetes/vso). |
| 55 | +* [VSO on catalog.redhat.com](https://catalog.redhat.com/en/software/containers/hashicorp/vault-secrets-operator-bundle/64ddcd189d40d16b88133fd8) |
55 | 56 |
|
56 | | -Use the `deployment.playbook` script to automate the installation of Red Hat GitOps with Ansible and Kustomize. |
| 57 | +## ArgoCD orchestration principles |
57 | 58 |
|
58 | | -* Login to the OpenShift cluster as the kubeadmin user from the workstation. |
59 | | -* Install the Red Hat GitOps Operator and deploy an ArgoCD instance with the `deployment.playbook` script: |
60 | | - ``` |
61 | | - $ ./base/initialize/gitops/deployment.playbook |
62 | | - ``` |
63 | | -Alternatively, deploy Red Hat GitOps and ArgoCD with Kustomize directly in stages. |
| 59 | +### Sync-waves |
64 | 60 |
|
65 | | -* Login to the OpenShift cluster as the kubeadmin user from the workstation. |
66 | | -* Install the Red Hat GitOps Operator: |
67 | | - ``` |
68 | | - $ oc create --save-config -k base/initialize/gitops/subscribe |
69 | | - ``` |
70 | | -* Validate the Subscription has been completed. The subscription status should return: |
71 | | - ``` |
72 | | - $ oc get subscription.operators.coreos.com/openshift-gitops-operator \ |
73 | | - --namespace openshift-gitops-operator -ojsonpath='{.status.state}' |
74 | | - ``` |
75 | | -* When the value returned is `AtLastKnown`, then continue by deploying and ArgoCD instance. |
| 61 | +We’re using sync-waves annotations for specific jobs and actions. |
76 | 62 |
|
77 | | -* Create the ArgoCD instance: |
78 | | - ``` |
79 | | - $ oc create --save-config -k base/initialize/gitops/enable |
80 | | - ``` |
| 63 | +The range -20;20 is reserved. |
81 | 64 |
|
82 | | -### Set up Red Hat Advanced Cluster Management for GitOps |
| 65 | +### Healthchecks |
83 | 66 |
|
84 | | -When using Red Hat Advanced Cluster Management (RHACM) to support GitOps |
85 | | -Applications for managed clusters, we will configure the hub cluster in |
86 | | -preparation for using GitOps to support managed cluster configuration. |
| 67 | +TBD |
87 | 68 |
|
88 | | -If you are using GitOps on an unmanaged cluster without RHACM, then this will |
89 | | -be unnecessary. |
| 69 | +## Application responsibilities and content |
90 | 70 |
|
91 | | -_Prerequisites_ |
| 71 | +### openstack-operator |
92 | 72 |
|
93 | | -* You have installed and setup RHACM (hub cluster) for your hardware |
94 | | - environment that will host the managed OpenShift deployment. |
95 | | -* You are logged into the hub cluster as the kubeadmin user. |
96 | | -* You have installed Red Hat GitOps. |
| 73 | +#### Purpose |
97 | 74 |
|
98 | | -_Procedure_ |
| 75 | +Installs the foundational OpenStack operators required for the deployment. Covers [Installation Documentation Chapter 1](https://docs.redhat.com/en/documentation/red_hat_openstack_services_on_openshift/18.0/html/deploying_red_hat_openstack_services_on_openshift/assembly_installing-and-preparing-the-openstack-operator) and part of [Installation Documentation Chapter 2](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_creating-the-openstack-namespace_preparing) |
99 | 76 |
|
100 | | -* Setup RHACM for RHOSO cluster deployments and placements with GitOps: |
101 | | - ``` |
102 | | - oc apply -k base/cluster/hub/advanced-cluster-managment/ |
103 | | - ``` |
104 | | -* Add your cluster and place it in the `rhoso` ClusterSet |
| 77 | +#### Key resources |
105 | 78 |
|
106 | | -## Accessing the user interface for OpenShift GitOps |
| 79 | +* **Namespaces:** `openstack`, `openstack-operators` |
| 80 | +* **Operator Subscription:** OpenStack operator from Red Hat CDN |
| 81 | +* **RBAC:** Install plan approver service account and roles |
| 82 | +* **Job:** `approve-openstack-installplan` to "imperatively" accept the `install_plan` created by `OLM` and wait for its completion. |
107 | 83 |
|
108 | | -You can view progress and management of the Applications by looking up the host |
109 | | -address with `oc`. |
| 84 | +### openstack-operator-cr |
110 | 85 |
|
111 | | -_Procedure_ |
112 | | - |
113 | | -* Look up the host address of the OpenShift GitOps user interface: |
114 | | - ``` |
115 | | - $ oc get route/openshift-gitops-server -nopenshift-gitops -ojsonpath='{.spec.host}' |
116 | | - ``` |
| 86 | +#### Purpose |
117 | 87 |
|
118 | | -## Deploy Prerequisites |
| 88 | +Creates the main OpenStack custom resource that defines the overall OpenStack deployment configuration. Covers [Installation Documentation Chapter 1](https://docs.redhat.com/en/documentation/red_hat_openstack_services_on_openshift/18.0/html/deploying_red_hat_openstack_services_on_openshift/assembly_installing-and-preparing-the-openstack-operator). |
119 | 89 |
|
120 | | -Deploy the prerequisites for deployment of a RHOSO environment by creating the |
121 | | -`openstack-prerequisites` GitOps Application. |
| 90 | +#### Key resources |
122 | 91 |
|
123 | | -_Procedure_ |
| 92 | +* **OpenStack CR:** Primary configuration object in `openstack-operators` namespace |
124 | 93 |
|
125 | | -* Create the `openstack-prerequisites` GitOps Application: |
126 | | -``` |
127 | | -$ oc create --save-config -k applications/base/prerequisites |
128 | | -``` |
| 94 | +### openstack-networks |
| 95 | + |
| 96 | +#### Purpose |
| 97 | + |
| 98 | +Create underlying networks for controlplane and dataplane. Covers [Installation Documentation Chapter 3](https://docs.redhat.com/en/documentation/red_hat_openstack_services_on_openshift/18.0/html/deploying_red_hat_openstack_services_on_openshift/assembly_preparing-rhoso-networks_preparing). |
| 99 | + |
| 100 | +#### Key resources |
| 101 | + |
| 102 | +* [3.2.1. Preparing RHOCP with isolated network interfaces](https://docs.redhat.com/en/documentation/red_hat_openstack_services_on_openshift/18.0/html-single/deploying_red_hat_openstack_services_on_openshift/index#proc_preparing-RHOCP-with-isolated-network-interfaces_preparing_networks): for `NodeNetworkConfigurationPolicies` resources |
| 103 | +* [3.2.2. Attaching service pods to the isolated networks](https://docs.redhat.com/en/documentation/red_hat_openstack_services_on_openshift/18.0/html-single/deploying_red_hat_openstack_services_on_openshift/index#proc_attaching-service-pods-to-the-isolated-networks_preparing_networks): for `NetworkAttachmentDefinitions` resources |
| 104 | +* [3.2.3. Preparing RHOCP for RHOSO network VIPS](https://docs.redhat.com/en/documentation/red_hat_openstack_services_on_openshift/18.0/html-single/deploying_red_hat_openstack_services_on_openshift/index#proc_preparing-RHOCP-for-RHOSO-network-VIPs_preparing_networks) for `L2Advertisements` and `IPAdrressPool` resources |
| 105 | +* [3.3. CREATING THE DATA PLANE NETWORK](https://docs.redhat.com/en/documentation/red_hat_openstack_services_on_openshift/18.0/html-single/deploying_red_hat_openstack_services_on_openshift/index#proc_creating-the-data-plane-network_preparing_networks): for `NetConfig` resources |
| 106 | + |
| 107 | +### openstack-controlplane |
| 108 | + |
| 109 | +#### Purpose |
| 110 | + |
| 111 | +Deploys and configures `OpenStackControlPlane` resource. Covers [Installation Documentation Chapter 4](https://docs.redhat.com/en/documentation/red_hat_openstack_services_on_openshift/18.0/html/deploying_red_hat_openstack_services_on_openshift/assembly_creating-the-control-plane) |
| 112 | + |
| 113 | +#### Key resources |
| 114 | + |
| 115 | +* `OpenStackControlPlane` |
| 116 | + |
| 117 | +### openstack-dataplane |
| 118 | + |
| 119 | +#### Purpose |
| 120 | + |
| 121 | +Deploys and configures the OpenStack data plane nodes. Covers [Installation Documentation Chapter 5](https://docs.redhat.com/en/documentation/red_hat_openstack_services_on_openshift/18.0/html/deploying_red_hat_openstack_services_on_openshift/assembly_creating-the-data-plane) |
| 122 | + |
| 123 | +#### Key resources |
| 124 | + |
| 125 | +* `OpenStackDataPlaneNodeSet` |
| 126 | +* `OpenStackDataPlaneDeployment` |
| 127 | + |
| 128 | +## What’s NOT covered by ArgoCD applications yet |
| 129 | + |
| 130 | +### Dependencies installation |
| 131 | + |
| 132 | +Dependencies such as `MetalLB`, `NMState` and `Cert-Manager` are not deployed nor managed using ArgoCD Application yet. |
| 133 | + |
| 134 | +### Secret management and creation |
| 135 | + |
| 136 | +Secrets are to be stored within a secure service, such as HashiCorp Vault, and never in Git. Our main focus for now is on the RHOSO application slicing, we will provide an ArgoCD Application definition later. |
| 137 | + |
| 138 | +## Consume proposed components |
| 139 | + |
| 140 | +### Base controlplane |
| 141 | + |
| 142 | +Provides the base for IPAddressPool, L2Advertisement, NetworkAttachementDefinition, |
| 143 | +NetConfig NodeNetworkConfigurationPolicy and OpenStackControlPlane on a 3-master OCP cluster. |
| 144 | + |
| 145 | +The CR are extracted from the |
| 146 | +[RHOSO official documentation](https://docs.redhat.com/en/documentation/red_hat_openstack_services_on_openshift/18.0/html/deploying_red_hat_openstack_services_on_openshift/assembly_creating-the-control-plane) |
| 147 | + |
| 148 | +### Base dataplane |
| 149 | + |
| 150 | +Provides the base for the OpenStackDataplaneNodeSet and OpenStackDataPlaneDeployment. |
| 151 | + |
| 152 | +The CRs are extracted from the |
| 153 | +[RHOSO official documentation](https://docs.redhat.com/en/documentation/red_hat_openstack_services_on_openshift/18.0/html/deploying_red_hat_openstack_services_on_openshift/assembly_creating-the-data-plane) |
| 154 | + |
| 155 | +### ArgoCD sync-wave annotation |
| 156 | +These annotations enable ArgoCD to determine the order that resources are created for the whole RHOSO cloud. |
| 157 | +[Learn more about sync-waves](https://argo-cd.readthedocs.io/en/stable/user-guide/sync-waves/) |
| 158 | + |
| 159 | +**Example usage** |
| 160 | +1. Directly within the Application definition: |
| 161 | + ```yaml |
| 162 | + apiVersion: argoproj.io/v1alpha1 |
| 163 | + kind: Application |
| 164 | + metadata: |
| 165 | + # [...] |
| 166 | + spec: |
| 167 | + project: "default" |
| 168 | + source: |
| 169 | + repoURL: "..." |
| 170 | + targetRevision: "..." |
| 171 | + path: "..." |
| 172 | + kustomize: |
| 173 | + components: |
| 174 | + - https://github.com/openstack-gitops/rhoso-gitops/components/argocd/annotations?ref=TAG |
| 175 | + ``` |
| 176 | +1. From within an overlay or base: |
| 177 | + ```yaml |
| 178 | + apiVersion: kustomize.config.k8s.io/v1beta1 |
| 179 | + kind: Kustomization |
| 180 | + components: |
| 181 | + - https://github.com/openstack-gitops/rhoso-gitops/components/argocd/annotations?ref=TAG |
| 182 | + # [...] |
| 183 | + ``` |
| 184 | + |
| 185 | +## External resources |
| 186 | + |
| 187 | +1. [Official RHOSO documentation](https://docs.redhat.com/en/documentation/red_hat_openstack_services_on_openshift/18.0) |
| 188 | +1. [Official openshift-gitops documentation](https://www.redhat.com/en/technologies/cloud-computing/openshift/gitops) |
| 189 | +1. [Official ArgoCD documentation](https://argo-cd.readthedocs.io/en/stable/) |
0 commit comments