in pkg/cmd/podidentity/detect.go [70:95]
func newDetectCmd() *cobra.Command {
detectCmd := &detectCmd{}
cmd := &cobra.Command{
Use: "detect",
Short: "Detect the existing aad-pod-identity configuration",
Long: "This command will detect the existing aad-pod-identity configuration and generate a sample configuration file for migration to workload identity",
PreRunE: func(cmd *cobra.Command, args []string) error {
return detectCmd.prerun()
},
RunE: func(cmd *cobra.Command, args []string) error {
return detectCmd.run()
},
}
f := cmd.Flags()
f.StringVar(&detectCmd.namespace, "namespace", "default", "Namespace to detect the configuration")
f.StringVarP(&detectCmd.outputDir, "output-dir", "o", "", "Output directory to write the configuration files")
f.Int32VarP(&detectCmd.proxyPort, "proxy-port", "p", 8000, "Proxy port to use for the proxy container")
f.DurationVar(&detectCmd.serviceAccountTokenExpiration, options.ServiceAccountTokenExpiration.Flag, time.Duration(webhook.DefaultServiceAccountTokenExpiration)*time.Second, options.ServiceAccountTokenExpiration.Description)
f.StringVar(&detectCmd.tenantID, "tenant-id", "", "Managed identity tenant id. If specified, the tenant id will be set as an annotation on the service account.")
_ = cmd.MarkFlagRequired("output-dir")
return cmd
}