set.go 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /*
  2. Copyright 2016 The Kubernetes Authors.
  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. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. */
  13. package set
  14. import (
  15. "github.com/spf13/cobra"
  16. "k8s.io/cli-runtime/pkg/genericclioptions"
  17. cmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util"
  18. "k8s.io/kubernetes/pkg/kubectl/util/i18n"
  19. "k8s.io/kubernetes/pkg/kubectl/util/templates"
  20. )
  21. var (
  22. setLong = templates.LongDesc(`
  23. Configure application resources
  24. These commands help you make changes to existing application resources.`)
  25. )
  26. // NewCmdSet returns an initialized Command instance for 'set' sub command
  27. func NewCmdSet(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command {
  28. cmd := &cobra.Command{
  29. Use: "set SUBCOMMAND",
  30. DisableFlagsInUseLine: true,
  31. Short: i18n.T("Set specific features on objects"),
  32. Long: setLong,
  33. Run: cmdutil.DefaultSubCommandRun(streams.ErrOut),
  34. }
  35. // add subcommands
  36. cmd.AddCommand(NewCmdImage(f, streams))
  37. cmd.AddCommand(NewCmdResources(f, streams))
  38. cmd.AddCommand(NewCmdSelector(f, streams))
  39. cmd.AddCommand(NewCmdSubject(f, streams))
  40. cmd.AddCommand(NewCmdServiceAccount(f, streams))
  41. cmd.AddCommand(NewCmdEnv(f, streams))
  42. return cmd
  43. }