Skip to content

Commit

Permalink
include the airgap registry cluster IP in the node join response (#4553)
Browse files Browse the repository at this point in the history
* include the airgap registry cluster IP in the node join response

* use kotsutil.GetEmbeddedRegistryCreds
  • Loading branch information
laverya authored Apr 17, 2024
1 parent ea2056e commit e2d71bc
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions pkg/handlers/embedded_cluster_node_join_command.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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 {
Expand Down Expand Up @@ -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,
Expand All @@ -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,
})
}

0 comments on commit e2d71bc

Please sign in to comment.