Skip to content

resource-quota resource

Description

ResourceQuotaResource manages a namespaced quota and waits for hard limits on create and spec updates. A change to identity, cluster, or scopes replaces it.

Source: internal/api/core/v1/resource_quota_rsrc.go:26

Example usage:

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

resources: {
  example: kubernetes-core-v1.resource-quota {
    # Set input fields here.
  }
}

Inputs

metadata

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

required

spec

optional(object)
optional(
  object({
    hard: optional(map(string))
    scopes: optional(list(string))
    scope-selector: optional(
      object({
        match-expressions: optional(
          list(
            object({
              scope-name: string
              operator: string
              values: optional(list(string))
            })
          )
        )
      })
    )
  })
)

ignore-annotations

optional(list(string))

ignore-labels

optional(list(string))

create-timeout

optional(string)

update-timeout

optional(string)

Input Constraints

Metadata rules

Exactly one of metadata.name or metadata.generate-name.

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

If set, metadata.generate-name must match the specified pattern.

Rule logic
Require
@core.is-match(input.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.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}$')

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

Spec rules

Requirement.

Rule logic
For each
input.spec.scopes ?? []
Require
@each.value == 'Terminating'
|| @each.value == 'NotTerminating'
|| @each.value == 'BestEffort'
|| @each.value == 'NotBestEffort'
|| @each.value == 'PriorityClass'

Requirement.

Rule logic
For each
input.spec.scope-selector.match-expressions ?? []
Require
@each.value.scope-name == 'Terminating'
|| @each.value.scope-name == 'NotTerminating'
|| @each.value.scope-name == 'BestEffort'
|| @each.value.scope-name == 'NotBestEffort'
|| @each.value.scope-name == 'PriorityClass'

Requirement.

Rule logic
For each
input.spec.scope-selector.match-expressions ?? []
Require
@each.value.operator == 'In'
|| @each.value.operator == 'NotIn'
|| @each.value.operator == 'Exists'
|| @each.value.operator == 'DoesNotExist'

Outputs

server

string

api-version

string

kind

string

name

string

namespace

string

uid

string

metadata

object
object({
  name: string
  generate-name: string
  namespace: string
  annotations: map(string)
  labels: map(string)
})

spec

object
object({
  hard: map(string)
  scopes: list(string)
  scope-selector: optional(
    object({
      match-expressions: list(
        object({
          scope-name: string
          operator: string
          values: optional(list(string))
        })
      )
    })
  )
})