Skip to content

namespace data source

Description

NamespaceDataSource reads one cluster-scoped Namespace without changing it. A missing Namespace returns lookup metadata and null spec.

Source: internal/api/core/v1/namespace_dsrc.go:18

Example usage:

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

data-sources: {
  example: kubernetes-core-v1.namespace {
    # Set input fields here.
  }
}

Inputs

metadata

object
object({
  name: string
  annotations: optional(map(optional(string)))
  labels: optional(map(optional(string)))
})

required

Input Constraints

Metadata rules

Requirement.

Rule logic
Require
@core.is-match(input.metadata.name, '^[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*$')
&& @core.length(input.metadata.name) <= 253

Requirement.

Rule logic
For each
input.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.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.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}$')

Outputs

metadata

object
object({
  name: string
  annotations: map(string)
  labels: map(string)
  generation: integer
  resource-version: string
  uid: string
})

spec

optional(object)
optional(
  object({
    finalizers: list(string)
  })
)