Skip to content

limit-range resource

Source: internal/api/core/v1/limit_range_rsrc.go:20

Example usage:

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

resources: {
  example: kubernetes-core-v1.limit-range {
    # 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: optional(
    object({
      limit: optional(
        list(
          object({
            type: optional(string)
            default: optional(map(string))
            default-request: optional(map(string))
            max: optional(map(string))
            max-limit-request-ratio: optional(map(string))
            min: optional(map(string))
          })
        )
      )
    })
  )
})

required

ignore-annotations

optional(list(string))

ignore-labels

optional(list(string))

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

Conditional requirement.

Rule logic
For each
input.object.spec.limit ?? []
When
@each.value.type == 'Pod'
Require
@core.length(@each.value.default-request ?? {}) <= 0

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: optional(
    object({
      limit: list(
        object({
          type: string
          default: map(string)
          default-request: map(string)
          max: map(string)
          max-limit-request-ratio: map(string)
          min: map(string)
        })
      )
    })
  )
})