Skip to content

Commit

Permalink
fix(main): delete pkg/infra code (#2674)
Browse files Browse the repository at this point in the history
Signed-off-by: cuisongliu <cuisongliu@qq.com>
  • Loading branch information
cuisongliu authored Feb 27, 2023
1 parent 0890a0a commit 3d24a2b
Show file tree
Hide file tree
Showing 13 changed files with 62 additions and 949 deletions.
3 changes: 3 additions & 0 deletions go.work.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1686,6 +1686,7 @@ golang.org/x/mobile v0.0.0-20201217150744-e6ae53a27f4f/go.mod h1:skQtrUTUwhdJvXM
golang.org/x/mod v0.1.1-0.20191209134235-331c550502dd/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
golang.org/x/mod v0.5.0/go.mod h1:5OXOZSfqPIIbmVBIIKWRFfZjPR0E5r58TLhUjH0a2Ro=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 h1:6zppjxzCulZykYSLyVDYbneBfbaBIQPYMevg0bEwv2s=
golang.org/x/mod v0.6.0 h1:b9gGHsz9/HhJ3HF5DHQytPpuwocVTChQJK3AvoLRD5I=
golang.org/x/mod v0.6.0/go.mod h1:4mET923SAdbXp2ki8ey+zGs1SLqsuM2Y0uvdZR/fUNI=
golang.org/x/net v0.0.0-20180530234432-1e491301e022/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
Expand Down Expand Up @@ -1793,6 +1794,7 @@ golang.org/x/tools v0.1.6/go.mod h1:LGqMHiF4EqQNHR1JncWGqT5BVaXmza+X+BDGol+dOxo=
golang.org/x/tools v0.1.7/go.mod h1:LGqMHiF4EqQNHR1JncWGqT5BVaXmza+X+BDGol+dOxo=
golang.org/x/tools v0.1.11/go.mod h1:SgwaegtQh8clINPpECJMqnxLv9I09HLqnW3RMqW0CA4=
golang.org/x/tools v0.1.12 h1:VveCTK38A2rkS8ZqFY25HIDFscX5X9OoEhJd3quQmXU=
golang.org/x/tools v0.2.0 h1:G6AHpWxTMGY1KyEYoAQ5WTtIekUUvDNjan3ugu60JvE=
golang.org/x/tools v0.2.0/go.mod h1:y4OqIKeOV/fWJetJ8bXPU1sEVniLMIyDAZWeHdV+NTA=
golang.org/x/xerrors v0.0.0-20190410155217-1f06c39b4373/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20190513163551-3ee3066db522/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
Expand Down Expand Up @@ -1898,6 +1900,7 @@ honnef.co/go/tools v0.2.1/go.mod h1:lPVVZ2BS5TfnjLyizF7o7hv7j9/L+8cZY2hLyjP9cGY=
k8s.io/cloud-provider v0.24.3 h1:Z4O3AiuFxGRPn1ilzaeWS2uBnW8LsH5MbniCTf1xAgs=
k8s.io/cloud-provider v0.25.6/go.mod h1:CHXlDObyf8hE7sKxSuzbHi5lA/zHjkgEdT46r+wwvLU=
k8s.io/code-generator v0.24.3 h1:itd1V1ZAYKM+WT+qQDlFKhU1D/Ff5HcEFL/icfClnZA=
k8s.io/code-generator v0.25.6 h1:md8jqhQiMqos8WaTY0ZxhDk8ttlmJl/ijCneJ8ahBNQ=
k8s.io/controller-manager v0.24.3 h1:MK0JXIp5HrBkaJsZzBTrTx2MYIrMEM27LYlen/iRTnQ=
k8s.io/controller-manager v0.25.6/go.mod h1:NSq3oQUkOXxcj0RZCSxRBOXbEOQSZ1cYnVbaQb1LaQE=
k8s.io/csi-translation-lib v0.24.3 h1:5gZQjHNyPpy10TtchUhZPwtL86RdboeVN7YWgpDSrUc=
Expand Down
2 changes: 1 addition & 1 deletion pkg/apply/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ func (r *ClusterArgs) setHostWithIpsPort(ips []string, roles []string) {
_, master0Port := iputils.GetHostIPAndPortOrDefault(ips[0], defaultPort)
for port, host := range hostMap {
host.IPS = removeIPListDuplicatesAndEmpty(host.IPS)
if port == master0Port && stringsutil.InList(v2.Master, roles) {
if port == master0Port && stringsutil.InList(v2.MASTER, roles) {
r.hosts = append([]v2.Host{*host}, r.hosts...)
continue
}
Expand Down
38 changes: 19 additions & 19 deletions pkg/apply/scale_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func TestDelete(t *testing.T) {
},
{
IPS: []string{"192.168.16.1:22", "192.168.16.2:22", "192.168.16.3:22", "192.168.16.4:22"},
Roles: []string{v2.Node},
Roles: []string{v2.NODE},
},
},
},
Expand Down Expand Up @@ -90,7 +90,7 @@ func TestDelete(t *testing.T) {
},
{
IPS: []string{"192.168.16.1:22", "192.168.16.2:22", "192.168.16.3:22", "192.168.16.4:22"},
Roles: []string{v2.Node},
Roles: []string{v2.NODE},
},
},
},
Expand Down Expand Up @@ -126,7 +126,7 @@ func TestDelete(t *testing.T) {
},
{
IPS: []string{"192.168.16.1:22", "192.168.16.2:22", "192.168.16.3:22", "192.168.16.4:22"},
Roles: []string{v2.Node},
Roles: []string{v2.NODE},
},
},
},
Expand Down Expand Up @@ -162,7 +162,7 @@ func TestDelete(t *testing.T) {
},
{
IPS: []string{"192.168.16.1:22", "192.168.16.2:22", "192.168.16.3:22", "192.168.16.4:22"},
Roles: []string{v2.Node},
Roles: []string{v2.NODE},
},
},
},
Expand Down Expand Up @@ -198,7 +198,7 @@ func TestDelete(t *testing.T) {
},
{
IPS: []string{"192.168.16.1:22", "192.168.16.2:22", "192.168.16.3:22", "192.168.16.4:22"},
Roles: []string{v2.Node},
Roles: []string{v2.NODE},
},
},
},
Expand Down Expand Up @@ -234,7 +234,7 @@ func TestDelete(t *testing.T) {
},
{
IPS: []string{"192.168.16.1:22", "192.168.16.2:22", "192.168.16.3:22", "192.168.16.4:22"},
Roles: []string{v2.Node},
Roles: []string{v2.NODE},
},
},
},
Expand Down Expand Up @@ -270,7 +270,7 @@ func TestDelete(t *testing.T) {
},
{
IPS: []string{"192.168.16.1:22", "192.168.16.2:22", "192.168.16.3:22", "192.168.16.4:22"},
Roles: []string{v2.Node},
Roles: []string{v2.NODE},
},
},
},
Expand Down Expand Up @@ -306,7 +306,7 @@ func TestDelete(t *testing.T) {
},
{
IPS: []string{"192.168.16.1:22", "192.168.16.2:22", "192.168.16.3:22", "192.168.16.4:22"},
Roles: []string{v2.Node},
Roles: []string{v2.NODE},
},
},
},
Expand Down Expand Up @@ -342,7 +342,7 @@ func TestDelete(t *testing.T) {
},
{
IPS: []string{"192.168.16.1:22", "192.168.16.2:22", "192.168.16.3:22", "192.168.16.4:22"},
Roles: []string{v2.Node},
Roles: []string{v2.NODE},
},
},
},
Expand Down Expand Up @@ -378,7 +378,7 @@ func TestDelete(t *testing.T) {
},
{
IPS: []string{"192.168.16.1:22", "192.168.16.2:22", "192.168.16.3:22", "192.168.16.4:22"},
Roles: []string{v2.Node},
Roles: []string{v2.NODE},
},
},
},
Expand Down Expand Up @@ -414,7 +414,7 @@ func TestDelete(t *testing.T) {
},
{
IPS: []string{"192.168.16.1:22", "192.168.16.2:22", "192.168.16.3:22", "192.168.16.4:22"},
Roles: []string{v2.Node},
Roles: []string{v2.NODE},
},
},
},
Expand Down Expand Up @@ -472,7 +472,7 @@ func TestJoin(t *testing.T) {
},
{
IPS: []string{"192.168.16.1:22", "192.168.16.2:22", "192.168.16.3:22", "192.168.16.4:22"},
Roles: []string{v2.Node},
Roles: []string{v2.NODE},
},
},
},
Expand Down Expand Up @@ -508,7 +508,7 @@ func TestJoin(t *testing.T) {
},
{
IPS: []string{"192.168.16.1:22", "192.168.16.2:22", "192.168.16.3:22", "192.168.16.4:22"},
Roles: []string{v2.Node},
Roles: []string{v2.NODE},
},
},
},
Expand Down Expand Up @@ -544,7 +544,7 @@ func TestJoin(t *testing.T) {
},
{
IPS: []string{"192.168.16.1:22", "192.168.16.2:22", "192.168.16.3:22", "192.168.16.4:22"},
Roles: []string{v2.Node},
Roles: []string{v2.NODE},
},
},
},
Expand Down Expand Up @@ -580,7 +580,7 @@ func TestJoin(t *testing.T) {
},
{
IPS: []string{"192.168.16.1:22", "192.168.16.2:22", "192.168.16.3:22", "192.168.16.4:22"},
Roles: []string{v2.Node},
Roles: []string{v2.NODE},
},
},
},
Expand Down Expand Up @@ -616,7 +616,7 @@ func TestJoin(t *testing.T) {
},
{
IPS: []string{"192.168.16.1:22", "192.168.16.2:22", "192.168.16.3:22", "192.168.16.4:22"},
Roles: []string{v2.Node},
Roles: []string{v2.NODE},
},
},
},
Expand Down Expand Up @@ -652,7 +652,7 @@ func TestJoin(t *testing.T) {
},
{
IPS: []string{"192.168.16.1:22", "192.168.16.2:22", "192.168.16.3:22", "192.168.16.4:22"},
Roles: []string{v2.Node},
Roles: []string{v2.NODE},
},
},
},
Expand Down Expand Up @@ -688,7 +688,7 @@ func TestJoin(t *testing.T) {
},
{
IPS: []string{"192.168.16.1:22", "192.168.16.2:22", "192.168.16.3:22", "192.168.16.4:22"},
Roles: []string{v2.Node},
Roles: []string{v2.NODE},
},
},
},
Expand Down Expand Up @@ -724,7 +724,7 @@ func TestJoin(t *testing.T) {
},
{
IPS: []string{"192.168.16.1:22", "192.168.16.2:22", "192.168.16.3:22", "192.168.16.4:22"},
Roles: []string{v2.Node},
Roles: []string{v2.NODE},
},
},
},
Expand Down
2 changes: 1 addition & 1 deletion pkg/ssh/ssh.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ func NewSSHClient(ssh *v2.SSH, isStdout bool) Interface {
func NewSSHByCluster(cluster *v2.Cluster, isStdout bool) (Interface, error) {
var ipList []string
sshClient := NewSSHClient(&cluster.Spec.SSH, isStdout)
ipList = append(ipList, append(cluster.GetIPSByRole(v2.Master), cluster.GetIPSByRole(v2.Node)...)...)
ipList = append(ipList, append(cluster.GetIPSByRole(v2.MASTER), cluster.GetIPSByRole(v2.NODE)...)...)
return sshClient, WaitSSHReady(sshClient, defaultMaxRetry, ipList...)
}

Expand Down
9 changes: 0 additions & 9 deletions pkg/types/v1beta1/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,9 @@ var (
REGISTRY = "registry"
)

type Provider string

type Arch string

const (
AMD64 Arch = "amd64"
ARM64 Arch = "arm64"
)

type Protocol string

const (
ProtocolTCP Protocol = "tcp"
ProtocolUDP Protocol = "udp"
)
38 changes: 0 additions & 38 deletions pkg/types/v1beta1/defaults.go

This file was deleted.

26 changes: 0 additions & 26 deletions pkg/types/v1beta1/defaults_cluster.go

This file was deleted.

Loading

0 comments on commit 3d24a2b

Please sign in to comment.