From 6fe8887bff368eecb3fa3c71eb4f7aaed2ec7c65 Mon Sep 17 00:00:00 2001 From: Andrew Lavery Date: Thu, 19 Sep 2024 15:29:53 -0500 Subject: [PATCH 1/2] return the entire installation spec object in a EC join struct --- .../embedded_cluster_node_join_command.go | 52 +++++-------------- 1 file changed, 14 insertions(+), 38 deletions(-) diff --git a/pkg/handlers/embedded_cluster_node_join_command.go b/pkg/handlers/embedded_cluster_node_join_command.go index 258aebe862..175ebd4208 100644 --- a/pkg/handlers/embedded_cluster_node_join_command.go +++ b/pkg/handlers/embedded_cluster_node_join_command.go @@ -20,17 +20,12 @@ type GenerateEmbeddedClusterNodeJoinCommandResponse struct { } 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 *ecv1beta1.ProxySpec `json:"proxy,omitempty"` - Network *ecv1beta1.NetworkSpec `json:"network,omitempty"` + ClusterID string `json:"clusterID"` + K0sJoinCommand string `json:"k0sJoinCommand"` + K0sToken string `json:"k0sToken"` + EmbeddedClusterVersion string `json:"embeddedClusterVersion"` + AirgapRegistryAddress string `json:"airgapRegistryAddress"` + Spec ecv1beta1.InstallationSpec `json:"installationSpec,omitempty"` } type GenerateEmbeddedClusterNodeJoinCommandRequest struct { @@ -157,11 +152,9 @@ func (h *Handler) GetEmbeddedClusterNodeJoinCommand(w http.ResponseWriter, r *ht return } - // extract the configuration overrides from the installation object - endUserK0sConfigOverrides := install.Spec.EndUserK0sConfigOverrides - var k0sUnsupportedOverrides, ecVersion string + // extract the version from the installation object for backwards compatibility + var ecVersion string if install.Spec.Config != nil { - k0sUnsupportedOverrides = install.Spec.Config.UnsupportedOverrides.K0s ecVersion = install.Spec.Config.Version } @@ -176,29 +169,12 @@ func (h *Handler) GetEmbeddedClusterNodeJoinCommand(w http.ResponseWriter, r *ht airgapRegistryAddress, _, _ = kotsutil.GetEmbeddedRegistryCreds(clientset) } - httpProxy := util.HTTPProxy() - httpsProxy := util.HTTPSProxy() - noProxy := util.NoProxy() - var proxy *ecv1beta1.ProxySpec - if httpProxy != "" || httpsProxy != "" || noProxy != "" { - proxy = &ecv1beta1.ProxySpec{ - HTTPProxy: httpProxy, - HTTPSProxy: httpsProxy, - NoProxy: noProxy, - } - } - JSON(w, http.StatusOK, GetEmbeddedClusterNodeJoinCommandResponse{ - ClusterID: install.Spec.ClusterID, - K0sJoinCommand: k0sJoinCommand, - K0sToken: k0sToken, - K0sUnsupportedOverrides: k0sUnsupportedOverrides, - EndUserK0sConfigOverrides: endUserK0sConfigOverrides, - MetricsBaseURL: install.Spec.MetricsBaseURL, - EmbeddedClusterVersion: ecVersion, - AirgapRegistryAddress: airgapRegistryAddress, - IsAirgap: install.Spec.AirGap, - Proxy: proxy, - Network: install.Spec.Network, + ClusterID: install.Spec.ClusterID, + K0sJoinCommand: k0sJoinCommand, + K0sToken: k0sToken, + EmbeddedClusterVersion: ecVersion, + AirgapRegistryAddress: airgapRegistryAddress, + Spec: install.Spec, }) } From 1cc8485a1a3e7a0db58ba9e7d0174b21fe490770 Mon Sep 17 00:00:00 2001 From: Andrew Lavery Date: Fri, 20 Sep 2024 21:30:33 +0200 Subject: [PATCH 2/2] Spec -> InstallationSpec --- pkg/handlers/embedded_cluster_node_join_command.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/handlers/embedded_cluster_node_join_command.go b/pkg/handlers/embedded_cluster_node_join_command.go index 175ebd4208..691855fd54 100644 --- a/pkg/handlers/embedded_cluster_node_join_command.go +++ b/pkg/handlers/embedded_cluster_node_join_command.go @@ -25,7 +25,7 @@ type GetEmbeddedClusterNodeJoinCommandResponse struct { K0sToken string `json:"k0sToken"` EmbeddedClusterVersion string `json:"embeddedClusterVersion"` AirgapRegistryAddress string `json:"airgapRegistryAddress"` - Spec ecv1beta1.InstallationSpec `json:"installationSpec,omitempty"` + InstallationSpec ecv1beta1.InstallationSpec `json:"installationSpec,omitempty"` } type GenerateEmbeddedClusterNodeJoinCommandRequest struct { @@ -175,6 +175,6 @@ func (h *Handler) GetEmbeddedClusterNodeJoinCommand(w http.ResponseWriter, r *ht K0sToken: k0sToken, EmbeddedClusterVersion: ecVersion, AirgapRegistryAddress: airgapRegistryAddress, - Spec: install.Spec, + InstallationSpec: install.Spec, }) }