persistent-volume-claim resource¶
Description¶
PersistentVolumeClaimResource manages a PVC, with JSON Patch updates and saved UID identity. Create waits for Bound by default. A failed create can leave a PVC requiring manual cleanup. Deletion waits for removal and never clears finalizers or deletes a backing volume.
Source: internal/api/core/v1/persistent_volume_claim_rsrc.go:30
Example usage:
imports: {
kubernetes-core-v1: 'github.com/cloudboss/unobin-library-kubernetes//api/core/v1'
}
resources: {
example: kubernetes-core-v1.persistent-volume-claim {
# Set input fields here.
}
}
Inputs¶
object
object
object({
metadata: object({
name: optional(string)
generate-name: optional(string)
namespace: optional(string)
annotations: optional(map(string))
labels: optional(map(string))
})
spec: object({
access-modes: list(string)
resources: object({
limits: optional(map(string))
requests: optional(map(string))
})
selector: optional(
object({
match-labels: optional(map(string))
match-expressions: optional(
list(
object({
key: optional(string)
operator: optional(string)
values: optional(list(string))
})
)
)
})
)
volume-name: optional(string)
storage-class-name: optional(string)
volume-mode: optional(string)
})
})
Object contains required metadata and spec. Exactly one nonempty name or generate-name is required. Namespace defaults to default. Spec quantities use Kubernetes quantity syntax. Access modes and selector values are sets. Immutable spec edits and storage decreases replace. Omitted volume-name, storage-class-name and volume-mode retain API assigned values.
wait-until-bound
optional(boolean)
WaitUntilBound defaults to true and affects create only. Only Pending is retried.
create-timeout
optional(string)
CreateTimeout is a Go duration, defaults to 5m, and bounds the entire create operation. Zero and negative durations expire immediately. Caller cancellation always takes precedence.
ignore-annotations
optional(list(string))
IgnoreAnnotations contains unanchored key regexes used during reads. Tracked keys override internal-key and regex filters. Updates still write explicitly configured keys.
ignore-labels
optional(list(string))
IgnoreLabels applies the annotation filtering rules independently to label keys.
Input Constraints¶
Object rules
Exactly one of object.metadata.name or object.metadata.generate-name.
Requirement.
Rule logic
- Require
@core.is-match(input.object.metadata.name, '^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$')
&& @core.length(input.object.metadata.name ?? '') <= 253
If set, object.metadata.generate-name must match the specified pattern.
Rule logic
- Require
@core.is-match(input.object.metadata.generate-name, '^([a-z0-9]([-a-z0-9]{0,61}[a-z0-9])?|[\\x00-\\x7f]-|[a-z0-9][-a-z0-9]{0,61}[\\x00-\\x7f]-)$')
Requirement.
Rule logic
- For each
input.object.metadata.labels ?? {}- Require
@core.is-match(@each.key, '^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?[A-Za-z0-9]([-A-Za-z0-9_.]*[A-Za-z0-9])?$')
&& @core.is-match(@each.key, '^([^/]{1,253}/)?[^/]{1,63}$')
If set, @each.value must match the specified pattern.
Rule logic
- For each
input.object.metadata.labels ?? {}- Require
@core.is-match(@each.value, '^([A-Za-z0-9]([-A-Za-z0-9_.]{0,61}[A-Za-z0-9])?)?$')
Requirement.
Rule logic
- For each
input.object.metadata.annotations ?? {}- Require
@core.is-match(@each.key, '^([a-zA-Z0-9İK]([-a-zA-Z0-9İK]*[a-zA-Z0-9İK])?(\\.[a-zA-Z0-9İK]([-a-zA-Z0-9İK]*[a-zA-Z0-9İK])?)*/)?[A-Za-z0-9İK]([-A-Za-z0-9_.İK]*[A-Za-z0-9İK])?$')
&& @core.is-match(@each.key, '^([^/]{1,253}/)?[^/]{1,63}$')
Requirement.
Rule logic
- For each
input.object.spec.access-modes- Require
@each.value == 'ReadWriteOnce'
|| @each.value == 'ReadOnlyMany'
|| @each.value == 'ReadWriteMany'
|| @each.value == 'ReadWriteOncePod'
Conditional requirement.
Rule logic
- When
input.object.spec.volume-mode != null- Require
input.object.spec.volume-mode == 'Block'
|| input.object.spec.volume-mode == 'Filesystem'
Ignore annotations rules
If set, @each.value must be a valid Go regular expression.
Rule logic
- For each
input.ignore-annotations ?? []- Require
@core.is-format(@each.value, 'regex')
Ignore labels rules
If set, @each.value must be a valid Go regular expression.
Rule logic
- For each
input.ignore-labels ?? []- Require
@core.is-format(@each.value, 'regex')
Outputs¶
server
string
api-version
string
kind
string
object
object
object({
metadata: object({
name: string
generate-name: string
namespace: string
uid: string
annotations: map(string)
labels: map(string)
})
spec: object({
access-modes: list(string)
resources: object({
limits: map(string)
requests: map(string)
})
selector: optional(
object({
match-labels: optional(map(string))
match-expressions: optional(
list(
object({
key: optional(string)
operator: optional(string)
values: optional(list(string))
})
)
)
})
)
volume-name: string
storage-class-name: string
volume-mode: string
})
})