-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implementation of theia and policy recommendation CLI (#25)
In this commit, we add the implementation of theia, the command-line tool for Theia based on the cobra framework. Policy recommendation CLI is also included. It consists of 3 commands which let users could run a new policy recommendation job, check the current status of a previous job, and retrieve the recommendation result of a previous job respectively. In order to access theia services externally, theia can make use of k8s port forwarder functionality. Port forwarder provides tooling to start/stop port forwarding channel for eather Pod+Port or Service+Port. The code is loosely based on the corresponding code in kubectl. Document of theia and policy recommendation will be added in a separate commit later. Signed-off-by: Yongming Ding <dyongming@vmware.com> Co-authored-by: Yanjun Zhou <zhouya@vmware.com> Co-authored-by: Anna Khmelnitsky <akhmelnitsky@vmware.com>
- Loading branch information
1 parent
1acd4bb
commit 4391011
Showing
20 changed files
with
3,773 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// Copyright 2022 Antrea Authors | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package commands | ||
|
||
import ( | ||
"fmt" | ||
|
||
"github.com/spf13/cobra" | ||
) | ||
|
||
// policyRecommendationCmd represents the policy recommendation command group | ||
var policyRecommendationCmd = &cobra.Command{ | ||
Use: "policy-recommendation", | ||
Aliases: []string{"pr"}, | ||
Short: "Commands of Theia policy recommendation feature", | ||
Long: `Command group of Theia policy recommendation feature. | ||
Must specify a subcommand like run, status or retrieve.`, | ||
Run: func(cmd *cobra.Command, args []string) { | ||
fmt.Println("Error: must also specify a subcommand like run, status or retrieve") | ||
}, | ||
} | ||
|
||
func init() { | ||
rootCmd.AddCommand(policyRecommendationCmd) | ||
rootCmd.PersistentFlags().StringP( | ||
"kubeconfig", | ||
"k", | ||
"", | ||
"absolute path to the k8s config file, will use $KUBECONFIG if not specified", | ||
) | ||
} |
Oops, something went wrong.