Skip to content

Commit

Permalink
remove k8s.io/kubernetes dependency from yurtctl join/reset (#697)
Browse files Browse the repository at this point in the history
  • Loading branch information
rambohe-ch authored Dec 31, 2021
1 parent 78eea75 commit bebc077
Show file tree
Hide file tree
Showing 78 changed files with 10,039 additions and 1,386 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
3 changes: 2 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ module github.com/openyurtio/openyurt
go 1.13

require (
github.com/Microsoft/go-winio v0.4.14
github.com/NYTimes/gziphandler v1.1.1 // indirect
github.com/aliyun/alibaba-cloud-sdk-go v1.61.355
github.com/daviddengcn/go-colortext v0.0.0-20160507010035-511bcaf42ccd
Expand All @@ -15,7 +16,6 @@ require (
github.com/lithammer/dedent v1.1.0
github.com/onsi/ginkgo v1.13.0
github.com/onsi/gomega v1.10.1
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/opencontainers/selinux v1.3.1-0.20190929122143-5215b1806f52
github.com/openyurtio/yurt-app-manager-api v0.18.8
github.com/pkg/errors v0.8.1
Expand All @@ -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
k8s.io/utils v0.0.0-20210819203725-bdf08cb9a70a
sigs.k8s.io/apiserver-network-proxy v0.0.15
)
Expand Down
3 changes: 0 additions & 3 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ github.com/daviddengcn/go-colortext v0.0.0-20160507010035-511bcaf42ccd/go.mod h1
github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM=
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
github.com/dnaeon/go-vcr v1.0.1/go.mod h1:aBB1+wY4s93YsC3HHjMBMrwTj2R9FHDzUr9KyGc8n1E=
github.com/docker/distribution v2.7.1+incompatible h1:a5mlkVzth6W5A4fOsS3D2EO5BUmsJpcB+cRlLU7cSug=
github.com/docker/distribution v2.7.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w=
github.com/docker/docker v0.7.3-0.20190327010347-be7ac8be2ae0/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk=
github.com/docker/docker v17.12.0-ce-rc1.0.20200531234253-77e06fda0c94+incompatible h1:PmGHHCZ43l6h8aZIi+Xa+z1SWe4dFImd5EK3TNp1jlo=
Expand Down Expand Up @@ -474,8 +473,6 @@ github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7J
github.com/onsi/gomega v1.10.1 h1:o0+MgICZLuZ7xjH7Vx6zS/zcu93/BEp1VwkIW1mEXCE=
github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo=
github.com/opencontainers/go-digest v1.0.0-rc1/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s=
github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U=
github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM=
github.com/opencontainers/image-spec v1.0.1/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0=
github.com/opencontainers/runc v1.0.0-rc10/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U=
github.com/opencontainers/runtime-spec v1.0.0/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0=
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 bebc077

Please sign in to comment.