From e2d71bc9b46a4f1d0bdb0cf1339a73b6d88188fb Mon Sep 17 00:00:00 2001 From: Andrew Lavery Date: Thu, 18 Apr 2024 00:24:34 +0900 Subject: [PATCH] include the airgap registry cluster IP in the node join response (#4553) * include the airgap registry cluster IP in the node join response * use kotsutil.GetEmbeddedRegistryCreds --- pkg/handlers/embedded_cluster_node_join_command.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pkg/handlers/embedded_cluster_node_join_command.go b/pkg/handlers/embedded_cluster_node_join_command.go index 06c3b19637..4355784d42 100644 --- a/pkg/handlers/embedded_cluster_node_join_command.go +++ b/pkg/handlers/embedded_cluster_node_join_command.go @@ -7,6 +7,7 @@ import ( "github.com/replicatedhq/kots/pkg/embeddedcluster" "github.com/replicatedhq/kots/pkg/k8sutil" + "github.com/replicatedhq/kots/pkg/kotsutil" "github.com/replicatedhq/kots/pkg/logger" "github.com/replicatedhq/kots/pkg/store" "github.com/replicatedhq/kots/pkg/util" @@ -24,6 +25,8 @@ type GetEmbeddedClusterNodeJoinCommandResponse struct { EndUserK0sConfigOverrides string `json:"endUserK0sConfigOverrides"` MetricsBaseURL string `json:"metricsBaseURL"` EmbeddedClusterVersion string `json:"embeddedClusterVersion"` + AirgapRegistryAddress string `json:"airgapRegistryAddress"` + IsAirgap bool `json:"isAirgap"` } type GenerateEmbeddedClusterNodeJoinCommandRequest struct { @@ -163,6 +166,11 @@ func (h *Handler) GetEmbeddedClusterNodeJoinCommand(w http.ResponseWriter, r *ht ecVersion = install.Spec.Config.Version } + airgapRegistryAddress := "" + if install.Spec.AirGap { + airgapRegistryAddress, _, _ = kotsutil.GetEmbeddedRegistryCreds(client) + } + JSON(w, http.StatusOK, GetEmbeddedClusterNodeJoinCommandResponse{ ClusterID: clusterID, K0sJoinCommand: k0sJoinCommand, @@ -171,5 +179,7 @@ func (h *Handler) GetEmbeddedClusterNodeJoinCommand(w http.ResponseWriter, r *ht EndUserK0sConfigOverrides: endUserK0sConfigOverrides, MetricsBaseURL: install.Spec.MetricsBaseURL, EmbeddedClusterVersion: ecVersion, + AirgapRegistryAddress: airgapRegistryAddress, + IsAirgap: install.Spec.AirGap, }) }