Skip to content

Defining env variables in Subscription creates two ReplicaSetsΒ #2725

@ryanemerson

Description

@ryanemerson

Bug Report

What did you do?
Create a Subscription with environment variables defined via spec.config.env:

apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
  name: my-infinispan
  namespace: namespace-for-testing
spec:
  channel: 2.2.x
  name: infinispan
  source: operatorhubio-catalog
  sourceNamespace: olm
  config:
    env:
      - name: example-env
        value: some-value

What did you expect to see?
I expect the operator's deployment to be created with a single ReplicaSet containing the configured environment variables.

What did you see instead? Under which circumstances?
The deployment was created with two ReplicaSet instances. The first ReplicaSet does not contain the defined environment variables, but the second does. Eventually only the second ReplicaSet remains in an active state and the operator pods have the environment variables as expected.

The problem is that while the first ReplicaSet is active, the Deployment's readiness probes can pass and the operator pods without the environment variables will start reconciling CR resources. This is problematic in our case, as we use env variables in the operator pods to define default annotation/labels that must be applied to CR resources. Therefore CRs reconciled when the first ReplicaSet is active will be missing these defaults.

Environment

  • operator-lifecycle-manager version:

v.0.20.0

  • Kubernetes version information:

v.1.21.1

  • Kubernetes cluster kind:

kind

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugCategorizes issue or PR as related to a bug.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions