Title here
Summary here
Block Deployment writes during a weekly maintenance window and warn users in advance. This policy is admission-only. Its manifest includes the required ServiceAccount without workload or impersonation permissions.
apiVersion: addons.projectcapsule.dev/v1alpha1
kind: ChangeWindow
metadata:
name: weekly-maintenance
spec:
serviceAccount:
namespace: schedule-action-controller-system
name: weekly-maintenance
namespaceSelectors:
- matchLabels:
maintenance: enabled
schedules:
- name: sunday
cron: "0 2 * * 0"
timeZone: UTC
duration: 2h
targets:
- name: deployments
apiVersion: apps/v1
kind: Deployment
admission:
- name: freeze
targets: [deployments]
operations: [CREATE, UPDATE, DELETE]
subresources: ["", scale]
when: Active
action: Deny
message: "Maintenance is active. Retry after {{ .window.end }}."
config:
admission:
warnings:
- name: upcoming
targets: [deployments]
operations: [CREATE, UPDATE, DELETE]
subresources: ["", scale]
when: BeforeStart
within: 1h
message: "Maintenance begins at {{ .window.start }} (in {{ .window.startsIn }})."
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: weekly-maintenance
namespace: schedule-action-controller-system
automountServiceAccountToken: falseDownload maintenance-only.yaml
Namespace selectors choose the affected namespaces. Both parent writes and
scale requests are covered. Omitting audience and matchConditions applies
the entry to every caller and matching write during its configured period.
A custom denial message tells users why their request was rejected.
For a narrower freeze, see the replica-change example.