Skip to content

secret resource

Description

SecretResource manages a namespaced Secret with sensitive ordinary state values. Name, namespace, generate-name, and type changes replace the object. Changes to payloads or immutability also replace a previously immutable Secret.

Source: internal/api/core/v1/secret_rsrc.go:27

Example usage:

imports: {
  kubernetes-core-v1: 'github.com/cloudboss/unobin-library-kubernetes//api/core/v1'
}

resources: {
  example: kubernetes-core-v1.secret {
    # 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))
  })
  data: optional(map(string))
  binary-data: optional(map(string))
  immutable: optional(boolean)
  type: optional(string)
})

required sensitive

Object contains required metadata, optional text data, base64 binary-data, immutable, and type. Metadata accepts name or generate-name, namespace, annotations, and labels; name conflicts with generate-name. The server returns the generated name. Omitted namespace defaults to default and type to Opaque. Omitted data preserves computed text; explicit empty data clears it. Selected binary keys form a separate read partition. Create sends text through stringData, which wins overlaps; complete data updates favor binary values. Sensitivity masks this object; ordinary values persist in state. Mark outputs that select nested values with @sensitive in the factory.

wait-for-service-account-token

optional(boolean)

WaitForServiceAccountToken defaults to true and waits only during creation of a returned service-account-token Secret until its token key exists.

create-timeout

optional(string)

CreateTimeout is a positive Go duration, default 1m, for the entire create.

ignore-annotations

optional(list(string))

IgnoreAnnotations filters untracked annotation keys with regular expressions.

ignore-labels

optional(list(string))

IgnoreLabels filters untracked label keys with regular expressions.

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}$')

If set, @each.value must be standard padded base64 text.

Rule logic
For each
input.object.binary-data ?? {}
Require
@core.is-format(@each.value, 'base64')

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')

Create timeout rules

If set, create-timeout must be a positive duration.

Rule logic
Require
@core.is-format(input.create-timeout, 'positive-duration')

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)
  })
  data: map(string)
  binary-data: map(string)
  immutable: boolean
  type: string
})

sensitive