rules

package
v0.14.3 Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MetadataKeyExpression added in v0.13.10

func MetadataKeyExpression(selector string) runtime.ExpressionRegex

MetadataKeyExpression converts a metadata key selector into the regular expression used by admission validation and runtime matching. Asterisks are convenient wildcards, while the rest of the selector retains regexp syntax.

Types

type ActionType

type ActionType string

+kubebuilder:validation:Enum=allow;deny;audit

const (
	ActionTypeAllow ActionType = "allow"
	ActionTypeDeny  ActionType = "deny"
	ActionTypeAudit ActionType = "audit"
)

func (ActionType) OrDefault

func (a ActionType) OrDefault() ActionType

type Audience added in v0.13.10

type Audience struct {
	// +kubebuilder:validation:Enum=User;Group;ServiceAccount;Custom
	Kind AudienceKind `json:"kind"`
	Name string       `json:"name"`
}

+kubebuilder:object:generate=true

func (*Audience) DeepCopy added in v0.13.10

func (in *Audience) DeepCopy() *Audience

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Audience.

func (*Audience) DeepCopyInto added in v0.13.10

func (in *Audience) DeepCopyInto(out *Audience)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type AudienceKind added in v0.13.10

type AudienceKind string
const (
	AudienceKindUser           AudienceKind = "User"
	AudienceKindGroup          AudienceKind = "Group"
	AudienceKindServiceAccount AudienceKind = "ServiceAccount"
	AudienceKindCustom         AudienceKind = "Custom"
)

type CustomAudience added in v0.13.10

type CustomAudience string
const (
	CustomAudienceCapsuleUser   CustomAudience = "CapsuleUser"
	CustomAudienceAdministrator CustomAudience = "Administrator"
	CustomAudienceTenantOwner   CustomAudience = "TenantOwner"
	CustomAudienceController    CustomAudience = "Controller"
)

type ImagePullPolicySpec

type ImagePullPolicySpec string

+kubebuilder:validation:Enum=Always;Never;IfNotPresent

func (ImagePullPolicySpec) String

func (i ImagePullPolicySpec) String() string

type IngressType added in v0.13.10

type IngressType string

+kubebuilder:validation:Enum=Ingress;Route;ListenerSet;HTTPRoute;Gateway;TLSRoute;GRPCRoute

const (
	IngressTypeIngress     IngressType = "Ingress"
	IngressTypeRoute       IngressType = "Route"
	IngressTypeListenerSet IngressType = "ListenerSet"
	IngressTypeHTTPRoute   IngressType = "HTTPRoute"
	IngressTypeGateway     IngressType = "Gateway"
	IngressTypeTLSRoute    IngressType = "TLSRoute"
	IngressTypeGRPCRoute   IngressType = "GRPCRoute"
)

type MetadataRule added in v0.13.8

type MetadataRule struct {
	runtime.VersionKinds `json:",inline"`

	// Labels defines metadata policies by label key.
	//
	// +optional
	Labels map[string]MetadataValueRule `json:"labels,omitempty"`

	// Annotations defines metadata policies by annotation key.
	//
	// +optional
	Annotations map[string]MetadataValueRule `json:"annotations,omitempty"`
}

MetadataRule defines metadata constraints for namespaced resources.

+kubebuilder:object:generate=true +kubebuilder:validation:XValidation:rule="has(self.labels) || has(self.annotations)",message="at least one of labels or annotations must be set"

func (*MetadataRule) DeepCopy added in v0.13.8

func (in *MetadataRule) DeepCopy() *MetadataRule

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MetadataRule.

func (*MetadataRule) DeepCopyInto added in v0.13.8

func (in *MetadataRule) DeepCopyInto(out *MetadataRule)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (MetadataRule) MatchesGroupVersionKind added in v0.13.10

func (r MetadataRule) MatchesGroupVersionKind(gvk schema.GroupVersionKind) bool

MatchesGroupVersionKind matches metadata targets. Namespace is deliberately opt-in: wildcard kind selectors never include it, so cluster-scoped namespace admission cannot be enabled accidentally.

type MetadataValueRule added in v0.13.8

