service data source¶
Description¶
ServiceDataSource reads one Service by name without changing it. A missing Service returns lookup metadata with absent spec and status.
Source: internal/api/core/v1/service_dsrc.go:21
Example usage:
imports: {
kubernetes-core-v1: 'github.com/cloudboss/unobin-library-kubernetes//api/core/v1'
}
data-sources: {
example: kubernetes-core-v1.service {
# Set input fields here.
}
}
Inputs¶
metadata
object
object({
name: optional(string)
namespace: optional(string)
annotations: optional(map(string))
labels: optional(map(string))
})
Metadata selects the Service. Namespace defaults to default independently of configuration. Optional annotations and labels are validated metadata, not selectors. An omitted name reaches the native empty-name error.
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
namespace: string
annotations: map(string)
labels: map(string)
generation: integer
resource-version: string
uid: string
})
spec
optional(object)
optional(
object({
type: string
allocate-load-balancer-node-ports: boolean
cluster-ip: string
cluster-ips: list(string)
external-ips: list(string)
external-name: string
external-traffic-policy: string
internal-traffic-policy: string
ip-families: list(string)
ip-family-policy: string
load-balancer-class: string
load-balancer-ip: string
load-balancer-source-ranges: list(string)
health-check-node-port: integer
publish-not-ready-addresses: boolean
selector: map(string)
session-affinity: string
session-affinity-config: optional(
object({
client-ip: optional(
object({
timeout-seconds: integer
})
)
})
)
port: list(
object({
port: integer
name: string
app-protocol: string
protocol: string
node-port: integer
target-port: string
})
)
})
)
status
optional(object)
optional(
object({
load-balancer: object({
ingress: list(
object({
ip: string
hostname: string
ip-mode: string
})
)
})
})
)