Skip to content

Commit 3353a09

Browse files
committed
Merge remote-tracking branch 'origin/main' into k0s-1-28-9
2 parents 9a95d58 + b7c5611 commit 3353a09

File tree

10 files changed

+238
-29
lines changed

10 files changed

+238
-29
lines changed

Makefile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ ARCH := $(shell uname -m)
44
APP_NAME = embedded-cluster
55
ADMIN_CONSOLE_CHART_URL = oci://registry.replicated.com/library
66
ADMIN_CONSOLE_CHART_NAME = admin-console
7-
ADMIN_CONSOLE_CHART_VERSION = 1.108.9-build.1
7+
ADMIN_CONSOLE_CHART_VERSION = 1.108.10
88
ADMIN_CONSOLE_IMAGE_OVERRIDE =
99
ADMIN_CONSOLE_MIGRATIONS_IMAGE_OVERRIDE =
1010
EMBEDDED_OPERATOR_CHART_URL = oci://registry.replicated.com/library
1111
EMBEDDED_OPERATOR_CHART_NAME = embedded-cluster-operator
12-
EMBEDDED_OPERATOR_CHART_VERSION = 0.28.2
12+
EMBEDDED_OPERATOR_CHART_VERSION = 0.29.0
1313
EMBEDDED_OPERATOR_UTILS_IMAGE = busybox:1.36.1
1414
EMBEDDED_CLUSTER_OPERATOR_IMAGE_OVERRIDE =
15-
OPENEBS_CHART_URL = https://openebs.github.io/charts
15+
OPENEBS_CHART_URL = https://openebs-archive.github.io/charts
1616
OPENEBS_CHART_NAME = openebs/openebs
1717
OPENEBS_CHART_VERSION = 3.10.0
1818
OPENEBS_UTILS_VERSION = 4.0.0
@@ -29,7 +29,7 @@ KUBECTL_VERSION = v1.28.9
2929
K0S_VERSION = v1.28.9+k0s.0
3030
PREVIOUS_K0S_VERSION ?= v1.28.8+k0s.0
3131
K0S_BINARY_SOURCE_OVERRIDE =
32-
TROUBLESHOOT_VERSION = v0.88.1
32+
TROUBLESHOOT_VERSION = v0.89.0
3333
KOTS_VERSION = v$(shell echo $(ADMIN_CONSOLE_CHART_VERSION) | sed 's/\([0-9]\+\.[0-9]\+\.[0-9]\+\).*/\1/')
3434
LD_FLAGS = -X github.com/replicatedhq/embedded-cluster/pkg/defaults.K0sVersion=$(K0S_VERSION) \
3535
-X github.com/replicatedhq/embedded-cluster/pkg/defaults.Version=$(VERSION) \

e2e/scripts/unsupported-overrides.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ spec:
5757
version: 6.6.2
5858
repositories:
5959
- name: openebs
60-
url: https://openebs.github.io/charts
60+
url: https://openebs-archive.github.io/charts
6161
"
6262

