From e16cda42e587244939cbcda36fc1a3e78cd4f155 Mon Sep 17 00:00:00 2001 From: sangdammad <86688098+sangdammad@users.noreply.github.com> Date: Wed, 28 Sep 2022 15:05:40 -0500 Subject: [PATCH] Update crd version (#20) * fix:update crd version in helm chart * fix:update crd version in folder * refactor: remove the import aliases as they are not needed thereby reducing maintenance with every upgrade * refactor: upgrading the version on samples and comments that were missed in the last commit * fix: moving the crd to crd folder and checking to see if we can deploy through helm controller * upgrade helm chart version * refactor: update v1aplpha2 reference Co-authored-by: Sangeetha Madamanchi Co-authored-by: Flux <> --- Makefile | 2 +- api/v1alpha2/application_types.go | 8 ++++---- api/v1alpha2/groupversion_info.go | 2 +- api/v1alpha2/reference_types.go | 4 +--- charts/overwhelm/Chart.yaml | 2 +- .../applications.core.expediagroup.com-crd.yaml | 15 +++++++++++---- .../bases/core.expediagroup.com_applications.yaml | 10 ++++++---- .../application_crd_older_version_patch.yaml | 11 +++++++++++ config/helm-manifest/kustomization.yaml | 11 +++++++++-- 9 files changed, 45 insertions(+), 20 deletions(-) create mode 100644 config/helm-manifest/application_crd_older_version_patch.yaml diff --git a/Makefile b/Makefile index 9fc0417..feedee6 100644 --- a/Makefile +++ b/Makefile @@ -152,7 +152,7 @@ helmManifests: manifests kustomize kubernetes-split-yaml ## Create Helm Template .PHONY: helmInstall helmInstall: - helm upgrade -i overwhelm ./charts/overwhelm + helm upgrade -i overwhelm -n overwhelm-system ./charts/overwhelm .PHONY: uninstall uninstall: manifests kustomize ## Uninstall CRDs from the K8s cluster specified in ~/.kube/config. Call with ignore-not-found=true to ignore resource not found errors during deletion. diff --git a/api/v1alpha2/application_types.go b/api/v1alpha2/application_types.go index 4978f9f..7759f30 100644 --- a/api/v1alpha2/application_types.go +++ b/api/v1alpha2/application_types.go @@ -51,8 +51,8 @@ type ApplicationSpec struct { // +optional Data map[string]string `json:"data,omitempty"` - // PreRenderer holds custom templating delimiters and a flag to - // By default standard delimiters {{ and }} will be used to render values within. If specified then the custom delimiters will be used. + // PreRenderer holds custom templating delimiters and a flag. + // By default, standard delimiters {{ and }} will be used to render values within. If specified then the custom delimiters will be used. // +optional PreRenderer PreRenderer `json:"preRenderer,omitempty"` @@ -74,11 +74,11 @@ type ApplicationStatus struct { // +optional Conditions []metav1.Condition `json:"conditions,omitempty"` - // HelmReleaseGeneration is the helm release generation + // HelmReleaseGeneration is the helm release generation number // +optional HelmReleaseGeneration int64 `json:"helmReleaseGeneration,omitempty"` - // ValuesCheckSum is the checksum of the values for helm + // ValuesCheckSum is the checksum of the values file associated with the helm chart // +optional ValuesCheckSum string `json:"valuesCheckSum,omitempty"` diff --git a/api/v1alpha2/groupversion_info.go b/api/v1alpha2/groupversion_info.go index 2cadb01..d1ac955 100644 --- a/api/v1alpha2/groupversion_info.go +++ b/api/v1alpha2/groupversion_info.go @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -// Package v1alpha2contains API Schema definitions for the core v1alpha2 API group +// Package v1alpha2 contains API Schema definitions for the core v1alpha2 API group //+kubebuilder:object:generate=true //+groupName=core.expediagroup.com //+versionName:=v1alpha2 diff --git a/api/v1alpha2/reference_types.go b/api/v1alpha2/reference_types.go index feef9f3..ba1220a 100644 --- a/api/v1alpha2/reference_types.go +++ b/api/v1alpha2/reference_types.go @@ -14,8 +14,6 @@ package v1alpha2 -// SourceReference is the reference of the source where the chart is available. -// For e.g., the HelmRepository resource specifying where the helm chart is located type PreRenderer struct { // Custom non white-spaced and non alpha-numeric open delimiter used for go templating action to pre-render. For e.g., <%. Default is {{ @@ -30,7 +28,7 @@ type PreRenderer struct { // +optional RightDelimiter string `json:"closeDelimiter,omitempty"` - // Enable to allow Helm Templating to interpolate values within the default delimiters {{ }}. + // Enable to allow Helm Templating to interpolate values within the delimiters {{ }}. // Defaults to false allowing the pre-renderer to do interpolation within the default delimiters. If both helm templating // and pre-rendering are desired, then enable EnableHelmTemplating and specify custom delimiters as LeftDelimiter and RightDelimiter // +optional diff --git a/charts/overwhelm/Chart.yaml b/charts/overwhelm/Chart.yaml index fb170a2..e6ab715 100644 --- a/charts/overwhelm/Chart.yaml +++ b/charts/overwhelm/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v2 name: overwhelm -version: 1.1.1 +version: 1.1.2 maintainers: - name: "Expedia Group" url: "https://github.com/ExpediaGroup/overwhelm" \ No newline at end of file diff --git a/charts/overwhelm/crds/applications.core.expediagroup.com-crd.yaml b/charts/overwhelm/crds/applications.core.expediagroup.com-crd.yaml index 2f51675..f28172e 100755 --- a/charts/overwhelm/crds/applications.core.expediagroup.com-crd.yaml +++ b/charts/overwhelm/crds/applications.core.expediagroup.com-crd.yaml @@ -16,6 +16,13 @@ spec: singular: application scope: Namespaced versions: + - name: v1alpha1 + schema: + openAPIV3Schema: + description: Application is the Schema for the applications API + type: object + served: false + storage: false - additionalPrinterColumns: - jsonPath: .status.conditions[?(@.type=="Ready")].status name: Ready @@ -48,7 +55,7 @@ spec: description: Data to be consolidated for the Helm Chart's values.yaml file type: object preRenderer: - description: PreRenderer holds custom templating delimiters and a flag to By default standard delimiters \{\{ and }} will be used to render values within. If specified then the custom delimiters will be used. + description: PreRenderer holds custom templating delimiters and a flag. By default, standard delimiters \{\{ and }} will be used to render values within. If specified then the custom delimiters will be used. properties: closeDelimiter: description: Custom non white-spaced and non alpha-numeric close delimiter used for go templating action to pre-render. For e.g., %>. Default is }} @@ -56,7 +63,7 @@ spec: minLength: 2 type: string enableHelmTemplating: - description: Enable to allow Helm Templating to interpolate values within the default delimiters \{\{ }}. Defaults to false allowing the pre-renderer to do interpolation within the default delimiters. If both helm templating and pre-rendering are desired, then enable EnableHelmTemplating and specify custom delimiters as LeftDelimiter and RightDelimiter + description: Enable to allow Helm Templating to interpolate values within the delimiters \{\{ }}. Defaults to false allowing the pre-renderer to do interpolation within the default delimiters. If both helm templating and pre-rendering are desired, then enable EnableHelmTemplating and specify custom delimiters as LeftDelimiter and RightDelimiter type: boolean openDelimiter: description: Custom non white-spaced and non alpha-numeric open delimiter used for go templating action to pre-render. For e.g., <%. Default is \{\{ @@ -590,7 +597,7 @@ spec: format: int64 type: integer helmReleaseGeneration: - description: HelmReleaseGeneration is the helm release generation + description: HelmReleaseGeneration is the helm release generation number format: int64 type: integer observedGeneration: @@ -598,7 +605,7 @@ spec: format: int64 type: integer valuesCheckSum: - description: ValuesCheckSum is the checksum of the values for helm + description: ValuesCheckSum is the checksum of the values file associated with the helm chart type: string type: object type: object diff --git a/config/crd/bases/core.expediagroup.com_applications.yaml b/config/crd/bases/core.expediagroup.com_applications.yaml index cdeade4..108f3cc 100644 --- a/config/crd/bases/core.expediagroup.com_applications.yaml +++ b/config/crd/bases/core.expediagroup.com_applications.yaml @@ -55,7 +55,7 @@ spec: type: object preRenderer: description: PreRenderer holds custom templating delimiters and a - flag to By default standard delimiters {{ and }} will be used to + flag. By default, standard delimiters {{ and }} will be used to render values within. If specified then the custom delimiters will be used. properties: @@ -68,8 +68,8 @@ spec: type: string enableHelmTemplating: description: Enable to allow Helm Templating to interpolate values - within the default delimiters {{ }}. Defaults to false allowing - the pre-renderer to do interpolation within the default delimiters. + within the delimiters {{ }}. Defaults to false allowing the + pre-renderer to do interpolation within the default delimiters. If both helm templating and pre-rendering are desired, then enable EnableHelmTemplating and specify custom delimiters as LeftDelimiter and RightDelimiter @@ -883,6 +883,7 @@ spec: type: integer helmReleaseGeneration: description: HelmReleaseGeneration is the helm release generation + number format: int64 type: integer observedGeneration: @@ -890,7 +891,8 @@ spec: format: int64 type: integer valuesCheckSum: - description: ValuesCheckSum is the checksum of the values for helm + description: ValuesCheckSum is the checksum of the values file associated + with the helm chart type: string type: object type: object diff --git a/config/helm-manifest/application_crd_older_version_patch.yaml b/config/helm-manifest/application_crd_older_version_patch.yaml new file mode 100644 index 0000000..aaf8519 --- /dev/null +++ b/config/helm-manifest/application_crd_older_version_patch.yaml @@ -0,0 +1,11 @@ +# add older versions here if there is a version upgrade of the application CRD +- op: add + path: /spec/versions/0 + value: + name: v1alpha1 + served: false + storage: false + schema: + openAPIV3Schema: + description: Application is the Schema for the applications API + type: object \ No newline at end of file diff --git a/config/helm-manifest/kustomization.yaml b/config/helm-manifest/kustomization.yaml index da20a11..9fb9ad3 100644 --- a/config/helm-manifest/kustomization.yaml +++ b/config/helm-manifest/kustomization.yaml @@ -10,8 +10,8 @@ patchesStrategicMerge: name: overwhelm-system $patch: delete -patchesJson6902: # We use Json6902 patches for inline replacement patches which are not possible with Strategic Merge patches - - target: +patchesJson6902: + - target: # We use Json6902 patches for inline replacement patches which are not possible with Strategic Merge patches group: apps version: v1 kind: Deployment @@ -20,3 +20,10 @@ patchesJson6902: # We use Json6902 patches for inline replacement patches which - op: replace path: /spec/template/spec/containers/0/resources value: toYaml .Values.deployment.resources | indent 10 + - target: + group: apiextensions.k8s.io + version: v1 + kind: CustomResourceDefinition + name: applications.core.expediagroup.com + path: application_crd_older_version_patch.yaml +