Skip to content

Commit

Permalink
Merge pull request #436 from Mirantis/templates-version
Browse files Browse the repository at this point in the history
Templates versioning
  • Loading branch information
Kshatrix authored Oct 7, 2024
2 parents af8858f + 63a8a9f commit e66ac68
Show file tree
Hide file tree
Showing 35 changed files with 54 additions and 58 deletions.
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
NAMESPACE ?= hmc-system
VERSION ?= $(shell git describe --tags --always)
FQDN_VERSION = $(patsubst v%,%,$(subst .,-, $(VERSION)))
# Image URL to use all building/pushing image targets
IMG ?= hmc/controller:latest
IMG_REPO = $(shell echo $(IMG) | cut -d: -f1)
Expand Down Expand Up @@ -69,7 +70,8 @@ set-hmc-version: yq
$(YQ) eval '.version = "$(VERSION)"' -i $(PROVIDER_TEMPLATES_DIR)/hmc-templates/Chart.yaml
$(YQ) eval '.image.tag = "$(VERSION)"' -i $(PROVIDER_TEMPLATES_DIR)/hmc/values.yaml
$(YQ) eval '.spec.version = "$(VERSION)"' -i $(PROVIDER_TEMPLATES_DIR)/hmc-templates/files/release.yaml
$(YQ) eval '.metadata.name = "hmc-$(patsubst v%,%,$(subst .,-, $(VERSION)))"' -i $(PROVIDER_TEMPLATES_DIR)/hmc-templates/files/release.yaml
$(YQ) eval '.metadata.name = "hmc-$(FQDN_VERSION)"' -i $(PROVIDER_TEMPLATES_DIR)/hmc-templates/files/release.yaml
$(YQ) eval '.spec.hmc.template = "hmc-$(FQDN_VERSION)"' -i $(PROVIDER_TEMPLATES_DIR)/hmc-templates/files/release.yaml

.PHONY: hmc-chart-release
hmc-chart-release: set-hmc-version templates-generate ## Generate hmc helm chart
Expand Down
2 changes: 2 additions & 0 deletions api/v1alpha1/management_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ type ManagementStatus struct {
AvailableProviders Providers `json:"availableProviders,omitempty"`
// Components indicates the status of installed HMC components and CAPI providers.
Components map[string]ComponentStatus `json:"components,omitempty"`
// Release indicates the current Release object.
Release string `json:"release,omitempty"`
}

