plugin

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2023 License: Apache-2.0 Imports: 35 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyUserGlobalRole added in v0.0.2

func ApplyUserGlobalRole(ctx context.Context, cl client.Client, username, path string) error

func AuthenticateUser added in v0.0.2

func AuthenticateUser(serverUrl string, requestBody *apis.Login) (*apis.LoginResponse, error)

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 CreateUser(ctx context.Context, cl client.Client, passwordHash string) (*managementv3.User, error)

func GenerateRandomPassword added in v0.0.2

func GenerateRandomPassword() (string, string, error)

func GetServer added in v0.0.2

func GetServer(ctx context.Context, cl client.Client) (string, error)

func HashPasswordString added in v0.0.2

func HashPasswordString(password string) (string, error)

func ResetPassword added in v0.0.2

func ResetPassword(ctx context.Context, cl client.Client) error

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

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.

Jump to

Keyboard shortcuts

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