diff --git a/hack/build-manifests.sh b/hack/build-manifests.sh index b7bff7b5df91..35fe8263f969 100755 --- a/hack/build-manifests.sh +++ b/hack/build-manifests.sh @@ -32,8 +32,33 @@ for arg in $args; do final_out_dir=$(dirname ${MANIFESTS_OUT_DIR}/${arg}) mkdir -p ${final_out_dir} manifest=$(basename -s .in ${arg}) + outfile=${final_out_dir}/${manifest} sed -e "s#{{ docker_tag }}#${docker_tag}#g" \ -e "s#{{ docker_prefix }}#${manifest_docker_prefix}#g" \ -e "s#{{ namespace }}#${namespace}#g" \ - ${KUBEVIRT_DIR}/manifests/$arg >${final_out_dir}/${manifest} + ${KUBEVIRT_DIR}/manifests/$arg >${outfile} + + set +e + grep -q '^.*APPEND_AUTOGENERATED_VM_CRD$' $outfile + append_vm_crd=$? + grep -q '^.*APPEND_AUTOGENERATED_VMRS_CRD$' $outfile + append_vmrs_crd=$? + grep -q '^.*APPEND_AUTOGENERATED_VMPRESET_CRD$' $outfile + append_vmpreset_crd=$? + grep -q '^.*APPEND_AUTOGENERATED_OVM_CRD$' $outfile + append_ovm_crd=$? + set -e + + if [ "$append_vm_crd" -eq 0 ]; then + cat ${KUBEVIRT_DIR}/manifests/generated/vm-resource.yaml >>$outfile + fi + if [ "$append_vmrs_crd" -eq 0 ]; then + cat ${KUBEVIRT_DIR}/manifests/generated/vmrs-resource.yaml >>$outfile + fi + if [ "$append_vmpreset_crd" -eq 0 ]; then + cat ${KUBEVIRT_DIR}/manifests/generated/vmpreset-resource.yaml >>$outfile + fi + if [ "$append_ovm_crd" -eq 0 ]; then + cat ${KUBEVIRT_DIR}/manifests/generated/ovm-resource.yaml >>$outfile + fi done diff --git a/manifests/dev/offline-vm.yaml.in b/manifests/dev/offline-vm.yaml.in index e5d2b96237e6..502aa1ae306e 100644 --- a/manifests/dev/offline-vm.yaml.in +++ b/manifests/dev/offline-vm.yaml.in @@ -1,17 +1 @@ -apiVersion: apiextensions.k8s.io/v1beta1 -kind: CustomResourceDefinition -metadata: - name: offlinevirtualmachines.kubevirt.io - label: - kubevirt.io: "" -spec: - scope: Namespaced - group: kubevirt.io - version: v1alpha1 - names: - kind: OfflineVirtualMachine - plural: offlinevirtualmachines - singular: offlinevirtualmachine - shortNames: - - ovm - - ovms +# APPEND_AUTOGENERATED_OVM_CRD diff --git a/manifests/dev/replicase-resource.yaml.in b/manifests/dev/replicase-resource.yaml.in index c22a81b2da8e..3d70ccf60b80 100644 --- a/manifests/dev/replicase-resource.yaml.in +++ b/manifests/dev/replicase-resource.yaml.in @@ -1,17 +1 @@ -apiVersion: apiextensions.k8s.io/v1beta1 -kind: CustomResourceDefinition -metadata: - name: virtualmachinereplicasets.kubevirt.io - labels: - kubevirt.io: "" -spec: - scope: Namespaced - group: kubevirt.io - version: v1alpha1 - names: - kind: VirtualMachineReplicaSet - plural: virtualmachinereplicasets - singular: virtualmachinereplicaset - shortNames: - - vmrs - - vmrss +# APPEND_AUTOGENERATED_VMRS_CRD diff --git a/manifests/dev/vm-resource.yaml.in b/manifests/dev/vm-resource.yaml.in index debe0d84713e..596909bdf1ee 100644 --- a/manifests/dev/vm-resource.yaml.in +++ b/manifests/dev/vm-resource.yaml.in @@ -1,17 +1 @@ -apiVersion: apiextensions.k8s.io/v1beta1 -kind: CustomResourceDefinition -metadata: - name: virtualmachines.kubevirt.io - labels: - kubevirt.io: "" -spec: - group: kubevirt.io - version: v1alpha1 - scope: Namespaced - names: - plural: virtualmachines - singular: virtualmachine - kind: VirtualMachine - shortNames: - - vm - - vms +# APPEND_AUTOGENERATED_VM_CRD diff --git a/manifests/dev/vmpreset-resource.yaml.in b/manifests/dev/vmpreset-resource.yaml.in index 1cac9596eeed..4ea054a4a9a8 100644 --- a/manifests/dev/vmpreset-resource.yaml.in +++ b/manifests/dev/vmpreset-resource.yaml.in @@ -1,17 +1 @@ -apiVersion: apiextensions.k8s.io/v1beta1 -kind: CustomResourceDefinition -metadata: - name: virtualmachinepresets.kubevirt.io - labels: - kubevirt.io: "" -spec: - group: kubevirt.io - version: v1alpha1 - scope: Namespaced - names: - plural: virtualmachinepresets - singular: virtualmachinepreset - kind: VirtualMachinePreset - shortNames: - - vmpreset - - vmpresets +# APPEND_AUTOGENERATED_VMPRESET_CRD diff --git a/manifests/release/kubevirt.yaml.in b/manifests/release/kubevirt.yaml.in index 18e786f0f316..35ba005d89f2 100644 --- a/manifests/release/kubevirt.yaml.in +++ b/manifests/release/kubevirt.yaml.in @@ -225,43 +225,6 @@ subjects: name: kubevirt-privileged namespace: {{ namespace }} --- -# custom resource definitions -apiVersion: apiextensions.k8s.io/v1beta1 -kind: CustomResourceDefinition -metadata: - name: virtualmachines.kubevirt.io - labels: - kubevirt.io: "" -spec: - group: kubevirt.io - version: v1alpha1 - scope: Namespaced - names: - plural: virtualmachines - singular: virtualmachine - kind: VirtualMachine - shortNames: - - vm - - vms ---- -apiVersion: apiextensions.k8s.io/v1beta1 -kind: CustomResourceDefinition -metadata: - name: virtualmachinereplicasets.kubevirt.io - labels: - kubevirt.io: "" -spec: - scope: Namespaced - group: kubevirt.io - version: v1alpha1 - names: - kind: VirtualMachineReplicaSet - plural: virtualmachinereplicasets - singular: virtualmachinereplicaset - shortNames: - - vmrs - - vmrss ---- apiVersion: v1 kind: Service metadata: @@ -413,39 +376,7 @@ spec: - name: virt-private-dir hostPath: path: /var/run/kubevirt-private ---- -apiVersion: apiextensions.k8s.io/v1beta1 -kind: CustomResourceDefinition -metadata: - name: virtualmachinepresets.kubevirt.io - labels: - kubevirt.io: "" -spec: - group: kubevirt.io - version: v1alpha1 - scope: Namespaced - names: - plural: virtualmachinepresets - singular: virtualmachinepreset - kind: VirtualMachinePreset - shortNames: - - vmpreset - - vmpresets ---- -apiVersion: apiextensions.k8s.io/v1beta1 -kind: CustomResourceDefinition -metadata: - name: offlinevirtualmachines.kubevirt.io - label: - kubevirt.io: "" -spec: - scope: Namespaced - group: kubevirt.io - version: v1alpha1 - names: - kind: OfflineVirtualMachine - plural: offlinevirtualmachines - singular: offlinevirtualmachine - shortNames: - - ovm - - ovms +# APPEND_AUTOGENERATED_VM_CRD +# APPEND_AUTOGENERATED_VMRS_CRD +# APPEND_AUTOGENERATED_VMPRESET_CRD +# APPEND_AUTOGENERATED_OVM_CRD