Merge pull request #976 from hj-johannes-lee/bundle

operator deployment: move from packagemanifests to bundle
This commit is contained in:
Mikko Ylinen 2022-04-25 20:42:29 +03:00 committed by GitHub
commit 43bd592790
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 24 additions and 18 deletions

View File

@ -207,16 +207,19 @@ Fork the [Community Operators](https://github.com/k8s-operatorhub/community-oper
$ git clone https://github.com/<GitHub Username>/community-operators
```
Generate package manifests with:
Generate bundle and build bundle image:
```
$ make packagemanifests OPERATOR_VERSION=0.X.Y
$ make bundle OPERATOR_VERSION=0.X.Y
$ make bundle-build
```
> **Note**: You need to push the image to a registry if you want to follow the verification process below.
Verify the operator deployment works OK via OLM in your development cluster:
```
$ operator-sdk olm install
$ kubectl create namespace testoperator
$ operator-sdk run packagemanifests community-operators/operators/intel-device-plugins-operator/ --namespace testoperator --version 0.X.Y
$ operator-sdk run bundle <Registry>/<Tag> -n testoperator --use-http
# do verification checks
...
# do clean up

View File

@ -27,7 +27,7 @@ BUNDLE_DEFAULT_CHANNEL := --default-channel=$(DEFAULT_CHANNEL)
endif
BUNDLE_METADATA_OPTS ?= $(BUNDLE_CHANNELS) $(BUNDLE_DEFAULT_CHANNEL)
OLM_MANIFESTS = deployments/operator/manifests
PACKAGEMANIFESTS_DIR = community-operators/operators/intel-device-plugins-operator
BUNDLE_DIR = community-operators/operators/intel-device-plugins-operator/${OPERATOR_VERSION}
TESTDATA_DIR = pkg/topology/testdata
@ -116,17 +116,18 @@ build: $(cmds)
.PHONY: bundle
bundle:
mkdir -p ${BUNDLE_DIR}/${OPERATOR_VERSION}
$(OPERATOR_SDK) generate kustomize manifests -q --input-dir $(OLM_MANIFESTS) --output-dir $(OLM_MANIFESTS) --apis-dir pkg/apis
$(KUSTOMIZE) build $(OLM_MANIFESTS) | sed "s|intel-deviceplugin-operator:devel|intel-deviceplugin-operator:$(OPERATOR_VERSION)|" | $(OPERATOR_SDK) generate bundle -q --overwrite --kustomize-dir $(OLM_MANIFESTS) --version $(OPERATOR_VERSION) $(BUNDLE_METADATA_OPTS)
$(OPERATOR_SDK) bundle validate ./bundle
.PHONY: packagemanifests
packagemanifests:
$(OPERATOR_SDK) generate kustomize manifests -q --input-dir $(OLM_MANIFESTS) --output-dir $(OLM_MANIFESTS) --apis-dir pkg/apis
$(KUSTOMIZE) build $(OLM_MANIFESTS) | sed "s|intel-deviceplugin-operator:devel|intel-deviceplugin-operator:$(OPERATOR_VERSION)|" | $(OPERATOR_SDK) generate packagemanifests -q --kustomize-dir $(OLM_MANIFESTS) --version $(OPERATOR_VERSION) --from-version $(OPERATOR_PREVIOUS_VERSION) $(BUNDLE_METADATA_OPTS) --output-dir $(PACKAGEMANIFESTS_DIR)
$(KUSTOMIZE) build $(OLM_MANIFESTS) | sed "s|intel-deviceplugin-operator:devel|intel-deviceplugin-operator:$(OPERATOR_VERSION)|" | $(OPERATOR_SDK) generate bundle -q --overwrite --kustomize-dir $(OLM_MANIFESTS) --version $(OPERATOR_VERSION) $(BUNDLE_METADATA_OPTS) --output-dir .
# Remove unneeded resources
rm $(PACKAGEMANIFESTS_DIR)/$(OPERATOR_VERSION)/*service.yaml
rm $(PACKAGEMANIFESTS_DIR)/$(OPERATOR_VERSION)/*clusterrole.yaml
rm manifests/*service.yaml
rm manifests/*clusterrole.yaml
# Put generated files in a directory
mv manifests metadata tests bundle.Dockerfile ${BUNDLE_DIR}
$(OPERATOR_SDK) bundle validate ${BUNDLE_DIR}/
bundle-build:
docker build -f $(BUNDLE_DIR)/bundle.Dockerfile -t $(BUNDLE_IMG) $(BUNDLE_DIR)
clean:
@for cmd in $(cmds) ; do pwd=$(shell pwd) ; cd cmd/$$cmd ; $(GO) clean ; cd $$pwd ; done

View File

@ -33,6 +33,13 @@ spec:
kind: DlbDevicePlugin
name: dlbdeviceplugins.deviceplugin.intel.com
version: v1
- description: IaaDevicePlugin is the Schema for the iaadeviceplugins API. It
represents the IAA device plugin responsible for advertising Intel IAA hardware
resources to the kubelet.
displayName: Intel IAA Device Plugin
kind: IaaDevicePlugin
name: iaadeviceplugins.deviceplugin.intel.com
version: v1
- description: AcceleratorFunction is a specification for an Accelerator Function
resource provided by a FPGA-based programmable hardware accelerator.
displayName: Accelerator Function
@ -73,11 +80,6 @@ spec:
kind: SgxDevicePlugin
name: sgxdeviceplugins.deviceplugin.intel.com
version: v1
description: IaaDevicePlugin is the Schema for the iaadeviceplugins API. It represents the IAA device plugin responsible for advertising Intel IAA hardware resources to the kubelet.
displayName: Intel IAA Device Plugin
kind: IaaDevicePlugin
name: iaadeviceplugins.deviceplugin.intel.com
version: v1
description: |
[Intel Device Plugins for Kubernetes](https://github.com/intel/intel-device-plugins-for-kubernetes) is a collection of
[device plugins](https://kubernetes.io/docs/concepts/extend-kubernetes/compute-storage-net/device-plugins/) advertising Intel specific hardware resources