istio.io/istio@v0.0.0-20240520182934-d79c90f27776/istioctl/pkg/admin/admin.go (about) 1 // Copyright Istio Authors 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 package admin 16 17 import ( 18 "fmt" 19 20 "github.com/spf13/cobra" 21 22 "istio.io/istio/istioctl/pkg/cli" 23 ) 24 25 func Cmd(ctx cli.Context) *cobra.Command { 26 adminCmd := &cobra.Command{ 27 Use: "admin", 28 Short: "Manage control plane (istiod) configuration", 29 Long: "A group of commands used to manage istiod configuration", 30 Example: ` # Retrieve information about istiod configuration. 31 istioctl admin log`, 32 Aliases: []string{"istiod"}, 33 Args: func(cmd *cobra.Command, args []string) error { 34 if len(args) != 0 { 35 return fmt.Errorf("unknown subcommand %q", args[0]) 36 } 37 return nil 38 }, 39 RunE: func(cmd *cobra.Command, args []string) error { 40 cmd.HelpFunc()(cmd, args) 41 return nil 42 }, 43 } 44 45 istiodLog := istiodLogCmd(ctx) 46 adminCmd.AddCommand(istiodLog) 47 adminCmd.PersistentFlags().StringVarP(&istiodLabelSelector, "selector", "l", "app=istiod", "label selector") 48 49 return adminCmd 50 }