Skip to content

Commit 8779eb7

Browse files
chore: Use reimplimented types (#239)
* Use our own kinds * asdf * clean up test errors * clean up test errors * clean up test errors * convert between equal types * fix test * gofmt * remove relative import * bump * sum * bump * test types * omitempty * use own repository kind * bump to merged kinds version * remove volume mount from makefile
1 parent cf48a5c commit 8779eb7

File tree

11 files changed

+171
-193
lines changed

11 files changed

+171
-193
lines changed

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

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,9 @@ spec:
4444
extensions:
4545
properties:
4646
helm:
47-
description: HelmExtensions specifies settings for cluster helm based extensions
47+
description: Helm contains helm extension settings
4848
properties:
4949
charts:
50-
description: ChartsSettings charts settings
5150
items:
5251
description: Chart single helm addon
5352
properties:
@@ -60,10 +59,7 @@ spec:
6059
order:
6160
type: integer
6261
timeout:
63-
description: |-
64-
A Duration represents the elapsed time between two instants
65-
as an int64 nanosecond count. The representation limits the
66-
largest representable duration to approximately 290 years.
62+
description: Timeout specifies the timeout for how long to wait for the chart installation to finish.
6763
format: int64
6864
type: integer
6965
values:
@@ -75,9 +71,7 @@ spec:
7571
concurrencyLevel:
7672
type: integer
7773
repositories:
78-
description: RepositoriesSettings repository settings
7974
items:
80-
description: Repository describes single repository entry. Fields map to the CLI flags for the "helm add" command
8175
properties:
8276
caFile:
8377
type: string
@@ -315,10 +309,9 @@ spec:
315309
extensions:
316310
properties:
317311
helm:
318-
description: HelmExtensions specifies settings for cluster helm based extensions
312+
description: Helm contains helm extension settings
319313
properties:
320314
charts:
321-
description: ChartsSettings charts settings
322315
items:
323316
description: Chart single helm addon
324317
properties:
@@ -331,10 +324,7 @@ spec:
331324
order:
332325
type: integer
333326
timeout:
334-
description: |-
335-
A Duration represents the elapsed time between two instants
336-
as an int64 nanosecond count. The representation limits the
337-
largest representable duration to approximately 290 years.
327+
description: Timeout specifies the timeout for how long to wait for the chart installation to finish.
338328
format: int64
339329
type: integer
340330
values:
@@ -346,9 +336,7 @@ spec:
346336
concurrencyLevel:
347337
type: integer
348338
repositories:
349-
description: RepositoriesSettings repository settings
350339
items:
351-
description: Repository describes single repository entry. Fields map to the CLI flags for the "helm add" command
352340
properties:
353341
caFile:
354342
type: string

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

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,9 @@ spec:
4242
extensions:
4343
properties:
4444
helm:
45-
description: HelmExtensions specifies settings for cluster helm
46-
based extensions
45+
description: Helm contains helm extension settings
4746
properties:
4847
charts:
49-
description: ChartsSettings charts settings
5048
items:
5149
description: Chart single helm addon
5250
properties:
@@ -59,10 +57,8 @@ spec:
5957
order:
6058
type: integer
6159
timeout:
62-
description: |-
63-
A Duration represents the elapsed time between two instants
64-
as an int64 nanosecond count. The representation limits the
65-
largest representable duration to approximately 290 years.
60+
description: Timeout specifies the timeout for how long
61+
to wait for the chart installation to finish.
6662
format: int64
6763
type: integer
6864
values:
@@ -74,10 +70,7 @@ spec:
7470
concurrencyLevel:
7571
type: integer
7672
repositories:
77-
description: RepositoriesSettings repository settings
7873
items:
79-
description: Repository describes single repository entry.
80-
Fields map to the CLI flags for the "helm add" command
8174
properties:
8275
caFile:
8376
type: string

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

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,9 @@ spec:
9494
extensions:
9595
properties:
9696
helm:
97-
description: HelmExtensions specifies settings for cluster
98-
helm based extensions
97+
description: Helm contains helm extension settings
9998
properties:
10099
charts:
101-
description: ChartsSettings charts settings
102100
items:
103101
description: Chart single helm addon
104102
properties:
@@ -111,10 +109,8 @@ spec:
111109
order:
112110
type: integer
113111
timeout:
114-
description: |-
115-
A Duration represents the elapsed time between two instants
116-
as an int64 nanosecond count. The representation limits the
117-
largest representable duration to approximately 290 years.
112+
description: Timeout specifies the timeout for how
113+
long to wait for the chart installation to finish.
118114
format: int64
119115
type: integer
120116
values:
@@ -126,11 +122,7 @@ spec:
126122
concurrencyLevel:
127123
type: integer
128124
repositories:
129-
description: RepositoriesSettings repository settings
130125
items:
131-
description: Repository describes single repository
132-
entry. Fields map to the CLI flags for the "helm add"
133-
command
134126
properties:
135127
caFile:
136128
type: string

controllers/helm.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ func setHelmValue(valuesYaml string, path string, newValue interface{}) (string,
4646
}
4747

4848
// merge the default helm charts and repositories (from meta.Configs) with vendor helm charts (from in.Spec.Config.Extensions.Helm)
49-
func mergeHelmConfigs(ctx context.Context, meta *ectypes.ReleaseMetadata, in *v1beta1.Installation, clusterConfig k0sv1beta1.ClusterConfig) *k0sv1beta1.HelmExtensions {
49+
func mergeHelmConfigs(ctx context.Context, meta *ectypes.ReleaseMetadata, in *v1beta1.Installation, clusterConfig k0sv1beta1.ClusterConfig) *v1beta1.Helm {
5050
// merge default helm charts (from meta.Configs) with vendor helm charts (from in.Spec.Config.Extensions.Helm)
51-
combinedConfigs := &k0sv1beta1.HelmExtensions{ConcurrencyLevel: 1}
51+
combinedConfigs := &v1beta1.Helm{ConcurrencyLevel: 1}
5252
if meta != nil {
5353
combinedConfigs.Charts = meta.Configs.Charts
5454
combinedConfigs.Repositories = meta.Configs.Repositories
@@ -117,7 +117,7 @@ func mergeHelmConfigs(ctx context.Context, meta *ectypes.ReleaseMetadata, in *v1
117117
}
118118

119119
// update the 'admin-console' and 'embedded-cluster-operator' charts to add cluster ID, binary name, airgap status, and HA status
120-
func updateInfraChartsFromInstall(ctx context.Context, in *v1beta1.Installation, clusterConfig k0sv1beta1.ClusterConfig, charts k0sv1beta1.ChartsSettings) k0sv1beta1.ChartsSettings {
120+
func updateInfraChartsFromInstall(ctx context.Context, in *v1beta1.Installation, clusterConfig k0sv1beta1.ClusterConfig, charts []v1beta1.Chart) []v1beta1.Chart {
121121
log := ctrl.LoggerFrom(ctx)
122122

123123
if in == nil {
@@ -382,12 +382,12 @@ func detectChartCompletion(combinedConfigs *k0sv1beta1.HelmExtensions, installed
382382
}
383383

384384
// applyUserProvidedAddonOverrides applies user-provided overrides to the HelmExtensions spec.
385-
func applyUserProvidedAddonOverrides(in *v1beta1.Installation, combinedConfigs *k0sv1beta1.HelmExtensions) (*k0sv1beta1.HelmExtensions, error) {
385+
func applyUserProvidedAddonOverrides(in *v1beta1.Installation, combinedConfigs *v1beta1.Helm) (*v1beta1.Helm, error) {
386386
if in == nil || in.Spec.Config == nil {
387387
return combinedConfigs, nil
388388
}
389389
patchedConfigs := combinedConfigs.DeepCopy()
390-
patchedConfigs.Charts = k0sv1beta1.ChartsSettings{}
390+
patchedConfigs.Charts = []v1beta1.Chart{}
391391
for _, chart := range combinedConfigs.Charts {
392392
newValues, err := in.Spec.Config.ApplyEndUserAddOnOverrides(chart.Name, chart.Values)
393393
if err != nil {
@@ -403,7 +403,7 @@ func applyUserProvidedAddonOverrides(in *v1beta1.Installation, combinedConfigs *
403403
// sure that all helm charts point to a chart stored on disk as a tgz file. These files are already
404404
// expected to be present on the disk and, during an upgrade, are laid down on disk by the artifact
405405
// copy job.
406-
func patchExtensionsForAirGap(config *k0sv1beta1.HelmExtensions) *k0sv1beta1.HelmExtensions {
406+
func patchExtensionsForAirGap(config *v1beta1.Helm) *v1beta1.Helm {
407407
config.Repositories = nil
408408
for idx, chart := range config.Charts {
409409
chartName := fmt.Sprintf("%s-%s.tgz", chart.Name, chart.Version)

0 commit comments

Comments
 (0)