Skip to content

Commit

Permalink
Generate HCO CRDs from csv-merger and remove templates (#459)
Browse files Browse the repository at this point in the history
manifest-templator is used to render the manifest for
not OLM based deployment; csv-merger is used to render
the unified CSV for OLM based deployment.

OLM bundles are composed by CSV+CRDs but currently
csv-merger renders only the CSV while HCO CRDs (HCO and
v2v-vmware ones) are inheredited from manifest-templator
execution.

This PR will:
- extend csv-merger (downstream we use only this one) to
independently render hco CRDs
- removes /templates which are not used at all

Signed-off-by: Simone Tiraboschi <stirabos@redhat.com>

Co-authored-by: Simone Tiraboschi <stirabos@redhat.com>
  • Loading branch information
kubevirt-bot and tiraboschi authored Feb 21, 2020
1 parent 158e098 commit 2a8e509
Show file tree
Hide file tree
Showing 28 changed files with 202 additions and 1,732 deletions.
5 changes: 1 addition & 4 deletions build/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,12 @@ FROM registry.access.redhat.com/ubi8/ubi-minimal
ENV OPERATOR=/usr/local/bin/hyperconverged-cluster-operator \
CSV_MERGER=/usr/local/bin/csv-merger \
USER_UID=1001 \
USER_NAME=hyperconverged-cluster-operator \
CSV_TEMPLATE=/var/hco-csv-template.yaml.in

USER_NAME=hyperconverged-cluster-operator

COPY --from=builder /go/src/github.com/kubevirt/hyperconverged-cluster-operator/build/bin/ /usr/local/bin
RUN /usr/local/bin/user_setup
COPY --from=builder /go/src/github.com/kubevirt/hyperconverged-cluster-operator/_out/hyperconverged-cluster-operator $OPERATOR
COPY --from=builder /go/src/github.com/kubevirt/hyperconverged-cluster-operator/_out/csv-merger $CSV_MERGER
COPY --from=builder /go/src/github.com/kubevirt/hyperconverged-cluster-operator/templates/olm-catalog/kubevirt-hyperconverged/VERSION/kubevirt-hyperconverged-operator.VERSION.clusterserviceversion_merger.yaml.in $CSV_TEMPLATE
ENTRYPOINT ["/usr/local/bin/entrypoint"]
USER ${USER_UID}

Expand Down
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions deploy/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ kubectl config set-context $(kubectl config current-context) --namespace=kubevir
# Launch all of the CRDs.
kubectl create -f https://raw.githubusercontent.com/kubevirt/hyperconverged-cluster-operator/master/deploy/crds/cluster-network-addons00.crd.yaml
kubectl create -f https://raw.githubusercontent.com/kubevirt/hyperconverged-cluster-operator/master/deploy/crds/containerized-data-importer00.crd.yaml
kubectl create -f https://raw.githubusercontent.com/kubevirt/hyperconverged-cluster-operator/master/deploy/crds/hco.crd.yaml
kubectl create -f https://raw.githubusercontent.com/kubevirt/hyperconverged-cluster-operator/master/deploy/crds/hco00.crd.yaml
kubectl create -f https://raw.githubusercontent.com/kubevirt/hyperconverged-cluster-operator/master/deploy/crds/kubevirt00.crd.yaml
kubectl create -f https://raw.githubusercontent.com/kubevirt/hyperconverged-cluster-operator/master/deploy/crds/node-maintenance00.crd.yaml
kubectl create -f https://raw.githubusercontent.com/kubevirt/hyperconverged-cluster-operator/master/deploy/crds/scheduling-scale-performance00.crd.yaml
kubectl create -f https://raw.githubusercontent.com/kubevirt/hyperconverged-cluster-operator/master/deploy/crds/scheduling-scale-performance01.crd.yaml
kubectl create -f https://raw.githubusercontent.com/kubevirt/hyperconverged-cluster-operator/master/deploy/crds/scheduling-scale-performance02.crd.yaml
kubectl create -f https://raw.githubusercontent.com/kubevirt/hyperconverged-cluster-operator/master/deploy/crds/scheduling-scale-performance03.crd.yaml
kubectl create -f https://raw.githubusercontent.com/kubevirt/hyperconverged-cluster-operator/master/deploy/crds/v2vvmware.crd.yaml
kubectl create -f https://raw.githubusercontent.com/kubevirt/hyperconverged-cluster-operator/master/deploy/crds/hco01.crd.yaml

# Launch all of the Service Accounts, Cluster Role(Binding)s, and Operators.
kubectl create -f https://raw.githubusercontent.com/kubevirt/hyperconverged-cluster-operator/master/deploy/cluster_role.yaml
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ metadata:
categories: OpenShift Optional
certified: "false"
containerImage: quay.io/kubevirt/hyperconverged-cluster-operator:latest
createdAt: "2020-02-15 10:58:39"
createdAt: "2020-02-18 14:13:09"
description: |-
**HyperConverged Cluster Operator** is an Operator pattern for managing multi-operator products.
Specifcally, the HyperConverged Cluster Operator manages the deployment of KubeVirt,
Expand Down
23 changes: 18 additions & 5 deletions hack/build-manifests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -206,10 +206,21 @@ spec:
provider:
name: KubeVirt project
EOM

# Write HCO CRDs
(cd ${PROJECT_ROOT}/tools/csv-merger/ && go build)
hco_crds=${TEMPDIR}/hco.crds.yaml
${PROJECT_ROOT}/tools/csv-merger/csv-merger --output-mode=CRDs > $hco_crds
csplit --digits=2 --quiet --elide-empty-files \
--prefix=hco \
--suffix-format="%02d.${CRD_EXT}" \
$hco_crds \
"/---/" "{*}"

popd

mkdir -p "${CSV_DIR}"
cp -f ${TEMPDIR}/*.${CRD_EXT} ${CRD_DIR}
rm -f ${CSV_DIR}/*

# Build and write deploy dir
(cd ${PROJECT_ROOT}/tools/manifest-templator/ && go build)
Expand All @@ -225,11 +236,7 @@ ${PROJECT_ROOT}/tools/manifest-templator/manifest-templator \
--operator-image="${OPERATOR_IMAGE}"
(cd ${PROJECT_ROOT}/tools/manifest-templator/ && go clean)

# Copy all CRDs into the CSV direcotry
cp -f ${CRD_DIR}/*.${CRD_EXT} ${CSV_DIR}

# Build and merge CSVs
(cd ${PROJECT_ROOT}/tools/csv-merger/ && go build)
${PROJECT_ROOT}/tools/csv-merger/csv-merger \
--cna-csv="$(<${cnaCsv})" \
--virt-csv="$(<${virtCsv})" \
Expand All @@ -247,5 +254,11 @@ ${PROJECT_ROOT}/tools/csv-merger/csv-merger \
--operator-image-name="${OPERATOR_IMAGE}" > "${CSV_DIR}/${OPERATOR_NAME}.v${CSV_VERSION}.${CSV_EXT}"
(cd ${PROJECT_ROOT}/tools/csv-merger/ && go clean)

# Copy all CRDs into the CRD and CSV directories
rm -f ${CRD_DIR}/*
cp -f ${TEMPDIR}/*.${CRD_EXT} ${CRD_DIR}
cp -f ${TEMPDIR}/*.${CRD_EXT} ${CSV_DIR}


# Intentionally removing last so failure leaves around the templates
rm -rf ${TEMPDIR}
198 changes: 0 additions & 198 deletions templates/cluster_role.yaml.in

This file was deleted.

Loading

0 comments on commit 2a8e509

Please sign in to comment.