// ComponentStatus is the status of Management component installation
Expand Down
2 changes: 0 additions & 2 deletions api/v1alpha1/release_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ import (
type ReleaseSpec struct {
// Version of the HMC Release in the semver format.
Version string `json:"version"`
// UpgradeableVersions contains a list of versions available to upgrade from.
UpgradeableVersions []string `json:"upgradeableVersions,omitempty"`
// HMC references the HMC template.
HMC CoreProviderTemplate `json:"hmc"`
// CAPI references the Cluster API template.
Expand Down
5 changes: 0 additions & 5 deletions api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion hack/templates.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,15 @@ for type in "$TEMPLATES_DIR"/*; do
name=$(grep '^name:' $chart/Chart.yaml | awk '{print $2}')
if [ "$name" = "$HMC_TEMPLATES_CHART_NAME" ]; then continue; fi
version=$(grep '^version:' $chart/Chart.yaml | awk '{print $2}')
template_name=$name-$(echo "$version" | sed 's/^v//; s/\./-/g')

cat <<EOF > $TEMPLATES_OUTPUT_DIR/$name.yaml
apiVersion: hmc.mirantis.com/v1alpha1
kind: $kind
EOF
cat <<EOF >> $TEMPLATES_OUTPUT_DIR/$name.yaml
metadata:
name: $name
name: $template_name
annotations:
helm.sh/resource-policy: keep
spec:
Expand Down
1 change: 1 addition & 0 deletions internal/controller/management_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ func (r *ManagementReconciler) Update(ctx context.Context, management *hmc.Manag
management.Status.ObservedGeneration = management.Generation
management.Status.AvailableProviders = detectedProviders
management.Status.Components = detectedComponents
management.Status.Release = management.Spec.Release
if err := r.Status().Update(ctx, management); err != nil {
errs = errors.Join(errs, fmt.Errorf("failed to update status for Management %s: %w",
management.Name, err))
Expand Down
2 changes: 1 addition & 1 deletion templates/cluster/aws-hosted-cp/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.4
version: 0.0.1
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
Expand Down
2 changes: 1 addition & 1 deletion templates/cluster/aws-standalone-cp/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.4
version: 0.0.1
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
Expand Down
2 changes: 1 addition & 1 deletion templates/cluster/azure-hosted-cp/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.1
version: 0.0.1
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
Expand Down
2 changes: 1 addition & 1 deletion templates/cluster/azure-standalone-cp/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.1
version: 0.0.1
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
Expand Down
2 changes: 1 addition & 1 deletion templates/cluster/vsphere-hosted-cp/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.0.2
version: 0.0.1
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
Expand Down
2 changes: 1 addition & 1 deletion templates/cluster/vsphere-standalone-cp/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.0.2
version: 0.0.1
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
Expand Down
2 changes: 1 addition & 1 deletion templates/provider/cluster-api-provider-aws/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.2
version: 0.0.1
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
Expand Down
2 changes: 1 addition & 1 deletion templates/provider/cluster-api/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.1
version: 0.0.1
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
Expand Down
2 changes: 1 addition & 1 deletion templates/provider/hmc-templates/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.0
version: 0.0.1
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
Expand Down
14 changes: 7 additions & 7 deletions templates/provider/hmc-templates/files/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@ metadata:
spec:
version: v0.0.2
hmc:
template: hmc
template: hmc-0-0-1
capi:
template: cluster-api
template: cluster-api-0-0-1
providers:
- name: k0smotron
template: k0smotron
template: k0smotron-0-0-1
- name: cluster-api-provider-azure
template: cluster-api-provider-azure
template: cluster-api-provider-azure-0-0-1
- name: cluster-api-provider-vsphere
template: cluster-api-provider-vsphere
template: cluster-api-provider-vsphere-0-0-1
- name: cluster-api-provider-aws
template: cluster-api-provider-aws
template: cluster-api-provider-aws-0-0-1
- name: projectsveltos
template: projectsveltos
template: projectsveltos-0-38-2
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
apiVersion: hmc.mirantis.com/v1alpha1
kind: ClusterTemplate
metadata:
name: aws-hosted-cp
name: aws-hosted-cp-0-0-1
annotations:
helm.sh/resource-policy: keep
spec:
helm:
chartName: aws-hosted-cp
chartVersion: 0.1.4
chartVersion: 0.0.1
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
apiVersion: hmc.mirantis.com/v1alpha1
kind: ClusterTemplate
metadata:
name: aws-standalone-cp
name: aws-standalone-cp-0-0-1
annotations:
helm.sh/resource-policy: keep
spec:
helm:
chartName: aws-standalone-cp
chartVersion: 0.1.4
chartVersion: 0.0.1
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
apiVersion: hmc.mirantis.com/v1alpha1
kind: ClusterTemplate
metadata:
name: azure-hosted-cp
name: azure-hosted-cp-0-0-1
annotations:
helm.sh/resource-policy: keep
spec:
helm:
chartName: azure-hosted-cp
chartVersion: 0.1.1
chartVersion: 0.0.1
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
apiVersion: hmc.mirantis.com/v1alpha1
kind: ClusterTemplate
metadata:
name: azure-standalone-cp
name: azure-standalone-cp-0-0-1
annotations:
helm.sh/resource-policy: keep
spec:
helm:
chartName: azure-standalone-cp
chartVersion: 0.1.1
chartVersion: 0.0.1
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
apiVersion: hmc.mirantis.com/v1alpha1
kind: ProviderTemplate
metadata:
name: cluster-api-provider-aws
name: cluster-api-provider-aws-0-0-1
annotations:
helm.sh/resource-policy: keep
spec:
helm:
chartName: cluster-api-provider-aws
chartVersion: 0.1.2
chartVersion: 0.0.1
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: hmc.mirantis.com/v1alpha1
kind: ProviderTemplate
metadata:
name: cluster-api-provider-azure
name: cluster-api-provider-azure-0-0-1
annotations:
helm.sh/resource-policy: keep
spec:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: hmc.mirantis.com/v1alpha1
kind: ProviderTemplate
metadata:
name: cluster-api-provider-vsphere
name: cluster-api-provider-vsphere-0-0-1
annotations:
helm.sh/resource-policy: keep
spec:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
apiVersion: hmc.mirantis.com/v1alpha1
kind: ProviderTemplate
metadata:
name: cluster-api
name: cluster-api-0-0-1
annotations:
helm.sh/resource-policy: keep
spec:
helm:
chartName: cluster-api
chartVersion: 0.1.1
chartVersion: 0.0.1
4 changes: 2 additions & 2 deletions templates/provider/hmc-templates/files/templates/hmc.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
apiVersion: hmc.mirantis.com/v1alpha1
kind: ProviderTemplate
metadata:
name: hmc
name: hmc-0-0-1
annotations:
helm.sh/resource-policy: keep
spec:
helm:
chartName: hmc
chartVersion: 0.1.0
chartVersion: 0.0.1
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: hmc.mirantis.com/v1alpha1
kind: ServiceTemplate
metadata:
name: ingress-nginx
name: ingress-nginx-4-11-0
annotations:
helm.sh/resource-policy: keep
spec:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
apiVersion: hmc.mirantis.com/v1alpha1
kind: ProviderTemplate
metadata:
name: k0smotron
name: k0smotron-0-0-1
annotations:
helm.sh/resource-policy: keep
spec:
helm:
chartName: k0smotron
chartVersion: 0.1.3
chartVersion: 0.0.1
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: hmc.mirantis.com/v1alpha1
kind: ServiceTemplate
metadata:
name: kyverno
name: kyverno-3-2-6
annotations:
helm.sh/resource-policy: keep
spec:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: hmc.mirantis.com/v1alpha1
kind: ProviderTemplate
metadata:
name: projectsveltos
name: projectsveltos-0-38-2
annotations:
helm.sh/resource-policy: keep
spec:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
apiVersion: hmc.mirantis.com/v1alpha1
kind: ClusterTemplate
metadata:
name: vsphere-hosted-cp
name: vsphere-hosted-cp-0-0-1
annotations:
helm.sh/resource-policy: keep
spec:
helm:
chartName: vsphere-hosted-cp
chartVersion: 0.0.2
chartVersion: 0.0.1
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
apiVersion: hmc.mirantis.com/v1alpha1
kind: ClusterTemplate
metadata:
name: vsphere-standalone-cp
name: vsphere-standalone-cp-0-0-1
annotations:
helm.sh/resource-policy: keep
spec:
helm:
chartName: vsphere-standalone-cp
chartVersion: 0.0.2
chartVersion: 0.0.1
2 changes: 1 addition & 1 deletion templates/provider/hmc/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.0
version: 0.0.1
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,9 @@ spec:
description: ObservedGeneration is the last observed generation.
format: int64
type: integer
release:
description: Release indicates the current Release object.
type: string
type: object
type: object
served: true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,12 +76,6 @@ spec:
- template
type: object
type: array
upgradeableVersions:
description: UpgradeableVersions contains a list of versions available
to upgrade from.
items:
type: string
type: array
version:
description: Version of the HMC Release in the semver format.
type: string
Expand Down
2 changes: 1 addition & 1 deletion templates/provider/k0smotron/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.3
version: 0.0.1
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
Expand Down

0 comments on commit e66ac68

Please sign in to comment.