I have been experimenting with deploying multiple AWX instances in a
cluster, with each instance in its own namespace. I have been
following the process using Kustomize with AWX Operator v1.4.0 with
AWX v21.14.0.
I have seen that it is possible to install 2 different instances of
AWX alongside an instance of AWX Operator in 2 different namespaces.
However when I uninstall one of the AWX + AWX Operator instances using
Kustomize with "kustomization.yaml" as below, using the command
"kubectl delete -k ." that the other AWX is also uninstalled.
I suppose this is because the Operator installation for each deploys
non-namespace-scoped K8s objects and the uninstallation of one of the
Operator instances removes these "shared" objects, which triggers the
removal of the other AWX instance.
I suppose that instead of installing the AWX instance with Kustomize I
could install it with the command "kubectl apply -f awx_manifest.yml"
and uninstall only that AWX instance with "kubectl delete -f
awx_manifest.yml" and then delete the namespace to get rid of the
namespace-scoped Operator objects. However that doesn't cleanly get
rid of all Operator objects and that even after uninstalling all AWX
instances and their namespaces, the non-namespace-scoped Operator
objects would need to be separately deleted.
Is there a clean way of deleting an Operator instance without
clobbering all AWX instances on that cluster?
Part of the problem here is that the AWX custom resource definition (CRD) is a global resource. So when you run “kubectl delete -k .”, when the operator is deleted it will delete the CRD in the process, thus deleting all of the child custom resources (CR) in the process.
So the trick will be finding a way to exclude deleting the 3 CRD’s upon teardown. You’ll have the same problem with make deploy and make undeploy. I’ll think on a potential solution here… The OLM install leaves the CRD behind when the operator is deleted for this reason (OperatorHub install).
However, I wasn’t able to use this approach to exclude deletion of the CRD resources because it is not guaranteed that they exist (because of cleanup). So I would recommend making a cleanup script for the time being.