What type of PR is this?
/kind enhancement
What does this PR do / why we need it:
This would add a new field, .host
, to .status
of ArgoCD
. When route or ingress is enabled (priority given to route) then the route will be displayed in the new URL field.
When no URL exists from a route or ingress, the field will not be displayed.
When on a non-OpenShift cluster (meaning the Route API is not available), if the user chooses to enable Route, they will only get a log saying that Routes are not available in non-OpenShift environments and to please use Ingresses instead. The state of the application controller and of the URL will not be affected.
When the route or ingress is configured, but the corresponding controller has not yet set it up properly (i.e. is not in Ready state or does not propagate its URL), this is indicated in the Operand as well in the value of .status.url
as Pending instead of the URL. Also, if .status.url
is Pending, this affects the overall status for the Operand by making it Pending instead of Available.
Have you updated the necessary documentation?
- [x] Documentation update is required by this PR.
- [ ] Documentation has been updated.
Which issue(s) this PR fixes:
Fixes #246
How to test changes / Special notes to the reviewer:
Special Notes to the reviewer:
Whatever your cluster is, make sure that Ingress Controller is installed, enabled and running before moving forward. Instructions for ingress-controller for the following types of cluster are:
- kind : https://abhishekveeramalla-av.medium.com/run-argo-cd-using-operator-on-kind-e59f48687d38
- minikube: run command
minikube addons enable ingress
- k3d: Traefik Ingress Controller is installed/enabled by default
- OpenShift: after enabling ingress in Argo CD spec, update the following on the ingress spec:
- remove
Nginx
annotations
- update hostame to
example-argocd.yourcluster.example.com
where example-argocd
is the argocd host
Ingress Testing:
-
Get cluster and log in (I used a K3D cluster for this).
-
In your cloned repo on this branch, go to Makefile and change the version # (just to something else) and change image base tag to IMAGE_TAG_BASE ?= quay.io/{your quay or docker username}/argocd-operator
. Then run make docker-build
, make docker-push
and login to a cluster and then run make deploy
-
Add the Argo CD instance:
cat <<EOF | kubectl apply -f -
apiVersion: argoproj.io/v1alpha1
kind: ArgoCD
metadata:
name: argocd
spec: {}
EOF
- Create an Ingress:
cat <<EOF | oc apply -f -
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: argocd-server
spec:
rules:
- host: argocd
http:
paths:
- backend:
service:
name: argocd-server
port:
number: 8080
path: /
pathType: ImplementationSpecific
EOF
If you do oc get ingress argocd-server
you should see:
NAME CLASS HOSTS ADDRESS PORTS AGE
argocd-server <none> argocd 172.22.0.3 80 9m56s
- Edit the ArgoCD instance so that ingress and route (or at least just route if you're on an OpenShift cluster) is enabled with
oc edit argocd argocd
. spec.server
should look something like:
server:
autoscale:
enabled: false
grpc:
ingress:
enabled: false
ingress:
enabled: true
route:
enabled: false
service:
type: ""
tls:
ca: {}
Save your changes.
- Wait a second for it to update, and then check back on your CR
oc get argocd argocd -o yaml
. You should see that the URL has been added to the .status
field.
status:
applicationController: Running
dex: Running
host: 172.22.0.3
phase: Available
redis: Running
repo: Running
server: Running
ssoConfig: Unknown
Route Testing:
-
Get cluster and log in (I used an OpenShift cluster for this since routes are specific to OpenShift, if the Route API is not available this functionality will not work).
-
In your cloned repo on this branch, go to Makefile and change the version # (just to something else) and change image base tag to IMAGE_TAG_BASE ?= quay.io/{your quay or docker username}/argocd-operator
. Then run make docker-build
, make docker-push
and login to a cluster and then run make deploy
-
Add the Argo CD instance:
cat <<EOF | kubectl apply -f -
apiVersion: argoproj.io/v1alpha1
kind: ArgoCD
metadata:
name: argocd
spec: {}
EOF
- Edit the ArgoCD instance so that ingress and route (or at least just route if you're on an OpenShift cluster) is enabled with
oc edit argocd argocd
. spec.server
should look something like:
server:
autoscale:
enabled: false
grpc:
ingress:
enabled: false
ingress:
enabled: false
route:
enabled: true
service:
type: ""
tls:
ca: {}
Save your changes.
5. Wait a second for it to update, and then check back on your CR oc get argocd argocd -o yaml
. You should see that the URL has been added to the .status
field.
status:
applicationController: Running
dex: Running
host: argocd-server-default.apps.app-svc-4.8-120914.devcluster.openshift.com
phase: Available
redis: Running
repo: Running
server: Running
ssoConfig: Unknown
Note: If route and ingress are both enabled, the route (if available) will have preference over ingress.