type MetadataValueRule struct {
	// Required enforces that the metadata key must be present.
	//
	// This is mainly meaningful with action=allow. Deny and audit rules remain
	// value matchers and do not require missing metadata to exist.
	//
	// +optional
	// +kubebuilder:default:=false
	Required bool `json:"required,omitempty"`

	// Values defines allowed, denied, or audited values for the metadata key.
	//
	// If Required=true and Values is empty, only presence is enforced.
	//
	// +optional
	Values []runtime.ExpressionMatch `json:"values,omitempty"`

	// Default is applied by admission mutation when the concrete metadata key is absent.
	// It is not reconciled after admission.
	// +optional
	Default *string `json:"default,omitempty"`

	// Managed is enforced by admission mutation and reconciled by the RuleStatus
	// controller using server-side apply when the rule configuration changes.
	// +optional
	Managed *string `json:"managed,omitempty"`
}

+kubebuilder:object:generate=true

func (*MetadataValueRule) DeepCopy added in v0.13.8

func (in *MetadataValueRule) DeepCopy() *MetadataValueRule

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MetadataValueRule.

func (*MetadataValueRule) DeepCopyInto added in v0.13.8

func (in *MetadataValueRule) DeepCopyInto(out *MetadataValueRule)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type NamespaceRuleBodyNamespace

type NamespaceRuleBodyNamespace struct {
	// Audience limits this rule to matching request subjects.
	// An empty audience matches every request.
	// +optional
	Audience []Audience `json:"audience,omitempty"`

	// Quota contains native Kubernetes ResourceQuota specifications shared by
	// all namespaces selected by this rule. Unlike Enforce, quota accounting is
	// independent of the request audience.
	// +optional
	// +listType=map
	// +listMapKey=name
	Quota []ResourceQuotaRule `json:"quota,omitempty"`

	// Enforcement for given rule
	//+optional
	Enforce *NamespaceRuleEnforceBody `json:"enforce,omitzero"`
}

For future implementation where users might manage RuleStatus CRs themselves +kubebuilder:object:generate=true

func (*NamespaceRuleBodyNamespace) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NamespaceRuleBodyNamespace.

func (*NamespaceRuleBodyNamespace) DeepCopyInto

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type NamespaceRuleBodyTenant

type NamespaceRuleBodyTenant struct {
	*NamespaceRuleBodyNamespace `json:",inline"`

	// Select namespaces which are going to be targeted with this rule
	NamespaceSelector *metav1.LabelSelector `json:"namespaceSelector,omitempty"`

	// Permissions for given rule
	//+optional
	Permissions NamespaceRulePermissionBody `json:"permissions,omitempty"`
}

Rules Distributed via Tenants +kubebuilder:object:generate=true

func (*NamespaceRuleBodyTenant) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NamespaceRuleBodyTenant.

func (*NamespaceRuleBodyTenant) DeepCopyInto

func (in *NamespaceRuleBodyTenant) DeepCopyInto(out *NamespaceRuleBodyTenant)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type NamespaceRuleEnforceBody

type NamespaceRuleEnforceBody struct {
	// Declare the action being performed on the enforcement rule:
	// deny: On match, deny admission request
	// allow: On match, allowed admission request
	// audit: On match, audit (post event) of admission request
	//+kubebuilder:default:=deny
	Action ActionType `json:"action,omitempty"`

	// Enforcement for Workloads (Pods)
	Workloads NamespaceRuleEnforceWorkloadsBody `json:"workloads,omitempty"`

	// Enforcement for Services.
	// +optional
	Services NamespaceRuleEnforceServicesBody `json:"services,omitempty"`

	// Enforcement for object metadata on namespaced resources.
	//
	// +optional
	Metadata []MetadataRule `json:"metadata,omitempty"`

	// Enforcement for Ingress and Gateway API resource hostnames.
	// +optional
	Ingress NamespaceRuleEnforceIngressBody `json:"ingress,omitempty"`
}

+kubebuilder:object:generate=true

func (*NamespaceRuleEnforceBody) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NamespaceRuleEnforceBody.

func (*NamespaceRuleEnforceBody) DeepCopyInto

func (in *NamespaceRuleEnforceBody) DeepCopyInto(out *NamespaceRuleEnforceBody)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (NamespaceRuleEnforceBody) GetWorkloadTargets

func (e NamespaceRuleEnforceBody) GetWorkloadTargets(target WorkloadValidationTarget) bool

