-
Notifications
You must be signed in to change notification settings - Fork 230
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 Experimental HelmOps controller. #3092
Conversation
5324f8f
to
4ad653a
Compare
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.
Thanks for this! Leaving a few comments, many of which are just nitpicks.
This new feature creates bundles synchronously, which may be fine for now as they are more lightweight, without resources, than in the gitOps case. But I wonder if that may become an issue on larger setups (although worker counts will soon be configurable even in the agent).
fc68a6c
to
55f7216
Compare
internal/cmd/controller/helmops/reconciler/fleethelm_controller.go
Outdated
Show resolved
Hide resolved
internal/cmd/controller/helmops/reconciler/fleethelm_controller.go
Outdated
Show resolved
Hide resolved
bc8fb2c
to
33e5ff9
Compare
f3fc4b6
to
9f1850c
Compare
fleet "github.com/rancher/fleet/pkg/apis/fleet.cattle.io/v1alpha1" | ||
v1alpha1 "github.com/rancher/fleet/pkg/apis/fleet.cattle.io/v1alpha1" |
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.
fleet "github.com/rancher/fleet/pkg/apis/fleet.cattle.io/v1alpha1" | |
v1alpha1 "github.com/rancher/fleet/pkg/apis/fleet.cattle.io/v1alpha1" | |
fleetv1 "github.com/rancher/fleet/pkg/apis/fleet.cattle.io/v1alpha1" |
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've deleted the v1alpha1
one
It adds a new custom resource `HelmApp` (resource name open to debate) that describes a helm chart to be deployed. The resource contains all the fealds from the classic `fleet.yaml` file plus a few new from the `GitRepo` resource. `HelmApp` yaml example: ```yaml apiVersion: fleet.cattle.io/v1alpha1 kind: HelmApp metadata: name: sample1 namespace: fleet-local spec: helm: releaseName: testhelm repo: https://charts.bitnami.com/bitnami chart: postgresql version: 16.2.1 insecureSkipTLSVerify: true ``` The implementation tries to share as much as possible from a `Bundle` spec inside the new resource, because it helps to "transform" the `HelmApp` into a deployment (no coversion is needed for most of the spec). The new controller was also implemented splitting the functionality into 2 controllers (similar to what we did for the `GitRepo` controller). This allows us to reuse most of the status handling code, as display fields in the status of the new resource are as similar as possible to have consistent user experience and to integrate with the UI in the same way the `GitRepo` does. When a new `HelmApp` resource is applied it is transformed into a single `Bundle`, adding some extra fields to let the `Bundle` reconciler know that this is not a regular `Bundle` coming from a `GitRepo`. Similar as we did for OCI storage, the `Bundle` created from a `HelmApp` does not contain resources. The helm chart to be deployed is downloaded by the agent. Code for downloading the helm chart is reused from gitops, so the same formats are supported. Insecure TLS skipping was added the the ChartURL and LoadDirectory functions in order to support this for gitops and helmops. If we need a secret to access the helm repository we can use the `helmSecretName` field. This secret will be cloned to secrets under the `BundleDeployment` namespace (same as we did for the OCI storage secret handling). The PR includes unit, integration (most of code is tested this way) and just one single e2e test so far just to test the whole feature together in a real cluster. Note: This is an experimental feature. In order to activate the `HelmApp` reconciling and `Bundle` deployment you need to the the environment variable: `EXPERIMENTAL_HELM_OPS=true` Refers to: rancher#2962
Signed-off-by: Xavi Garcia <[email protected]>
This is so we can enable the UI and browse artifacts Signed-off-by: Xavi Garcia <[email protected]>
Signed-off-by: Xavi Garcia <[email protected]>
Signed-off-by: Xavi Garcia <[email protected]>
Signed-off-by: Xavi Garcia <[email protected]>
Signed-off-by: Xavi Garcia <[email protected]>
Signed-off-by: Xavi Garcia <[email protected]>
Signed-off-by: Xavi Garcia <[email protected]>
Signed-off-by: Xavi Garcia <[email protected]>
Signed-off-by: Xavi Garcia <[email protected]>
Signed-off-by: Xavi Garcia <[email protected]>
Signed-off-by: Xavi Garcia <[email protected]>
Signed-off-by: Xavi Garcia <[email protected]>
dc32344
to
6a2d48a
Compare
Signed-off-by: Xavi Garcia <[email protected]>
6a2d48a
to
c082cf8
Compare
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
This adds a new custom resource
HelmApp
(resource name open to debate) that describes a helm chart to be deployed.The resource contains all the fields from the classic
fleet.yaml
file plus a few new from theGitRepo
resource.HelmApp
yaml example:The implementation tries to share as much as possible from a
Bundle
spec inside the new resource, because it helps to "transform" theHelmApp
into a deployment (no conversion is needed for most of the spec).The new controller was also implemented splitting the functionality into 2 controllers (similar to what we did for the
GitRepo
controller). This allows us to reuse most of the status handling code, as display fields in the status of the new resource are as similar as possible to have consistent user experience and to integrate with the UI in the same way theGitRepo
does.When a new
HelmApp
resource is applied it is transformed into a singleBundle
, adding some extra fields to let theBundle
reconciler know that this is not a regularBundle
coming from aGitRepo
.Similar as we did for OCI storage, the
Bundle
created from aHelmApp
does not contain resources. The helm chart to be deployed is downloaded by the agent.Code for downloading the helm chart is reused from gitops, so the same formats are supported. Insecure TLS skipping was added the the ChartURL and LoadDirectory functions in order to support this for gitops and helmops.
If we need a secret to access the helm repository we can use the
helmSecretName
field. This secret will be cloned to secrets under theBundleDeployment
namespace (same as we did for the OCI storage secret handling).The PR includes unit, integration (most of code is tested this way) and just one single e2e test so far just to test the whole feature together in a real cluster.
The following image describes how Spec fields are shared between
Bundle
andHelmApp
and how the Status fields are shared betweenGitRepo
andHelmApp
:Note: This is an experimental feature. In order to activate the
HelmApp
reconciling andBundle
deployment you need to set the following environment variable:EXPERIMENTAL_HELM_OPS=true
Refers to: #2962