IBM / operand-deployment-lifecycle-manager

Managing the lifecycle for a group of operands
Apache License 2.0
32 stars 46 forks source link

Cannot create CR with custom name by OperandRequest #711

Open morningspace opened 3 years ago

morningspace commented 3 years ago

/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:

Daniel-Fan commented 3 years ago

Hi @morningspace

It is because we did not preserve the unknown filed for CR's spec section. PR is created #702

morningspace commented 3 years ago

Thanks, I see it's been opened for a while, wonder when will this be merged :-)

Daniel-Fan commented 3 years ago

It will be merged on next Monday, but it will take a while to include this fix in public build.