func (NamespaceRuleEnforceBody) WorkloadTargetsAny

func (e NamespaceRuleEnforceBody) WorkloadTargetsAny(targets ...WorkloadValidationTarget) bool

type NamespaceRuleEnforceIngressBody added in v0.13.10

type NamespaceRuleEnforceIngressBody struct {
	// Types defines the resource kinds to which hostname enforcement applies.
	//
	// +kubebuilder:validation:MinItems=1
	Types []IngressType `json:"types,omitempty"`

	// Hostnames defines allowed, denied, or audited hostname expressions.
	// A resource targeted by an allow or deny rule must declare non-empty values
	// in all hostname fields. Audit-only rules record missing hostnames without
	// denying them.
	//
	// +kubebuilder:validation:MinItems=1
	Hostnames []runtime.ExpressionMatch `json:"hostnames,omitempty"`
}

NamespaceRuleEnforceIngressBody defines hostname enforcement for Kubernetes Ingress and Gateway API resources.

+kubebuilder:object:generate=true

func (*NamespaceRuleEnforceIngressBody) DeepCopy added in v0.13.10

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NamespaceRuleEnforceIngressBody.

func (*NamespaceRuleEnforceIngressBody) DeepCopyInto added in v0.13.10

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type NamespaceRuleEnforceServicesBody added in v0.13.7

type NamespaceRuleEnforceServicesBody struct {
	// Types defines the Service types matched by this rule.
	//
	// Supported values:
	// - ClusterIP
	// - NodePort
	// - LoadBalancer
	// - ExternalName
	//
	// +optional
	// +kubebuilder:validation:items:Enum=ClusterIP;NodePort;LoadBalancer;ExternalName
	Types []ServiceType `json:"types,omitempty"`

	// LoadBalancers defines additional constraints for Services of type LoadBalancer.
	// +optional
	LoadBalancers *ServiceLoadBalancerRule `json:"loadBalancers,omitempty"`

	// ExternalIPs defines constraints for spec.externalIPs.
	// +optional
	ExternalIPs *ServiceExternalIPRule `json:"externalIPs,omitempty"`

	// ExternalNames defines additional constraints for Services of type ExternalName.
	// +optional
	ExternalNames *ServiceExternalNameRule `json:"externalNames,omitempty"`

	// NodePorts defines additional constraints for nodePort values.
	// +optional
	NodePorts *ServiceNodePortRule `json:"nodePorts,omitempty"`
}

+kubebuilder:object:generate=true

func (*NamespaceRuleEnforceServicesBody) DeepCopy added in v0.13.7

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NamespaceRuleEnforceServicesBody.

func (*NamespaceRuleEnforceServicesBody) DeepCopyInto added in v0.13.7

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type NamespaceRuleEnforceWorkloadsBody

type NamespaceRuleEnforceWorkloadsBody struct {
	// Define the enforcement targets this rule applies to.
	// If empty, each webhook applies its own backwards-compatible default.
	// +optional
	Targets []WorkloadValidationTarget `json:"targets,omitempty"`

	// Resources defines mutation and enforcement policies for Pod and container
	// resource requests and limits. The workload targets select where the
	// policies apply. With no targets, resource policies apply to all compatible
	// locations: Pod-level resources, regular containers, and init containers.
	// Resource names unsupported at Pod level still apply to compatible container
	// locations.
	// Mutation is applied when a Pod is created. Remove and MatchRequest manage
	// explicit values, Default fills an absent value, and Ratio fills an absent
	// limit from its request. An explicit Ratio violation is then handled by the
	// enclosing allow, deny, or audit action.
	//
	// +optional
	Resources *WorkloadResourceRules `json:"resources,omitempty"`

	// Define Pod QoS classes matched by this enforcement rule.
	// Supported values are Guaranteed, Burstable and BestEffort.
	// +optional
	QoSClasses []corev1.PodQOSClass `json:"qosClasses,omitempty"`

	// Define registries which are allowed to be used within this tenant
	// The rules are aggregated, since you can use Regular Expressions the match registry endpoints
	// +optional
	Registries []OCIRegistry `json:"registries,omitempty"`

	// Schedulers defines schedulerName matchers for Pod admission.
	//
	// The rule is evaluated against pod.spec.schedulerName.
	// Empty schedulerName is ignored and is not normalized to default-scheduler.
	//
	// +optional
	Schedulers []runtime.ExpressionMatch `json:"schedulers,omitempty"`
}

+kubebuilder:object:generate=true

func (*NamespaceRuleEnforceWorkloadsBody) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NamespaceRuleEnforceWorkloadsBody.

func (*NamespaceRuleEnforceWorkloadsBody) DeepCopyInto

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type NamespaceRulePermissionBody

type NamespaceRulePermissionBody struct {
	// Bindings defines additional RoleBindings for namespaces selected by this rule.
	Bindings []rbac.AdditionalRoleBindingsSpec `json:"bindings,omitempty"`

	// Define Promotion Rules which distributed additional ClusterRoles across the Tenant
	// for promoted ServiceAccounts.
	Promotions []*NamespaceRulePromotionRule `json:"promotions,omitempty"`
}

+kubebuilder:object:generate=true

func (*NamespaceRulePermissionBody) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NamespaceRulePermissionBody.

func (*NamespaceRulePermissionBody) DeepCopyInto

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type NamespaceRulePromotionRule

type NamespaceRulePromotionRule struct {
	// ClusterRoles granted to the promoted ServiceAccounts across the Tenant
	// kubebuilder:validation:Minimum=1
	ClusterRoles []string `json:"clusterRoles,omitempty"`

	// Match ServiceAccounts which are promoted which are granted these additional ClusterRoles
	// across the Tenant
	Selector *metav1.LabelSelector `json:"selector,omitempty"`
}

+kubebuilder:object:generate=true

func (*NamespaceRulePromotionRule) DeepCopy

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NamespaceRulePromotionRule.

func (*NamespaceRulePromotionRule) DeepCopyInto

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type OCIRegistry

type OCIRegistry struct {
	runtime.ExpressionMatch `json:",inline"`

	// Allowed PullPolicy for the given registry. Supplying no value allows all policies.
	// +optional
	// +kubebuilder:validation:Items:Enum=Always;Never;IfNotPresent
	Policy []corev1.PullPolicy `json:"policy,omitempty"`
}

+kubebuilder:object:generate=true

func (*OCIRegistry) DeepCopy

func (in *OCIRegistry) DeepCopy() *OCIRegistry

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new OCIRegistry.

func (*OCIRegistry) DeepCopyInto

func (in *OCIRegistry) DeepCopyInto(out *OCIRegistry)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ResourceQuotaRule added in v0.14.0

type ResourceQuotaRule struct {
	corev1.ResourceQuotaSpec `json:",inline"`

	// Name is the stable identity of this quota within the Tenant. Changing the
	// name replaces the generated GlobalResourceQuota; changing the quota or its
	// namespace selector updates the existing object.
	// +kubebuilder:validation:MinLength=1
	// +kubebuilder:validation:MaxLength=63
	// +kubebuilder:validation:Pattern=`^[a-z0-9]([-a-z0-9]*[a-z0-9])?$`
	Name string `json:"name"`
}

ResourceQuotaRule defines a named ResourceQuota specification generated by a Tenant rule. Name is the durable identity of the generated GlobalResourceQuota and must be unique across all rules of a Tenant. +kubebuilder:object:generate=true

func (*ResourceQuotaRule) DeepCopy added in v0.14.0

func (in *ResourceQuotaRule) DeepCopy() *ResourceQuotaRule

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceQuotaRule.

func (*ResourceQuotaRule) DeepCopyInto added in v0.14.0

func (in *ResourceQuotaRule) DeepCopyInto(out *ResourceQuotaRule)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type RuleDecision

type RuleDecision struct {
	Action ActionType
	Rule   *NamespaceRuleBodyNamespace
}

type ServiceExternalIPRule added in v0.14.1

type ServiceExternalIPRule struct {
	// CIDRs restricts spec.externalIPs. Individual IP addresses are treated as
	// host CIDRs (/32 for IPv4 and /128 for IPv6).
	// For deny rules, empty means all external IPs are denied. For allow and
	// audit rules, empty means no external IP restriction.
	// +optional
	CIDRs []string `json:"cidrs,omitempty"`
}

+kubebuilder:object:generate=true

func (*ServiceExternalIPRule) DeepCopy added in v0.14.1

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServiceExternalIPRule.

