Documentation
¶
Index ¶
- func ApplyUserGlobalRole(ctx context.Context, cl client.Client, username, path string) error
- func AuthenticateUser(serverUrl string, requestBody *apis.Login) (*apis.LoginResponse, error)
- func CollectKubeconfig(serverUrl, token string) (*apis.ConfigResponse, error)
- func CreateClusterRole(ctx context.Context, cl client.Client, user *managementv3.User) (*managementv3.GlobalRole, error)
- func CreateRoleBinding(ctx context.Context, cl client.Client, user *managementv3.User) (*managementv3.GlobalRoleBinding, error)
- func CreateUser(ctx context.Context, cl client.Client, passwordHash string) (*managementv3.User, error)
- func GenerateRandomPassword() (string, string, error)
- func GetServer(ctx context.Context, cl client.Client) (string, error)
- func HashPasswordString(password string) (string, error)
- func ResetPassword(ctx context.Context, cl client.Client) error
- type BindAPIServiceOptions
- func (b *BindAPIServiceOptions) AddCmdFlags(cmd *cobra.Command)
- func (b *BindAPIServiceOptions) Complete(args []string) error
- func (b *BindAPIServiceOptions) DisplayKubeconfig(config *apis.ConfigResponse) error
- func (b *BindAPIServiceOptions) GetClient() (client.Client, error)
- func (b *BindAPIServiceOptions) Run(ctx context.Context) error
- func (b *BindAPIServiceOptions) Validate() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ApplyUserGlobalRole ¶ added in v0.0.2
func AuthenticateUser ¶ added in v0.0.2
func CollectKubeconfig ¶ added in v0.0.2
func CollectKubeconfig(serverUrl, token string) (*apis.ConfigResponse, error)
func CreateClusterRole ¶ added in v0.0.2
func CreateClusterRole(ctx context.Context, cl client.Client, user *managementv3.User) (*managementv3.GlobalRole, error)
func CreateRoleBinding ¶ added in v0.0.2
func CreateRoleBinding(ctx context.Context, cl client.Client, user *managementv3.User) (*managementv3.GlobalRoleBinding, error)
func CreateUser ¶ added in v0.0.2
func GenerateRandomPassword ¶ added in v0.0.2
func HashPasswordString ¶ added in v0.0.2
Types ¶
type BindAPIServiceOptions ¶
type BindAPIServiceOptions struct { Options *base.Options Logs *logs.Options *runtime.Scheme // contains filtered or unexported fields }
BindAPIServiceOptions are the options for the kubectl-rancher-bind command.
func NewRancherBindOptions ¶
func NewRancherBindOptions(streams genericclioptions.IOStreams) *BindAPIServiceOptions
NewRancherBindOptions returns new BindAPIServiceOptions.
func (*BindAPIServiceOptions) AddCmdFlags ¶
func (b *BindAPIServiceOptions) AddCmdFlags(cmd *cobra.Command)
AddCmdFlags binds fields to cmd's flagset.
func (*BindAPIServiceOptions) Complete ¶
func (b *BindAPIServiceOptions) Complete(args []string) error
Complete ensures all fields are initialized.
func (*BindAPIServiceOptions) DisplayKubeconfig ¶ added in v0.0.2
func (b *BindAPIServiceOptions) DisplayKubeconfig(config *apis.ConfigResponse) error
func (*BindAPIServiceOptions) GetClient ¶ added in v0.0.2
func (b *BindAPIServiceOptions) GetClient() (client.Client, error)
func (*BindAPIServiceOptions) Run ¶
func (b *BindAPIServiceOptions) Run(ctx context.Context) error
Run starts the kubeconfig generation process.
Flow: - Fetch the setting pointing to the rancher url. - Create a GlobalRole resource. - Create a User resource, with a generated password. - Create a global role binding with sufficient permissions to obtain the token. - Authenticate as the user. - Collect the kubeconfig generated from the given token. - Remove the temporary GlobalRole and binding. - Create the provided ClusterRole from file, add a role binding.
func (*BindAPIServiceOptions) Validate ¶
func (b *BindAPIServiceOptions) Validate() error
Validate validates the NewRancherBindOptions are complete and usable.