Skip to content

Commit 821b64a

Browse files
committed
feat: add generic fields rule enforcement
1 parent f7c5523 commit 821b64a

20 files changed

Lines changed: 2045 additions & 32 deletions

charts/capsule/crds/capsule.clastix.io_rulestatuses.yaml

Lines changed: 271 additions & 0 deletions
Large diffs are not rendered by default.

charts/capsule/crds/capsule.clastix.io_tenants.yaml

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2515,6 +2515,97 @@ spec:
25152515
- deny
25162516
- audit
25172517
type: string
2518+
fields:
2519+
description: Enforcement for values at declared field paths
2520+
on namespaced resources.
2521+
items:
2522+
description: |-
2523+
FieldRule defines value constraints for a declared field path on
2524+
namespaced resources.
2525+
2526+
Rules constrain values that exist: a path resolving to no value (or only
2527+
empty values) is not evaluated, so field rules never make a field
2528+
required. Note that server-side defaulting (DefaultStorageClass,
2529+
LimitRanger, ...) runs before validating webhooks, so defaulted fields
2530+
are already populated when rules are evaluated.
2531+
properties:
2532+
apiGroups:
2533+
description: |-
2534+
API groups or API group/version selectors of the referents.
2535+
2536+
Empty or omitted APIGroups means the core Kubernetes API version "v1".
2537+
Use "*" to match all API groups and versions.
2538+
2539+
Examples:
2540+
- [] or [""] means core "v1".
2541+
- ["v1"] means core "v1".
2542+
- ["apps"] means any version in the "apps" API group.
2543+
- ["apps/v1"] means only "apps/v1".
2544+
- ["apps", "batch/v1"] means any "apps" version and "batch/v1".
2545+
- ["*"] means all API groups and versions.
2546+
items:
2547+
type: string
2548+
type: array
2549+
kinds:
2550+
description: |-
2551+
Kinds of the referents.
2552+
2553+
Use "*" to match all kinds.
2554+
items:
2555+
minLength: 1
2556+
type: string
2557+
minItems: 1
2558+
type: array
2559+
match:
2560+
description: |-
2561+
Match defines allowed, denied, or audited values for the field,
2562+
depending on the enforcement action.
2563+
items:
2564+
description: |-
2565+
At least one of Exact or Exp must be set.
2566+
Both may be set together.
2567+
properties:
2568+
exact:
2569+
description: Exact matches one of the provided
2570+
values exactly.
2571+
items:
2572+
type: string
2573+
minItems: 1
2574+
type: array
2575+
exp:
2576+
description: Exp matches regular expression.
2577+
minLength: 1
2578+
type: string
2579+
negate:
2580+
default: false
2581+
description: Negate regular Expression
2582+
type: boolean
2583+
type: object
2584+
x-kubernetes-validations:
2585+
- message: at least one of exact or exp must be
2586+
set
2587+
rule: has(self.exact) || has(self.exp)
2588+
minItems: 1
2589+
type: array
2590+
path:
2591+
description: |-
2592+
Path is a JSONPath expression into the object, written with a leading
2593+
dot and without surrounding curly braces (the same form used by
2594+
CustomQuota source paths), e.g.
2595+
".spec.template.spec.containers[*].image", where "[*]" expands every
2596+
element of an array field into one checked value.
2597+
2598+
Values resolved by the path must be scalars, and violations are
2599+
reported against the configured path, not concrete array indexes.
2600+
maxLength: 512
2601+
minLength: 1
2602+
type: string
2603+
required:
2604+
- kinds
2605+
- match
2606+
- path
2607+
type: object
2608+
type: array
25182609
metadata:
25192610
description: Enforcement for object metadata on namespaced
25202611
resources.

0 commit comments

Comments
 (0)