diff --git a/go.mod b/go.mod index 8372b68e28..0ddf7ced90 100644 --- a/go.mod +++ b/go.mod @@ -49,7 +49,7 @@ require ( github.com/phayes/freeport v0.0.0-20220201140144-74d24b5ae9f5 github.com/pkg/errors v0.9.1 github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 - github.com/replicatedhq/embedded-cluster/kinds v1.14.3 + github.com/replicatedhq/embedded-cluster/kinds v1.15.0 github.com/replicatedhq/kotskinds v0.0.0-20240718194123-1018dd404e95 github.com/replicatedhq/kurlkinds v1.5.0 github.com/replicatedhq/troubleshoot v0.103.0 diff --git a/go.sum b/go.sum index ae0bfb2921..87ed20449c 100644 --- a/go.sum +++ b/go.sum @@ -1342,8 +1342,8 @@ github.com/redis/go-redis/v9 v9.0.5/go.mod h1:WqMKv5vnQbRuZstUwxQI195wHy+t4PuXDO github.com/redis/go-redis/v9 v9.5.1 h1:H1X4D3yHPaYrkL5X06Wh6xNVM/pX0Ft4RV0vMGvLBh8= github.com/redis/go-redis/v9 v9.5.1/go.mod h1:hdY0cQFCN4fnSYT6TkisLufl/4W5UIXyv0b/CLO2V2M= github.com/remyoudompheng/bigfft v0.0.0-20170806203942-52369c62f446/go.mod h1:uYEyJGbgTkfkS4+E/PavXkNJcbFIpEtjt2B0KDQ5+9M= -github.com/replicatedhq/embedded-cluster/kinds v1.14.3 h1:4TdzuMT7paGk+sjtWIQZ8WpyOr5a3u++VUcZfvfnzoE= -github.com/replicatedhq/embedded-cluster/kinds v1.14.3/go.mod h1:eCRG7AjsENoi62kguGWKbYWMuri8uR+QV1yarvn/MBY= +github.com/replicatedhq/embedded-cluster/kinds v1.15.0 h1:hqlDSjyZ+kBnyPaE9GSjZN2TVZKgNc8b9tF2XgXcR8w= +github.com/replicatedhq/embedded-cluster/kinds v1.15.0/go.mod h1:eCRG7AjsENoi62kguGWKbYWMuri8uR+QV1yarvn/MBY= github.com/replicatedhq/kotskinds v0.0.0-20240718194123-1018dd404e95 h1:JhwPz4Bgbz5iYl3UV2EB+HnF9oW/eCRi+hASAz+J6XI= github.com/replicatedhq/kotskinds v0.0.0-20240718194123-1018dd404e95/go.mod h1:QjhIUu3+OmHZ09u09j3FCoTt8F3BYtQglS+OLmftu9I= github.com/replicatedhq/kurlkinds v1.5.0 h1:zZ0PKNeh4kXvSzVGkn62DKTo314GxhXg1TSB3azURMc= diff --git a/pkg/kotsadmsnapshot/backup.go b/pkg/kotsadmsnapshot/backup.go index 8bda4bcaa7..4361ffaca1 100644 --- a/pkg/kotsadmsnapshot/backup.go +++ b/pkg/kotsadmsnapshot/backup.go @@ -996,21 +996,38 @@ func ecBackupAnnotations(ctx context.Context, kbClient kbclient.Client, in *embe annotations["kots.io/embedded-cluster-id"] = util.EmbeddedClusterID() annotations["kots.io/embedded-cluster-version"] = util.EmbeddedClusterVersion() annotations["kots.io/embedded-cluster-is-ha"] = strconv.FormatBool(in.Spec.HighAvailability) - if in.Spec.AdminConsole != nil && in.Spec.AdminConsole.Port > 0 { - annotations["kots.io/embedded-cluster-admin-console-port"] = strconv.Itoa(in.Spec.AdminConsole.Port) - } - if in.Spec.LocalArtifactMirror != nil && in.Spec.LocalArtifactMirror.Port > 0 { - annotations["kots.io/embedded-cluster-local-artifact-mirror-port"] = strconv.Itoa(in.Spec.LocalArtifactMirror.Port) - } if in.Spec.Network != nil { annotations["kots.io/embedded-cluster-pod-cidr"] = in.Spec.Network.PodCIDR annotations["kots.io/embedded-cluster-service-cidr"] = in.Spec.Network.ServiceCIDR } + if in.Spec.RuntimeConfig != nil { + rcAnnotations := ecRuntimeConfigToBackupAnnotations(in.Spec.RuntimeConfig) + for k, v := range rcAnnotations { + annotations[k] = v + } + } + return annotations, nil } +func ecRuntimeConfigToBackupAnnotations(runtimeConfig *embeddedclusterv1beta1.RuntimeConfigSpec) map[string]string { + annotations := map[string]string{} + + if runtimeConfig.AdminConsole.Port > 0 { + annotations["kots.io/embedded-cluster-admin-console-port"] = strconv.Itoa(runtimeConfig.AdminConsole.Port) + } + if runtimeConfig.LocalArtifactMirror.Port > 0 { + annotations["kots.io/embedded-cluster-local-artifact-mirror-port"] = strconv.Itoa(runtimeConfig.LocalArtifactMirror.Port) + } + if runtimeConfig.DataDir != "" { + annotations["kots.io/embedded-cluster-data-dir"] = runtimeConfig.DataDir + } + + return annotations +} + // ecIncludedNamespaces returns the namespaces that should be included in an embedded cluster backup func ecIncludedNamespaces(in *embeddedclusterv1beta1.Installation) []string { includedNamespaces := []string{"embedded-cluster", "kube-system", "openebs"}