Skip to content

Commit

Permalink
feat(ec): consolidate data directories (#4935)
Browse files Browse the repository at this point in the history
* feat(ec): consolidate data directories

* f

* f

* f
  • Loading branch information
emosbaugh authored Oct 8, 2024
1 parent 3255275 commit a38c002
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 9 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down
29 changes: 23 additions & 6 deletions pkg/kotsadmsnapshot/backup.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"}
Expand Down

0 comments on commit a38c002

Please sign in to comment.