Policy

Policy applies lists, schedules and resolver settings to client groups.

API versionkudurru.io/v1alpha1
KindPolicy
ScopeNamespaced
Resourcepolicies.kudurru.io
Short namespol
Subresourcesstatus

Columns of kubectl get policies:

ColumnTypeValue
GROUPSstring.spec.clientGroupRefs
PRIORITYinteger.spec.priority
READYstring.status.conditions[?(@.type=="Ready")].status

Spec

PolicySpec binds client groups to lists and resolver behaviour.

FieldTypeDescription
spec.allowListRefs[]string
spec.allowOnlybooleanAllowOnly answers only names present in the allow lists.
spec.allowedServices[]stringAllowedServices are exceptions to blockedCategories: services of a blocked category this policy does not block. They do not cancel an ID listed in blockedServices, nor another policy's blocks; allow lists still win over every service.
Items: at most 256
List type: set
spec.blockListRefs[]string
spec.blockModestringBlockResponse is how a blocked query is answered: nxdomain, zeroIP (0.0.0.0 / ::), refused, customIP (the customIP addresses) or blockPage (the addresses of the block page listener, blockPage.ipv4/ipv6, so browsers show why the name is blocked).
One of: nxdomain, zeroIP, refused, customIP, blockPage
spec.blockTTLstringDefault: 10m
spec.blockedCategories[]stringBlockedCategories names categories of the catalogue (GET /api/v1/catalogue/categories: ai, social, gaming, ...); every service in them is blocked as if listed in blockedServices, including services a later catalogue adds to the category. Unknown IDs are reported as Degraded{UnknownCategory}.
Items: at most 64
List type: set
spec.blockedServices[]stringBlockedServices names services of the blocked-services catalogue (GET /api/v1/catalogue/services: youtube, tiktok, ...) whose domains this policy blocks like a block list; the query log names the service as the list, "service:<id>". IDs are checked against the catalogue in service, which can change at runtime, so an unknown ID is reported as Degraded{UnknownService} rather than refused.
Items: at most 256
List type: set
spec.clientGroupRefs[]string
spec.priorityintegerPriority breaks ties when several policies match; highest wins.
spec.queryLogbooleanQueryLog false excludes matching clients from the query log.
spec.rewrites[]object
spec.rewrites[].cnamestring
spec.rewrites[].namestringRequired.
spec.rewrites[].targets[]string
spec.rewrites[].typestring
spec.safeSearchbooleanSafeSearch true answers the search engines' and YouTube's host names with their vendor's safe-search target (a CNAME to forcesafesearch.google.com, strict.bing.com, ...; see the catalogue).
spec.safeSearchModestringSafeSearchMode is the level for engines that offer two: strict (the default) or moderate. Only YouTube has two levels (Strict or Moderate Restricted Mode); every other engine is always strict.
One of: strict, moderate
spec.scheduleobjectSchedule limits when a policy applies.
spec.schedule.endstringRequired.
Pattern: ^([01][0-9]|2[0-3]):[0-5][0-9]$
spec.schedule.startstringRequired. Start and End are "HH:MM" in TZ.
Pattern: ^([01][0-9]|2[0-3]):[0-5][0-9]$
spec.schedule.tzstringDefault: UTC
spec.schedule.weekdays[]string
spec.upstreamGroupstring

Status

PolicyStatus is the observed state of a policy.

FieldTypeDescription
status.conditions[]ConditionList type: map, keyed by type
status.observedGenerationintegerFormat: int64

Example

config/samples/kudurru.io_v1alpha1_policy.yaml:

apiVersion: kudurru.io/v1alpha1
kind: Policy
metadata:
  name: kids
  namespace: dns
spec:
  clientGroupRefs: [kids]
  blockListRefs: [default-ads, adult]
  blockMode: zeroIP
  blockTTL: 10m
  schedule:
    weekdays: [mon, tue, wed, thu, fri]
    start: "08:00"
    end: "20:00"
    tz: Europe/Berlin
  priority: 10

Source: site/content/reference/crds/policy.md