-
Notifications
You must be signed in to change notification settings - Fork 763
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add route/ingress URL to .status #514
Conversation
deploy/olm-catalog/argocd-operator/0.2.0/argoproj.io_argocds.yaml
Outdated
Show resolved
Hide resolved
@reginapizza please run |
would it be a good idea to mention that the created route/ingress URL can be retrieved from the ArgoCD instance's |
On further thought, a couple of cases occurred to me that I'm wondering how/if we should handle:
|
@jaideepr97 I've updated my PR to address your first concern, but I'm still not sure about the second. @iam-veeramalla do you think that it's a concern? |
LGTM |
controllers/argocd/status.go
Outdated
cr.Status.Phase = status | ||
return r.Client.Status().Update(context.TODO(), cr) | ||
} else { | ||
cr.Status.URL = route.Spec.Host |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should get the host from route.Status.Ingress
which is a list of RouteIngresses. I think we should show all the ingresses.
Also, each ingress has a status. If any of the ingresses is in failed status, should cr.Status.Phase be set to failed?
Ingress and route can be enabled at the same time. However, the status does not show ingress if route is enabled. WDYT @jaideepr97 @iam-veeramalla @reginapizza Should status be honest about showing ingress as well? We can probably just document as such. |
Per my understanding, on openshift environments routes are given more importance than ingresses (since a route is created automatically for each ingress) so I would say it makes sense to just show the route and document that the ingress is not shown in this case On a related note, if both route and ingress are enabled we might end up with 2 routes for the same server deployment |
@jaideepr97 It is also my understanding. https://docs.openshift.com/container-platform/4.6/networking/routes/route-configuration.html#nw-ingress-creating-a-route-via-an-ingress_route-configuration You can annotate an Ingress and OpenShift can create a Route automatically, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
log.Info("argocd-server ingress requested but not found on cluster") | ||
return nil | ||
} else { | ||
if !reflect.DeepEqual(ingress.Status.LoadBalancer, corev1.LoadBalancerStatus{}) && len(ingress.Status.LoadBalancer.Ingress) > 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@reginapizza @jannfis I can''t figure out why is the DeepEqual() is needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would if !reflect.ValueOf(ingress.Status.LoadBalancer).IsZero() && len(ingress.Status.LoadBalancer.Ingress) > 0 {
be better?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, IsZero
a bit cleaner and faster then DeepCopy
and && len(ingress.Status.LoadBalancer.Ingress) > 0
can be eliminated. Leaving it as-is is fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should keep the len(ingress.Status.LoadBalancer.Ingress) > 0
as a sanity check, to make sure code only executes if we have at least 1 proper ingress hostname/ip to work with
@reginapizza please update how to test o include testing the ingress only case. |
@wtam2018 I've updated the instructions on how to test ingresses with it! |
* Improve docs for custom roles feature (#548) * add route/ingress host to .status (#514) * fix: argocd-tls-certs-cm is overwritten on any change (#553) Signed-off-by: iam-veeramalla <abhishek.veeramalla@gmail.com> * add docs for host field in .status (#554) * GITOPS-1550 removed unnecessary roles/rolebindings for target namespace (#557) * chore(deps): bump github.com/argoproj/argo-cd/v2 from 2.2.2 to 2.2.4 (#560) Bumps [github.com/argoproj/argo-cd/v2](https://github.com/argoproj/argo-cd) from 2.2.2 to 2.2.4. - [Release notes](https://github.com/argoproj/argo-cd/releases) - [Changelog](https://github.com/argoproj/argo-cd/blob/master/CHANGELOG.md) - [Commits](argoproj/argo-cd@v2.2.2...v2.2.4) --- updated-dependencies: - dependency-name: github.com/argoproj/argo-cd/v2 dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * fix: update operator capabilities level in CSV (#549) * feat: bump argo cd to version 2.2.5 * feat: update bundle and manifests to v0.3.0 * Update deploy/olm-catalog/argocd-operator/0.2.0/argocd-operator.v0.2.0.clusterserviceversion.yaml Co-authored-by: jannfis <jann@mistrust.net> * Update config/manifests/bases/argocd-operator.clusterserviceversion.yaml Co-authored-by: jannfis <jann@mistrust.net> * Update bundle/manifests/argocd-operator.clusterserviceversion.yaml Co-authored-by: jannfis <jann@mistrust.net> Co-authored-by: Chetan Banavikalmutt <chetanrns1997@gmail.com> Co-authored-by: Regina Scott <50851526+reginapizza@users.noreply.github.com> Co-authored-by: Yi Cai <yicai@redhat.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Jaideep Raghunath Rao <jaideep.r97@gmail.com> Co-authored-by: William Tam <wtam@redhat.com> Co-authored-by: jannfis <jann@mistrust.net>
Known Issue: |
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
ofArgoCD
. 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?
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:
minikube addons enable ingress
Nginx
annotationsexample-argocd.yourcluster.example.com
whereexample-argocd
is the argocd hostIngress 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 runmake docker-build
,make docker-push
and login to a cluster and then runmake deploy
Add the Argo CD instance:
If you do
oc get ingress argocd-server
you should see:oc edit argocd argocd
.spec.server
should look something like:Save your changes.
oc get argocd argocd -o yaml
. You should see that the URL has been added to the.status
field.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 runmake docker-build
,make docker-push
and login to a cluster and then runmake deploy
Add the Argo CD instance:
oc edit argocd argocd
.spec.server
should look something like: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.Note: If route and ingress are both enabled, the route (if available) will have preference over ingress.