kubevirt / containerized-data-importer

Data Import Service for kubernetes, designed with kubevirt in mind.
Apache License 2.0
418 stars 261 forks source link

Include csv-generator to published operator container #1032

Closed djzager closed 4 years ago

djzager commented 4 years ago

Is this a BUG REPORT or FEATURE REQUEST?:

/kind enhancement

related: https://github.com/kubevirt/hostpath-provisioner-operator/issues/28

This pull request in HCO makes use of the csv-generator in all of the component operators (including this one) to build all of the manifests (most importantly the HCO CSV). The idea is to make it less burdensome on component operator developers to help keep the HCO CSV up-to-date, by simply using the csv-generator to get all of the important information (deployment spec, CRDs, rbac).

@awels pointed out, and I confirmed, that the next release of CDI will not include the csv-generator:

$ docker run --entrypoint /usr/bin/csv-generator docker.io/kubevirt/cdi-operator:latest
Unable to find image 'kubevirt/cdi-operator:latest' locally
latest: Pulling from kubevirt/cdi-operator
21d95e340ee0: Already exists
38fb14371f87: Pull complete
Digest: sha256:122f6e25a86e8dfc58b3012c60d242f22862331f3f50f532ae208927ae96902c
Status: Downloaded newer image for kubevirt/cdi-operator:latest
docker: Error response from daemon: OCI runtime create failed: container_linux.go:348: starting container process caused "exec: \"/usr/bin/csv-generator\": stat /usr/bin/csv-generator: no such file or directory": unknown.
ERRO[0001] error waiting for container: context canceled
tiraboschi commented 4 years ago

v1.12.0 doesn't include anymore csv-generator so we are not able to generate a unified CSV with it on HCO side:

[stirabos@t470s hyperconverged-cluster-operator]$ docker run --rm --entrypoint=/usr/bin/csv-generator docker.io/kubevirt/cdi-operator:v1.12.0 --namespace=kubevirt-hyperconverged --csv-version=1.0.0 --pull-policy=IfNotPresent --operator-image=docker.io/kubevirt/cdi-operator:v1.12.0 --controller-image=docker.io/kubevirt/cdi-controller:v1.12.0 --apiserver-image=docker.io/kubevirt/cdi-apiserver:v1.12.0 --cloner-image=docker.io/kubevirt/cdi-cloner:v1.12.0 --importer-image=docker.io/kubevirt/cdi-importer:v1.12.0 --uploadproxy-image=docker.io/kubevirt/cdi-uploadproxy:v1.12.0 --uploadserver-image=docker.io/kubevirt/cdi-uploadserver:v1.12.0 --dump-crds
docker: Error response from daemon: OCI runtime create failed: container_linux.go:346: starting container process caused "exec: \"/usr/bin/csv-generator\": stat /usr/bin/csv-generator: no such file or directory": unknown.

it was working in v1.11.0:

[stirabos@t470s hyperconverged-cluster-operator]$ docker run --rm --entrypoint=/usr/bin/csv-generator docker.io/kubevirt/cdi-operator:v1.11.0 --namespace=kubevirt-hyperconverged --csv-version=1.0.0 --pull-policy=IfNotPresent --operator-image=docker.io/kubevirt/cdi-operator:v1.11.0 --controller-image=docker.io/kubevirt/cdi-controller:v1.11.0 --apiserver-image=docker.io/kubevirt/cdi-apiserver:v1.11.0 --cloner-image=docker.io/kubevirt/cdi-cloner:v1.11.0 --importer-image=docker.io/kubevirt/cdi-importer:v1.11.0 --uploadproxy-image=docker.io/kubevirt/cdi-uploadproxy:v1.11.0 --uploadserver-image=docker.io/kubevirt/cdi-uploadserver:v1.11.0 --dump-crds
---
apiVersion: operators.coreos.com/v1alpha1
kind: ClusterServiceVersion
metadata:
  annotations:
    alm-examples: |2-

            [
              {
                "apiVersion":"cdi.kubevirt.io/v1alpha1",
                "kind":"CDI",
                "metadata": {
                  "name":"cdi",
                  "namespace":"cdi"
                },
                "spec": {
                  "imagePullPolicy":"IfNotPresent"
                }
              }
            ]
    capabilities: Full Lifecycle
    categories: Storage,Virtualization
    description: Creates and maintains CDI deployments
  name: cdioperator.1.0.0
  namespace: kubevirt-hyperconverged
