The following steps will help you creating an environment for developing StoneSoup.
Getting Started
Steps:
-
Run
./hack/bootstrap-cluster.sh [preview]
which will bootstrap Argo CD (using OpenShift GitOps) and setup the Argo CDApplication
Custom Resources (CRs) for each component. This command will output the Argo CD Web UI route when it’s finished.preview
will enable preview mode used for development and testing on non-production clusters, described in section Preview mode for your clusters. -
Open the Argo CD Web UI to see the status of your deployments. You can use the route from the previous step and login using your OpenShift credentials (using the ‘Login with OpenShift’ button), or login to the OpenShift Console and navigate to Argo CD using the OpenShift Gitops menu in the Applications pulldown.
-
If your deployment was successful, you should see several applications running, such as “all-components-staging”, “gitops”, and so on.
Preview mode for your clusters
Once you bootstrap a cluster without preview
argument, the root ArgoCD Application and all of the component applications will each point to the upstream repository. Or you can bootstrap cluster directly in mode which you need.
To enable development for a team or individual to test changes on your own cluster, you need to replace the references to https://github.com/redhat-appstudio/infra-deployments.git
with references to your own fork.
There are a set of scripts that help with this, and minimize the changes needed in your forks.
The development configuration includes a kustomize overlay that can redirect the default components individual repositories to your fork.
The script also supports branches automatically. If you work in a checked out branch, each of the components in the overlays will mapped to that branch by setting targetRevision:
.
Preview mode works in a feature branch, apply script which creates new preview branch and create additional commit with customization.
Setting Preview mode
Steps:
-
Copy
hack/preview-template.env
tohack/preview.env
and update new file based on instructions. Filehack/preview.env
should never be included in commit. -
Work on your changes in a feature branch
-
Commit your changes
- Run
./hack/preview.sh
, which will do: -
New branch is created from your current branch, the name of new branch is
preview-<name-of-current-branch>
-
Commit with changes related to your environment is added into preview branch
-
Preview branch is pushed into your fork
-
ArgoCD is set to point to your fork and the preview branch
- User is switched back to feature branch to create additional changes
If you want to reset your environment you can run the hack/util-update-app-of-apps.sh https://github.com/redhat-appstudio/infra-deployments.git staging main
to reset everything including your cluster to https://github.com/redhat-appstudio/infra-deployments.git
and match the upstream config.
Note running these scripts in a clone repo will have no effect as the repo will remain https://github.com/redhat-appstudio/infra-deployments.git
Optional: OpenShift Local Post-Bootstrap Configuration
Even with 6 CPU cores, you will need to reduce the CPU resource requests for each StoneSoup application. Either run ./hack/reduce-gitops-cpu-requests.sh
which will set resources.requests.cpu values to 50m or use kubectl edit argocd/openshift-gitops -n openshift-gitops
to reduce the values to some other value. More details are in the FAQ below.