func (*ServiceExternalIPRule) DeepCopyInto added in v0.14.1

func (in *ServiceExternalIPRule) DeepCopyInto(out *ServiceExternalIPRule)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ServiceExternalNameRule added in v0.13.7

type ServiceExternalNameRule struct {
	// Hostnames restricts spec.externalName.
	// Empty means no additional hostname restriction once ExternalName is allowed by types.
	// +optional
	Hostnames []runtime.ExpressionMatch `json:"hostnames,omitempty"`
}

+kubebuilder:object:generate=true

func (*ServiceExternalNameRule) DeepCopy added in v0.13.7

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServiceExternalNameRule.

func (*ServiceExternalNameRule) DeepCopyInto added in v0.13.7

func (in *ServiceExternalNameRule) DeepCopyInto(out *ServiceExternalNameRule)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ServiceLoadBalancerRule added in v0.13.7

type ServiceLoadBalancerRule struct {
	// CIDRs restricts spec.loadBalancerIP and spec.loadBalancerSourceRanges.
	// Empty means no additional CIDR restriction once LoadBalancer is allowed by types.
	// +optional
	CIDRs []string `json:"cidrs,omitempty"`
}

+kubebuilder:object:generate=true

func (*ServiceLoadBalancerRule) DeepCopy added in v0.13.7

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServiceLoadBalancerRule.

func (*ServiceLoadBalancerRule) DeepCopyInto added in v0.13.7

func (in *ServiceLoadBalancerRule) DeepCopyInto(out *ServiceLoadBalancerRule)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ServiceNodePortRange added in v0.13.7

type ServiceNodePortRange struct {
	// +kubebuilder:validation:Minimum=1
	// +kubebuilder:validation:Maximum=65535
	From int32 `json:"from"`

	// +kubebuilder:validation:Minimum=1
	// +kubebuilder:validation:Maximum=65535
	To int32 `json:"to"`
}

+kubebuilder:object:generate=true

func (*ServiceNodePortRange) DeepCopy added in v0.13.7

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServiceNodePortRange.

func (*ServiceNodePortRange) DeepCopyInto added in v0.13.7

func (in *ServiceNodePortRange) DeepCopyInto(out *ServiceNodePortRange)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ServiceNodePortRule added in v0.13.7

type ServiceNodePortRule struct {
	// Ports restricts explicitly requested nodePort values.
	// Empty means no additional port restriction once NodePort is allowed by types.
	// +optional
	Ports []ServiceNodePortRange `json:"ports,omitempty"`
}

+kubebuilder:object:generate=true

func (*ServiceNodePortRule) DeepCopy added in v0.13.7

func (in *ServiceNodePortRule) DeepCopy() *ServiceNodePortRule

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ServiceNodePortRule.

func (*ServiceNodePortRule) DeepCopyInto added in v0.13.7

func (in *ServiceNodePortRule) DeepCopyInto(out *ServiceNodePortRule)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ServiceType added in v0.13.7

type ServiceType string

+kubebuilder:validation:Enum=ClusterIP;NodePort;LoadBalancer;ExternalName

const (
	ServiceTypeClusterIP    ServiceType = "ClusterIP"
	ServiceTypeNodePort     ServiceType = "NodePort"
	ServiceTypeLoadBalancer ServiceType = "LoadBalancer"
	ServiceTypeExternalName ServiceType = "ExternalName"
)

type WorkloadResourceLimitPolicy added in v0.14.0

type WorkloadResourceLimitPolicy struct {
	// Policy selects how the limit is handled: Preserve leaves it unchanged,
	// Default fills an absent limit, Remove deletes it, MatchRequest manages it
	// to equal the request, and Ratio defaults an absent limit and enforces the
	// maximum multiplier against explicitly supplied limits.
	// +kubebuilder:validation:Enum=Preserve;Default;Remove;MatchRequest;Ratio
	Policy WorkloadResourceLimitPolicyType `json:"policy"`

	// Value is the quantity applied by Default or the maximum limit-to-request
	// multiplier applied by Ratio.
	// +optional
	Value *resource.Quantity `json:"value,omitempty"`
}

WorkloadResourceLimitPolicy defines how a resource limit is mutated and enforced.

