Skip to content

Cannot create CR with custom name by OperandRequest #711

Open
@morningspace

Description

@morningspace

/kind bug

What steps did you take and what happened:

I was looking for a way to have OperandRequest to create the Operand CR with a custom name rather than using the default CR name defined in alm-examples in CSV. By looking at the code, it looks the way to achieve this is using instanceName when define OperandRequest, e.g:

apiVersion: operator.ibm.com/v1alpha1
kind: OperandRequest
metadata:
  name: foo
spec:
  requests:
  - registry: bar
    registryNamespace: default
    operands:
    - name: elastic-cloud-eck
      kind: Elasticsearch
      apiVersion: elasticsearch.k8s.elastic.co/v1
      instanceName: baz
      spec:
        version: 7.13.3
        nodeSets:
        - name: default
          count: 1
          config:
            node.store.allow_mmap: false

However, after I apply the above change, I see ODLM leaves the Operand spec empty:

apiVersion: operator.ibm.com/v1alpha1
kind: OperandRequest
metadata:
  name: foo
spec:
  requests:
  - registry: bar
    registryNamespace: default
    operands:
    - name: elastic-cloud-eck
      kind: Elasticsearch
      apiVersion: elasticsearch.k8s.elastic.co/v1
      instanceName: baz
      spec: {}

This causes the CR failed to recreate, see logs in ODLM:

E0717 10:37:56.184088       1 operandrequest_controller.go:145] failed to reconcile Operands for OperandRequest default/foo: the following errors occurred:
  - the following errors occurred:
  - failed to create custom resource: Elasticsearch.elasticsearch.k8s.elastic.co "baz" is invalid: [spec.nodeSets: Required value, spec.version: Required value]

What did you expect to happen:

ODLM should allow me to create OperandRequest w/ non-empty Operand spec.

Anything else you would like to add:

Environment:

  • ODLM version: latest
  • Minikube/KIND/OCP version: kind v0.12.0-alpha+718ede73045ce3
  • Kubernetes version: (use kubectl version): v1.21.2
  • OS (e.g. from /etc/os-release): RHEL

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions