Skip to content
This repository has been archived by the owner on Dec 4, 2023. It is now read-only.

Commit

Permalink
Use new bundle format (#5138)
Browse files Browse the repository at this point in the history
* Switch to use new bundle format in olm manifest
* Create OLM index
* Enable systemtests to work with new OLM index.
  • Loading branch information
Ulf Lilleengen authored Aug 19, 2020
1 parent 2cb12fa commit 6ab123b
Show file tree
Hide file tree
Showing 92 changed files with 211 additions and 14,784 deletions.
3 changes: 3 additions & 0 deletions .github/scripts/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,6 @@ make -j 4 docker_tag docker_push

echo "Generate templates"
make templates

echo "Generate OLM index"
make olmindex olmindex_push
6 changes: 6 additions & 0 deletions .github/scripts/setup-olm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,9 @@ kubectl apply -f https://github.com/operator-framework/operator-lifecycle-manage

# Delete "operatorhubio-catalog"
kubectl delete catalogsource operatorhubio-catalog -n olm


# Install OPM tool
curl -o opm -L https://github.com/operator-framework/operator-registry/releases/download/v1.13.7/linux-amd64-opm
chmod 755 opm
sudo mv opm /usr/bin
8 changes: 7 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ DOCKER_DIRS = \
keycloak-plugin \
service-broker \
console/console-init \
olm-manifest \
olm-manifest

FULL_BUILD = true
GOOPTS ?= -mod=vendor
Expand Down Expand Up @@ -50,6 +50,12 @@ build_java: build_go templates

build_go: $(GO_DIRS) test_go

olmindex:
$(MAKE) -C olm-index docker_build docker_tag

olmindex_push:
$(MAKE) -C olm-index docker_push

imageenv:
@echo $(IMAGE_ENV) > imageenv.txt

Expand Down
7 changes: 5 additions & 2 deletions Makefile.common
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ buildpush:
$(MAKE) docker_tag
$(MAKE) docker_push

docker_build: package
docker_build: package image_deps
if [ -f Dockerfile ]; then $(DOCKER) build $(DOCKER_BUILD_ARGS) --build-arg maven_version=$(MAVEN_VERSION) --build-arg version=$(VERSION) --build-arg revision=$(REVISION) -t $(PROJECT_PREFIX)-$(PROJECT_NAME):$(VERSION) . ; fi
if [ -f Dockerfile ]; then $(DOCKER) images | grep $(PROJECT_PREFIX); fi

Expand All @@ -57,5 +57,8 @@ kind_load_image:
buildpushkind: all docker_build docker_tag kind_load_image
:

image_deps::
:


.PHONY: all init build test package clean docker_build docker_tag docker_push kind_load_image buildpushkind buildpush
.PHONY: all init build test package clean docker_build docker_tag docker_push kind_load_image buildpushkind buildpush image_deps
29 changes: 17 additions & 12 deletions Makefile.env.mk
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
# Docker env
DOCKER_REGISTRY ?= quay.io
DOCKER_ORG ?= enmasse
DOCKER ?= docker
PROJECT_PREFIX ?= enmasse
PROJECT_NAME ?= $(shell basename $(CURDIR))
REVISION ?= $(shell git rev-parse HEAD)
VERSION ?= $(shell grep "release.version" $(TOPDIR)/pom.properties| cut -d'=' -f2)
OLM_VERSION ?= $(shell grep "olm.version" $(TOPDIR)/pom.properties| cut -d'=' -f2)
MAVEN_VERSION ?= $(shell grep "maven.version" $(TOPDIR)/pom.properties| cut -d'=' -f2)
APP_BUNDLE_PREFIX ?= $(shell grep "application.bundle.prefix" $(TOPDIR)/pom.properties| cut -d'=' -f2)
OLM_PACKAGE_CHANNEL ?= $(shell grep "olm.package.channel" $(TOPDIR)/pom.properties| cut -d'=' -f2)
TAG ?= latest
DOCKER_REGISTRY ?= quay.io
DOCKER_ORG ?= enmasse
DOCKER ?= docker
PROJECT_PREFIX ?= enmasse
PROJECT_NAME ?= $(shell basename $(CURDIR))
REVISION ?= $(shell git rev-parse HEAD)
VERSION ?= $(shell grep "release.version" $(TOPDIR)/pom.properties| cut -d'=' -f2)
OLM_VERSION ?= $(shell grep "olm.version" $(TOPDIR)/pom.properties| cut -d'=' -f2)
MAVEN_VERSION ?= $(shell grep "maven.version" $(TOPDIR)/pom.properties| cut -d'=' -f2)
APP_BUNDLE_PREFIX ?= $(shell grep "application.bundle.prefix" $(TOPDIR)/pom.properties| cut -d'=' -f2)
OLM_PACKAGE_CHANNEL ?= $(shell grep "olm.package.channel" $(TOPDIR)/pom.properties| cut -d'=' -f2)
OLM_REPLACES_VERSION ?= $(shell grep "olm.csv.replaces" $(TOPDIR)/pom.properties| cut -d'=' -f2)
TAG ?= latest

CONSOLE_LINK_NAME ?= $(shell grep "application.globalconsole.display.name" $(TOPDIR)/pom.properties| cut -d'=' -f2)
CONSOLE_LINK_SECTION_NAME ?= $(shell grep "application.globalconsole.section.name" $(TOPDIR)/pom.properties| cut -d'=' -f2)
Expand All @@ -36,6 +37,8 @@ CONSOLE_PROXY_OPENSHIFT_IMAGE ?= quay.io/openshift/origin-oauth-proxy:latest
CONSOLE_PROXY_OPENSHIFT3_IMAGE ?= openshift/oauth-proxy:latest
CONSOLE_PROXY_KUBERNETES_IMAGE ?= quay.io/oauth2-proxy/oauth2-proxy:v5.1.0
OLM_MANIFEST_IMAGE ?= $(DOCKER_REGISTRY_PREFIX)$(DOCKER_ORG)/olm-manifest:$(IMAGE_VERSION)
OLM_INDEX_IMAGE ?= $(DOCKER_REGISTRY_PREFIX)$(DOCKER_ORG)/olm-index:$(IMAGE_VERSION)
OLM_INDEX_IMAGE_PREVIOUS ?= quay.io/enmasse/olm-index:$(OLM_REPLACES_VERSION)
PROMETHEUS_IMAGE ?= prom/prometheus:v2.4.3
ALERTMANAGER_IMAGE ?= prom/alertmanager:v0.15.2
GRAFANA_IMAGE ?= grafana/grafana:5.3.1
Expand Down Expand Up @@ -70,6 +73,8 @@ IMAGE_ENV=ADDRESS_SPACE_CONTROLLER_IMAGE=$(ADDRESS_SPACE_CONTROLLER_IMAGE) \
CONSOLE_PROXY_OPENSHIFT3_IMAGE=$(CONSOLE_PROXY_OPENSHIFT3_IMAGE) \
CONSOLE_PROXY_KUBERNETES_IMAGE=$(CONSOLE_PROXY_KUBERNETES_IMAGE) \
OLM_MANIFEST_IMAGE=$(OLM_MANIFEST_IMAGE) \
OLM_INDEX_IMAGE=$(OLM_INDEX_IMAGE) \
OLM_INDEX_IMAGE_PREVIOUS=$(OLM_INDEX_IMAGE_PREVIOUS) \
PROMETHEUS_IMAGE=$(PROMETHEUS_IMAGE) \
ALERTMANAGER_IMAGE=$(ALERTMANAGER_IMAGE) \
GRAFANA_IMAGE=$(GRAFANA_IMAGE) \
Expand Down
16 changes: 16 additions & 0 deletions olm-index/Dockerfile.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#
# Copyright 2018-2019, EnMasse authors.
# License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html).
#
FROM ${OLM_INDEX_IMAGE_PREVIOUS}

ARG version
ARG revision
ARG maven_version
ENV VERSION=${version} MAVEN_VERSION=${maven_version} REVISION=${revision}

# Add new manifests
ADD target/lib/manifests manifests/${OLM_VERSION}/manifests
ADD target/lib/metadata/annotations.yaml manifests/${OLM_VERSION}/metadata/annotations.yaml

RUN initializer -m manifests -o /database/index.db
10 changes: 10 additions & 0 deletions olm-index/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
include ../Makefile.common

OPM_ARGS ?= --skip-tls -u docker -p docker

image_deps:: Dockerfile

Dockerfile:
opm index add --bundles $(OLM_MANIFEST_IMAGE) --from-index $(OLM_INDEX_IMAGE_PREVIOUS) --generate -d Dockerfile $(OPM_ARGS)

.PHONY: Dockerfile
9 changes: 8 additions & 1 deletion olm-manifest/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,18 @@
# License: Apache License 2.0 (see the file LICENSE or http://apache.org/licenses/LICENSE-2.0.html).
#

FROM quay.io/enmasse/fedora-minimal:31
FROM scratch

ARG version
ARG revision
ARG maven_version
ENV VERSION=${version} MAVEN_VERSION=${maven_version} REVISION=${revision}

LABEL operators.operatorframework.io.bundle.mediatype.v1=registry+v1
LABEL operators.operatorframework.io.bundle.manifests.v1=manifests/
LABEL operators.operatorframework.io.bundle.metadata.v1=metadata/
LABEL operators.operatorframework.io.bundle.package.v1=enmasse
LABEL operators.operatorframework.io.bundle.channels.v1=alpha
LABEL operators.operatorframework.io.bundle.channel.default.v1=alpha

ADD target/olm-manifest-${maven_version}-dist.tar.gz /
18 changes: 7 additions & 11 deletions olm-manifest/src/assembly/unix-dist.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,27 +28,23 @@
<fileSets>
<fileSet>
<directory>${project.basedir}/../templates/crds</directory>
<outputDirectory>/manifests/${olm.version}</outputDirectory>
<outputDirectory>/manifests</outputDirectory>
<includes>
<include>*</include>
</includes>
</fileSet>
<fileSet>
<directory>${project.basedir}/target/classes/manifests</directory>
<outputDirectory>/manifests</outputDirectory>
</fileSet>
</fileSets>
<files>
<file>
<source>${project.basedir}/target/classes/latest/enmasse.package.yaml</source>
<outputDirectory>/manifests</outputDirectory>
<destName>${application.bundle.prefix}.package.yaml</destName>
<source>${project.basedir}/target/classes/annotations.yaml</source>
<outputDirectory>/metadata</outputDirectory>
<destName>annotations.yaml</destName>
<fileMode>0644</fileMode>
</file>
<file>
<source>${project.basedir}/target/classes/latest/enmasse.clusterserviceversion.yaml</source>
<outputDirectory>/manifests/${olm.version}</outputDirectory>
<destName>${application.bundle.prefix}.${olm.version}.clusterserviceversion.yaml</destName>
<source>${project.basedir}/target/classes/enmasse.clusterserviceversion.yaml</source>
<outputDirectory>/manifests</outputDirectory>
<destName>${application.bundle.prefix}.clusterserviceversion.yaml</destName>
<fileMode>0644</fileMode>
</file>
</files>
Expand Down
7 changes: 7 additions & 0 deletions olm-manifest/src/main/resources/annotations.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
annotations:
operators.operatorframework.io.bundle.channel.default.v1: ${olm.package.channel}
operators.operatorframework.io.bundle.channels.v1: ${olm.package.channel}
operators.operatorframework.io.bundle.manifests.v1: manifests/
operators.operatorframework.io.bundle.mediatype.v1: registry+v1
operators.operatorframework.io.bundle.metadata.v1: metadata/
operators.operatorframework.io.bundle.package.v1: ${olm.package.name}
Loading

0 comments on commit 6ab123b

Please sign in to comment.