Set CATTLE_SERVER_URL when running Rancher with Docker
Summary
Fixes #14559
Occurred changes and/or fixed issues
- By providing a valid value for the
server-urlSetting from the beginning (instead of during first-login page), startup will be faster, allowing Fleet to install the Fleet Agent in the local cluster almost immediately, instead of after several minutes (see parent issue).
Technical notes summary
Fleet requires a working apiServerURL (part of the config payload in the fleet-controller ConfigMap), which is taken from the server-url Setting. This value is normally filled during the bootstrap, but may be incorrect when using the default value. Early specifying a valid value ensures that Fleet (and fleet-agent deployed for the local Cluster) will be configured correctly.
Areas or cases that should be tested
The parent issue did not include specific jobs that were failing. Please review if any tests were temporarily disabled which may need to be restored after this fix.
Areas which could experience regressions
Screenshot/Video
Checklist
- [X] The PR is linked to an issue and the linked issue has a Milestone, or no issue is needed
- [X] The PR has a Milestone
- [X] The PR template has been filled out
- [X] The PR has been self reviewed
- [X] The PR has a reviewer assigned
- [X] The PR has automated tests or clear instructions for manual tests and the linked issue has appropriate QA labels, or tests are not needed
- [X] ~The PR has reviewed with UX and tested in light and dark mode, or there are no UX changes~
- [X] ~The PR has been reviewed in terms of Accessibility~
This need to fix an issue in the dashboard repo, so please create one.
Can you add some tests for this - our existing e2e tests have been passing without this change - is a change incoming from Fleet which will break that, which this fixes?
This need to fix an issue in the dashboard repo, so please create one.
The parent issue was originally created in the dashboard repo, later moved to rancher/rancher. I've asked @gaktive to move it back to dashboard, since there is no point in having those, as there is no actual problem on the Fleet side, only a misconfiguration on the Rancher installation.
Can you add some tests for this - our existing e2e tests have been passing without this change - is a change incoming from Fleet which will break that, which this fixes?
The original issue reported a problem with E2E continuously failing due to this. Since it was open for a few months, I suspect some of those tests may have been temporarily skipped to bypass those failures. That's why I asked in the description for someone with more knowledge about the test suite to check if that was the case an enable back such tests. I think the value of this change resides on existing E2E continuing to work well. I'm also not sure which kind of additional tests could be added for this.
I added a comment to the thread, but bringing up some of those points here and added new
- found the affected e2e tests - cypress/e2e/tests/pages/fleet/resources/bundles.spec.ts
- i think the root issue is the delay in sorting out certs, however this might be just for 127.0.0.1 address? (see here)
- this tweak feels like a workaround for a rancher issue, rather than a fleet or e2e config one. taking several minutes to create a cert doesn't feel right
- we have a very old PR to use helm instead of docker in e2e tests, however requires some time to address failures (uses
kubectl cpto patch ui files)
I added a comment to the thread, but bringing up some of those points here and added new
- found the affected e2e tests - cypress/e2e/tests/pages/fleet/resources/bundles.spec.ts
Thanks! I've just re-enabled those checks. My previous search didn't match due to the issue being moved between projects.
- i think the root issue is the delay in sorting out certs, however this might be just for 127.0.0.1 address? (see here)
- this tweak feels like a workaround for a rancher issue, rather than a fleet or e2e config one. taking several minutes to create a cert doesn't feel right
In my tests, the certs were actually created. What takes a long time is setting the server URL. It's not "several minutes", it's actually "until the bootstrap is completed". In my tests, I ran Rancher and never logged in: the server-url was never set and Fleet wouldn't create the fleet-agent deployment in the cattle-local-fleet-system namespace.
- we have a very old PR to use helm instead of docker in e2e tests, however requires some time to address failures (uses
kubectl cpto patch ui files)
I wouldn't mind taking a look when I have some spare time if you think it's worth it.