Skip to content

Commit

Permalink
Add antctl join command
Browse files Browse the repository at this point in the history
Signed-off-by: hjiajing <hjiajing@vmware.com>
  • Loading branch information
hjiajing committed Jul 19, 2022
1 parent b254621 commit 206a7a1
Show file tree
Hide file tree
Showing 4 changed files with 394 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ func NewRemoteCommonArea(clusterID common.ClusterID, clusterSetID common.Cluster
clusterSetNamespace string) (CommonArea, error) {
klog.InfoS("Create a RemoteCommonArea", "Cluster", clusterID)

crtData, token, err := getSecretCACrtAndToken(secret)
crtData, token, err := GetSecretCACrtAndToken(secret)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -174,9 +174,9 @@ func NewRemoteCommonArea(clusterID common.ClusterID, clusterSetID common.Cluster
}

/**
* getSecretCACrtAndToken returns the access credentials from Secret.
* GetSecretCACrtAndToken returns the access credentials from Secret.
*/
func getSecretCACrtAndToken(secretObj *v1.Secret) ([]byte, []byte, error) {
func GetSecretCACrtAndToken(secretObj *v1.Secret) ([]byte, []byte, error) {
caData, found := secretObj.Data[v1.ServiceAccountRootCAKey]
if !found {
return nil, nil, fmt.Errorf("ca.crt data not found in Secret %v", secretObj.GetName())
Expand Down
6 changes: 6 additions & 0 deletions pkg/antctl/antctl.go
Original file line number Diff line number Diff line change
Expand Up @@ -621,6 +621,12 @@ $ antctl get podmulticaststats pod -n namespace`,
supportController: false,
commandGroup: mc,
},
{
cobraCommand: multicluster.JoinCmd,
supportAgent: false,
supportController: false,
commandGroup: mc,
},
{
cobraCommand: set.SetCmd,
supportAgent: false,
Expand Down
3 changes: 3 additions & 0 deletions pkg/antctl/raw/multicluster/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
deleteCmd "antrea.io/antrea/pkg/antctl/raw/multicluster/delete"
"antrea.io/antrea/pkg/antctl/raw/multicluster/deploy"
"antrea.io/antrea/pkg/antctl/raw/multicluster/get"
"antrea.io/antrea/pkg/antctl/raw/multicluster/join"
)

var GetCmd = &cobra.Command{
Expand Down Expand Up @@ -49,6 +50,8 @@ var DeployCmd = &cobra.Command{
Short: "Deploy Antrea Multi-cluster Controller to a leader or member cluster",
}

var JoinCmd = join.NewJoinCommand()

func init() {
GetCmd.AddCommand(get.NewClusterSetCommand())
GetCmd.AddCommand(get.NewResourceImportCommand())
Expand Down
Loading

0 comments on commit 206a7a1

Please sign in to comment.