Skip to content

Commit c936a95

Browse files
authored
feat: enable v2 in the Config spec (#1726)
1 parent 5bff51f commit c936a95

File tree

8 files changed

+49
-1
lines changed

8 files changed

+49
-1
lines changed

Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ output/bin/embedded-cluster-release-builder:
189189
initial-release: export EC_VERSION = $(VERSION)-$(CURRENT_USER)
190190
initial-release: export APP_VERSION = appver-dev-$(call random-string)
191191
initial-release: export RELEASE_YAML_DIR = e2e/kots-release-install
192+
initial-release: export V2_ENABLED = 0
192193
initial-release: check-env-EC_VERSION check-env-APP_VERSION
193194
UPLOAD_BINARIES=0 \
194195
./scripts/build-and-release.sh
@@ -205,6 +206,7 @@ rebuild-release: check-env-EC_VERSION check-env-APP_VERSION
205206
upgrade-release: RANDOM_STRING = $(call random-string)
206207
upgrade-release: export EC_VERSION = $(VERSION)-$(CURRENT_USER)-upgrade-$(RANDOM_STRING)
207208
upgrade-release: export APP_VERSION = appver-dev-$(call random-string)-upgrade-$(RANDOM_STRING)
209+
upgrade-release: export V2_ENABLED = 0
208210
upgrade-release: check-env-EC_VERSION check-env-APP_VERSION
209211
UPLOAD_BINARIES=1 \
210212
RELEASE_YAML_DIR=e2e/kots-release-upgrade \

e2e/kots-release-upgrade/cluster-config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ metadata:
44
name: "testconfig"
55
spec:
66
version: "__version_string__"
7+
v2Enabled: "__v2_enabled__"
78
binaryOverrideUrl: "__release_url__"
89
metadataOverrideUrl: "__metadata_url__"
910
roles:

kinds/apis/v1beta1/config_types.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,12 @@ func ConvertFrom(e k0sv1beta1.HelmExtensions, t *Helm) (*Helm, error) {
176176

177177
// ConfigSpec defines the desired state of Config
178178
type ConfigSpec struct {
179-
Version string `json:"version,omitempty"`
179+
Version string `json:"version,omitempty"`
180+
// V2Enabled is a temporary property that can be used to opt-in to the new installer. If set,
181+
// in addition to using the new v2 install method, v1 installations will be migrated to v2 on
182+
// upgrade. This property will be removed once the new installer is fully implemented and the
183+
// old installer is removed.
184+
V2Enabled bool `json:"v2Enabled,omitempty"`
180185
BinaryOverrideURL string `json:"binaryOverrideUrl,omitempty"`
181186
MetadataOverrideURL string `json:"metadataOverrideUrl,omitempty"`
182187
Roles Roles `json:"roles,omitempty"`

operator/charts/embedded-cluster-operator/charts/crds/templates/resources.yaml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,13 @@ spec:
218218
to use a string here.
219219
type: string
220220
type: object
221+
v2Enabled:
222+
description: |-
223+
V2Enabled is a temporary property that can be used to opt-in to the new installer. If set,
224+
in addition to using the new v2 install method, v1 installations will be migrated to v2 on
225+
upgrade. This property will be removed once the new installer is fully implemented and the
226+
old installer is removed.
227+
type: boolean
221228
version:
222229
type: string
223230
type: object
@@ -508,6 +515,13 @@ spec:
508515
to use a string here.
509516
type: string
510517
type: object
518+
v2Enabled:
519+
description: |-
520+
V2Enabled is a temporary property that can be used to opt-in to the new installer. If set,
521+
in addition to using the new v2 install method, v1 installations will be migrated to v2 on
522+
upgrade. This property will be removed once the new installer is fully implemented and the
523+
old installer is removed.
524+
type: boolean
511525
version:
512526
type: string
513527
type: object

operator/config/crd/bases/embeddedcluster.replicated.com_configs.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,13 @@ spec:
227227
to use a string here.
228228
type: string
229229
type: object
230+
v2Enabled:
231+
description: |-
232+
V2Enabled is a temporary property that can be used to opt-in to the new installer. If set,
233+
in addition to using the new v2 install method, v1 installations will be migrated to v2 on
234+
upgrade. This property will be removed once the new installer is fully implemented and the
235+
old installer is removed.
236+
type: boolean
230237
version:
231238
type: string
232239
type: object

operator/config/crd/bases/embeddedcluster.replicated.com_installations.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,13 @@ spec:
289289
to use a string here.
290290
type: string
291291
type: object
292+
v2Enabled:
293+
description: |-
294+
V2Enabled is a temporary property that can be used to opt-in to the new installer. If set,
295+
in addition to using the new v2 install method, v1 installations will be migrated to v2 on
296+
upgrade. This property will be removed once the new installer is fully implemented and the
297+
old installer is removed.
298+
type: boolean
292299
version:
293300
type: string
294301
type: object

scripts/ci-embed-release.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ RELEASE_YAML_DIR=${RELEASE_YAML_DIR:-e2e/kots-release-install}
1414
EC_BINARY=${EC_BINARY:-output/bin/embedded-cluster}
1515
S3_BUCKET="${S3_BUCKET:-dev-embedded-cluster-bin}"
1616
USES_DEV_BUCKET=${USES_DEV_BUCKET:-1}
17+
V2_ENABLED=${V2_ENABLED:-0}
1718

1819
require RELEASE_YAML_DIR "${RELEASE_YAML_DIR:-}"
1920
require EC_BINARY "${EC_BINARY:-}"
@@ -63,6 +64,11 @@ function create_release_archive() {
6364
fi
6465

6566
sed -i.bak "s|__version_string__|${EC_VERSION}|g" output/tmp/release/cluster-config.yaml
67+
if [ "$V2_ENABLED" == "1" ]; then
68+
sed -i.bak "s|__v2_enabled__|true|g" output/tmp/release/cluster-config.yaml
69+
else
70+
sed -i.bak "s|__v2_enabled__|false|g" output/tmp/release/cluster-config.yaml
71+
fi
6672
sed -i.bak "s|__release_url__|$release_url|g" output/tmp/release/cluster-config.yaml
6773
sed -i.bak "s|__metadata_url__|$metadata_url|g" output/tmp/release/cluster-config.yaml
6874

scripts/ci-release-app.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ REPLICATED_APP=${REPLICATED_APP:-embedded-cluster-smoke-test-staging-app}
1313
REPLICATED_API_ORIGIN=${REPLICATED_API_ORIGIN:-https://api.staging.replicated.com/vendor}
1414
S3_BUCKET="${S3_BUCKET:-dev-embedded-cluster-bin}"
1515
USES_DEV_BUCKET=${USES_DEV_BUCKET:-1}
16+
V2_ENABLED=${V2_ENABLED:-0}
1617

1718
if [ "$USES_DEV_BUCKET" == "1" ]; then
1819
require S3_BUCKET "${S3_BUCKET:-}"
@@ -63,6 +64,11 @@ function create_release() {
6364
fi
6465

6566
sed -i.bak "s|__version_string__|${EC_VERSION}|g" output/tmp/release/cluster-config.yaml
67+
if [ "$V2_ENABLED" == "1" ]; then
68+
sed -i.bak "s|__v2_enabled__|true|g" output/tmp/release/cluster-config.yaml
69+
else
70+
sed -i.bak "s|__v2_enabled__|false|g" output/tmp/release/cluster-config.yaml
71+
fi
6672
sed -i.bak "s|__release_url__|$release_url|g" output/tmp/release/cluster-config.yaml
6773
sed -i.bak "s|__metadata_url__|$metadata_url|g" output/tmp/release/cluster-config.yaml
6874

0 commit comments

Comments
 (0)