Documentation
¶
Index ¶
- Constants
- func FreightApprovedForStagesIndexer(obj client.Object) []string
- func FreightByVerifiedStagesIndexer(obj client.Object) []string
- func FreightByWarehouseIndexer(obj client.Object) []string
- func GetCredential(ctx context.Context, cfg *rest.Config) (string, error)
- func IgnoreInvalid(err error) error
- func IndexEventsByInvolvedObjectAPIGroup(ctx context.Context, mgr ctrl.Manager) error
- func IndexFreightByApprovedStages(ctx context.Context, mgr ctrl.Manager) error
- func IndexFreightByVerifiedStages(ctx context.Context, mgr ctrl.Manager) error
- func IndexFreightByWarehouse(ctx context.Context, mgr ctrl.Manager) error
- func IndexPromotionsByStage(ctx context.Context, mgr ctrl.Manager) error
- func IndexPromotionsByStageAndFreight(ctx context.Context, mgr ctrl.Manager) error
- func IndexRunningPromotionsByArgoCDApplications(ctx context.Context, mgr ctrl.Manager, shardName string) error
- func IndexServiceAccountsByOIDCEmail(ctx context.Context, mgr ctrl.Manager) error
- func IndexServiceAccountsByOIDCGroups(ctx context.Context, mgr ctrl.Manager) error
- func IndexServiceAccountsByOIDCSubjects(ctx context.Context, mgr ctrl.Manager) error
- func IndexStagesByAnalysisRun(ctx context.Context, mgr ctrl.Manager, shardName string) error
- func IndexStagesByArgoCDApplications(ctx context.Context, mgr ctrl.Manager, shardName string) error
- func IndexStagesByFreight(ctx context.Context, mgr ctrl.Manager) error
- func IndexStagesByUpstreamStages(ctx context.Context, mgr ctrl.Manager) error
- func IndexStagesByWarehouse(ctx context.Context, mgr ctrl.Manager) error
- func PatchStatus[T HasStatus[S], S any](ctx context.Context, kubeClient client.Client, resource T, ...) error
- func PatchUnstructured(ctx context.Context, c client.Client, obj ObjectWithKind, ...) error
- func StageAndFreightKey(stage, freight string) string
- type HasStatus
- type ObjectWithKind
- type UnstructuredPatchFn
Constants ¶
const ( EventsByInvolvedObjectAPIGroupIndexField = "involvedObject.apiGroup" FreightByVerifiedStagesIndexField = "verifiedIn" FreightApprovedForStagesIndexField = "approvedFor" FreightByWarehouseIndexField = "warehouse" PromotionsByStageAndFreightIndexField = "stageAndFreight" PromotionsByStageIndexField = "stage" RunningPromotionsByArgoCDApplicationsIndexField = "applications" StagesByAnalysisRunIndexField = "analysisRun" StagesByArgoCDApplicationsIndexField = "applications" StagesByFreightIndexField = "freight" StagesByUpstreamStagesIndexField = "upstreamStages" StagesByWarehouseIndexField = "warehouse" ServiceAccountsByOIDCEmailIndexField = "email" ServiceAccountsByOIDCGroupIndexField = "groups" ServiceAccountsByOIDCSubjectIndexField = "subjects" )
Variables ¶
This section is empty.
Functions ¶
func FreightApprovedForStagesIndexer ¶ added in v0.8.0
FreightApprovedForStagesIndexer is a client.IndexerFunc that indexes Freight by the Stages for which it has been (manually) approved.
func FreightByVerifiedStagesIndexer ¶ added in v0.8.0
FreightByVerifiedStagesIndexer is a client.IndexerFunc that indexes Freight by the Stages in which it has been verified.
func FreightByWarehouseIndexer ¶ added in v0.8.0
FreightByWarehouseIndexer is a client.IndexerFunc that indexes Freight by the Warehouse it is associated with.
func GetCredential ¶
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 IgnoreInvalid ¶ added in v0.6.0
IgnoreInvalid returns nil on Invalid errors. All other values that are not Invalid errors or nil are returned unmodified.
func IndexEventsByInvolvedObjectAPIGroup ¶ added in v0.6.0
func IndexFreightByApprovedStages ¶ added in v0.3.0
IndexFreightByApprovedStages indexes Freight by the Stages for which it has been (manually) approved.
func IndexFreightByVerifiedStages ¶ added in v0.3.0
IndexFreightByVerifiedStages indexes Freight by the Stages in which it has been verified.
func IndexFreightByWarehouse ¶ added in v0.2.0
func IndexPromotionsByStage ¶
IndexPromotionsByStage creates Promotion index by Stage for which all the given predicates returns true for the Promotion.
func IndexPromotionsByStageAndFreight ¶ added in v0.2.1
IndexPromotionsByStageAndFreight indexes Promotions by the Freight + Stage they reference.
func IndexRunningPromotionsByArgoCDApplications ¶ added in v0.6.0
func IndexServiceAccountsByOIDCEmail ¶ added in v0.3.0
func IndexServiceAccountsByOIDCGroups ¶ added in v0.3.0
func IndexServiceAccountsByOIDCSubjects ¶ added in v0.3.0
func IndexStagesByAnalysisRun ¶ added in v0.3.0
func IndexStagesByFreight ¶ added in v0.3.0
func IndexStagesByUpstreamStages ¶ added in v0.2.0
func IndexStagesByWarehouse ¶ added in v0.3.0
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.
func PatchUnstructured ¶ added in v0.8.5
func PatchUnstructured(ctx context.Context, c client.Client, obj ObjectWithKind, modify UnstructuredPatchFn) error
PatchUnstructured patches a Kubernetes object using unstructured objects. It fetches the object from the API server, applies modifications via the provided UnstructuredPatchFn, and patches the object back to the server.
The UnstructuredPatchFn is called with src (a copy of the original object converted to unstructured format) and dest (the object fetched from the API server).
It returns an error if it fails to fetch the object, apply modifications, patch the object, or convert the result back to its typed form.
func StageAndFreightKey ¶ added in v0.2.1
Types ¶
type ObjectWithKind ¶ added in v0.8.5
type ObjectWithKind interface { client.Object schema.ObjectKind }
type UnstructuredPatchFn ¶ added in v0.8.5
type UnstructuredPatchFn func(src, dest unstructured.Unstructured) error
UnstructuredPatchFn is a function which modifies the destination unstructured object based on the source unstructured object.