kubeclient

package
v0.1.1-rc.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	StagesByArgoCDApplicationsIndexField   = "applications"
	PromotionsByStageIndexField            = "stage"
	NonTerminalPromotionsByStageIndexField = PromotionsByStageIndexField
	PromotionPoliciesByStageIndexField     = "stage"
	FreightByWarehouseIndexField           = "warehouse"
	FreightByQualifiedStagesIndexField     = "qualifiedStages"
	StagesByUpstreamStagesIndexField       = "upstreamStages"
)

Variables

This section is empty.

Functions

func GetCredential

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

GetCredential implements a hacky method of gleaning the bearer token that is used for authentication to a given Kubernetes API server. It works by building an HTTP client using the provided *rest.Config as well as a custom http.RoundTripper. The custom http.RoundTripper copies the Authorization header from an outbound request to the X-Kargo-User-Credential header in the corresponding inbound response. This client is used to make a request to the Kubernetes API server and the value of the X-Kargo-User-Credential header is read from the response and returned.

Note: The reason the token isn't simply read directly from the *rest.Config is because that strategy would not account for cases where the bearer token is actually supplied by a credential plugin.

This method will not work when authentication to the Kubernetes API server is achieved using a client certificate, but that methods of authentication does not seem to be widely used beyond kind and k3d.

func IndexFreightByQualifiedStages added in v0.2.0

func IndexFreightByQualifiedStages(
	ctx context.Context,
	mgr ctrl.Manager,
) error

func IndexFreightByWarehouse added in v0.2.0

func IndexFreightByWarehouse(ctx context.Context, mgr ctrl.Manager) error

func IndexNonTerminalPromotionsByStage

func IndexNonTerminalPromotionsByStage(ctx context.Context, mgr ctrl.Manager) error

IndexNonTerminalPromotionsByStage indexes Promotions in non-terminal states by Stage

func IndexPromotionPoliciesByStage

func IndexPromotionPoliciesByStage(ctx context.Context, mgr ctrl.Manager) error

func IndexPromotionsByStage

func IndexPromotionsByStage(ctx context.Context, mgr ctrl.Manager, predicates ...func(*kargoapi.Promotion) bool) error

IndexPromotionsByStage creates Promotion index by Stage for which all the given predicates returns true for the Promotion.

func IndexStagesByArgoCDApplications

func IndexStagesByArgoCDApplications(ctx context.Context, mgr ctrl.Manager, shardName string) error

func IndexStagesByUpstreamStages added in v0.2.0

func IndexStagesByUpstreamStages(ctx context.Context, mgr ctrl.Manager) error

func PatchStatus

func PatchStatus[T HasStatus[S], S any](
	ctx context.Context, kubeClient client.Client, resource T, update func(status S)) error

PatchStatus patches evaluate changes applied by the callback to the status of a resource and patches resource status if there are any changes.

Types

type HasStatus

type HasStatus[S any] interface {
	client.Object
	GetStatus() S
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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