From 46f88f471d2c13320369d870cf9eb2491f906741 Mon Sep 17 00:00:00 2001 From: Stefan Prodan Date: Fri, 13 Sep 2024 13:04:40 +0300 Subject: [PATCH 1/2] Update controller-gen to v0.16.1 Signed-off-by: Stefan Prodan --- Makefile | 2 +- .../helm.toolkit.fluxcd.io_helmreleases.yaml | 106 +++--------------- config/rbac/role.yaml | 14 +-- 3 files changed, 16 insertions(+), 106 deletions(-) diff --git a/Makefile b/Makefile index b7266e9c3..46223f7a7 100644 --- a/Makefile +++ b/Makefile @@ -39,7 +39,7 @@ SOURCE_CRD_VER = $(CRD_DEP_ROOT)/.src-crd-$(SOURCE_VER) HELMCHART_SOURCE_CRD ?= $(CRD_DEP_ROOT)/source.toolkit.fluxcd.io_helmcharts.yaml # API (doc) generation utilities -CONTROLLER_GEN_VERSION ?= v0.15.0 +CONTROLLER_GEN_VERSION ?= v0.16.1 GEN_API_REF_DOCS_VERSION ?= e327d0730470cbd61b06300f81c5fcf91c23c113 all: manager diff --git a/config/crd/bases/helm.toolkit.fluxcd.io_helmreleases.yaml b/config/crd/bases/helm.toolkit.fluxcd.io_helmreleases.yaml index e6193ca63..44411e09a 100644 --- a/config/crd/bases/helm.toolkit.fluxcd.io_helmreleases.yaml +++ b/config/crd/bases/helm.toolkit.fluxcd.io_helmreleases.yaml @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 kind: CustomResourceDefinition metadata: annotations: - controller-gen.kubebuilder.io/version: v0.15.0 + controller-gen.kubebuilder.io/version: v0.16.1 name: helmreleases.helm.toolkit.fluxcd.io spec: group: helm.toolkit.fluxcd.io @@ -134,6 +134,7 @@ spec: minLength: 1 type: string required: + - kind - name type: object valuesFiles: @@ -333,17 +334,13 @@ spec: `Create` or `CreateReplace`. Default is `Create` and if omitted CRDs are installed but not updated. - Skip: do neither install nor replace (update) any CRDs. - Create: new CRDs are created, existing CRDs are neither updated nor deleted. - CreateReplace: new CRDs are created, existing CRDs are updated (replaced) but not deleted. - By default, CRDs are applied (installed) during Helm install action. With this option users can opt in to CRD replace existing CRDs on Helm install actions, which is not (yet) natively supported by Helm. @@ -411,7 +408,6 @@ spec: SkipCRDs tells the Helm install action to not install any CRDs. By default, CRDs are installed if not already present. - Deprecated use CRD policy (`crds`) attribute with value `Skip` instead. type: boolean timeout: @@ -472,13 +468,11 @@ spec: duration of the reconciliation, instead of being created and destroyed for each (step of a) Helm action. - This can improve performance, but may cause issues with some Helm charts that for example do create Custom Resource Definitions during installation outside Helm's CRD lifecycle hooks, which are then not observed to be available by e.g. post-install hooks. - If not set, it defaults to true. type: boolean postRenderers: @@ -756,17 +750,13 @@ spec: `Create` or `CreateReplace`. Default is `Skip` and if omitted CRDs are neither installed nor upgraded. - Skip: do neither install nor replace (update) any CRDs. - Create: new CRDs are created, existing CRDs are neither updated nor deleted. - CreateReplace: new CRDs are created, existing CRDs are updated (replaced) but not deleted. - By default, CRDs are not applied during Helm upgrade action. With this option users can opt-in to CRD upgrade, which is not (yet) natively supported by Helm. https://helm.sh/docs/chart_best_practices/custom_resource_definitions. @@ -909,16 +899,8 @@ spec: conditions: description: Conditions holds the conditions for the HelmRelease. items: - description: "Condition contains details for one aspect of the current - state of this API Resource.\n---\nThis struct is intended for - direct use as an array at the field path .status.conditions. For - example,\n\n\n\ttype FooStatus struct{\n\t // Represents the - observations of a foo's current state.\n\t // Known .status.conditions.type - are: \"Available\", \"Progressing\", and \"Degraded\"\n\t // - +patchMergeKey=type\n\t // +patchStrategy=merge\n\t // +listType=map\n\t - \ // +listMapKey=type\n\t Conditions []metav1.Condition `json:\"conditions,omitempty\" - patchStrategy:\"merge\" patchMergeKey:\"type\" protobuf:\"bytes,1,rep,name=conditions\"`\n\n\n\t - \ // other fields\n\t}" + description: Condition contains details for one aspect of the current + state of this API Resource. properties: lastTransitionTime: description: |- @@ -959,12 +941,7 @@ spec: - Unknown type: string type: - description: |- - type of condition in CamelCase or in foo.example.com/CamelCase. - --- - Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be - useful (see .node.status.conditions), the ability to deconflict is important. - The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + description: type of condition in CamelCase or in foo.example.com/CamelCase. maxLength: 316 pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ type: string @@ -1298,6 +1275,7 @@ spec: minLength: 1 type: string required: + - kind - name type: object valuesFile: @@ -1363,7 +1341,6 @@ spec: ChartRef holds a reference to a source controller resource containing the Helm chart artifact. - Note: this field is provisional to the v2 API, and not actively used by v2beta1 HelmReleases. properties: @@ -1419,7 +1396,6 @@ spec: differences between the manifest in the Helm storage and the resources currently existing in the cluster. - Note: this field is provisional to the v2beta2 API, and not actively used by v2beta1 HelmReleases. properties: @@ -1510,17 +1486,13 @@ spec: `Create` or `CreateReplace`. Default is `Create` and if omitted CRDs are installed but not updated. - Skip: do neither install nor replace (update) any CRDs. - Create: new CRDs are created, existing CRDs are neither updated nor deleted. - CreateReplace: new CRDs are created, existing CRDs are updated (replaced) but not deleted. - By default, CRDs are applied (installed) during Helm install action. With this option users can opt-in to CRD replace existing CRDs on Helm install actions, which is not (yet) natively supported by Helm. @@ -1588,7 +1560,6 @@ spec: SkipCRDs tells the Helm install action to not install any CRDs. By default, CRDs are installed if not already present. - Deprecated use CRD policy (`crds`) attribute with value `Skip` instead. type: boolean timeout: @@ -1652,13 +1623,11 @@ spec: duration of the reconciliation, instead of being created and destroyed for each (step of a) Helm action. - This can improve performance, but may cause issues with some Helm charts that for example do create Custom Resource Definitions during installation outside Helm's CRD lifecycle hooks, which are then not observed to be available by e.g. post-install hooks. - If not set, it defaults to true. type: boolean postRenderers: @@ -2014,17 +1983,13 @@ spec: `Create` or `CreateReplace`. Default is `Skip` and if omitted CRDs are neither installed nor upgraded. - Skip: do neither install nor replace (update) any CRDs. - Create: new CRDs are created, existing CRDs are neither updated nor deleted. - CreateReplace: new CRDs are created, existing CRDs are updated (replaced) but not deleted. - By default, CRDs are not applied during Helm upgrade action. With this option users can opt-in to CRD upgrade, which is not (yet) natively supported by Helm. https://helm.sh/docs/chart_best_practices/custom_resource_definitions. @@ -2155,6 +2120,7 @@ spec: type: object type: array required: + - chart - interval type: object status: @@ -2165,16 +2131,8 @@ spec: conditions: description: Conditions holds the conditions for the HelmRelease. items: - description: "Condition contains details for one aspect of the current - state of this API Resource.\n---\nThis struct is intended for - direct use as an array at the field path .status.conditions. For - example,\n\n\n\ttype FooStatus struct{\n\t // Represents the - observations of a foo's current state.\n\t // Known .status.conditions.type - are: \"Available\", \"Progressing\", and \"Degraded\"\n\t // - +patchMergeKey=type\n\t // +patchStrategy=merge\n\t // +listType=map\n\t - \ // +listMapKey=type\n\t Conditions []metav1.Condition `json:\"conditions,omitempty\" - patchStrategy:\"merge\" patchMergeKey:\"type\" protobuf:\"bytes,1,rep,name=conditions\"`\n\n\n\t - \ // other fields\n\t}" + description: Condition contains details for one aspect of the current + state of this API Resource. properties: lastTransitionTime: description: |- @@ -2215,12 +2173,7 @@ spec: - Unknown type: string type: - description: |- - type of condition in CamelCase or in foo.example.com/CamelCase. - --- - Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be - useful (see .node.status.conditions), the ability to deconflict is important. - The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + description: type of condition in CamelCase or in foo.example.com/CamelCase. maxLength: 316 pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ type: string @@ -2248,7 +2201,6 @@ spec: History holds the history of Helm releases performed for this HelmRelease up to the last successfully completed release. - Note: this field is provisional to the v2beta2 API, and not actively used by v2beta1 HelmReleases. items: @@ -2368,7 +2320,6 @@ spec: LastAttemptedConfigDigest is the digest for the config (better known as "values") of the last reconciliation attempt. - Note: this field is provisional to the v2beta2 API, and not actively used by v2beta1 HelmReleases. type: string @@ -2377,7 +2328,6 @@ spec: LastAttemptedGeneration is the last generation the controller attempted to reconcile. - Note: this field is provisional to the v2beta2 API, and not actively used by v2beta1 HelmReleases. format: int64 @@ -2387,7 +2337,6 @@ spec: LastAttemptedReleaseAction is the last release action performed for this HelmRelease. It is used to determine the active remediation strategy. - Note: this field is provisional to the v2beta2 API, and not actively used by v2beta1 HelmReleases. type: string @@ -2405,7 +2354,6 @@ spec: LastHandledForceAt holds the value of the most recent force request value, so a change of the annotation value can be detected. - Note: this field is provisional to the v2beta2 API, and not actively used by v2beta1 HelmReleases. type: string @@ -2420,7 +2368,6 @@ spec: LastHandledResetAt holds the value of the most recent reset request value, so a change of the annotation value can be detected. - Note: this field is provisional to the v2beta2 API, and not actively used by v2beta1 HelmReleases. type: string @@ -2442,7 +2389,6 @@ spec: StorageNamespace is the namespace of the Helm release storage for the current release. - Note: this field is provisional to the v2beta2 API, and not actively used by v2beta1 HelmReleases. type: string @@ -2578,6 +2524,7 @@ spec: minLength: 1 type: string required: + - kind - name type: object valuesFile: @@ -2645,7 +2592,6 @@ spec: ChartRef holds a reference to a source controller resource containing the Helm chart artifact. - Note: this field is provisional to the v2 API, and not actively used by v2beta2 HelmReleases. properties: @@ -2788,17 +2734,13 @@ spec: `Create` or `CreateReplace`. Default is `Create` and if omitted CRDs are installed but not updated. - Skip: do neither install nor replace (update) any CRDs. - Create: new CRDs are created, existing CRDs are neither updated nor deleted. - CreateReplace: new CRDs are created, existing CRDs are updated (replaced) but not deleted. - By default, CRDs are applied (installed) during Helm install action. With this option users can opt in to CRD replace existing CRDs on Helm install actions, which is not (yet) natively supported by Helm. @@ -2866,7 +2808,6 @@ spec: SkipCRDs tells the Helm install action to not install any CRDs. By default, CRDs are installed if not already present. - Deprecated use CRD policy (`crds`) attribute with value `Skip` instead. type: boolean timeout: @@ -2927,13 +2868,11 @@ spec: duration of the reconciliation, instead of being created and destroyed for each (step of a) Helm action. - This can improve performance, but may cause issues with some Helm charts that for example do create Custom Resource Definitions during installation outside Helm's CRD lifecycle hooks, which are then not observed to be available by e.g. post-install hooks. - If not set, it defaults to true. type: boolean postRenderers: @@ -3314,17 +3253,13 @@ spec: `Create` or `CreateReplace`. Default is `Skip` and if omitted CRDs are neither installed nor upgraded. - Skip: do neither install nor replace (update) any CRDs. - Create: new CRDs are created, existing CRDs are neither updated nor deleted. - CreateReplace: new CRDs are created, existing CRDs are updated (replaced) but not deleted. - By default, CRDs are not applied during Helm upgrade action. With this option users can opt-in to CRD upgrade, which is not (yet) natively supported by Helm. https://helm.sh/docs/chart_best_practices/custom_resource_definitions. @@ -3467,16 +3402,8 @@ spec: conditions: description: Conditions holds the conditions for the HelmRelease. items: - description: "Condition contains details for one aspect of the current - state of this API Resource.\n---\nThis struct is intended for - direct use as an array at the field path .status.conditions. For - example,\n\n\n\ttype FooStatus struct{\n\t // Represents the - observations of a foo's current state.\n\t // Known .status.conditions.type - are: \"Available\", \"Progressing\", and \"Degraded\"\n\t // - +patchMergeKey=type\n\t // +patchStrategy=merge\n\t // +listType=map\n\t - \ // +listMapKey=type\n\t Conditions []metav1.Condition `json:\"conditions,omitempty\" - patchStrategy:\"merge\" patchMergeKey:\"type\" protobuf:\"bytes,1,rep,name=conditions\"`\n\n\n\t - \ // other fields\n\t}" + description: Condition contains details for one aspect of the current + state of this API Resource. properties: lastTransitionTime: description: |- @@ -3517,12 +3444,7 @@ spec: - Unknown type: string type: - description: |- - type of condition in CamelCase or in foo.example.com/CamelCase. - --- - Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be - useful (see .node.status.conditions), the ability to deconflict is important. - The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt) + description: type of condition in CamelCase or in foo.example.com/CamelCase. maxLength: 316 pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$ type: string diff --git a/config/rbac/role.yaml b/config/rbac/role.yaml index 52b74ee1f..f2ef2c043 100644 --- a/config/rbac/role.yaml +++ b/config/rbac/role.yaml @@ -45,19 +45,6 @@ rules: - source.toolkit.fluxcd.io resources: - helmcharts - verbs: - - get - - list - - watch -- apiGroups: - - source.toolkit.fluxcd.io - resources: - - helmcharts/status - verbs: - - get -- apiGroups: - - source.toolkit.fluxcd.io - resources: - ocirepositories verbs: - get @@ -66,6 +53,7 @@ rules: - apiGroups: - source.toolkit.fluxcd.io resources: + - helmcharts/status - ocirepositories/status verbs: - get From b36b123dcb27cdc08a7b90fbeb6cddcf2eea24a8 Mon Sep 17 00:00:00 2001 From: Stefan Prodan Date: Fri, 13 Sep 2024 13:14:52 +0300 Subject: [PATCH 2/2] Add required kind field to tests Signed-off-by: Stefan Prodan --- internal/controller/helmrelease_controller_test.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/controller/helmrelease_controller_test.go b/internal/controller/helmrelease_controller_test.go index 8a3ae7095..d56ea0c4c 100644 --- a/internal/controller/helmrelease_controller_test.go +++ b/internal/controller/helmrelease_controller_test.go @@ -47,6 +47,7 @@ import ( "github.com/fluxcd/pkg/apis/acl" aclv1 "github.com/fluxcd/pkg/apis/acl" + "github.com/fluxcd/pkg/apis/kustomize" "github.com/fluxcd/pkg/apis/meta" "github.com/fluxcd/pkg/runtime/conditions" feathelper "github.com/fluxcd/pkg/runtime/features" @@ -64,7 +65,6 @@ import ( intreconcile "github.com/fluxcd/helm-controller/internal/reconcile" "github.com/fluxcd/helm-controller/internal/release" "github.com/fluxcd/helm-controller/internal/testutil" - "github.com/fluxcd/pkg/apis/kustomize" ) func TestHelmReleaseReconciler_reconcileRelease(t *testing.T) { @@ -3496,6 +3496,7 @@ func TestValuesReferenceValidation(t *testing.T) { Chart: "mychart", SourceRef: v2.CrossNamespaceObjectReference{ Name: "something", + Kind: "HelmRepository", }, }, },