api

package
v1.12.3 Latest Latest
Warning

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

Go to latest
Published: Oct 14, 2025 License: Apache-2.0 Imports: 56 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultTokenCachePath    = ".kube/cache/oidc-login"
	IssuerURLArg             = "--issuer-url="
	ClientIDArg              = "--client-id="
	ClientSecretArg          = "--client-secret="
	TokenURLArg              = "--token-url="
	UsePKCEArg               = "--use-pkce"
	CustomersPrefix          = "/Customers/"
	ClientCredentialsCmdName = "client-credentials"
	OIDCCmdName              = "oidc"
)

Variables

This section is empty.

Functions

func GetToken added in v1.1.0

func GetToken(ctx context.Context, issuerURL, clientID string, usePKCE bool, out io.Writer) error

GetToken executes the OIDC login flow using the kubelogin with the provided OIDC parameters writes the raw JSON ExecCredential result to out.

func GetTokenFromConfig added in v1.1.0

func GetTokenFromConfig(ctx context.Context, cfg *rest.Config) (string, error)

GetTokenFromConfig takes a rest.Config and returns a valid OIDC access token or the static bearer token if it's set in the config.

func GetTokenFromExecConfig added in v1.1.0

func GetTokenFromExecConfig(ctx context.Context, execConfig *api.ExecConfig) (string, error)

GetTokenFromExecConfig takes the provided execConfig, parses out the args and gets the token by executing the login flow.

func LoadingRules

func LoadingRules() (*clientcmd.ClientConfigLoadingRules, error)

func NamespacedName added in v1.1.0

func NamespacedName(name, project string) types.NamespacedName

func NewScheme

func NewScheme() (*runtime.Scheme, error)

NewScheme returns a *runtime.Scheme with all the relevant types registered.

func ObjectName added in v1.0.1

func ObjectName(obj runtimeclient.Object) types.NamespacedName

Types

type Client

type Client struct {
	runtimeclient.WithWatch
	Config            *rest.Config
	KubeconfigPath    string
	Project           string
	Log               *log.Client
	KubeconfigContext string
}

func New

func New(ctx context.Context, apiClusterContext, project string, opts ...ClientOpt) (*Client, error)

New returns a new Client by loading a kubeconfig with the supplied context and project. The kubeconfig is discovered like this: * KUBECONFIG environment variable pointing at a file * $HOME/.kube/config if exists

func (*Client) DeploioRuntimeClient added in v1.8.0

func (c *Client) DeploioRuntimeClient(ctx context.Context, scheme *runtime.Scheme) (runtimeclient.Client, error)

func (*Client) DeploioRuntimeConfig added in v1.8.0

func (c *Client) DeploioRuntimeConfig(ctx context.Context) (*rest.Config, error)

func (*Client) GetConnectionSecret

func (c *Client) GetConnectionSecret(ctx context.Context, mg resource.Managed) (*corev1.Secret, error)

func (*Client) GetObject added in v1.8.4

func (c *Client) GetObject(ctx context.Context, name string, obj runtimeclient.Object) error

GetObject gets the object in the current client project with some ux-improvements like hinting when the object has been found in a different project of the same organization.

func (*Client) ListObjects added in v1.8.4

func (c *Client) ListObjects(ctx context.Context, list runtimeclient.ObjectList, options ...ListOpt) error

ListObjects lists objects in the current client project with some ux-improvements like hinting when a resource has been found in a different project of the same organization.

func (*Client) Name

func (c *Client) Name(name string) types.NamespacedName

func (*Client) Organization added in v1.8.2

func (c *Client) Organization() (string, error)

func (*Client) Projects added in v1.8.4

func (c *Client) Projects(ctx context.Context, onlyName string) ([]management.Project, error)

Projects returns either all existing Projects or only the specific project identified by the "onlyName" parameter

func (*Client) Token added in v1.1.0

func (c *Client) Token(ctx context.Context) string

type ClientOpt added in v1.1.0

type ClientOpt func(c *Client) error

func LogClient added in v1.1.0

func LogClient(ctx context.Context, address string, insecure bool) ClientOpt

LogClient sets up a log client connected to the provided address.

func StaticToken added in v1.7.1

func StaticToken(ctx context.Context) ClientOpt

StaticToken configures the client to get a bearer token once and then set it statically in the client config. This means the client will not automatically renew the token when it expires.

type DefaultTokenGetter added in v1.2.0

type DefaultTokenGetter struct{}

func (*DefaultTokenGetter) GetTokenString added in v1.2.0

func (t *DefaultTokenGetter) GetTokenString(ctx context.Context, issuerURL, clientID string, usePKCE bool) (string, error)

type ListOpt added in v1.8.4

type ListOpt func(opts *ListOpts)

func AllNamespaces added in v1.8.4

func AllNamespaces() ListOpt

func AllProjects added in v1.8.4

func AllProjects() ListOpt

func MatchLabel added in v1.8.4

func MatchLabel(k, v string) ListOpt

func MatchName added in v1.8.4

func MatchName(name string) ListOpt

func Watch added in v1.11.0

func Watch(f WatchFunc) ListOpt

type ListOpts added in v1.8.4

type ListOpts struct {
	// contains filtered or unexported fields
}

type TokenGetter added in v1.2.0

type TokenGetter interface {
	GetTokenString(ctx context.Context, issuerURL, clientID string, usePKCE bool) (string, error)
}

type UserInfo added in v1.2.0

type UserInfo struct {
	User    string
	Orgs    []string
	Project string
}

func GetUserInfoFromToken added in v1.2.0

func GetUserInfoFromToken(tokenString string) (*UserInfo, error)

type WatchFunc added in v1.11.0

type WatchFunc func(list runtimeclient.ObjectList) error

Directories

Path Synopsis
login module

Jump to

Keyboard shortcuts

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