login

package
v0.1.39 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2025 License: Apache-2.0 Imports: 25 Imported by: 2

Documentation

Index

Constants

View Source
const (
	EnvPs1                      = "KUBE_PS1_CLUSTER_FUNCTION"
	LoginTypeClusterID          = "cluster-id"
	LoginTypeExistingKubeConfig = "kube-config"
	LoginTypePagerduty          = "pagerduty"
	LoginTypeJira               = "jira"
)

Environment variable that for setting PS1

Variables

View Source
var (

	// LoginCmd represents the login command
	LoginCmd = &cobra.Command{
		Use:   "login <CLUSTERID|EXTERNAL_ID|CLUSTER_NAME|CLUSTER_NAME_SEARCH>",
		Short: "Login to a target cluster",
		Long: `Running login command will send a request to backplane api
		using OCM token. The backplane api will return a proxy url for
		target cluster. The url will be written to kubeconfig, so we can
		run oc command later to operate the target cluster.`,
		Example: " backplane login <id>\n backplane login %test%\n backplane login <external_id>\n backplane login --pd <incident-id>",
		Args: func(cmd *cobra.Command, args []string) error {
			if cmd.Flags().Lookup("pd").Changed || cmd.Flags().Lookup("ohss").Changed {
				if err := cobra.ExactArgs(0)(cmd, args); err != nil {
					return err
				}
			} else {
				if err := cobra.ExactArgs(1)(cmd, args); err != nil {
					return err
				}
			}
			return nil
		},
		PreRunE:      preLogin,
		RunE:         runLogin,
		SilenceUsage: true,
	}
)

Functions

func GetRestConfig added in v0.1.5

func GetRestConfig(bp config.BackplaneConfiguration, clusterID string) (*rest.Config, error)

GetRestConfig returns a client-go *rest.Config which can be used to programmatically interact with the Kubernetes API of a provided clusterID

func GetRestConfigAsUser added in v0.1.5

func GetRestConfigAsUser(bp config.BackplaneConfiguration, clusterID, username string, elevationReasons ...string) (*rest.Config, error)

GetRestConfigAsUser returns a client-go *rest.Config like GetRestConfig, but supports configuring an impersonation username. Commonly, this is "backplane-cluster-admin" best practice would be to add at least one elevationReason in order to justity the impersonation

func GetRestConfigWithConn added in v0.1.31

func GetRestConfigWithConn(bp config.BackplaneConfiguration, ocmConnection *ocmsdk.Connection, clusterID string) (*rest.Config, error)

GetRestConfig returns a client-go *rest.Config which can be used to programmatically interact with the Kubernetes API of a provided clusterID

Types

This section is empty.

Jump to

Keyboard shortcuts

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