Skip to content

Commit

Permalink
remove k8s.io/kubernetes dependency from yurtctl join/reset
Browse files Browse the repository at this point in the history
  • Loading branch information
rambohe-ch committed Dec 28, 2021
1 parent c23c8d1 commit 13674d6
Show file tree
Hide file tree
Showing 77 changed files with 10,045 additions and 1,378 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -90,4 +90,4 @@ GOLINT_BIN=$(shell which golangci-lint)
endif

lint: install-golint ## Run go lint against code.
$(GOLINT_BIN) run -v
$(GOLINT_BIN) run -v
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ require (
k8s.io/kubectl v0.0.0
k8s.io/kubelet v0.0.0
k8s.io/kubernetes v1.18.8
k8s.io/system-validators v1.0.4 // indirect
k8s.io/utils v0.0.0-20210819203725-bdf08cb9a70a
sigs.k8s.io/apiserver-network-proxy v0.0.15
)
Expand Down
20 changes: 11 additions & 9 deletions pkg/node-servant/components/yurthub.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import (
"k8s.io/klog/v2"

enutil "github.com/openyurtio/openyurt/pkg/yurtctl/util/edgenode"
"github.com/openyurtio/openyurt/pkg/yurtctl/util/templates"
"github.com/openyurtio/openyurt/pkg/yurthub/certificate/hubself"
"github.com/openyurtio/openyurt/pkg/yurthub/storage/disk"
"github.com/openyurtio/openyurt/pkg/yurthub/util"
Expand Down Expand Up @@ -68,21 +69,22 @@ func (op *yurtHubOperator) Install() error {

// 1-1. replace variables in yaml file
klog.Infof("setting up yurthub apiServer addr")
yurthubTemplate := enutil.ReplaceRegularExpression(enutil.YurthubTemplate,
map[string]string{
"__kubernetes_service_addr__": op.apiServerAddr,
"__yurthub_image__": op.yurthubImage,
"__join_token__": op.joinToken,
"__working_mode__": string(op.workingMode),
})
yurthubTemplate, err := templates.SubsituteTemplate(enutil.YurthubTemplate, map[string]string{
"kubernetesServerAddr": op.apiServerAddr,
"image": op.yurthubImage,
"joinToken": op.joinToken,
"workingMode": string(op.workingMode),
})
if err != nil {
return err
}

// 1-2. create yurthub.yaml
podManifestPath := enutil.GetPodManifestPath()
if err := enutil.EnsureDir(podManifestPath); err != nil {
return err
}
err := ioutil.WriteFile(getYurthubYaml(podManifestPath), []byte(yurthubTemplate), fileMode)
if err != nil {
if err := ioutil.WriteFile(getYurthubYaml(podManifestPath), []byte(yurthubTemplate), fileMode); err != nil {
return err
}
klog.Infof("create the %s/yurt-hub.yaml", podManifestPath)
Expand Down
Loading

0 comments on commit 13674d6

Please sign in to comment.