+kubebuilder:object:generate=true +kubebuilder:validation:XValidation:rule="self.policy == 'Default' || self.policy == 'Ratio' ? has(self.value) : !has(self.value)",message="value must be set only for the Default and Ratio policies"

func (*WorkloadResourceLimitPolicy) DeepCopy added in v0.14.0

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkloadResourceLimitPolicy.

func (*WorkloadResourceLimitPolicy) DeepCopyInto added in v0.14.0

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type WorkloadResourceLimitPolicyType added in v0.14.0

type WorkloadResourceLimitPolicyType string
const (
	WorkloadResourceLimitPolicyPreserve     WorkloadResourceLimitPolicyType = "Preserve"
	WorkloadResourceLimitPolicyDefault      WorkloadResourceLimitPolicyType = "Default"
	WorkloadResourceLimitPolicyRemove       WorkloadResourceLimitPolicyType = "Remove"
	WorkloadResourceLimitPolicyMatchRequest WorkloadResourceLimitPolicyType = "MatchRequest"
	WorkloadResourceLimitPolicyRatio        WorkloadResourceLimitPolicyType = "Ratio"
)

type WorkloadResourceRequestPolicy added in v0.14.0

type WorkloadResourceRequestPolicy struct {
	// Policy selects how the request is handled: Preserve leaves it unchanged,
	// Default fills an absent request, and Remove deletes it.
	// +kubebuilder:validation:Enum=Preserve;Default;Remove
	Policy WorkloadResourceRequestPolicyType `json:"policy"`

	// Value is the quantity applied by the Default policy.
	// +optional
	Value *resource.Quantity `json:"value,omitempty"`
}

WorkloadResourceRequestPolicy defines how a resource request is mutated.

+kubebuilder:object:generate=true +kubebuilder:validation:XValidation:rule="self.policy == 'Default' ? has(self.value) : !has(self.value)",message="value must be set only for the Default policy"

func (*WorkloadResourceRequestPolicy) DeepCopy added in v0.14.0

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkloadResourceRequestPolicy.

func (*WorkloadResourceRequestPolicy) DeepCopyInto added in v0.14.0

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type WorkloadResourceRequestPolicyType added in v0.14.0

type WorkloadResourceRequestPolicyType string
const (
	WorkloadResourceRequestPolicyPreserve WorkloadResourceRequestPolicyType = "Preserve"
	WorkloadResourceRequestPolicyDefault  WorkloadResourceRequestPolicyType = "Default"
	WorkloadResourceRequestPolicyRemove   WorkloadResourceRequestPolicyType = "Remove"
)

type WorkloadResourceRules added in v0.14.0

type WorkloadResourceRules struct {
	// Requests defines policies for resource requests.
	// +optional
	// +kubebuilder:validation:MinProperties=1
	Requests map[corev1.ResourceName]WorkloadResourceRequestPolicy `json:"requests,omitempty"`

	// Limits defines policies for resource limits.
	// +optional
	// +kubebuilder:validation:MinProperties=1
	Limits map[corev1.ResourceName]WorkloadResourceLimitPolicy `json:"limits,omitempty"`
}

WorkloadResourceRules defines policies keyed by Kubernetes resource name.

+kubebuilder:object:generate=true +kubebuilder:validation:XValidation:rule="has(self.requests) || has(self.limits)",message="at least one of requests or limits must be set"

func (*WorkloadResourceRules) DeepCopy added in v0.14.0

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkloadResourceRules.

func (*WorkloadResourceRules) DeepCopyInto added in v0.14.0

func (in *WorkloadResourceRules) DeepCopyInto(out *WorkloadResourceRules)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type WorkloadValidationTarget

type WorkloadValidationTarget string

+kubebuilder:validation:Enum=pod;pod/initcontainers;pod/ephemeralcontainers;pod/containers;pod/volumes

const (
	DeprecatedValidateImages WorkloadValidationTarget = "pod/images"

	ValidatePod                 WorkloadValidationTarget = "pod"
	ValidateInitContainers      WorkloadValidationTarget = "pod/initcontainers"
	ValidateEphemeralContainers WorkloadValidationTarget = "pod/ephemeralcontainers"
	ValidateContainers          WorkloadValidationTarget = "pod/containers"
	ValidateVolumes             WorkloadValidationTarget = "pod/volumes"
)

Jump to

Keyboard shortcuts

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