spec:
  apiservicedefinitions: {}
  customresourcedefinitions:
    owned:
    - description: Represents a CDI deployment
      displayName: CDI deployment
      kind: CDI
      name: cdis.cdi.kubevirt.io
      resources:
      - kind: ConfigMap
        name: cdi-operator-leader-election-helper
        version: v1
      specDescriptors:
      - description: The ImageRegistry to use for the CDI components.
        displayName: ImageRegistry
        path: imageRegistry
        x-descriptors:
        - urn:alm:descriptor:text
      - description: The ImageTag to use for the CDI components.
        displayName: ImageTag
        path: imageTag
        x-descriptors:
        - urn:alm:descriptor:text
      - description: The ImagePullPolicy to use for the CDI components.
        displayName: ImagePullPolicy
        path: imagePullPolicy
        x-descriptors:
        - urn:alm:descriptor:io.kubernetes:imagePullPolicy
      statusDescriptors:
      - description: The deployment phase.
        displayName: Phase
        path: phase
        x-descriptors:
        - urn:alm:descriptor:io.kubernetes.phase
      - description: Explanation for the current status of the CDI deployment.
        displayName: Conditions
        path: conditions
        x-descriptors:
        - urn:alm:descriptor:io.kubernetes.conditions
      - description: The observed version of the CDI deployment.
        displayName: Observed CDI Version
        path: observedVersion
        x-descriptors:
        - urn:alm:descriptor:text
      - description: The targeted version of the CDI deployment.
        displayName: Target CDI Version
        path: targetVersion
        x-descriptors:
        - urn:alm:descriptor:text
      - description: The version of the CDI Operator
        displayName: CDI Operator Version
        path: operatorVersion
        x-descriptors:
        - urn:alm:descriptor:text
      version: v1alpha1
  description: |2

    CDI is a kubernetes extension that provides the ability to populate PVCs with VM images upon creation. Multiple image formats and sources are supported

    _The CDI Operator does not support updates yet._
  displayName: CDI
  icon:
  - base64data: ""
    mediatype: image/png
  install:
    spec:
      clusterPermissions:
      - rules:
        - apiGroups:
          - rbac.authorization.k8s.io
          resources:
          - roles
          - rolebindings
          - clusterrolebindings
          - clusterroles
          verbs:
          - '*'
        - apiGroups:
          - security.openshift.io
          resources:
          - securitycontextconstraints
          verbs:
          - get
          - list
          - watch
          - patch
          - update
        - apiGroups:
          - ""
          resources:
          - serviceaccounts
          - services
          verbs:
          - '*'
        - apiGroups:
          - ""
          resources:
          - nodes
          verbs:
          - get
          - list
          - watch
          - update
          - patch
        - apiGroups:
          - extensions
          resources:
          - deployments
          verbs:
          - '*'
        - apiGroups:
          - extensions
          resources:
          - ingresses
          verbs:
          - get
          - list
          - watch
        - apiGroups:
          - ""
          resources:
          - configmaps
          verbs:
          - watch
          - create
          - delete
          - get
          - update
          - patch
          - list
        - apiGroups:
          - batch
          resources:
          - jobs
          verbs:
          - create
          - delete
          - get
          - update
          - patch
          - list
        - apiGroups:
          - apiextensions.k8s.io
          resources:
          - customresourcedefinitions
          verbs:
          - create
          - delete
          - get
          - update
          - patch
          - list
          - watch
        - apiGroups:
          - apps
          resources:
          - deployments
          - deployments/finalizers
          - daemonstes
          verbs:
          - create
          - get
          - list
          - delete
          - watch
          - update
        - apiGroups:
          - admissionregistration.k8s.io
          resources:
          - validatingwebhookconfigurations
          - mutatingwebhookconfigurations
          verbs:
          - get
          - create
          - update
        - apiGroups:
          - apiregistration.k8s.io
          resources:
          - apiservices
          verbs:
          - get
          - list
          - watch
          - create
          - update
          - patch
        - apiGroups:
          - cdi.kubevirt.io
          - upload.cdi.kubevirt.io
          resources:
          - '*'
          verbs:
          - '*'
        - apiGroups:
          - storage.k8s.io
          resources:
          - storageclasses
          verbs:
          - get
          - list
        - apiGroups:
          - ""
          resources:
          - events
          verbs:
          - create
          - update
          - patch
        - apiGroups:
          - ""
          resources:
          - pods
          - persistentvolumeclaims
          - volumesnapshots
          verbs:
          - get
          - list
          - watch
          - create
          - update
          - patch
          - delete
        - apiGroups:
          - ""
          resources:
          - persistentvolumeclaims/finalizers
          - pods/finalizers
          - volumesnapshots/finalizers
          verbs:
          - update
        - apiGroups:
          - ""
          resources:
          - services
          verbs:
          - get
          - list
          - watch
          - create
          - delete
        - apiGroups:
          - ""
          resources:
          - secrets
          verbs:
          - get
          - list
          - watch
          - create
        - apiGroups:
          - ""
          resources:
          - namespaces
          verbs:
          - get
          - list
        - apiGroups:
          - route.openshift.io
          resources:
          - routes
          verbs:
          - get
          - list
          - watch
          - create
          - update
          - patch
        - apiGroups:
          - route.openshift.io
          resources:
          - routes/custom-host
          verbs:
          - create
          - update
        - apiGroups:
          - snapshot.storage.k8s.io
          resources:
          - '*'
          verbs:
          - '*'
        - apiGroups:
          - apiextensions.k8s.io
          resources:
          - customresourcedefinitions
          verbs:
          - '*'
        serviceAccountName: cdi-operator
      deployments:
      - name: cdi-operator
        spec:
          replicas: 1
          selector:
            matchLabels:
              name: cdi-operator
              operator.cdi.kubevirt.io: ""
          strategy: {}
          template:
            metadata:
              labels:
                name: cdi-operator
                operator.cdi.kubevirt.io: ""
            spec:
              containers:
              - env:
                - name: DEPLOY_CLUSTER_RESOURCES
                  value: "true"
                - name: OPERATOR_VERSION
                - name: CONTROLLER_IMAGE
                  value: docker.io/kubevirt/cdi-controller:v1.11.0
                - name: IMPORTER_IMAGE
                  value: docker.io/kubevirt/cdi-importer:v1.11.0
                - name: CLONER_IMAGE
                  value: docker.io/kubevirt/cdi-cloner:v1.11.0
                - name: APISERVER_IMAGE
                  value: docker.io/kubevirt/cdi-apiserver:v1.11.0
                - name: UPLOAD_SERVER_IMAGE
                  value: docker.io/kubevirt/cdi-uploadserver:v1.11.0
                - name: UPLOAD_PROXY_IMAGE
                  value: docker.io/kubevirt/cdi-uploadproxy:v1.11.0
                - name: VERBOSITY
                  value: "1"
                - name: PULL_POLICY
                  value: IfNotPresent
                image: docker.io/kubevirt/cdi-operator:v1.11.0
                imagePullPolicy: IfNotPresent
                name: cdi-operator
                ports:
                - containerPort: 60000
                  name: metrics
                  protocol: TCP
                resources: {}
              securityContext:
                runAsNonRoot: true
              serviceAccountName: cdi-operator
    strategy: deployment
  installModes:
  - supported: true
    type: OwnNamespace
  - supported: true
    type: SingleNamespace
  - supported: true
    type: MultiNamespace
  - supported: true
    type: AllNamespaces
  keywords:
  - CDI
  - Virtualization
  - Storage
  labels:
    alm-owner-cdi: cdi-operator
    operated-by: cdi-operator
  links:
  - name: CDI
    url: https://github.com/kubevirt/containerized-data-importer/blob/master/README.md
  - name: Source Code
    url: https://github.com/kubevirt/containerized-data-importer
  maintainers:
  - email: kubevirt-dev@googlegroups.com
    name: KubeVirt project
  maturity: alpha
  provider:
    name: KubeVirt/CDI project
  selector:
    matchLabels:
      alm-owner-cdi: cdi-operator
      operated-by: cdi-operator
  version: 1.0.0
---
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
  labels:
    operator.cdi.kubevirt.io: ""
  name: cdis.cdi.kubevirt.io
spec:
  additionalPrinterColumns:
  - JSONPath: .metadata.creationTimestamp
    name: Age
    type: date
  - JSONPath: .status.phase
    name: Phase
    type: string
  group: cdi.kubevirt.io
  names:
    categories:
    - all
    kind: CDI
    listKind: CDIList
    plural: cdis
    shortNames:
    - cdi
    - cdis
    singular: cdi
  scope: Cluster
  version: v1alpha1
  versions:
  - name: v1alpha1
    served: true
    storage: true
fabiand commented 4 years ago

@awels @aglitke @tiraboschi what do we need to get this work merged? Or: Why is this work not getting merged?

awels commented 4 years ago

We need to add the binary to the BUILD.bazel for the operator. Working on it.