add_user

package
v0.1.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 23, 2020 License: MPL-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCommand

func NewCommand() *cobra.Command

New returns a cobra command instance based on Handler.

Types

type Handler

type Handler struct {
	handler.Session

	KubeApiClientset    *cage_k8s_core.Clientset
	KubectlConfigClient cage_k8s_config.Client

	Cluster            string   `usage:"cluster of the new context to create (default from current-context)"`
	ClusterRoles       []string `usage:"cluster role binding to create (<role name>:<binding name>)"`
	ConfigFile         string   `usage:"kubectl config file to modify"`
	Namespace          string   `usage:"namespace to receive service account (default from current-context)"`
	Roles              []string `usage:"role binding to create (<role name>:<binding name>)"`
	ServiceAccountName string   `usage:"name of service account to create"`
	Username           string   `usage:"username/context to receive the service account's bearer token"`

	// Verbosity levels greater than 0 will enable status messages and error stack traces.
	//
	// It is an int for consistency with other commands, even though levels beyond 1 are not used.
	Verbosity int `usage:"kubectl verbosity level"`
}

Handler defines the sub-command flags and logic.

func (*Handler) BindFlags

func (h *Handler) BindFlags(cmd *cobra.Command) []string

BindFlags binds the flags to Handler fields.

It implements cli/handler/cobra.Handler.

func (*Handler) Init

func (h *Handler) Init() handler_cobra.Init

Init defines the command, its environment variable prefix, etc.

It implements cli/handler/cobra.Handler.

func (*Handler) Run

func (h *Handler) Run(ctx context.Context, input handler.Input)

Run performs the sub-command logic.

It implements cli/handler/cobra.Handler.

Based on:

https://stackoverflow.com/questions/42170380/how-to-add-users-to-kubernetes-kubectl/42186135#42186135
https://gist.github.com/innovia/fbba8259042f71db98ea8d4ad19bd708

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL