1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2025-03-09 09:26:54 +00:00
kyverno/cmd/cli/kubectl-kyverno/commands/oci/command.go
Charles-Edouard Brétéché dc71610df7
refactor: cli commands tests and error handling (#8367)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-09-13 09:53:19 +00:00

35 lines
1.1 KiB
Go

package oci
import (
"github.com/google/go-containerregistry/pkg/authn"
"github.com/google/go-containerregistry/pkg/authn/github"
"github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/command"
"github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/commands/oci/pull"
"github.com/kyverno/kyverno/cmd/cli/kubectl-kyverno/commands/oci/push"
"github.com/kyverno/kyverno/pkg/registryclient"
"github.com/spf13/cobra"
)
func Command() *cobra.Command {
keychain := authn.NewMultiKeychain(
authn.DefaultKeychain,
github.Keychain,
registryclient.AWSKeychain,
registryclient.GCPKeychain,
registryclient.AzureKeychain,
)
cmd := &cobra.Command{
Use: "oci",
Short: command.FormatDescription(true, websiteUrl, true, description...),
Long: command.FormatDescription(false, websiteUrl, true, description...),
Example: command.FormatExamples(examples...),
Args: cobra.NoArgs,
SilenceUsage: true,
RunE: func(cmd *cobra.Command, _ []string) error {
return cmd.Help()
},
}
cmd.AddCommand(pull.Command(keychain))
cmd.AddCommand(push.Command(keychain))
return cmd
}