change-windows

by Project Capsule

Helm chartv0.1.4App 0.1.4Verified publisher

Scheduled resource actions and admission maintenance windows for Kubernetes.

About this chart

Change Windows

Change Windows schedules Kubernetes resource actions and protects maintenance windows with admission rules and advance warnings. Helm is the supported installation method; cert-manager must be installed first.

Installation

See the installation guide for building an image and installing the chart from a checkout.

For a published release, set the chart version explicitly:

helm upgrade --install change-windows oci://ghcr.io/projectcapsule/charts/change-windows \
  --namespace capsule-system --create-namespace --version VERSION
helm status change-windows --namespace capsule-system

Before uninstalling, delete ChangeWindows and allow pending restorations and finalizers to complete while the controller is still running.

helm uninstall change-windows --namespace capsule-system

Admission configuration

The chart installs two validating webhooks. Configure request filtering through webhooks.hooks.resources for resource denials and warnings, and webhooks.hooks.changewindows for validation of the ChangeWindow API itself.

PropertyPurpose
rulesSelect API groups, versions, resources, operations, and resource scope.
namespaceSelectorFilter namespaced requests using labels on their Namespace.
objectSelectorFurther filter requests using object labels.
matchConditionsCEL conditions that must all evaluate to true before the webhook is called.
failurePolicyReject requests on webhook call failures (Fail, the default), or allow admission to continue (Ignore).
timeoutSeconds, matchPolicyConfigure the call timeout and API version matching.

The API server applies these filters before sending a request to the controller. A matching ChangeWindow must also select the resource through its namespace selectors, targets, audience, conditions, and schedule. Widening a ChangeWindow's selectors cannot override the Helm webhook filters. See the Kubernetes webhook reference.

Selecting namespaces outside Capsule tenants

By default, the resource webhook selects namespaced requests only when the Namespace has the capsule.clastix.io/tenant label:

webhooks:
  hooks:
    resources:
      namespaceSelector:
        matchExpressions:
          - key: capsule.clastix.io/tenant
            operator: Exists

To include other namespaces, provide your own webhooks.hooks.resources.namespaceSelector.matchExpressions, replacing the tenant-label expression. For example, this selects tenant and non-tenant namespaces while excluding infrastructure namespaces and the Helm release namespace:

webhooks:
  hooks:
    resources:
      namespaceSelector:
        matchExpressions:
          - key: kubernetes.io/metadata.name
            operator: NotIn
            values:
              - '{{ .Release.Namespace }}'
              - kube-system
              - kube-public
              - kube-node-lease

Save the override with your installation values and apply it with Helm:

helm upgrade --install change-windows oci://ghcr.io/projectcapsule/charts/change-windows \
  --namespace capsule-system --create-namespace --version VERSION --values values.yaml

Helm replaces the entire matchExpressions list. Adding another expression alongside the tenant-label expression still requires the tenant label, because selector requirements are combined with AND. Setting only namespaceSelector: {} retains the default expression through Helm's map merging; namespaceSelector: {matchExpressions: []} removes it. Clear any additional matchLabels constraints in your own values as well.

The controller works with or without Capsule. This tenant-only selector is an installation default, not a requirement for enforcing ChangeWindows. The controller's protected namespaces still apply: its own namespace, kube-system, kube-public, and kube-node-lease cannot be selected for admission or actions. Scheduled actions use ChangeWindow selection and executor RBAC independently of the webhook's request filters.

The default resource rules also include a separate cluster-scoped nodes rule. A namespaceSelector does not filter Nodes; Node maintenance uses the ChangeWindow's Node target selector. To intercept only namespaced resources, replace webhooks.hooks.resources.rules with:

webhooks:
  hooks:
    resources:
      rules:
        - apiGroups: ["*"]
          apiVersions: ["*"]
          operations: [CREATE, UPDATE, DELETE]
          resources: ["*/*"]
          scope: Namespaced

The changewindows hook validates cluster-scoped ChangeWindow objects and has independent filters. Broadening resource admission increases webhook traffic and extends the effect of its default failurePolicy: Fail to those requests.

Templating webhook properties

String values and map keys throughout webhooks support Helm templates using the chart's root context, including .Release, .Values, and chart helpers. This covers both hooks' selectors, rules, conditions and policies, as well as webhook labels, annotations, service settings, and certificate settings. Keep maps and lists as YAML structures and quote strings containing templates.

Boolean settings such as webhooks.enabled, webhooks.exclusive, and webhooks.certificate.generate.enabled can use templates producing true or false. Port and timeout templates must produce integers. For example:

webhooks:
  labels:
    app.kubernetes.io/instance: '{{ .Release.Name }}'
  service:
    port: '{{ add 400 43 }}'
  certificate:
    secret:
      name: '{{ .Release.Name }}-serving-tls'
  hooks:
    resources:
      failurePolicy: '{{ print "Fail" }}'
      timeoutSeconds: '{{ add 2 3 }}'
      matchConditions:
        - name: exclude-controller-namespace
          expression: 'request.namespace != {{ .Release.Namespace | quote }}'

Templating runs during Helm rendering and adds no work to the admission request path. Template output is not evaluated recursively, and ChangeWindow runtime templates elsewhere in your values are preserved. Use deterministic expressions for settings shared by multiple manifests, such as the serving Secret name. These templates are supplied by the chart installer and use Helm's tpl function.

Values

The following Values are available for this chart.

Global Values

KeyTypeDefaultDescription
global.jobs.kubectl.affinityobject{}Set affinity rules
global.jobs.kubectl.annotationsobject{}Annotations to add to the job.
global.jobs.kubectl.backoffLimitint4Backofflimit for jobs
global.jobs.kubectl.image.pullPolicystring"IfNotPresent"Set the image pull policy of the helm chart job
global.jobs.kubectl.image.registrystring"docker.io"Set the image repository of the helm chart job
global.jobs.kubectl.image.repositorystring"clastix/kubectl"Set the image repository of the helm chart job
global.jobs.kubectl.image.tagstring""Set the image tag of the helm chart job
global.jobs.kubectl.imagePullSecretslist[]ImagePullSecrets
global.jobs.kubectl.labelsobject{}Labels to add to the job.
global.jobs.kubectl.nodeSelectorobject{}Set the node selector
global.jobs.kubectl.podAnnotationsobject{}Annotations to add to the job pod
global.jobs.kubectl.podLabelsobject{}Labels to add to the job pod
global.jobs.kubectl.podSecurityContextobject{"enabled":true,"seccompProfile":{"type":"RuntimeDefault"}}Security context for the job pods.
global.jobs.kubectl.priorityClassNamestring""Set a pod priorityClassName
global.jobs.kubectl.resourcesobject{}Job resources
global.jobs.kubectl.restartPolicystring"Never"Set the restartPolicy
global.jobs.kubectl.securityContextobject{"allowPrivilegeEscalation":false,"capabilities":{"drop":["ALL"]},"enabled":true,"readOnlyRootFilesystem":true,"runAsGroup":1002,"runAsNonRoot":true,"runAsUser":1002}Security context for the job containers.
global.jobs.kubectl.tolerationslist[]Set list of tolerations
global.jobs.kubectl.topologySpreadConstraintslist[]Set Topology Spread Constraints
global.jobs.kubectl.ttlSecondsAfterFinishedint60Sets the ttl in seconds after a finished certgen job is deleted. Set to -1 to never delete.

CustomResourceDefinition Lifecycle

KeyTypeDefaultDescription
crds.annotationsobject{}Extra Annotations for CRDs
crds.exclusiveboolfalseOnly install the CRDs, no other primitives
crds.inlineboolfalse
crds.installbooltrueInstall the CustomResourceDefinitions (This also manages the lifecycle of the CRDs for update operations)
crds.keepbooltrueRetain CRDs and their resources when an inline installation is uninstalled
crds.labelsobject{}Extra Labels for CRDs

General Parameters

KeyTypeDefaultDescription
manager.affinityobject{}Set affinity rules
manager.args.extralist["--leader-elect"]Extra arguments
manager.args.kubeApiBurstint100Kubernetes client burst
manager.args.kubeApiQPSint50Kubernetes client QPS
manager.args.workersint1Maximum concurrent ChangeWindow reconciliations
manager.envlist[]Environment variables
manager.hostUsersboolfalseDo not use Host Users (User Namespaces)
manager.image.pullPolicystring"IfNotPresent"Set the image pull policy.
manager.image.referencestring""Complete image reference, including an optional digest; overrides registry, repository, and tag
manager.image.registrystring"ghcr.io"Set the image registry
manager.image.repositorystring"projectcapsule/change-windows"Set the image repository
manager.image.tagstring""Overrides the image tag whose default is the chart appVersion.
manager.livenessProbeobject{"httpGet":{"path":"/healthz","port":8081}}Configure the liveness probe using Deployment probe spec
manager.nodeSelectorobject{}Set the node selector
manager.podSecurityContextobject{"enabled":true,"seccompProfile":{"type":"RuntimeDefault"}}Set the securityContext
manager.priorityClassNamestring""Set the priority class name of the Capsule pod
manager.readinessProbeobject{"httpGet":{"path":"/readyz","port":8081}}Configure the readiness probe using Deployment probe spec
manager.replicaCountint1Amount of replicas
manager.resourcesobject{}Set the resource requests/limits
manager.securityContextobject{"allowPrivilegeEscalation":false,"capabilities":{"drop":["ALL"]},"enabled":true,"readOnlyRootFilesystem":true,"runAsNonRoot":true,"runAsUser":1000}Set the securityContext for the container
manager.tolerationslist[]Set list of tolerations
manager.topologySpreadConstraintslist[]Set topology spread constraints
metrics.serviceMonitor.enabledboolfalse
metrics.serviceMonitor.tokenSecretstring""
serviceAccount.annotationsobject{}Annotations to add to the service account.
serviceAccount.createbooltrueSpecifies whether a service account should be created.
serviceAccount.imagePullSecretslist[]Image pull secrets for the service account.
serviceAccount.namestring""The name of the service account to use.
webhooks.annotationsobject{}Additional Annotations for all webhooks
webhooks.certificate.generate.dnsNameslist[]Additional DNS Names to include in certificate
webhooks.certificate.generate.durationstring""Duration of validity for the CA certificate (e.g. 2160h for 90 days)
webhooks.certificate.generate.enabledbooltrueEnable cert-manager generated certificates for the webhook service
webhooks.certificate.generate.ipAddresseslist[]Additional IP Addresses to include in certificate
webhooks.certificate.generate.renewBeforestring""Renew the CA certificate before its expiration time (e.g. 360h for 15 days)
webhooks.certificate.generate.urislist[]Additional URIs to include in certificate
webhooks.certificate.secret.namestring""Name of the secret containing the TLS certificate for the webhook service
webhooks.enabledbooltrueSpecifies whether the admission webhooks are enabled
webhooks.exclusiveboolfalseWhen crds.exclusive is true the webhooks will be installed
webhooks.hooks.changewindows.failurePolicystring"Fail"FailurePolicy
webhooks.hooks.changewindows.matchConditionslist[]MatchConditions
webhooks.hooks.changewindows.matchPolicystring"Exact"MatchPolicy
webhooks.hooks.changewindows.namespaceSelectorobject{}[NamespaceSelector](https://kubernetes.io/docs/reference/access-authn-authz/extensible-admission-controllers/#matching-requ

Deploy change-windows with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has change-windows on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartchange-windows is pinned at v0.1.4 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply