Skip to content

ProactivePolicy and ClusterProactivePolicy do not evaluate workloads owned by cluster-scoped resources #77

@scubadam

Description

@scubadam

ProactivePolicy and ClusterProactivePolicy do not evaluate workloads owned by cluster-scoped resources

Version: automation-controller:0.1.3

Summary

When a Kubernetes workload's ownerReference chain terminates at a cluster-scoped resource (e.g. GatewayClass), the kubex automation engine silently skips it. Neither a namespace-scoped ProactivePolicy nor a ClusterProactivePolicy is able to rightsize these workloads.

Ownership chain

Pod
 └── ReplicaSet
      └── Deployment (in namespace: envoy-gateway-system)
           └── GatewayClass/envoy-gateway-class  ← cluster-scoped, no namespace

What we tried

Namespace-scoped ProactivePolicy

A ProactivePolicy in envoy-gateway-system targeting these Deployments was created and resolved (AutomationStrategyResolved: True). The engine never logged any evaluation or rightsizing activity for these pods, consistent with the expected behaviour that namespace-scoped policies cannot reach workloads whose ownerRef chain escapes the namespace.

Cluster-scoped ClusterProactivePolicy

A ClusterProactivePolicy was created with the following scope variations (tested iteratively):

# Attempt 1 — namespaceSelector matching the workload namespace
scope:
  namespaceSelector:
    operator: In
    values: [envoy-gateway-system]
  labelSelector:
    matchLabels:
      app.kubernetes.io/component: proxy
      app.kubernetes.io/managed-by: envoy-gateway

# Attempt 2 — permissive namespaceSelector (workaround for cluster-scoped owner)
scope:
  namespaceSelector:
    operator: NotIn
    values: [__no_match__]
  labelSelector:
    matchExpressions:
      - key: app.kubernetes.io/component
        operator: In
        values: [proxy]
      - key: app.kubernetes.io/managed-by
        operator: In
        values: [envoy-gateway]

# Attempt 3 — label added to GatewayClass, selector targeting it
# (GatewayClass labeled: app.kubernetes.io/managed-by=envoy-gateway)
scope:
  namespaceSelector:
    operator: NotIn
    values: [__no_match__]
  labelSelector:
    matchExpressions:
      - key: app.kubernetes.io/managed-by
        operator: In
        values: [envoy-gateway]

In all cases the policy resolved successfully (AutomationStrategyResolved: True) but the engine produced no admission webhook log entries and no workload annotation syncs for the proxy Deployments. Pod restarts were used to force admission webhook evaluation — confirmed via engine logs that the webhook fired for other pods in the same cluster at the same time.

Confirmed working baseline

A ClusterProactivePolicy with the same structure targeting the envoy-gateway controller Deployment (which has no escaping ownerRef — Helm-managed, no ownerReferences) worked correctly and produced RESIZED results immediately.

Expected behaviour

ClusterProactivePolicy should be able to evaluate and rightsize workloads whose ownerRef chain terminates at a cluster-scoped resource such as GatewayClass.

Questions

  1. Is ClusterProactivePolicy expected to support cluster-scoped root owners? If so, is there a supported configuration?
  2. Does the engine walk the ownerReferences chain and use the root owner's namespace/labels for scope resolution? If so, how should cluster-scoped owners be handled?
  3. Is there a planned fix or workaround?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions