From eca66af493fdd6c307cd75e211946f6cf2f75312 Mon Sep 17 00:00:00 2001 From: Ethan Mosbaugh Date: Thu, 19 Sep 2024 09:00:44 -0700 Subject: [PATCH] feat(ec): support for custom admin console and lam ports --- go.mod | 6 +++--- go.sum | 12 ++++++------ pkg/handlers/embedded_cluster_node_join_command.go | 7 +++++++ pkg/kotsadmsnapshot/backup.go | 6 ++++++ 4 files changed, 22 insertions(+), 9 deletions(-) diff --git a/go.mod b/go.mod index 7ec64c8a5e..af3113d67f 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 v0.0.0-20240911124703-aaa8c0236e21 + github.com/replicatedhq/embedded-cluster/kinds v1.14.0 github.com/replicatedhq/kotskinds v0.0.0-20240718194123-1018dd404e95 github.com/replicatedhq/kurlkinds v1.5.0 github.com/replicatedhq/troubleshoot v0.99.0 @@ -367,9 +367,9 @@ require ( golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect golang.org/x/mod v0.20.0 // indirect golang.org/x/net v0.28.0 // indirect - golang.org/x/sys v0.24.0 // indirect + golang.org/x/sys v0.25.0 // indirect golang.org/x/term v0.23.0 // indirect - golang.org/x/text v0.17.0 // indirect + golang.org/x/text v0.18.0 // indirect golang.org/x/time v0.5.0 // indirect golang.org/x/tools v0.24.0 // indirect google.golang.org/genproto v0.0.0-20240311173647-c811ad7063a7 // indirect diff --git a/go.sum b/go.sum index 5be0bf057d..e338784282 100644 --- a/go.sum +++ b/go.sum @@ -1337,8 +1337,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 v0.0.0-20240911124703-aaa8c0236e21 h1:WV2ISkxxamW596PMm+YnKEQJ+e+GDaUq5jxbQ1YPcBw= -github.com/replicatedhq/embedded-cluster/kinds v0.0.0-20240911124703-aaa8c0236e21/go.mod h1:W2AQug7u0e9afPL0oUZyHcmn1+5ur6Y0TRcdnI5te2g= +github.com/replicatedhq/embedded-cluster/kinds v1.14.0 h1:+b0as59Dg3GzSguYFe9e5B2yF8uI1k7HVOFOsE0YGHw= +github.com/replicatedhq/embedded-cluster/kinds v1.14.0/go.mod h1:N0N9rI45aib/rBEegDCq6Er2pS9FAtgC5HU9BCpYmvI= 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= @@ -1925,8 +1925,8 @@ golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.24.0 h1:Twjiwq9dn6R1fQcyiK+wQyHWfaz/BJB+YIpzU/Cv3Xg= -golang.org/x/sys v0.24.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.25.0 h1:r+8e+loiHxRqhXVl6ML1nO3l1+oFoWbnlu2Ehimmi34= +golang.org/x/sys v0.25.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= @@ -1956,8 +1956,8 @@ golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= -golang.org/x/text v0.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc= -golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= +golang.org/x/text v0.18.0 h1:XvMDiNzPAl0jr17s6W9lcaIhGUfUORdGCNsuLmPG224= +golang.org/x/text v0.18.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= diff --git a/pkg/handlers/embedded_cluster_node_join_command.go b/pkg/handlers/embedded_cluster_node_join_command.go index 258aebe862..1c1296878a 100644 --- a/pkg/handlers/embedded_cluster_node_join_command.go +++ b/pkg/handlers/embedded_cluster_node_join_command.go @@ -31,6 +31,7 @@ type GetEmbeddedClusterNodeJoinCommandResponse struct { IsAirgap bool `json:"isAirgap"` Proxy *ecv1beta1.ProxySpec `json:"proxy,omitempty"` Network *ecv1beta1.NetworkSpec `json:"network,omitempty"` + LocalArtifactMirrorPort int `json:"localArtifactMirrorPort,omitempty"` } type GenerateEmbeddedClusterNodeJoinCommandRequest struct { @@ -188,6 +189,11 @@ func (h *Handler) GetEmbeddedClusterNodeJoinCommand(w http.ResponseWriter, r *ht } } + localArtifactMirrorPort := 0 + if install.Spec.LocalArtifactMirror != nil { + localArtifactMirrorPort = install.Spec.LocalArtifactMirror.Port + } + JSON(w, http.StatusOK, GetEmbeddedClusterNodeJoinCommandResponse{ ClusterID: install.Spec.ClusterID, K0sJoinCommand: k0sJoinCommand, @@ -200,5 +206,6 @@ func (h *Handler) GetEmbeddedClusterNodeJoinCommand(w http.ResponseWriter, r *ht IsAirgap: install.Spec.AirGap, Proxy: proxy, Network: install.Spec.Network, + LocalArtifactMirrorPort: localArtifactMirrorPort, }) } diff --git a/pkg/kotsadmsnapshot/backup.go b/pkg/kotsadmsnapshot/backup.go index adf03040b5..8bda4bcaa7 100644 --- a/pkg/kotsadmsnapshot/backup.go +++ b/pkg/kotsadmsnapshot/backup.go @@ -996,6 +996,12 @@ 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