Skip to content

Commit

Permalink
Move worker config from admin to default
Browse files Browse the repository at this point in the history
  • Loading branch information
lmq1999 committed Sep 28, 2023
1 parent 21aebe5 commit 40fb4e9
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 43 deletions.
35 changes: 34 additions & 1 deletion kubernetes_engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const (
clusterPath = "/_"
kubeConfig = "kubeconfig"
k8sVersion = "/k8s_versions"
adminWorkerConfig = "/admin/worker_config"
adminWorkerConfig = "/worker_config"
clusterJoinEverywhere = "/engine/cluster_join_everywhere"
)

Expand Down Expand Up @@ -94,3 +94,36 @@ func (c *kubernetesEngineService) GetKubernetesVersion(ctx context.Context) (*Ku
}
return data, nil
}

type WorkerConfig struct {
ID string `json:"id" yaml:"id"`
Version string `json:"version" yaml:"version"`
Everywhere bool `json:"everywhere" yaml:"everywhere"`
Nvidiadevice bool `json:"nvidiadevice" yaml:"nvidiadevice"`
CniVersion string `json:"CNI_VERSION" yaml:"CNI_VERSION"`
RUNC_VERSION string `json:"RUNC_VERSION" yaml:"RUNC_VERSION"`
CONTAINERD_VERSION string `json:"CONTAINERD_VERSION" yaml:"CONTAINERD_VERSION"`
KUBE_VERSION string `json:"KUBE_VERSION" yaml:"KUBE_VERSION"`

}

type WorkerConfigs struct {
WorkerConfigs_ []WorkerConfig `json:"worker_configs" yaml:"worker_configs"`
}

func (c *kubernetesEngineService) GetAdminWorkerConfig(ctx context.Context) (*WorkerConfigs, error) {
var workerConfigs *WorkerConfigs
req, err := c.client.NewRequest(ctx, http.MethodGet, kubernetesServiceName, adminWorkerConfig, nil)
if err != nil {
return nil, err
}
resp, err := c.client.Do(ctx, req)
if err != nil {
return nil, err
}
defer resp.Body.Close()
if err := json.NewDecoder(resp.Body).Decode(workerConfigs); err != nil {
return nil, err
}
return workerConfigs, nil
}
40 changes: 0 additions & 40 deletions kubernetes_engine_admin.go

This file was deleted.

4 changes: 2 additions & 2 deletions kubernetes_engine_engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ type clusterCertificate struct {

type clusterReserved struct {
SystemReserved clusterSystemReserved `json:"system_reserved" yaml:"system_reserved"`
KubeReserved clusterKubeReserved `json:"kube_reserved" yaml:"kube_reserved"`
KubeReserved clusterKubeReserved `json:"kube_reserved" yaml:"kube_reserved"`
}

type clusterSystemReserved struct {
Expand Down Expand Up @@ -65,4 +65,4 @@ func (c *kubernetesEngineService) AddClusterEverywhere(ctx context.Context, id s
return nil, err
}
return joinEverywhereResponse, nil
}
}

0 comments on commit 40fb4e9

Please sign in to comment.