6363
embed_cluster_config() {

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ require (
1313
github.com/jedib0t/go-pretty v4.3.0+incompatible
1414
github.com/k0sproject/dig v0.2.0
1515
github.com/k0sproject/k0s v1.28.10-0.20240418084644-c99e4b437507
16-
github.com/replicatedhq/embedded-cluster-kinds v1.1.4
16+
github.com/replicatedhq/embedded-cluster-kinds v1.1.6
1717
github.com/replicatedhq/embedded-cluster-operator v0.27.0
1818
github.com/replicatedhq/embedded-cluster-utils v1.0.0
1919
github.com/replicatedhq/kotskinds v0.0.0-20230724164735-f83482cc9cfe

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,8 +243,8 @@ github.com/prometheus/common v0.45.0 h1:2BGz0eBc2hdMDLnO/8n0jeB3oPrt2D08CekT0lne
243243
github.com/prometheus/common v0.45.0/go.mod h1:YJmSTw9BoKxJplESWWxlbyttQR4uaEcGyv9MZjVOJsY=
244244
github.com/prometheus/procfs v0.12.0 h1:jluTpSng7V9hY0O2R9DzzJHYb2xULk9VTR1V1R/k6Bo=
245245
github.com/prometheus/procfs v0.12.0/go.mod h1:pcuDEFsWDnvcgNzo4EEweacyhjeA9Zk3cnaOZAZEfOo=
246-
github.com/replicatedhq/embedded-cluster-kinds v1.1.4 h1:0rquUeVpqj3nizF1RS1qrhkf+gJJqc1Y8ZiWP0Ed/iA=
247-
github.com/replicatedhq/embedded-cluster-kinds v1.1.4/go.mod h1:LheSDOgMngMRAbwAj0sVZUVv2ciKIVR2bYTMeOBGwlg=
246+
github.com/replicatedhq/embedded-cluster-kinds v1.1.6 h1:eJgXyo981RiNM2thKhXKxs/pq9rD0yqQY6zEZ12WPWM=
247+
github.com/replicatedhq/embedded-cluster-kinds v1.1.6/go.mod h1:tj418fVUIy1xzxKacfoMx0SG4Oy5HF7RYC6Sy1mXgcU=
248248
github.com/replicatedhq/embedded-cluster-operator v0.27.0 h1:Y/Ps7zNu+lLYbkvdHf/AKoexoH1L295OZ8DLI3CXGxI=
249249
github.com/replicatedhq/embedded-cluster-operator v0.27.0/go.mod h1:fia5+2ba2P7pBnEqVRkXpWnlJj8TrXmvjN6hr1equpQ=
250250
github.com/replicatedhq/embedded-cluster-utils v1.0.0 h1:Axdni1nYfl5zeOP9g5U79yvN8cRdClyU6hz0wV1Hmdc=

pkg/addons/applier.go

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,15 @@ func (a *Applier) GenerateHelmConfigs(additionalCharts []v1beta1.Chart, addition
8989

9090
// charts required by the application
9191
charts = append(charts, additionalCharts...)
92+
if a.endUserConfig != nil {
93+
for i, chart := range charts {
94+
values, err := a.endUserConfig.Spec.ApplyEndUserAddOnOverrides(chart.Name, chart.Values)
95+
if err != nil {
96+
return nil, nil, fmt.Errorf("unable to apply end user overrides for %s: %w", chart.Name, err)
97+
}
98+
charts[i].Values = values
99+
}
100+
}
92101
repositories = append(repositories, additionalRepositories...)
93102

94103
return charts, repositories, nil
@@ -191,13 +200,7 @@ func (a *Applier) load() ([]AddOn, error) {
191200
}
192201
addons = append(addons, reg)
193202

194-
operatorOptions := embeddedclusteroperator.Options{
195-
EndUserConfig: a.endUserConfig,
196-
LicenseFile: a.licenseFile,
197-
Airgap: a.airgapBundle != "",
198-
ReleaseMetadata: a.releaseMetadata,
199-
}
200-
embedoperator, err := embeddedclusteroperator.New(operatorOptions)
203+
embedoperator, err := embeddedclusteroperator.New(a.endUserConfig, a.licenseFile, a.airgapBundle != "", a.releaseMetadata)
201204
if err != nil {
202205
return nil, fmt.Errorf("unable to create embedded cluster operator addon: %w", err)
203206
}

pkg/addons/applier_test.go

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
package addons
2+
3+
import (
4+
"embed"
5+
"path/filepath"
6+
"strings"
7+
"testing"
8+
9+
"github.com/replicatedhq/embedded-cluster-kinds/apis/v1beta1"
10+
"github.com/stretchr/testify/require"
11+
"gopkg.in/yaml.v2"
12+
k8syaml "sigs.k8s.io/yaml"
13+
)
14+
15+
//go:embed testdata/*
16+
var testData embed.FS
17+
18+
func parseTestsYAML[T any](t *testing.T, prefix string) map[string]T {
19+
entries, err := testData.ReadDir("testdata")
20+
require.NoError(t, err)
21+
tests := make(map[string]T, 0)
22+
for _, entry := range entries {
23+
if !strings.HasPrefix(entry.Name(), prefix) {
24+
continue
25+
}
26+
27+
fpath := filepath.Join("testdata", entry.Name())
28+
data, err := testData.ReadFile(fpath)
29+
require.NoError(t, err)
30+
31+
var onetest T
32+
err = yaml.Unmarshal(data, &onetest)
33+
require.NoError(t, err)
34+
35+
tests[fpath] = onetest
36+
}
37+
return tests
38+
}
39+
40+
func TestGenerateHelmConfigWithOverrides(t *testing.T) {
41+
type addonConfig struct {
42+
Name string `yaml:"name"`
43+
Values string `yaml:"values"`
44+
}
45+
46+
type test struct {
47+
Name string
48+
EndUserConfig string `yaml:"endUserConfig"`
49+
Expected []addonConfig
50+
}
51+
52+
for tname, tt := range parseTestsYAML[test](t, "generate-helm-config-overrides-") {
53+
t.Run(tname, func(t *testing.T) {
54+
var config v1beta1.Config
55+
err := k8syaml.Unmarshal([]byte(tt.EndUserConfig), &config)
56+
require.NoError(t, err)
57+
applier := NewApplier(
58+
WithEndUserConfig(&config),
59+
WithoutPrompt(),
60+
WithAirgapBundle("/does/not/exist"),
61+
)
62+
charts, _, err := applier.GenerateHelmConfigs(nil, nil)
63+
require.NoError(t, err)
64+
65+
for _, exp := range tt.Expected {
66+
var values string
67+
for _, chart := range charts {
68+
if chart.Name != exp.Name {
69+
continue
70+
}
71+
values = chart.Values
72+
break
73+
}
74+
require.NotEmpty(t, values, "addon %s not found", exp.Name)
75+
76+
expected := map[string]interface{}{}
77+
err = yaml.Unmarshal([]byte(exp.Values), &expected)
78+
require.NoError(t, err)
79+
80+
found := map[string]interface{}{}
81+
err = yaml.Unmarshal([]byte(values), &found)
82+
require.NoError(t, err)
83+
84+
require.Equal(t, expected, found)
85+
}
86+
})
87+
}
88+
}

pkg/addons/embeddedclusteroperator/embeddedclusteroperator.go

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -212,24 +212,15 @@ func (e *EmbeddedClusterOperator) Outro(ctx context.Context, cli client.Client)
212212
return nil
213213
}
214214

215-
// Options is the options used when creating a new embedded cluster operator
216-
// addon installer.
217-
type Options struct {
218-
ReleaseMetadata *types.ReleaseMetadata
219-
EndUserConfig *embeddedclusterv1beta1.Config
220-
LicenseFile string
221-
Airgap bool
222-
}
223-
224215
// New creates a new EmbeddedClusterOperator addon.
225-
func New(opts Options) (*EmbeddedClusterOperator, error) {
216+
func New(endUserConfig *embeddedclusterv1beta1.Config, licenseFile string, airgapEnabled bool, releaseMetadata *types.ReleaseMetadata) (*EmbeddedClusterOperator, error) {
226217
return &EmbeddedClusterOperator{
227218
namespace: "embedded-cluster",
228219
deployName: "embedded-cluster-operator",
229-
endUserConfig: opts.EndUserConfig,
230-
licenseFile: opts.LicenseFile,
231-
airgap: opts.Airgap,
232-
releaseMetadata: opts.ReleaseMetadata,
220+
endUserConfig: endUserConfig,
221+
licenseFile: licenseFile,
222+
airgap: airgapEnabled,
223+
releaseMetadata: releaseMetadata,
233224
}, nil
234225
}
235226

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
endUserConfig: |
2+
apiVersion: embeddedcluster.replicated.com/v1beta1
3+
kind: Config
4+
spec:
5+
unsupportedOverrides:
6+
builtInExtensions:
7+
- name: docker-registry
8+
values: |
9+
replicaCount: 3
10+
persistence:
11+
size: 50Gi
12+
- name: openebs
13+
values: |-
14+
newProperty: newValue
15+
analytics:
16+
enabled: true
17+
localprovisioner:
18+
hostpathClass:
19+
isDefaultClass: false
20+
expected:
21+
- name: docker-registry
22+
values: |
23+
configData:
24+
auth:
25+
htpasswd:
26+
path: /auth/htpasswd
27+
realm: Registry
28+
extraVolumeMounts:
29+
- mountPath: /auth
30+
name: auth
31+
extraVolumes:
32+
- name: auth
33+
secret:
34+
secretName: registry-auth
35+
fullnameOverride: registry
36+
image:
37+
tag: 2.8.3
38+
persistence:
39+
accessMode: ReadWriteOnce
40+
enabled: true
41+
size: 50Gi
42+
storageClass: openebs-hostpath
43+
replicaCount: 3
44+
storage: filesystem
45+
- name: openebs
46+
values: |
47+
newProperty: newValue
48+
analytics:
49+
enabled: true
50+
ndmOperator:
51+
enabled: false
52+
helper:
53+
imageTag: ""
54+
ndm:
55+
enabled: false
56+
localprovisioner:
57+
deviceClass:
58+
enabled: false
59+
hostpathClass:
60+
isDefaultClass: false
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
endUserConfig: |
2+
apiVersion: embeddedcluster.replicated.com/v1beta1
3+
kind: Config
4+
spec:
5+
unsupportedOverrides:
6+
builtInExtensions:
7+
- name: openebs
8+
values: |-
9+
newProperty: newValue
10+
analytics:
11+
enabled: true
12+
localprovisioner:
13+
hostpathClass:
14+
isDefaultClass: false
15+
expected:
16+
- name: openebs
17+
values: |
18+
newProperty: newValue
19+
analytics:
20+
enabled: true
21+
ndmOperator:
22+
enabled: false
23+
helper:
24+
imageTag: ""
25+
ndm:
26+
enabled: false
27+
localprovisioner:
28+
deviceClass:
29+
enabled: false
30+
hostpathClass:
31+
isDefaultClass: false
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
endUserConfig: |
2+
apiVersion: embeddedcluster.replicated.com/v1beta1
3+
kind: Config
4+
spec:
5+
unsupportedOverrides:
6+
builtInExtensions:
7+
- name: docker-registry
8+
values: |
9+
replicaCount: 8
10+
persistence:
11+
size: 100Gi
12+
expected:
13+
- name: docker-registry
14+
values: |
15+
configData:
16+
auth:
17+
htpasswd:
18+
path: /auth/htpasswd
19+
realm: Registry
20+
extraVolumeMounts:
21+
- mountPath: /auth
22+
name: auth
23+
extraVolumes:
24+
- name: auth
25+
secret:
26+
secretName: registry-auth
27+
fullnameOverride: registry
28+
image:
29+
tag: 2.8.3
30+
persistence:
31+
accessMode: ReadWriteOnce
32+
enabled: true
33+
size: 100Gi
34+
storageClass: openebs-hostpath
35+
replicaCount: 8
36+
storage: filesystem

0 commit comments

Comments
 (0)