Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ docker-registry-cleanup: ## Clean up all cached images from docker registry. Acc
publish: manifests push ## Generate a cdi-controller and operator manifests and push the built container images to the registry defined in DOCKER_PREFIX

manifests: ## Generate a cdi-controller and operator manifests in '_out/manifests/'. Accepts [make variables]\(#make-variables\) DOCKER_TAG, DOCKER_PREFIX, VERBOSITY, PULL_POLICY, CSV_VERSION, QUAY_REPOSITORY, QUAY_NAMESPACE
${DO_BAZ} "DOCKER_PREFIX=${DOCKER_PREFIX} DOCKER_TAG=${DOCKER_TAG} VERBOSITY=${VERBOSITY} PULL_POLICY=${PULL_POLICY} CR_NAME=${CR_NAME} CDI_NAMESPACE=${CDI_NAMESPACE} ./hack/build/build-manifests.sh"
${DO_BAZ} "DOCKER_PREFIX=${DOCKER_PREFIX} DOCKER_TAG=${DOCKER_TAG} VERBOSITY=${VERBOSITY} PULL_POLICY=${PULL_POLICY} CR_NAME=${CR_NAME} CDI_NAMESPACE=${CDI_NAMESPACE} EXTRA_IMAGES=\"${EXTRA_IMAGES}\" ./hack/build/build-manifests.sh"

release-description: ## Generate a release announcement detailing changes between 2 commits (typically tags). Expects 'RELREF' and 'PREREF' to be set
./hack/build/release-description.sh ${RELREF} ${PREREF}
Expand All @@ -140,6 +140,7 @@ openshift-ci-image-push: ## Build and push the OpenShift CI build+test container
##@ Local cluster management
cluster-up: ## Start a default Kubernetes or Open Shift cluster. set KUBEVIRT_PROVIDER environment variable to either 'k8s-1.18' or 'os-3.11.0' to select the type of cluster. set KUBEVIRT_NUM_NODES to something higher than 1 to have more than one node.
./cluster-up/up.sh
./hack/extra-images.sh

cluster-down: ## Stop the cluster, doing a make cluster-down && make cluster-up will basically restart the cluster into an empty fresh state.
./cluster-up/down.sh
Expand Down
14 changes: 14 additions & 0 deletions hack/build/build-manifests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,20 @@ source "${script_dir}"/resource-generator.sh

mkdir -p "${MANIFEST_GENERATED_DIR}/"

# Update manifests to replace extra images with internal registry ones
if [ -n "${EXTRA_IMAGES-}" ]; then
for img in ${EXTRA_IMAGES}; do
base_image_path="${img#*/}"
local_img_url="registry:5000/${base_image_path}"
if [ "$img" = "${EXTERNAL_IMAGE_MINIO}" ]; then
EXTERNAL_IMAGE_MINIO=$local_img_url
fi
if [ "$img" = "${EXTERNAL_IMAGE_FAKEOVIRT}" ]; then
EXTERNAL_IMAGE_FAKEOVIRT=$local_img_url
fi
done
fi

#generate operator related manifests used to deploy cdi with operator-framework
generateResourceManifest $generator $MANIFEST_GENERATED_DIR "operator" "everything" "operator-everything.yaml.in"

Expand Down
3 changes: 3 additions & 0 deletions hack/build/config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ CDI_LOGO_PATH=${CDI_LOGO_PATH:-"assets/cdi_logo.png"}
# oVirt populator image, by default it is the same as the importer image
OVIRT_POPULATOR_IMAGE_NAME=${OVIRT_POPULATOR_IMAGE_NAME:-cdi-importer}

EXTERNAL_IMAGE_MINIO=${EXTERNAL_IMAGE_MINIO:-quay.io/kubevirt/minio:RELEASE.2024-10-02T17-50-41Z}
EXTERNAL_IMAGE_FAKEOVIRT=${EXTERNAL_IMAGE_FAKEOVIRT:-quay.io/kubevirt/fakeovirt:v1.38.0}

