Skip to content
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

✨ Install CAPI using operator after chart is installed #109

Merged
merged 6 commits into from
Sep 18, 2023

Conversation

alexander-demicev
Copy link
Member

@alexander-demicev alexander-demicev commented Sep 6, 2023

kind/feature

What this PR does / why we need it:

Add new values and template to helm chart so we can deploy CAPI with one command, assuming rancher and cert-manager are running users will be able to install extension, CAPI operator and CAPI like this:

helm repo add rancher-turtles https://rancher-sandbox.github.io/rancher-turtles
helm repo update
helm install rancher-turtles rancher-turtles/rancher-turtles --create-namespace -n rancher-turtles-system

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #18
Fixes #105

Special notes for your reviewer:

Checklist:

  • squashed commits into logical changes
  • includes documentation
  • adds unit tests
  • adds or updates e2e tests

@alexander-demicev
Copy link
Member Author

Should the kubeadm bootstrap and control plane also be included by default? or at least give an option to install them too. I'm fine with both approaches but would like to know what others think.

@alexander-demicev alexander-demicev force-pushed the coreproviderchart branch 2 times, most recently from a93ab06 to 2e33429 Compare September 6, 2023 15:57
capi:
enabled: true
namespace: capi-system
configSecret:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be included before 0.5.2 version is released?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

v1alpha2 is for v0.6.0 we can reuse the same values, the difference will be in the provider manifest, we also have conversion webhooks to handle the transition.

@@ -254,11 +254,50 @@ func initRancherTurtles(clusterProxy framework.ClusterProxy, config *clusterctl.
}
_, err := chart.Run(map[string]string{
"cluster-api-operator.cert-manager.enabled": "true",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As the proxy flags for capi have a different name, have you considered unified naming patter here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you mean capi-operator vs cluster-api-operator?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've just tried different approaches here, there will still be inconsistency. Helm doesn't like- character in go template so cluster-api.something is not an option, I changed it to clusterAPI and then cluster-api-operator.enabled to clusterAPIOperator.enabled, and if you want to pass values to capi operator chart you have to use chartname.something which is cluster-api-operator.something

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess it's better to keep cluster-api-operator.enabled to match with other actions related to operator

})
Expect(err).ToNot(HaveOccurred())

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO this test case should be added in the CAPI operator repository (nit)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you elaborate? what exactly has to be tested in CAPI operator?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this supposed to be installed together with operator by the users? Why testing kubeadm provider here when it could be tested in the CAPI operator repository? Additionally with helm uninstall issue, this blocks other operations within e2e tests, it surely missing manual uninstall part in this specific test case. It is not scalable.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will add a manual uninstall until this is fixed in operator

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so after some thinking, I don't believe we have to uninstall manually providers in e2e, we tear down the entire management cluster and if we need to debug the test run and skip cleanup it's better to leave the providers running, wdyt?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This implementation fixes uninstall process in capi operator - kubernetes-sigs/cluster-api-operator#251 so no need to do some unnessesary cluster teardowns, we just need to merge it. Creating and tearing down management clusters is costly, not scalable and will prolong the e2e test execution.

```
### Installing CAPI providers

The Rancher turtles extension does not install any CAPI providers, you will need to install them yourself using [CAPI operator](https://github.com/kubernetes-sigs/cluster-api-operator/tree/main/docs).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But you can, using infrastructure flag passed to helm values, no?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not really, in this case, CAPI operator chart will deploy the core CAPI provider too. We tried to follow the same pattern as clusterctl here, our deployment model is a bit more complicated. What can help here is a clusterctl plugin for operator or alternatively rancher users will get a UI for providers

@@ -59,7 +59,7 @@ jobs:
run: kind load docker-image ${{ env.MANIFEST_IMG }}:${{ env.TAG }}

- name: Run chart-testing (install)
run: helm install rancher-turtles out/charts/rancher-turtles/ -n rancher-turtles-system --create-namespace --wait --set cluster-api-operator.cert-manager.enabled=true
run: helm install rancher-turtles out/charts/rancher-turtles/ -n rancher-turtles-system --create-namespace --wait --set cluster-api-operator.cert-manager.enabled=true --set capi.enabled=false
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This workflow is the closest to quickstart process of the rancher turtles. Does this mean that capi operator will be disabled by default?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uninstalling doesn't really work for us right now properly due to CAPI operator not cleaning up providers before removing the controller. We can fix it on the CAPI operator side(preferable way) or document that users have to remove all providers manually before deleting the chart.
I don't want CAPI operator blocking our progress on the extension so disabling CAPI is a temporary solution

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are planning a v0.6.0 release for operator so fix can be included there

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Created kubernetes-sigs/cluster-api-operator#243 as I experienced this personally when trying out capi operator myself

@richardcase
Copy link
Contributor

Should the kubeadm bootstrap and control plane also be included by default? or at least give an option to install them too. I'm fine with both approaches but would like to know what others think.

I think initially, let's just install the core controllers. We want to favour Rancher solutions so i think Kubeadm will always be an optional install.

@alexander-demicev alexander-demicev force-pushed the coreproviderchart branch 2 times, most recently from e99f3f0 to d46d397 Compare September 12, 2023 11:36
Signed-off-by: Alexandr Demicev <alexandr.demicev@suse.com>

Install bootstrap and control plane providers using helm chart values

Signed-off-by: Alexandr Demicev <alexandr.demicev@suse.com>
Signed-off-by: Alexandr Demicev <alexandr.demicev@suse.com>
@alexander-demicev alexander-demicev force-pushed the coreproviderchart branch 2 times, most recently from 009dbff to 9dafa89 Compare September 12, 2023 13:08
@alexander-demicev
Copy link
Member Author

@richardcase @Danil-Grigorev please take a look again, all works in e2e

Signed-off-by: Alexandr Demicev <alexandr.demicev@suse.com>
@@ -0,0 +1,71 @@
{{- if .Values.clusterAPI.enabled }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe you’ve hit the issue with the naming here. I looked into this in the uninstall PR You can still use the
cluster-api-operator name like this:

Suggested change
{{- if .Values.clusterAPI.enabled }}
{{- if index .Values "cluster-api-operator" "enabled" }}

@Danil-Grigorev Danil-Grigorev changed the title Install CAPI using operator after chart is installed ✨ Install CAPI using operator after chart is installed Sep 15, 2023
Signed-off-by: Danil Grigorev <danil.grigorev@suse.com>
Signed-off-by: Danil Grigorev <danil.grigorev@suse.com>
- Update test-chart workflow with capi operator values

Signed-off-by: Danil Grigorev <danil.grigorev@suse.com>
Copy link
Contributor

@richardcase richardcase left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good!

@richardcase richardcase merged commit 2d91005 into rancher:main Sep 18, 2023
8 checks passed
@alexander-demicev alexander-demicev deleted the coreproviderchart branch September 18, 2023 11:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement Categorizes issue or PR as related to a new feature. kind/feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ensure additional Rancher ClusterRole's are deployed Ensure CAPI Operator is installed
3 participants