client

package
v1.12.0 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2025 License: Apache-2.0 Imports: 19 Imported by: 62

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromContext added in v1.8.0

func FromContext(ctx context.Context) (client.Client, error)

func NamespaceFromContext added in v0.1.72

func NamespaceFromContext(ctx context.Context) (string, error)

func New

func New(ctx context.Context, schemes ...SchemeAdder) (client.Client, error)

New returns a new controller runtime caching client, initialized with core and unikorn resources for typed operation.

func NewContext added in v1.8.0

func NewContext(ctx context.Context, client client.Client) context.Context

func NewContextWithCluster added in v0.1.64

func NewContextWithCluster(ctx context.Context, remote *ClusterContext) context.Context

func NewContextWithNamespace added in v0.1.72

func NewContextWithNamespace(ctx context.Context, namespace string) context.Context

func NewScheme

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

NewScheme returns a scheme with all types that are required by unikorn. TODO: we'd really love to include ArgoCD here, but it's dependency hell. See https://github.com/argoproj/gitops-engine/issues/56 for a never ending commentary on the underlying problem.

func TLSClientConfig added in v0.1.65

func TLSClientConfig(ctx context.Context, cli client.Client, options *HTTPOptions, clientOptions *HTTPClientOptions) (*tls.Config, error)

TLSClientConfig is a helper to create a TLS client configuration.

func VerifyAndDecode added in v1.4.0

func VerifyAndDecode(data any, payload string, certificate *x509.Certificate) error

VerifyAndDecode checks the payload's signature against the message and decodes the payload into an arbitrary data type.

Types

type ClusterContext added in v0.1.64

type ClusterContext struct {
	// Client is a Kubernetes client that can access resources on the remote
	// cluster.  This is typically used to extract Kubenetes configuration to
	// chain to the next remote cluster.  It is also used when some combination
	// of Helm application/ArgoCD is broken and needs manual intervention.
	Client client.Client
	// ID is the unique remote cluster ID as cunsumed by the CD layer.
	// This is only set on invocation of a remote cluster provisioner.
	ID *cd.ResourceIdentifier
	// Host is the Kubernetes endpoint hostname. This is only set on
	// invocation of a remote cluster provisioner.
	Host string
	// Port is the Kubernetes endpoint port. This is only set on
	// invocation of a remote cluster provisioner.
	Port string
}

ClusterContext is available to all provisioners and is updated when invoked within the scope of a remote cluster provisioner. In general, you should avoid having to use this, because it implies hackery.

func ClusterFromContext added in v0.1.64

func ClusterFromContext(ctx context.Context) (*ClusterContext, error)

type HTTPClientOptions added in v0.1.65

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

HTTPClientOptions allows generic options to be passed to all HTTP clients.

func (*HTTPClientOptions) AddFlags added in v0.1.65

func (o *HTTPClientOptions) AddFlags(f *pflag.FlagSet)

AddFlags adds the options to the CLI flags.

func (*HTTPClientOptions) ApplyTLSClientConfig added in v0.1.65

func (o *HTTPClientOptions) ApplyTLSClientConfig(ctx context.Context, cli client.Client, config *tls.Config) error

ApplyTLSClientConfig loads op a client certificate if one is configured and applies it to the provided TLS configuration.

func (*HTTPClientOptions) EncodeAndSign added in v1.4.0

func (o *HTTPClientOptions) EncodeAndSign(ctx context.Context, cli client.Client, data any) (string, error)

EncodeAndSign takes an arbitrary data type, encodes as JSON, generates a digest and creates a digital signature, then returns a stringified version for verifiable communication from one service to another. Confidentiality is ensured by the use of TLS.

type HTTPOptions added in v0.1.65

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

HTTPOptions are generic options for HTTP clients.

func NewHTTPOptions added in v0.1.65

func NewHTTPOptions(service string) *HTTPOptions

func (*HTTPOptions) AddFlags added in v0.1.65

func (o *HTTPOptions) AddFlags(f *pflag.FlagSet)

AddFlags adds the options to the CLI flags.

func (*HTTPOptions) ApplyTLSConfig added in v0.1.65

func (o *HTTPOptions) ApplyTLSConfig(ctx context.Context, cli client.Client, config *tls.Config) error

ApplyTLSConfig adds CA certificates to the TLS configuration if one is specified.

func (*HTTPOptions) Host added in v0.1.65

func (o *HTTPOptions) Host() string

type SchemeAdder

type SchemeAdder func(*runtime.Scheme) error

SchemeAdder allows custom resources to be added to the scheme.

Jump to

Keyboard shortcuts

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