function allPkgs() {
ret=$(sed "s,kubevirt.io/containerized-data-importer,${CDI_DIR},g" <(go list ./pkg/... ./tools/... ./tests/... ./cmd/... | grep -v "pkg/client" | sort -u))
echo "$ret"
Expand Down
4 changes: 4 additions & 0 deletions hack/build/resource-generator.sh
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,8 @@ function populateResourceManifest() {
-uploadproxy-image="${DOCKER_PREFIX}/${UPLOADPROXY_IMAGE_NAME}:${DOCKER_TAG}" \
-uploadserver-image="${DOCKER_PREFIX}/${UPLOADSERVER_IMAGE_NAME}:${DOCKER_TAG}" \
-ovirt-populator-image="${OVIRT_POPULATOR_IMAGE_NAME}" \
-external-image-minio="${EXTERNAL_IMAGE_MINIO}" \
-external-image-fakeovirt="${EXTERNAL_IMAGE_FAKEOVIRT}" \
-verbosity="${VERBOSITY}" \
-pull-policy="${PULL_POLICY}" \
-cr-name="${CR_NAME}" \
Expand All @@ -152,6 +154,8 @@ function populateResourceManifest() {
-apiserver-image="{{ apiserver_image }}" \
-uploadproxy-image="{{ uploadproxy_image }}" \
-uploadserver-image="{{ uploadserver_image }}" \
-external-image-minio="{{ external_image_minio }}" \
-external-image-fakeovirt="{{ external_image_fakeovirt }}" \
-verbosity="${VERBOSITY}" \
-pull-policy="{{ pull_policy }}" \
-namespace="{{ cdi_namespace }}" \
Expand Down
24 changes: 24 additions & 0 deletions hack/extra-images.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/usr/bin/env bash

set -e

script_dir="$(cd "$(dirname "$0")" && pwd -P)"
source "${script_dir}"/build/common.sh
source ./cluster-up/hack/common.sh
source ./cluster-up/cluster/${KUBEVIRT_PROVIDER}/provider.sh

cri_bin=$1
if [ -z $cri_bin ]; then
cri_bin=$CDI_CRI
fi

if [ -n "${EXTRA_IMAGES}" ]; then
registry_port=$(_port registry)
for img in ${EXTRA_IMAGES}; do
base_image_path="${img#*/}"
local_img_url="localhost:${registry_port}/${base_image_path}"
$cri_bin pull $img
$cri_bin tag $img $local_img_url
$cri_bin push $local_img_url
done
fi
2 changes: 1 addition & 1 deletion manifests/templates/file-host.yaml.in
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ spec:
initialDelaySeconds: 20
periodSeconds: 20
- name: s3
image: quay.io/kubevirt/minio:RELEASE.2024-10-02T17-50-41Z
image: {{ .ExternalImageMinio }}
imagePullPolicy: {{ .PullPolicy }}
env:
- name: MINIO_ACCESS_KEY
Expand Down
2 changes: 1 addition & 1 deletion manifests/templates/imageio.yaml.in
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ spec:
add-ticket myticket.json && tail -n+1 -f /var/log/ovirt-imageio/daemon.log
- name: fakeovirt
# Docker file: https://github.com/machacekondra/fakeovirt
image: quay.io/kubevirt/fakeovirt:v1.38.0
image: {{ .ExternalImageFakeovirt }}
imagePullPolicy: {{ .PullPolicy }}
ports:
- containerPort: 12346
Expand Down
2 changes: 2 additions & 0 deletions pkg/operator/resources/namespaced/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ type FactoryArgs struct {
APIServerImage string `required:"true" envconfig:"apiserver_image"`
UploadProxyImage string `required:"true" split_words:"true"`
UploadServerImage string `required:"true" split_words:"true"`
ExternalImageMinio string `split_words:"true"`
ExternalImageFakeovirt string `split_words:"true"`
Verbosity string `required:"true"`
PullPolicy string `required:"true" split_words:"true"`
ImagePullSecrets []corev1.LocalObjectReference
Expand Down
33 changes: 22 additions & 11 deletions tools/manifest-generator/manifest-generator.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ type templateData struct {
APIServerImage string
UploadProxyImage string
UploadServerImage string
ExternalImageMinio string
ExternalImageFakeovirt string
Verbosity string
PullPolicy string
CrName string
Expand All @@ -62,6 +64,8 @@ var (
apiServerImage = flag.String("apiserver-image", "", "")
uploadProxyImage = flag.String("uploadproxy-image", "", "")
uploadServerImage = flag.String("uploadserver-image", "", "")
externalImageMinio = flag.String("external-image-minio", "", "")
externalImageFakeovirt = flag.String("external-image-fakeovirt", "", "")
verbosity = flag.String("verbosity", "1", "")
pullPolicy = flag.String("pull-policy", "", "")
crName = flag.String("cr-name", "", "")
Expand All @@ -76,6 +80,9 @@ func main() {

klogFlags := flag.NewFlagSet("klog", flag.ExitOnError)
klog.InitFlags(klogFlags)

klog.Info("========Generator", "templFile", templFile)

flag.CommandLine.VisitAll(func(f1 *flag.Flag) {
f2 := klogFlags.Lookup(f1.Name)
if f2 != nil {
Expand Down Expand Up @@ -108,6 +115,8 @@ func generateFromFile(templFile string) {
APIServerImage: *apiServerImage,
UploadProxyImage: *uploadProxyImage,
UploadServerImage: *uploadServerImage,
ExternalImageMinio: *externalImageMinio,
ExternalImageFakeovirt: *externalImageFakeovirt,
PullPolicy: *pullPolicy,
CrName: *crName,
Namespace: *namespace,
Expand Down Expand Up @@ -205,17 +214,19 @@ func getClusterResources(codeGroup string) ([]client.Object, error) {

func getNamespacedResources(codeGroup string) ([]client.Object, error) {
args := &cdinamespaced.FactoryArgs{
Verbosity: *verbosity,
OperatorVersion: *operatorVersion,
ControllerImage: *controllerImage,
ImporterImage: *importerImage,
ClonerImage: *clonerImage,
OvirtPopulatorImage: *ovirtPopulatorImage,
APIServerImage: *apiServerImage,
UploadProxyImage: *uploadProxyImage,
UploadServerImage: *uploadServerImage,
PullPolicy: *pullPolicy,
Namespace: *namespace,
Verbosity: *verbosity,
OperatorVersion: *operatorVersion,
ControllerImage: *controllerImage,
ImporterImage: *importerImage,
ClonerImage: *clonerImage,
OvirtPopulatorImage: *ovirtPopulatorImage,
APIServerImage: *apiServerImage,
UploadProxyImage: *uploadProxyImage,
UploadServerImage: *uploadServerImage,
ExternalImageMinio: *externalImageMinio,
ExternalImageFakeovirt: *externalImageFakeovirt,
PullPolicy: *pullPolicy,
Namespace: *namespace,
}

return cdinamespaced.CreateResourceGroup(codeGroup, args)
Expand Down