operand-deployment-lifecycle-manager
                                
                                 operand-deployment-lifecycle-manager copied to clipboard
                                
                                    operand-deployment-lifecycle-manager copied to clipboard
                            
                            
                            
                        Cannot create CR with custom name by OperandRequest
/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
Hi @morningspace
It is because we did not preserve the unknown filed for CR's spec section. PR is created #702
Thanks, I see it's been opened for a while, wonder when will this be merged :-)
It will be merged on next Monday, but it will take a while to include this fix in public build.