Skip to content

operator subscription does not respect config.selector when it applies resource limits to the operator pods #1794

Open
@xiangjingli

Description

@xiangjingli

Bug Report

There are three pods in our multi- cluster subscription community operator https://github.com/operator-framework/community-operators/tree/master/community-operators/multicluster-operators-subscription

Though a selector is set to match 2 of 3 pods in the operator subscription CR, the resource limit is applied to all of the 3 pods.

To reproduce it:

  1. go to openshift operator Hub web console, install the community operator Multicluster Subscription Operator V0.2.3 in a namespace. e.g. open-cluster-management

  2. Make sure the 3 pods with different labels are installed. Also no resource limit is applied to the 3 pods.

% oc get pods -l "app in (multicluster-operators-standalone-subscription, multicluster-operators-hub-subscription, multicluster-operators-application)"
NAME                                                              READY   STATUS    RESTARTS   AGE
multicluster-operators-application-585d76cd-9p5ht                 4/4     Running   0          7m32s
multicluster-operators-hub-subscription-84b776d654-pmmjp          1/1     Running   0          7m32s
multicluster-operators-standalone-subscription-868b55fdbc-dmsct   1/1     Running   0          7m32s

% oc get pods multicluster-operators-standalone-subscription-7c8cbf885f-tjpb8 -o yaml 
apiVersion: v1
kind: Pod
spec:
  containers:
  - image: quay.io/open-cluster-management/multicluster-operators-subscription:community-2.1
    resources: {}

status:
  qosClass: BestEffort
  1. Apply the new operator subscription CR,
apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
  name: multicluster-operators-subscription
  namespace: open-cluster-management
spec:
  channel: release-2.1
  config:
    selector:
      matchExpressions:
      - key: app 
        operator: In
        values:
        - multicluster-operators-standalone-subscription
        - multicluster-operators-hub-subscription
    resources: 
      limits:
        cpu: 750m
        memory: 2Gi
      requests:
        cpu: 150m
        memory: 128Mi
  installPlanApproval: Automatic
  name: multicluster-operators-subscription
  source: community-operators
  sourceNamespace: openshift-marketplace
  startingCSV: multicluster-operators-subscription.v0.2.3
  1. Expected result.

The resource limit is applied to the two pods - multicluster-operators-standalone-subscription and multicluster-operators-hub-subscription

The pod multicluster-operators-application should have no resource limit

  1. Actual result

The resource limit is applied to all the three pods, including multicluster-operators-application

% oc get pods multicluster-operators-application-585d76cd-96drh -o yaml 
apiVersion: v1
kind: Pod
spec:
  containers:
  - image: quay.io/open-cluster-management/multicluster-operators-placementrule:community-2.1
    resources:
      limits:
        cpu: 750m
        memory: 2Gi
      requests:
        cpu: 150m
        memory: 128Mi
...
status:
  qosClass: Burstable

Environment
OCP V4.5.6 built-in OLM

Suggested Solution

  1. In our multicluster subscription operator CSV, we have defined different resource limits for each container in each pod. It seems to be ignored by OLM. Is there a specific reason for that?

It would be great if OLM could support to set container resource limits through operator CSV directly, which is consistent with k8s deployment api specification.

  1. If OLM only hopes to set resource limit though operator subscription CR, one generic solution would be to support multiple pod selectors, and resource is defined under each selector. As a result, different resource limit/request can be applied to all containers in different pods decided by the pods selector.

Metadata

Metadata

Assignees

No one assigned

    Labels

    triage/unresolvedIndicates an issue that can not or will not be resolved.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions