Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

If resource override is not defined in a subscription then the existing resource definition in the CSV is deleted #1912

Closed
hochdorf opened this issue Dec 17, 2020 · 0 comments · Fixed by #2010
Labels
kind/bug Categorizes issue or PR as related to a bug.

Comments

@hochdorf
Copy link

Bug Report

What did you do?
Created the following subscription where there is no override on the resources:

apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
  name: consul
  namespace: consul-stable
spec:
  channel: stable
  installPlanApproval: Manual
  name: consul
  source: applications
  sourceNamespace: olm
  startingCSV: consul.v0.0.10

This is the CSV that has resources section defined:

apiVersion: operators.coreos.com/v1alpha1
kind: ClusterServiceVersion
metadata:
  annotations:
    capabilities: Basic Install
  name: consul.v0.0.10
  namespace: placeholder
spec:
  apiservicedefinitions: {}
  replaces: consul.v0.0.9
  customresourcedefinitions:
    owned:
    - kind: Consul
      name: consuls.application.com
      version: v1alpha2
      displayName: Consul operator
      description: Consul operator      
  description: Placeholder description
  displayName: Consul
  install:    
    spec:
      deployments:
      - name: consul-operator
        spec:
          replicas: 1
          selector:
            matchLabels:
              name: consul-operator
          strategy: {}
          template:
            metadata:
              labels:
                name: consul-operator
            spec:
              containers:
              - command:
                - consul-operator
                env:
                - name: WATCH_NAMESPACE
                  valueFrom:
                    fieldRef:
                      fieldPath: metadata.annotations['olm.targetNamespaces']
                image: consul-operator:1.19
                imagePullPolicy: IfNotPresent
                name: consul-operator
                resources:
                  limits:
                    memory: 384Mi
                    cpu: 250m
              serviceAccountName: consul-operator
              imagePullSecrets:
                - name: pull-secret
      permissions:
      - rules:
        - apiGroups:
          - '*'
          resources:
          - '*'
          verbs:
          - '*'
        serviceAccountName: consul-operator
    strategy: deployment
  installModes:
  - supported: true
    type: OwnNamespace
  - supported: true
    type: SingleNamespace
  - supported: false
    type: MultiNamespace
  - supported: true
    type: AllNamespaces
  maturity: alpha
  provider: {}
  version: 0.0.10

The deployment created by the olm-operator based on the CSV, with empty resources section:

apiVersion: apps/v1
kind: Deployment
metadata:
  annotations:
    deployment.kubernetes.io/revision: "1"
  creationTimestamp: "2020-12-17T09:15:42Z"
  generation: 4
  labels:
    olm.deployment-spec-hash: 65fb759884
    olm.owner: consul.v0.0.10
    olm.owner.kind: ClusterServiceVersion
    olm.owner.namespace: consul-stable
    operators.coreos.com/consul.consul-stable: ""
  name: consul-operator
  namespace: consul-stable
  ownerReferences:
  - apiVersion: operators.coreos.com/v1alpha1
    blockOwnerDeletion: false
    controller: false
    kind: ClusterServiceVersion
    name: consul.v0.0.10
    uid: edc91de1-e2c1-46c1-b5b3-613c717e7e06
  resourceVersion: "46735524"
  selfLink: /apis/apps/v1/namespaces/consul-stable/deployments/consul-operator
  uid: 02e0db72-4933-4303-9b53-661f8438bc14
spec:
  progressDeadlineSeconds: 600
  replicas: 1
  revisionHistoryLimit: 1
  selector:
    matchLabels:
      name: consul-operator
  strategy:
    rollingUpdate:
      maxSurge: 25%
      maxUnavailable: 25%
    type: RollingUpdate
  template:
    metadata:
      annotations:
        capabilities: Basic Install
        olm.operatorGroup: consul
        olm.operatorNamespace: consul-stable
        olm.targetNamespaces: consul-stable
        operatorframework.io/properties: '{"properties":[{"type":"olm.gvk","value":{"group":"application.com","kind":"Consul","version":"v1alpha1"}},{"type":"olm.gvk","value":{"g                              roup":"application.com","kind":"Consul","version":"v1alpha2"}},{"type":"olm.package","value":{"packageName":"consul","version":"0.0.10"}}]}'
      creationTimestamp: null
      labels:
        name: consul-operator
    spec:
      containers:
      - command:
        - consul-operator
        env:
        - name: WATCH_NAMESPACE
          valueFrom:
            fieldRef:
              apiVersion: v1
              fieldPath: metadata.annotations['olm.targetNamespaces']
        - name: POD_NAME
          valueFrom:
            fieldRef:
              apiVersion: v1
              fieldPath: metadata.name
        image: consul-operator:1.19
        imagePullPolicy: IfNotPresent
        name: consul-operator
        resources: {}
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
      dnsPolicy: ClusterFirst
      imagePullSecrets:
      - name: pull-secret
      restartPolicy: Always
      schedulerName: default-scheduler
      securityContext: {}
      serviceAccount: consul-operator
      serviceAccountName: consul-operator
      terminationGracePeriodSeconds: 30
status:
  conditions:
  - lastTransitionTime: "2020-12-17T09:15:42Z"
    lastUpdateTime: "2020-12-17T09:15:42Z"
    message: Deployment does not have minimum availability.
    reason: MinimumReplicasUnavailable
    status: "False"
    type: Available
  - lastTransitionTime: "2020-12-17T09:15:42Z"
    lastUpdateTime: "2020-12-17T09:15:42Z"
    message: 'pods "consul-operator-88f8cb9b-8mbvx" is forbidden: failed quota:
      consul-stable: must specify cpu,memory'
    reason: FailedCreate
    status: "True"
    type: ReplicaFailure
  - lastTransitionTime: "2020-12-17T09:25:42Z"
    lastUpdateTime: "2020-12-17T09:25:42Z"
    message: ReplicaSet "consul-operator-88f8cb9b" has timed out progressing.
    reason: ProgressDeadlineExceeded
    status: "False"
    type: Progressing
  observedGeneration: 4
    unavailableReplicas: 1

What did you expect to see?
If there is no resources config defined in the subscription then the resources defined in the CSV should be preserved.

What did you see instead? Under which circumstances?
The resources section in the deployment was overwritten with the empty section from the subscription.

Environment

  • operator-lifecycle-manager version: 0.17.0
  • Kubernetes version information:

vagrant@vmvagrant> kubectl version
Client Version: version.Info{Major:"1", Minor:"14", GitVersion:"v1.14.2", GitCommit:"66049e3b21efe110454d67df4fa62b08ea79a19b", GitTreeState:"clean", BuildDate:"2019-05-16T16:23:09Z", GoVersion:"go1.12.5", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"16", GitVersion:"v1.16.9", GitCommit:"a17149e1a189050796ced469dbd78d380f2ed5ef", GitTreeState:"clean", BuildDate:"2020-04-16T11:36:15Z", GoVersion:"go1.13.9", Compiler:"gc", Platform:"linux/amd64"}

  • Kubernetes cluster kind:

Possible Solution

It is not checked if the resource config was defined in the subscription and the resources section of the containers is overwritten with the empty structure.

Additional context
#1334 (comment)

@umangachapagain

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug.
Projects
None yet
1 participant