Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OCPVE-738: feat: migrate to FBC for catalog in makefile #458

Merged
Merged
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
15 changes: 9 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ verify: ## Verify go formatting and generated files.
hack/verify-gofmt.sh
hack/verify-deps.sh
hack/verify-bundle.sh
hack/verify-catalog.sh
hack/verify-generated.sh

test: manifests generate envtest godeps-update ## Run tests.
Expand Down Expand Up @@ -285,12 +286,14 @@ ifneq ($(origin CATALOG_BASE_IMG), undefined)
FROM_INDEX_OPT := --from-index $(CATALOG_BASE_IMG)
endif

# Build a catalog image by adding bundle images to an empty catalog using the operator package manager tool, 'opm'.
# This recipe invokes 'opm' in 'semver' bundle add mode. For more information on add modes, see:
# https://github.com/operator-framework/community-operators/blob/7f1438c/docs/packaging-operator.md#updating-your-existing-operator
.PHONY: catalog-render
catalog-render: opm ## Render the catalog based on the given bundle
$(OPM) render $(BUNDLE_IMG) -oyaml > ./catalog/lvms-operator/operator.yaml
$(OPM) validate ./catalog

.PHONY: catalog-build
catalog-build: opm ## Build a catalog image.
$(OPM) index add --container-tool $(IMAGE_BUILD_CMD) --mode semver --tag $(CATALOG_IMG) --bundles $(BUNDLE_IMGS) $(FROM_INDEX_OPT)
catalog-build: opm catalog-render ## Build a catalog image.
$(IMAGE_BUILD_CMD) build -f catalog.Dockerfile -t $(CATALOG_IMG) .

# Push the catalog image.
.PHONY: catalog-push
Expand Down Expand Up @@ -363,7 +366,7 @@ ifeq (,$(shell which opm 2>/dev/null))
set -e ;\
mkdir -p $(dir $(OPM)) ;\
OS=$(shell go env GOOS) && ARCH=$(shell go env GOARCH) && \
curl -sSLo $(OPM) https://github.com/operator-framework/operator-registry/releases/download/v1.26.2/$${OS}-$${ARCH}-opm ;\
curl -sSLo $(OPM) https://github.com/operator-framework/operator-registry/releases/download/v1.30.0/$${OS}-$${ARCH}-opm ;\
chmod +x $(OPM) ;\
}
else
Expand Down
15 changes: 15 additions & 0 deletions catalog.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# The base image is expected to contain
# /bin/opm (with a serve subcommand) and /bin/grpc_health_probe
FROM quay.io/operator-framework/opm:latest

# Configure the entrypoint and command
ENTRYPOINT ["/bin/opm"]
CMD ["serve", "/configs", "--cache-dir=/tmp/cache"]

# Copy declarative config root into image at /configs and pre-populate serve cache
ADD catalog /configs
RUN ["/bin/opm", "serve", "/configs", "--cache-dir=/tmp/cache", "--cache-only"]

# Set DC-specific label for the location of the DC root directory
# in the image
LABEL operators.operatorframework.io.index.configs.v1=/configs
6 changes: 6 additions & 0 deletions catalog/channel.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
schema: olm.channel
package: lvms-operator
name: alpha
entries:
- name: lvms-operator.v0.0.1
148 changes: 148 additions & 0 deletions catalog/lvms-operator/operator.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
---
image: quay.io/lvms_dev/lvms-operator-bundle:latest
name: lvms-operator.v0.0.1
package: lvms-operator
properties:
- type: olm.gvk
value:
group: lvm.topolvm.io
kind: LVMCluster
version: v1alpha1
- type: olm.gvk
value:
group: lvm.topolvm.io
kind: LVMVolumeGroup
version: v1alpha1
- type: olm.gvk
value:
group: lvm.topolvm.io
kind: LVMVolumeGroupNodeStatus
version: v1alpha1
- type: olm.gvk
value:
group: topolvm.io
kind: LogicalVolume
version: v1
- type: olm.package
value:
packageName: lvms-operator
version: 0.0.1
- type: olm.csv.metadata
value:
annotations:
alm-examples: |-
[
{
"apiVersion": "lvm.topolvm.io/v1alpha1",
"kind": "LVMCluster",
"metadata": {
"name": "my-lvmcluster"
},
"spec": {
"storage": {
"deviceClasses": [
{
"default": true,
"fstype": "xfs",
"name": "vg1",
"thinPoolConfig": {
"name": "thin-pool-1",
"overprovisionRatio": 10,
"sizePercent": 90
}
}
]
}
}
}
]
capabilities: Seamless Upgrades
categories: Storage
containerImage: quay.io/lvms_dev/lvms-operator:latest
description: Logical volume manager storage provides dynamically provisioned
local storage for container workloads
olm.skipRange: ""
operatorframework.io/cluster-monitoring: "true"
operatorframework.io/initialization-resource: |-
{
"apiVersion": "lvm.topolvm.io/v1alpha1",
"kind": "LVMCluster",
"metadata": {
"name": "test-lvmcluster"
},
"spec": {
"storage": {
"deviceClasses": [
{
"name": "vg1",
"thinPoolConfig": {
"name": "thin-pool-1",
"overprovisionRatio": 10,
"sizePercent": 90
}
}
]
}
}
}
operatorframework.io/suggested-namespace: openshift-storage
operators.openshift.io/infrastructure-features: '["csi", "disconnected"]'
operators.operatorframework.io/builder: operator-sdk-v1.25.3
operators.operatorframework.io/internal-objects: '["logicalvolumes.topolvm.io",
"lvmvolumegroups.lvm.topolvm.io", "lvmvolumegroupnodestatuses.lvm.topolvm.io"]'
operators.operatorframework.io/project_layout: go.kubebuilder.io/v3
repository: https://github.com/openshift/lvm-operator
target.workload.openshift.io/management: '{"effect": "PreferredDuringScheduling"}'
apiServiceDefinitions: {}
crdDescriptions:
owned:
- kind: LogicalVolume
name: logicalvolumes.topolvm.io
version: v1
- description: LVMCluster is the Schema for the lvmclusters API
displayName: LVMCluster
kind: LVMCluster
name: lvmclusters.lvm.topolvm.io
version: v1alpha1
- kind: LVMVolumeGroupNodeStatus
name: lvmvolumegroupnodestatuses.lvm.topolvm.io
version: v1alpha1
- kind: LVMVolumeGroup
name: lvmvolumegroups.lvm.topolvm.io
version: v1alpha1
description: Logical volume manager storage provides dynamically provisioned local
storage.
displayName: LVM Storage
installModes:
- supported: true
type: OwnNamespace
- supported: true
type: SingleNamespace
- supported: false
type: MultiNamespace
- supported: false
type: AllNamespaces
keywords:
- local storage
- operator
- LVM
labels:
operatorframework.io/arch.amd64: supported
operatorframework.io/arch.arm64: supported
operatorframework.io/arch.ppc64le: supported
operatorframework.io/arch.s390x: supported
links:
- name: Source Repository
url: https://github.com/openshift/lvm-operator
maintainers:
- email: ocs-support@redhat.com
name: Red Hat Support
maturity: alpha
provider:
name: Red Hat
relatedImages:
- image: quay.io/lvms_dev/lvms-operator-bundle:latest
name: ""
- image: quay.io/lvms_dev/lvms-operator:latest
name: ""
schema: olm.bundle
4 changes: 4 additions & 0 deletions catalog/package.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
schema: olm.package
name: lvms-operator
defaultChannel: alpha
17 changes: 17 additions & 0 deletions hack/verify-catalog.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash
set -euo pipefail

function print_failure {
echo "There are unexpected changes to the tree when running 'make catalog-render'. Please"
echo "run these commands locally and double-check the Git repository for unexpected changes which may"
echo "need to be committed."
exit 1
}

if [ "${OPENSHIFT_CI:-false}" = true ]; then
echo "> generating the OLM catalog"
make catalog-render

test -z "$(git status --porcelain | \grep -v '^??')" || print_failure
echo "> verified generated catalog"
fi