2022-09-05 03:06:08 -04:00
|
|
|
/*
|
|
|
|
Copyright (c) Edgeless Systems GmbH
|
|
|
|
|
|
|
|
SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
*/
|
|
|
|
|
2023-01-19 09:57:50 -05:00
|
|
|
// Package helm provides types and functions shared across services.
|
2022-08-12 04:20:19 -04:00
|
|
|
package helm
|
|
|
|
|
2022-10-18 07:15:54 -04:00
|
|
|
// Release bundles all information necessary to create a helm release.
|
|
|
|
type Release struct {
|
2022-10-21 06:01:28 -04:00
|
|
|
Chart []byte
|
2022-10-25 09:51:23 -04:00
|
|
|
Values map[string]any
|
2022-10-18 07:15:54 -04:00
|
|
|
ReleaseName string
|
|
|
|
Wait bool
|
2022-08-12 04:20:19 -04:00
|
|
|
}
|
|
|
|
|
2022-11-09 09:57:54 -05:00
|
|
|
// Releases bundles all helm releases to be deployed to Constellation.
|
2022-10-18 07:15:54 -04:00
|
|
|
type Releases struct {
|
2022-10-21 06:01:28 -04:00
|
|
|
Cilium Release
|
2022-11-21 04:35:40 -05:00
|
|
|
CertManager Release
|
|
|
|
Operators Release
|
2022-10-21 06:01:28 -04:00
|
|
|
ConstellationServices Release
|
2022-08-12 04:20:19 -04:00
|
|
|
}
|
2022-12-19 10:52:15 -05:00
|
|
|
|
|
|
|
// MergeMaps returns a new map that is the merger of it's inputs.
|
2023-01-19 09:57:50 -05:00
|
|
|
// Key collisions are resolved by taking the value of the second argument (map b).
|
2022-12-19 10:52:15 -05:00
|
|
|
// Taken from: https://github.com/helm/helm/blob/dbc6d8e20fe1d58d50e6ed30f09a04a77e4c68db/pkg/cli/values/options.go#L91-L108.
|
|
|
|
func MergeMaps(a, b map[string]any) map[string]any {
|
|
|
|
out := make(map[string]any, len(a))
|
|
|
|
for k, v := range a {
|
|
|
|
out[k] = v
|
|
|
|
}
|
|
|
|
for k, v := range b {
|
|
|
|
if v, ok := v.(map[string]any); ok {
|
|
|
|
if bv, ok := out[k]; ok {
|
|
|
|
if bv, ok := bv.(map[string]any); ok {
|
|
|
|
out[k] = MergeMaps(bv, v)
|
|
|
|
continue
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
out[k] = v
|
|
|
|
}
|
|
|
|
return out
|
|
|
|
}
|