Skip to content

Commit

Permalink
include networking information with node join responses (#4719)
Browse files Browse the repository at this point in the history
* update [email protected]

* return network spec with join command
  • Loading branch information
laverya authored Jul 1, 2024
1 parent 9891998 commit e310c7c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 18 deletions.
1 change: 1 addition & 0 deletions pkg/embeddedcluster/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ func startClusterUpgrade(ctx context.Context, newcfg embeddedclusterv1beta1.Conf
MetricsBaseURL: current.Spec.MetricsBaseURL,
HighAvailability: current.Spec.HighAvailability,
AirGap: current.Spec.AirGap,
Network: current.Spec.Network,
Artifacts: artifacts,
Config: &newcfg,
EndUserK0sConfigOverrides: current.Spec.EndUserK0sConfigOverrides,
Expand Down
34 changes: 16 additions & 18 deletions pkg/handlers/embedded_cluster_node_join_command.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import (
"fmt"
"net/http"

ecv1beta1 "github.com/replicatedhq/embedded-cluster-kinds/apis/v1beta1"

"github.com/replicatedhq/kots/pkg/embeddedcluster"
"github.com/replicatedhq/kots/pkg/k8sutil"
"github.com/replicatedhq/kots/pkg/kotsutil"
Expand All @@ -17,23 +19,18 @@ type GenerateEmbeddedClusterNodeJoinCommandResponse struct {
Command []string `json:"command"`
}

type Proxy struct {
HTTPProxy string `json:"httpProxy"`
HTTPSProxy string `json:"httpsProxy"`
NoProxy string `json:"noProxy"`
}

type GetEmbeddedClusterNodeJoinCommandResponse struct {
ClusterID string `json:"clusterID"`
K0sJoinCommand string `json:"k0sJoinCommand"`
K0sToken string `json:"k0sToken"`
K0sUnsupportedOverrides string `json:"k0sUnsupportedOverrides"`
EndUserK0sConfigOverrides string `json:"endUserK0sConfigOverrides"`
MetricsBaseURL string `json:"metricsBaseURL"`
EmbeddedClusterVersion string `json:"embeddedClusterVersion"`
AirgapRegistryAddress string `json:"airgapRegistryAddress"`
IsAirgap bool `json:"isAirgap"`
Proxy *Proxy `json:"proxy,omitempty"`
ClusterID string `json:"clusterID"`
K0sJoinCommand string `json:"k0sJoinCommand"`
K0sToken string `json:"k0sToken"`
K0sUnsupportedOverrides string `json:"k0sUnsupportedOverrides"`
EndUserK0sConfigOverrides string `json:"endUserK0sConfigOverrides"`
MetricsBaseURL string `json:"metricsBaseURL"`
EmbeddedClusterVersion string `json:"embeddedClusterVersion"`
AirgapRegistryAddress string `json:"airgapRegistryAddress"`
IsAirgap bool `json:"isAirgap"`
Proxy *ecv1beta1.ProxySpec `json:"proxy,omitempty"`
Network *ecv1beta1.NetworkSpec `json:"network,omitempty"`
}

type GenerateEmbeddedClusterNodeJoinCommandRequest struct {
Expand Down Expand Up @@ -182,9 +179,9 @@ func (h *Handler) GetEmbeddedClusterNodeJoinCommand(w http.ResponseWriter, r *ht
httpProxy := util.HTTPProxy()
httpsProxy := util.HTTPSProxy()
noProxy := util.NoProxy()
var proxy *Proxy
var proxy *ecv1beta1.ProxySpec
if httpProxy != "" || httpsProxy != "" || noProxy != "" {
proxy = &Proxy{
proxy = &ecv1beta1.ProxySpec{
HTTPProxy: httpProxy,
HTTPSProxy: httpsProxy,
NoProxy: noProxy,
Expand All @@ -202,5 +199,6 @@ func (h *Handler) GetEmbeddedClusterNodeJoinCommand(w http.ResponseWriter, r *ht
AirgapRegistryAddress: airgapRegistryAddress,
IsAirgap: install.Spec.AirGap,
Proxy: proxy,
Network: install.Spec.Network,
})
}

0 comments on commit e310c7c

Please sign in to comment.