Documentation
¶
Overview ¶
Package v1beta2 contains API Schema definitions for the Resource Permits v1beta2 API group +kubebuilder:object:generate=true +groupName=addons.projectcapsule.dev
Index ¶
- Constants
- Variables
- func ValidateResourcePermitTemplate(brt ResourcePermitTemplateSource) error
- type ActivePeriod
- type GlobalResourcePermitTemplate
- func (brt *GlobalResourcePermitTemplate) CheckApprovalConditions(ctx context.Context, br *ResourcePermit) error
- func (in *GlobalResourcePermitTemplate) DeepCopy() *GlobalResourcePermitTemplate
- func (in *GlobalResourcePermitTemplate) DeepCopyInto(out *GlobalResourcePermitTemplate)
- func (in *GlobalResourcePermitTemplate) DeepCopyObject() pkgruntime.Object
- func (brt *GlobalResourcePermitTemplate) EvaluateApprovalConditions(ctx context.Context, br *ResourcePermit) (bool, error)
- func (brt *GlobalResourcePermitTemplate) TemplateData() ResourcePermitTemplateData
- func (brt *GlobalResourcePermitTemplate) ValidateApprovalConditions() error
- type GlobalResourcePermitTemplateList
- type GlobalResourcePermitTemplateReference
- type GlobalResourcePermitTemplateSpec
- type GlobalResourcePermitTemplateStatus
- type ResolvedGlobalResourcePermitTemplateReference
- type ResolvedResourcePermitTemplateReference
- type ResourcePermit
- func (br *ResourcePermit) ActivatePermit(entity *resourcepermit.AccessEntity) (err error)
- func (br *ResourcePermit) ApprovalPolicy(fallback ResourcePermitTemplateSource) resourcepermit.ApprovalSpec
- func (br *ResourcePermit) ApprovePermit(entity *resourcepermit.AccessEntity, properties *ResourcePermitStatusRequest, ...) (err error)
- func (br *ResourcePermit) CheckApprovalConditions(ctx context.Context, fallback ResourcePermitTemplateSource) error
- func (br *ResourcePermit) CompleteRetry() error
- func (in *ResourcePermit) DeepCopy() *ResourcePermit
- func (in *ResourcePermit) DeepCopyInto(out *ResourcePermit)
- func (in *ResourcePermit) DeepCopyObject() pkgruntime.Object
- func (br *ResourcePermit) DeletePermit()
- func (br *ResourcePermit) DenyPermit(entity *resourcepermit.AccessEntity, reason string) (err error)
- func (br *ResourcePermit) EvaluateApprovalConditions(ctx context.Context, fallback ResourcePermitTemplateSource) (bool, error)
- func (br *ResourcePermit) ExpirePermit(entity *resourcepermit.AccessEntity) (err error)
- func (br *ResourcePermit) FailPermit(stage ResourcePermitFailureStage, retryPhase ResourcePermitPhase, ...) error
- func (br *ResourcePermit) GenerateRequestStatus(templates ...ResourcePermitTemplateSource) (*ResourcePermitStatusRequest, error)
- func (br *ResourcePermit) LatestTransition(phase ResourcePermitPhase) *ResourcePermitTransition
- func (br *ResourcePermit) LoadTemplateContext(ctx context.Context, c client.Client, mapper k8smeta.RESTMapper, ...) (template.ReferenceContext, error)
- func (br *ResourcePermit) RenderResources(schema *k8sruntime.RawExtension, resources []apiruntime.ResourceTemplate, ...) ([]apiruntime.RenderedResource, error)
- func (br *ResourcePermit) ResolvePermitStatus(brt ResourcePermitTemplateSource) error
- func (br *ResourcePermit) RetryPermit(entity *resourcepermit.AccessEntity) error
- func (br *ResourcePermit) SetCreated(entity *resourcepermit.AccessEntity) error
- func (br *ResourcePermit) SetPending() (err error)
- func (br *ResourcePermit) SetReady(status metav1.ConditionStatus, reason, message string)
- func (br *ResourcePermit) SetRequested() error
- func (br *ResourcePermit) SetRequestedBy(entity *resourcepermit.AccessEntity) error
- func (br *ResourcePermit) ValidateParameters(schema *k8sruntime.RawExtension) error
- type ResourcePermitFailure
- type ResourcePermitFailureStage
- type ResourcePermitList
- type ResourcePermitPhase
- type ResourcePermitSpec
- type ResourcePermitStatus
- type ResourcePermitStatusRequest
- type ResourcePermitTemplate
- func (brt *ResourcePermitTemplate) CheckApprovalConditions(ctx context.Context, br *ResourcePermit) error
- func (in *ResourcePermitTemplate) DeepCopy() *ResourcePermitTemplate
- func (in *ResourcePermitTemplate) DeepCopyInto(out *ResourcePermitTemplate)
- func (in *ResourcePermitTemplate) DeepCopyObject() pkgruntime.Object
- func (brt *ResourcePermitTemplate) EvaluateApprovalConditions(ctx context.Context, br *ResourcePermit) (bool, error)
- func (brt *ResourcePermitTemplate) TemplateData() ResourcePermitTemplateData
- func (brt *ResourcePermitTemplate) ValidateApprovalConditions() error
- type ResourcePermitTemplateData
- type ResourcePermitTemplateList
- type ResourcePermitTemplateReference
- type ResourcePermitTemplateSource
- type ResourcePermitTemplateSpec
- type ResourcePermitTemplateStatus
- type ResourcePermitTransition
- type ResourcePermitTransitionActor
- type ResourcePermitVerdict
- type ReviewInfo
Constants ¶
const ( ResourcePermitTemplateKind = "ResourcePermitTemplate" GlobalResourcePermitTemplateKind = "GlobalResourcePermitTemplate" )
Variables ¶
var ( // GroupVersion is group version used to register these objects. GroupVersion = schema.GroupVersion{Group: "addons.projectcapsule.dev", Version: "v1beta2"} // SchemeBuilder is used to add go types to the GroupVersionKind scheme. SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes) // AddToScheme adds the types in this group-version to the given scheme. AddToScheme = SchemeBuilder.AddToScheme )
Functions ¶
func ValidateResourcePermitTemplate ¶
func ValidateResourcePermitTemplate(brt ResourcePermitTemplateSource) error
ValidateResourcePermitTemplate checks the static configuration shared by admission and template readiness reconciliation. Rendering and context loading depend on request parameters and are checked when a ResourcePermit is submitted.
Types ¶
type ActivePeriod ¶
type ActivePeriod struct {
ActiveFrom *metav1.Time `json:"from,omitempty"`
ActiveUntil *metav1.Time `json:"until,omitempty"`
}
ActivePeriod represents the time window when a request is active.
func (*ActivePeriod) DeepCopy ¶
func (in *ActivePeriod) DeepCopy() *ActivePeriod
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ActivePeriod.
func (*ActivePeriod) DeepCopyInto ¶
func (in *ActivePeriod) DeepCopyInto(out *ActivePeriod)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type GlobalResourcePermitTemplate ¶
type GlobalResourcePermitTemplate struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec GlobalResourcePermitTemplateSpec `json:"spec"`
Status GlobalResourcePermitTemplateStatus `json:"status,omitempty"`
}
GlobalResourcePermitTemplate is the Schema for the globalresourcepermittemplates API.
func (*GlobalResourcePermitTemplate) CheckApprovalConditions ¶
func (brt *GlobalResourcePermitTemplate) CheckApprovalConditions(ctx context.Context, br *ResourcePermit) error
CheckApprovalConditions returns an error when the template's approval gate is invalid or none of its conditions match the supplied request.
func (*GlobalResourcePermitTemplate) DeepCopy ¶
func (in *GlobalResourcePermitTemplate) DeepCopy() *GlobalResourcePermitTemplate
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GlobalResourcePermitTemplate.
func (*GlobalResourcePermitTemplate) DeepCopyInto ¶
func (in *GlobalResourcePermitTemplate) DeepCopyInto(out *GlobalResourcePermitTemplate)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*GlobalResourcePermitTemplate) DeepCopyObject ¶
func (in *GlobalResourcePermitTemplate) DeepCopyObject() pkgruntime.Object
DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (*GlobalResourcePermitTemplate) EvaluateApprovalConditions ¶
func (brt *GlobalResourcePermitTemplate) EvaluateApprovalConditions( ctx context.Context, br *ResourcePermit, ) (bool, error)
EvaluateApprovalConditions evaluates the stored approval conditions against a ResourcePermit and its requestor/reviewer identities. Conditions are ORed.
func (*GlobalResourcePermitTemplate) TemplateData ¶
func (brt *GlobalResourcePermitTemplate) TemplateData() ResourcePermitTemplateData
func (*GlobalResourcePermitTemplate) ValidateApprovalConditions ¶
func (brt *GlobalResourcePermitTemplate) ValidateApprovalConditions() error
ValidateApprovalConditions compiles the template's approval conditions in the Kubernetes CEL environment used for newly submitted expressions.
type GlobalResourcePermitTemplateList ¶
type GlobalResourcePermitTemplateList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []GlobalResourcePermitTemplate `json:"items"`
}
GlobalResourcePermitTemplateList contains a list of GlobalResourcePermitTemplate.
func (*GlobalResourcePermitTemplateList) DeepCopy ¶
func (in *GlobalResourcePermitTemplateList) DeepCopy() *GlobalResourcePermitTemplateList
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GlobalResourcePermitTemplateList.
func (*GlobalResourcePermitTemplateList) DeepCopyInto ¶
func (in *GlobalResourcePermitTemplateList) DeepCopyInto(out *GlobalResourcePermitTemplateList)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*GlobalResourcePermitTemplateList) DeepCopyObject ¶
func (in *GlobalResourcePermitTemplateList) DeepCopyObject() pkgruntime.Object
DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
type GlobalResourcePermitTemplateReference ¶
type GlobalResourcePermitTemplateReference = ResourcePermitTemplateReference
GlobalResourcePermitTemplateReference is retained as a compatibility alias.
type GlobalResourcePermitTemplateSpec ¶
type GlobalResourcePermitTemplateSpec struct {
// Impersonation identifies the required ServiceAccount used for context loading
// and every managed-resource action, including cleanup. Namespaced templates
// use a ServiceAccount in their own namespace; global templates specify both
// name and namespace. There is no default execution identity.
// +kubebuilder:validation:Required
Impersonation *meta.NamespacedRFC1123ObjectReferenceWithNamespace `json:"impersonation"`
// NamespaceSelectors limit the namespaces in which ResourcePermits may reference this template.
// Selectors are ORed. When omitted, the template is available in every namespace.
// +optional
NamespaceSelectors []selectors.NamespaceSelector `json:"namespaceSelectors,omitempty"`
// Resources rendered and managed by this template.
// +kubebuilder:validation:Required
// +kubebuilder:validation:MinItems=1
Resources []apiruntime.ResourceTemplate `json:"resources"`
// ParamSchema is the JSON Schema used to validate template parameters.
// Properties may use the x-capsule-form vendor extension to select values
// from arbitrary Kubernetes GVKs in compatible form clients. The schema may
// use x-kubernetes-validations for Kubernetes-compatible CEL rules.
ParamSchema *k8sruntime.RawExtension `json:"paramSchema,omitempty"`
// Context loads additional Kubernetes resources for use by all resource targets and templates.
// Resource reference fields may use parameters declared by ParamSchema.
// +optional
Context *tpl.TemplateContext `json:"context,omitempty"`
// The default duration of the ResourcePermit referencing this template should be valid for. If not set,
// the resource will be kept until the request is deleted.
DefaultDuration *metav1.Duration `json:"defaultDuration,omitempty"`
// The max allowed duration of the ResourcePermit referencing this template should be valid for.
MaxDuration *metav1.Duration `json:"maxDuration,omitempty"`
// The duration of this ResourcePermit will be kept in the system after it has been expired (eg. auditing purposes)
// If not set, the ResourcePermit will be deleted after expiring.
KeepFor *resourcepermit.ExtendedDuration `json:"keepFor,omitempty"`
// Approvals configures automatic and manual approval of requests using this template.
// +optional
Approvals resourcepermit.ApprovalSpec `json:"approvals,omitempty"`
}
GlobalResourcePermitTemplateSpec defines the desired state of GlobalResourcePermitTemplate.
func (*GlobalResourcePermitTemplateSpec) DeepCopy ¶
func (in *GlobalResourcePermitTemplateSpec) DeepCopy() *GlobalResourcePermitTemplateSpec
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GlobalResourcePermitTemplateSpec.
func (*GlobalResourcePermitTemplateSpec) DeepCopyInto ¶
func (in *GlobalResourcePermitTemplateSpec) DeepCopyInto(out *GlobalResourcePermitTemplateSpec)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type GlobalResourcePermitTemplateStatus ¶
type GlobalResourcePermitTemplateStatus struct {
// ObservedGeneration is the most recent generation resolved by the controller.
// +optional
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
// Namespaces contains the namespaces allowed to reference this template.
// A single "*" entry means that the template is available in every namespace.
// +optional
Namespaces []string `json:"namespaces,omitempty"`
// Conditions contains the reconciliation conditions for this template.
// +optional
Conditions meta.ConditionList `json:"conditions,omitempty"`
}
GlobalResourcePermitTemplateStatus defines the observed state of GlobalResourcePermitTemplate.
func (*GlobalResourcePermitTemplateStatus) DeepCopy ¶
func (in *GlobalResourcePermitTemplateStatus) DeepCopy() *GlobalResourcePermitTemplateStatus
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new GlobalResourcePermitTemplateStatus.
func (*GlobalResourcePermitTemplateStatus) DeepCopyInto ¶
func (in *GlobalResourcePermitTemplateStatus) DeepCopyInto(out *GlobalResourcePermitTemplateStatus)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*GlobalResourcePermitTemplateStatus) NamespacePresent ¶
func (s *GlobalResourcePermitTemplateStatus) NamespacePresent(namespace string) bool
NamespacePresent reports whether the resolved template status includes namespace.
type ResolvedGlobalResourcePermitTemplateReference ¶
type ResolvedGlobalResourcePermitTemplateReference = ResolvedResourcePermitTemplateReference
ResolvedGlobalResourcePermitTemplateReference is retained as a compatibility alias.
type ResolvedResourcePermitTemplateReference ¶
type ResolvedResourcePermitTemplateReference struct {
ResourcePermitTemplateReference `json:",inline"`
// ResourceVersion of the template used to render the request resources.
// +kubebuilder:validation:Required
ResourceVersion string `json:"resourceVersion"`
}
ResolvedResourcePermitTemplateReference identifies the exact template version used to render a ResourcePermit.
func (*ResolvedResourcePermitTemplateReference) DeepCopy ¶
func (in *ResolvedResourcePermitTemplateReference) DeepCopy() *ResolvedResourcePermitTemplateReference
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResolvedResourcePermitTemplateReference.
func (*ResolvedResourcePermitTemplateReference) DeepCopyInto ¶
func (in *ResolvedResourcePermitTemplateReference) DeepCopyInto(out *ResolvedResourcePermitTemplateReference)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type ResourcePermit ¶
type ResourcePermit struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec ResourcePermitSpec `json:"spec,omitempty"`
Status ResourcePermitStatus `json:"status,omitempty"`
}
ResourcePermit is the Schema for the ResourcePermits API.
func (*ResourcePermit) ActivatePermit ¶
func (br *ResourcePermit) ActivatePermit(entity *resourcepermit.AccessEntity) (err error)
ActivatePermit activates the ResourcePermit and materializes its requested resources.
func (*ResourcePermit) ApprovalPolicy ¶
func (br *ResourcePermit) ApprovalPolicy(fallback ResourcePermitTemplateSource) resourcepermit.ApprovalSpec
ApprovalPolicy returns the immutable policy captured with the rendered request. The template is only a compatibility fallback for requests created before approval snapshots were introduced.
func (*ResourcePermit) ApprovePermit ¶
func (br *ResourcePermit) ApprovePermit( entity *resourcepermit.AccessEntity, properties *ResourcePermitStatusRequest, reason string, ) (err error)
ApprovePermit Approves the ResourcePermit. Depending on the start time, it may also directly activate the request.
func (*ResourcePermit) CheckApprovalConditions ¶
func (br *ResourcePermit) CheckApprovalConditions( ctx context.Context, fallback ResourcePermitTemplateSource, ) error
CheckApprovalConditions checks the approval policy captured with the request, falling back to the supplied template for legacy requests.
func (*ResourcePermit) CompleteRetry ¶
func (br *ResourcePermit) CompleteRetry() error
CompleteRetry restores the trusted phase captured when the request failed. An automatically approved preflight retry receives a system review; an activation retry preserves the existing review.
func (*ResourcePermit) DeepCopy ¶
func (in *ResourcePermit) DeepCopy() *ResourcePermit
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourcePermit.
func (*ResourcePermit) DeepCopyInto ¶
func (in *ResourcePermit) DeepCopyInto(out *ResourcePermit)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*ResourcePermit) DeepCopyObject ¶
func (in *ResourcePermit) DeepCopyObject() pkgruntime.Object
DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (*ResourcePermit) DeletePermit ¶
func (br *ResourcePermit) DeletePermit()
DeletePermit Final stage, delete the request.
func (*ResourcePermit) DenyPermit ¶
func (br *ResourcePermit) DenyPermit(entity *resourcepermit.AccessEntity, reason string) (err error)
DenyPermit Denies the ResourcePermit. It may directly transition to the Denied phase or set a reason for denial.
func (*ResourcePermit) EvaluateApprovalConditions ¶
func (br *ResourcePermit) EvaluateApprovalConditions( ctx context.Context, fallback ResourcePermitTemplateSource, ) (bool, error)
EvaluateApprovalConditions evaluates the approval policy captured with the request, falling back to the supplied template for legacy requests.
func (*ResourcePermit) ExpirePermit ¶
func (br *ResourcePermit) ExpirePermit(entity *resourcepermit.AccessEntity) (err error)
ExpirePermit terminates a permit from any lifecycle phase. For active permits, resources are removed or orphaned according to their deletion policy; the permit itself may remain longer for auditing purposes.
func (*ResourcePermit) FailPermit ¶
func (br *ResourcePermit) FailPermit( stage ResourcePermitFailureStage, retryPhase ResourcePermitPhase, reason, message string, ) error
FailPermit records a recoverable controller failure. The rendered snapshot, review, and processed resources remain untouched so Retry can safely resume.
func (*ResourcePermit) GenerateRequestStatus ¶
func (br *ResourcePermit) GenerateRequestStatus( templates ...ResourcePermitTemplateSource, ) (*ResourcePermitStatusRequest, error)
GenerateRequestStatus returns the effective lifecycle properties for a review. Passing the referenced template resolves its lifecycle defaults for display and review. Already rendered resources are retained in the returned request snapshot.
func (*ResourcePermit) LatestTransition ¶
func (br *ResourcePermit) LatestTransition(phase ResourcePermitPhase) *ResourcePermitTransition
LatestTransition returns the newest audit entry for the given lifecycle type.
func (*ResourcePermit) LoadTemplateContext ¶
func (br *ResourcePermit) LoadTemplateContext( ctx context.Context, c client.Client, mapper k8smeta.RESTMapper, schema *k8sruntime.RawExtension, templateContext *template.TemplateContext, ) (template.ReferenceContext, error)
LoadTemplateContext loads external resources declared by the referenced GlobalResourcePermitTemplate. Request parameters are available while resolving resource names, namespaces, and selectors.
func (*ResourcePermit) RenderResources ¶
func (br *ResourcePermit) RenderResources( schema *k8sruntime.RawExtension, resources []apiruntime.ResourceTemplate, contexts ...template.ReferenceContext, ) ([]apiruntime.RenderedResource, error)
RenderResources renders direct targets with the flat parameter/context values and expands optional multi-document templates with the structured .params and .context.resources values. Both forms expose trusted request metadata under .request.
func (*ResourcePermit) ResolvePermitStatus ¶
func (br *ResourcePermit) ResolvePermitStatus(brt ResourcePermitTemplateSource) error
ResolvePermitStatus fills template defaults omitted by a reviewer and validates the effective duration before activation.
func (*ResourcePermit) RetryPermit ¶
func (br *ResourcePermit) RetryPermit(entity *resourcepermit.AccessEntity) error
RetryPermit requests one controller-owned recovery attempt. Admission reconstructs this transition from the persisted failure status.
func (*ResourcePermit) SetCreated ¶
func (br *ResourcePermit) SetCreated(entity *resourcepermit.AccessEntity) error
SetCreated records the initial lifecycle state using the API server's object creation time and attributes it to the authenticated requestor.
func (*ResourcePermit) SetPending ¶
func (br *ResourcePermit) SetPending() (err error)
SetPending Sets Requests to pending.
func (*ResourcePermit) SetReady ¶
func (br *ResourcePermit) SetReady(status metav1.ConditionStatus, reason, message string)
SetReady records whether the rendered resources and their reconciliation are ready. Phase conditions are kept alongside this condition for lifecycle history.
func (*ResourcePermit) SetRequested ¶
func (br *ResourcePermit) SetRequested() error
SetRequested sets the ResourcePermit phase to Requested (pending review).
func (*ResourcePermit) SetRequestedBy ¶
func (br *ResourcePermit) SetRequestedBy(entity *resourcepermit.AccessEntity) error
SetRequestedBy sets the ResourcePermit phase to Requested and attributes the initial lifecycle transition to the authenticated requestor.
func (*ResourcePermit) ValidateParameters ¶
func (br *ResourcePermit) ValidateParameters(schema *k8sruntime.RawExtension) error
ValidateParameters validates the request parameters against the template's parameter schema without loading context or rendering resources.
type ResourcePermitFailure ¶
type ResourcePermitFailure struct {
// Stage identifies whether the failure happened before review or while
// activating an already approved request.
// +kubebuilder:validation:Enum=Preflight;Activation
Stage ResourcePermitFailureStage `json:"stage"`
// RetryPhase is the phase Capsule resumes after recovery succeeds.
// +kubebuilder:validation:Enum=Requested;Approved
RetryPhase ResourcePermitPhase `json:"retryPhase"`
// Reason is the stable machine-readable Ready condition reason.
Reason string `json:"reason"`
// Message contains the latest actionable failure returned by Kubernetes.
Message string `json:"message"`
}
ResourcePermitFailure records how a failed request can be retried while the Ready condition carries the detailed reason and message.
func (*ResourcePermitFailure) DeepCopy ¶
func (in *ResourcePermitFailure) DeepCopy() *ResourcePermitFailure
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourcePermitFailure.
func (*ResourcePermitFailure) DeepCopyInto ¶
func (in *ResourcePermitFailure) DeepCopyInto(out *ResourcePermitFailure)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type ResourcePermitFailureStage ¶
type ResourcePermitFailureStage string
const ( ResourcePermitFailureStagePreflight ResourcePermitFailureStage = "Preflight" ResourcePermitFailureStageActivation ResourcePermitFailureStage = "Activation" )
type ResourcePermitList ¶
type ResourcePermitList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []ResourcePermit `json:"items"`
}
ResourcePermitList contains a list of ResourcePermit.
func (*ResourcePermitList) DeepCopy ¶
func (in *ResourcePermitList) DeepCopy() *ResourcePermitList
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourcePermitList.
func (*ResourcePermitList) DeepCopyInto ¶
func (in *ResourcePermitList) DeepCopyInto(out *ResourcePermitList)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*ResourcePermitList) DeepCopyObject ¶
func (in *ResourcePermitList) DeepCopyObject() pkgruntime.Object
DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
type ResourcePermitPhase ¶
type ResourcePermitPhase string
const ( ResourcePermitPhaseCreated ResourcePermitPhase = "Created" ResourcePermitPhaseRequested ResourcePermitPhase = "Requested" ResourcePermitPhasePending ResourcePermitPhase = "Pending" ResourcePermitPhaseDenied ResourcePermitPhase = "Denied" ResourcePermitPhaseApproved ResourcePermitPhase = "Approved" ResourcePermitPhaseActive ResourcePermitPhase = "Active" ResourcePermitPhaseFailed ResourcePermitPhase = "Failed" ResourcePermitPhaseRetrying ResourcePermitPhase = "Retrying" ResourcePermitPhaseExpired ResourcePermitPhase = "Expired" )
type ResourcePermitSpec ¶
type ResourcePermitSpec struct {
// Template references the template to use for this request.
// +kubebuilder:validation:Required
Template ResourcePermitTemplateReference `json:"template"`
// Params the parameters to use for the template.
Params *k8sruntime.RawExtension `json:"params,omitempty"`
// Requesting actor for the resource permit.
Requestor resourcepermit.AccessEntity `json:"requestor,omitempty"`
// A reason on why the request is needed
Reason string `json:"reason,omitempty"`
// The duration of this ResourcePermit should be valid for.
// If no duration was defined, the lifecycle is bound to the request itself -
// if the request is deleted, it's the end of the duration.
// The Request can also be Terminated by another automation via calling the ExpirePermit() API-Function.
Duration *metav1.Duration `json:"duration,omitempty"`
// Optional point in time when the permit should become active. Must be in the future.
// If omitted, this is set to the current time. The Request must already be approved before the start time.
// +optional
// +kubebuilder:validation:Format=date-time
// +kubebuilder:validation:Type=string
StartTime *metav1.Time `json:"startTime,omitempty"`
}
ResourcePermitSpec defines the desired state of ResourcePermit.
func (*ResourcePermitSpec) DeepCopy ¶
func (in *ResourcePermitSpec) DeepCopy() *ResourcePermitSpec
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourcePermitSpec.
func (*ResourcePermitSpec) DeepCopyInto ¶
func (in *ResourcePermitSpec) DeepCopyInto(out *ResourcePermitSpec)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type ResourcePermitStatus ¶
type ResourcePermitStatus struct {
meta.ManagedResourcesStatus `json:",inline"`
// Request contains the resolved template, execution identity, lifecycle
// properties, and rendered resources presented for review.
// +optional
Request *ResourcePermitStatusRequest `json:"request,omitempty"`
// Review refers to the subject that either approved or denied the request
Review *ReviewInfo `json:"review,omitempty"`
// Failure describes a recoverable preflight or activation failure. RetryPhase
// is the trusted lifecycle phase Capsule resumes after a successful retry.
// +optional
Failure *ResourcePermitFailure `json:"failure,omitempty"`
// Shows timestamps between approval and termination of the request.
Active *ActivePeriod `json:"active,omitempty"`
// The time until which the ResourcePermit should be retained after it expires (e.g. for auditing).
// If unset, the ResourcePermit can be deleted immediately after expiring.
KeepUntil *metav1.Time `json:"keepUntil,omitempty"`
// Transitions is the chronological, append-only audit trail of lifecycle
// changes. Conditions remain reserved for operational state such as Ready.
// +optional
Transitions []ResourcePermitTransition `json:"transitions,omitempty"`
// Conditions describes current operational state such as readiness.
Conditions []metav1.Condition `json:"conditions,omitempty"`
// +kubebuilder:validation:Enum=Created;Requested;Pending;Denied;Approved;Active;Failed;Retrying;Expired
Phase ResourcePermitPhase `json:"phase,omitempty"`
}
ResourcePermitStatus defines the observed state of ResourcePermit.
func (*ResourcePermitStatus) DeepCopy ¶
func (in *ResourcePermitStatus) DeepCopy() *ResourcePermitStatus
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourcePermitStatus.
func (*ResourcePermitStatus) DeepCopyInto ¶
func (in *ResourcePermitStatus) DeepCopyInto(out *ResourcePermitStatus)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type ResourcePermitStatusRequest ¶
type ResourcePermitStatusRequest struct {
// Template identifies the exact template version used to render the request.
// +optional
Template *ResolvedResourcePermitTemplateReference `json:"template,omitempty"`
// Impersonation is the resolved identity used for template context loading
// and managed-resource actions. It is copied from the template before preflight
// and retained for the request's lifecycle, including cleanup.
// +optional
Impersonation *meta.NamespacedRFC1123ObjectReferenceWithNamespace `json:"impersonation,omitempty"`
// Approvals is the approval policy copied from the resolved template. It is
// immutable after rendering so an in-flight request is reviewed against the
// policy presented with its resource snapshot.
// +optional
Approvals *resourcepermit.ApprovalSpec `json:"approvals,omitempty"`
KeepFor *resourcepermit.ExtendedDuration `json:"keepFor,omitempty"`
Duration *metav1.Duration `json:"duration,omitempty"`
StartTime *metav1.Time `json:"startTime,omitempty"`
// Resources contains the fully rendered manifests prepared for this request.
// These resources are the source of truth for server-side apply and pruning;
// source templates and rendering context are never copied into the request.
Resources []apiruntime.RenderedResource `json:"resources,omitempty"`
}
ResourcePermitStatusRequest is the controller-resolved request presented for review and used as the source of truth for application and pruning.
func (*ResourcePermitStatusRequest) DeepCopy ¶
func (in *ResourcePermitStatusRequest) DeepCopy() *ResourcePermitStatusRequest
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourcePermitStatusRequest.
func (*ResourcePermitStatusRequest) DeepCopyInto ¶
func (in *ResourcePermitStatusRequest) DeepCopyInto(out *ResourcePermitStatusRequest)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type ResourcePermitTemplate ¶
type ResourcePermitTemplate struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec ResourcePermitTemplateSpec `json:"spec"`
Status ResourcePermitTemplateStatus `json:"status,omitempty"`
}
ResourcePermitTemplate is the Schema for namespaced ResourcePermit templates.
func (*ResourcePermitTemplate) CheckApprovalConditions ¶
func (brt *ResourcePermitTemplate) CheckApprovalConditions(ctx context.Context, br *ResourcePermit) error
CheckApprovalConditions checks a namespaced template's approval gate.
func (*ResourcePermitTemplate) DeepCopy ¶
func (in *ResourcePermitTemplate) DeepCopy() *ResourcePermitTemplate
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourcePermitTemplate.
func (*ResourcePermitTemplate) DeepCopyInto ¶
func (in *ResourcePermitTemplate) DeepCopyInto(out *ResourcePermitTemplate)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*ResourcePermitTemplate) DeepCopyObject ¶
func (in *ResourcePermitTemplate) DeepCopyObject() pkgruntime.Object
DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (*ResourcePermitTemplate) EvaluateApprovalConditions ¶
func (brt *ResourcePermitTemplate) EvaluateApprovalConditions( ctx context.Context, br *ResourcePermit, ) (bool, error)
EvaluateApprovalConditions evaluates a namespaced template's approval conditions.
func (*ResourcePermitTemplate) TemplateData ¶
func (brt *ResourcePermitTemplate) TemplateData() ResourcePermitTemplateData
func (*ResourcePermitTemplate) ValidateApprovalConditions ¶
func (brt *ResourcePermitTemplate) ValidateApprovalConditions() error
ValidateApprovalConditions compiles a namespaced template's approval conditions.
type ResourcePermitTemplateData ¶
type ResourcePermitTemplateData struct {
Resources []apiruntime.ResourceTemplate
ParamSchema *k8sruntime.RawExtension
Context *tpl.TemplateContext
DefaultDuration *metav1.Duration
MaxDuration *metav1.Duration
KeepFor *resourcepermit.ExtendedDuration
Approvals resourcepermit.ApprovalSpec
}
ResourcePermitTemplateData is the common configuration exposed by namespaced and global ResourcePermit templates. +kubebuilder:object:generate=false
type ResourcePermitTemplateList ¶
type ResourcePermitTemplateList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []ResourcePermitTemplate `json:"items"`
}
ResourcePermitTemplateList contains a list of ResourcePermitTemplate.
func (*ResourcePermitTemplateList) DeepCopy ¶
func (in *ResourcePermitTemplateList) DeepCopy() *ResourcePermitTemplateList
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourcePermitTemplateList.
func (*ResourcePermitTemplateList) DeepCopyInto ¶
func (in *ResourcePermitTemplateList) DeepCopyInto(out *ResourcePermitTemplateList)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (*ResourcePermitTemplateList) DeepCopyObject ¶
func (in *ResourcePermitTemplateList) DeepCopyObject() pkgruntime.Object
DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
type ResourcePermitTemplateReference ¶
type ResourcePermitTemplateReference struct {
// Kind of template being referenced.
// +kubebuilder:validation:Required
// +kubebuilder:validation:Enum=ResourcePermitTemplate;GlobalResourcePermitTemplate
Kind string `json:"kind"`
// Name of the template being referenced.
// +kubebuilder:validation:Required
// +kubebuilder:validation:MinLength=1
// +kubebuilder:validation:MaxLength=253
// +kubebuilder:validation:Pattern=`^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$`
Name string `json:"name"`
}
ResourcePermitTemplateReference identifies the namespaced or global template used by a ResourcePermit.
func (*ResourcePermitTemplateReference) DeepCopy ¶
func (in *ResourcePermitTemplateReference) DeepCopy() *ResourcePermitTemplateReference
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourcePermitTemplateReference.
func (*ResourcePermitTemplateReference) DeepCopyInto ¶
func (in *ResourcePermitTemplateReference) DeepCopyInto(out *ResourcePermitTemplateReference)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type ResourcePermitTemplateSource ¶
type ResourcePermitTemplateSource interface {
metav1.Object
TemplateData() ResourcePermitTemplateData
ValidateApprovalConditions() error
EvaluateApprovalConditions(ctx context.Context, br *ResourcePermit) (bool, error)
CheckApprovalConditions(ctx context.Context, br *ResourcePermit) error
}
ResourcePermitTemplateSource is implemented by both supported template kinds. It lets ResourcePermit lifecycle code treat their shared behavior uniformly. +kubebuilder:object:generate=false
type ResourcePermitTemplateSpec ¶
type ResourcePermitTemplateSpec struct {
// Impersonation identifies the required ServiceAccount used for context loading
// and every managed-resource action, including cleanup. Namespaced templates
// use a ServiceAccount in their own namespace; global templates specify both
// name and namespace. There is no default execution identity.
// +kubebuilder:validation:Required
Impersonation *meta.LocalRFC1123ObjectReference `json:"impersonation"`
// Resources rendered and managed by this template.
// +kubebuilder:validation:Required
// +kubebuilder:validation:MinItems=1
Resources []apiruntime.ResourceTemplate `json:"resources"`
// ParamSchema is the JSON Schema used to validate template parameters.
// Properties may use the x-capsule-form vendor extension to select values
// from arbitrary Kubernetes GVKs in compatible form clients. The schema may
// use x-kubernetes-validations for Kubernetes-compatible CEL rules.
ParamSchema *k8sruntime.RawExtension `json:"paramSchema,omitempty"`
// Context loads additional Kubernetes resources for use by all resource targets and templates.
// Resource reference fields may use parameters declared by ParamSchema.
// +optional
Context *tpl.TemplateContext `json:"context,omitempty"`
// The default duration of a ResourcePermit referencing this template.
DefaultDuration *metav1.Duration `json:"defaultDuration,omitempty"`
// The maximum allowed duration of a ResourcePermit referencing this template.
MaxDuration *metav1.Duration `json:"maxDuration,omitempty"`
// The duration a ResourcePermit is retained after it expires for auditing.
KeepFor *resourcepermit.ExtendedDuration `json:"keepFor,omitempty"`
// Approvals configures automatic and manual approval of requests using this template.
// +optional
Approvals resourcepermit.ApprovalSpec `json:"approvals,omitempty"`
}
ResourcePermitTemplateSpec defines the desired state of a namespaced ResourcePermitTemplate.
func (*ResourcePermitTemplateSpec) DeepCopy ¶
func (in *ResourcePermitTemplateSpec) DeepCopy() *ResourcePermitTemplateSpec
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourcePermitTemplateSpec.
func (*ResourcePermitTemplateSpec) DeepCopyInto ¶
func (in *ResourcePermitTemplateSpec) DeepCopyInto(out *ResourcePermitTemplateSpec)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type ResourcePermitTemplateStatus ¶
type ResourcePermitTemplateStatus struct {
// ObservedGeneration is the most recent generation resolved by the controller.
// +optional
ObservedGeneration int64 `json:"observedGeneration,omitempty"`
// Conditions contains the reconciliation conditions for this template.
// +optional
Conditions meta.ConditionList `json:"conditions,omitempty"`
}
ResourcePermitTemplateStatus defines the observed state of ResourcePermitTemplate.
func (*ResourcePermitTemplateStatus) DeepCopy ¶
func (in *ResourcePermitTemplateStatus) DeepCopy() *ResourcePermitTemplateStatus
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourcePermitTemplateStatus.
func (*ResourcePermitTemplateStatus) DeepCopyInto ¶
func (in *ResourcePermitTemplateStatus) DeepCopyInto(out *ResourcePermitTemplateStatus)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type ResourcePermitTransition ¶
type ResourcePermitTransition struct {
// Type identifies the lifecycle state entered by this transition. The
// previous state can be derived from the preceding chronological entry.
// +kubebuilder:validation:Required
// +kubebuilder:validation:Enum=Created;Requested;Pending;Denied;Approved;Active;Failed;Retrying;Expired
Type ResourcePermitPhase `json:"type"`
// Timestamp is when the transition was requested or performed.
// +kubebuilder:validation:Required
Timestamp metav1.Time `json:"timestamp"`
// Actor is the authenticated user, ServiceAccount, or Capsule system actor
// responsible for the transition. Group claims are deliberately not copied
// into the audit trail.
// +kubebuilder:validation:Required
Actor ResourcePermitTransitionActor `json:"actor"`
// Reason is a stable machine-readable explanation of the transition.
// +kubebuilder:validation:Required
Reason string `json:"reason"`
// Message is the human-readable explanation of the transition.
// +optional
Message string `json:"message,omitempty"`
// EventTime is set after Capsule emits the Kubernetes lifecycle event for
// this transition.
// +optional
EventTime *metav1.Time `json:"eventTime,omitempty"`
}
ResourcePermitTransition records one authenticated lifecycle transition.
func (*ResourcePermitTransition) DeepCopy ¶
func (in *ResourcePermitTransition) DeepCopy() *ResourcePermitTransition
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourcePermitTransition.
func (*ResourcePermitTransition) DeepCopyInto ¶
func (in *ResourcePermitTransition) DeepCopyInto(out *ResourcePermitTransition)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type ResourcePermitTransitionActor ¶
type ResourcePermitTransitionActor struct {
// Name is the authenticated actor name.
// +kubebuilder:validation:Required
Name string `json:"name"`
// Type identifies the kind of authenticated actor.
// +kubebuilder:validation:Required
// +kubebuilder:validation:Enum=User;Group;System;ServiceAccount
Type resourcepermit.AccessEntityType `json:"type"`
}
ResourcePermitTransitionActor is the compact identity recorded for a lifecycle transition. Authorization group claims remain available on the request and are not duplicated in each audit entry.
func (*ResourcePermitTransitionActor) DeepCopy ¶
func (in *ResourcePermitTransitionActor) DeepCopy() *ResourcePermitTransitionActor
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourcePermitTransitionActor.
func (*ResourcePermitTransitionActor) DeepCopyInto ¶
func (in *ResourcePermitTransitionActor) DeepCopyInto(out *ResourcePermitTransitionActor)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
type ResourcePermitVerdict ¶
type ResourcePermitVerdict string
const ( ResourcePermitVerdictDenied ResourcePermitVerdict = "Denied" ResourcePermitVerdictApproved ResourcePermitVerdict = "Approved" ResourcePermitVerdictPending ResourcePermitVerdict = "Pending" )
type ReviewInfo ¶
type ReviewInfo struct {
// The Entity reviewing this request
Reviewer *resourcepermit.AccessEntity `json:"reviewer,omitempty"`
// The verdict made by the reviewing entity
// +kubebuilder:validation:Enum=Pending;Denied;Approved
Verdict ResourcePermitVerdict `json:"verdict,omitempty"`
// Message with the review
Message string `json:"message,omitempty"`
}
ReviewInfo contains information about the review of a request.
func (*ReviewInfo) DeepCopy ¶
func (in *ReviewInfo) DeepCopy() *ReviewInfo
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ReviewInfo.
func (*ReviewInfo) DeepCopyInto ¶
func (in *ReviewInfo) DeepCopyInto(out *ReviewInfo)
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.