Skip to content

Commit

Permalink
Add new files for openshift operator updates
Browse files Browse the repository at this point in the history
  • Loading branch information
ukclivecox authored and seldondev committed Oct 12, 2020
1 parent 2e62a3a commit 4be2412
Show file tree
Hide file tree
Showing 93 changed files with 81,777 additions and 89 deletions.
99 changes: 98 additions & 1 deletion operator/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ IMG_VERSION_REDHAT ?= ${IMAGE_NAME_BASE}-ubi8:${VERSION}
IMG_REDHAT ?= seldonio/${IMG_VERSION_REDHAT}
# Produce CRDs that work back to Kubernetes 1.11 (no version conversion)
CRD_OPTIONS ?= "crd:trivialVersions=true"
#CRD_OPTIONS ?= ""

KIND_NAME ?= kind

Expand Down Expand Up @@ -122,8 +123,13 @@ deploy-lite: manifests
manifests: controller-gen
$(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=config/crd/bases

# Commented out alternative is looking ahead to issue that on Openshift our v1 CRD is too large
# to be installed. This may also affect operator-sdk community operators.
# See https://github.com/operator-framework/operator-registry/issues/385
# Solution may be to drop v1alpha2 and v1alpha3 versions to decrease size by 2/3
manifests_v1: controller-gen
$(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=config/crd_v1/bases crd:crdVersions=v1
$(CONTROLLER_GEN) rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=config/crd_v1/bases crd:crdVersions=v1
#$(CONTROLLER_GEN) rbac:roleName=manager-role webhook paths="./apis/machinelearning.seldon.io/v1" output:crd:artifacts:config=config/crd_v1/bases crd:crdVersions=v1

# Run go fmt against code
fmt:
Expand Down Expand Up @@ -240,3 +246,94 @@ generate-resources:

config/crd_v1/patches/graph_children.yaml:
python hack/create_graph_openapi_schema.py hack/graph_patch.tmpl.yaml config/crd_v1/patches/graph_children.yaml


###################################
#
# Openshift / OperatorHub addtions
#
###################################

#
# Testing with operstor-sdk 1.0.1
#

.PHONY: bundle
recreate_bundle:
rm -r bundle
kustomize build config/manifests | operator-sdk --verbose generate bundle --version ${VERSION}
python hack/csv_hack.py bundle/manifests/seldon-operator.clusterserviceversion.yaml

.PHONY: update_packagemanifests
update_packagemanifests:
kustomize build config/manifests | operator-sdk --verbose generate packagemanifests --version ${VERSION}
python hack/csv_hack.py packagemanifests/${VERSION}/seldon-operator.clusterserviceversion.yaml
mv packagemanifests/${VERSION}/seldon-operator.clusterserviceversion.yaml packagemanifests/${VERSION}/seldon-operator.v${VERSION}.clusterserviceversion.yaml

#
# Tested with operator-courier 2.1.10
#
.PHONY: verify_package
verify_package:
operator-courier verify packagemanifests/

# Commented out as bundle/opm_index seems the way to test on latest Openshift
#.PHONY: push_package
#push_package:
# operator-courier push packagemanifests/ seldon seldon-operator ${VERSION} "$QUAY_TOKEN"

.PHONY: create_bundle_image
create_bundle_image:
docker build . -f bundle.Dockerfile -t quay.io/seldon/seldon-operator:v${VERSION}

.PHONY: push_bundle_image
push_bundle_image:
docker push quay.io/seldon/seldon-operator:v${VERSION}

.PHONY: validate_bundle_image
validate_bundle_image:
operator-sdk bundle validate quay.io/seldon/seldon-operator:v${VERSION}

# PREV_VERSION needs manual update for now
PREV_VERSION=1.2.2
opm_index:
opm index add -c docker --bundles quay.io/seldon/seldon-operator:v${VERSION},quay.io/seldon/seldon-operator:v${PREV_VERSION} --tag quay.io/seldon/test-catalog:latest


opm_push:
docker push quay.io/seldon/test-catalog:latest

#
# Scorecard
#

scorecard:
operator-sdk scorecard --kubeconfig ~/.kube/config quay.io/seldon/seldon-operator:v${VERSION}


#
# Certified Openshift Operator
#
# https://redhat-connect.gitbook.io/certified-operator-guide/appendix/bundle-maintenance-after-migration

PKG_CERT=packagemanifests-certified
create_certified_bundle:
rm -rf ${PKG_CERT}/${VERSION}
mkdir -p ${PKG_CERT}/${VERSION}
cp bundle/manifests/* ${PKG_CERT}/${VERSION}
./hack/update-openshift-certified.sh ${VERSION}
cd ${PKG_CERT} && opm alpha bundle generate -c alpha -p seldon-operator -d ./${VERSION}/ -u ./${VERSION}/
mv ${PKG_CERT}/bundle.Dockerfile ${PKG_CERT}/bundle-${VERSION}.Dockerfile
mv ${PKG_CERT}/${VERSION}/seldon-operator.clusterserviceversion.yaml ${PKG_CERT}/${VERSION}/seldon-operator.v${VERSION}.clusterserviceversion.yaml
mv ${PKG_CERT}/${VERSION}/manifests/seldon-operator.clusterserviceversion.yaml ${PKG_CERT}/${VERSION}/manifests/seldon-operator.v${VERSION}.clusterserviceversion.yaml
cd ${PKG_CERT} && sed -i 's#seldon-operator.v.*#seldon-operator.v${VERSION}#' seldon-operator.package.yaml

build_certified_bundle:
opm alpha bundle build -d packagemanifests-certified/${VERSION}/ --tag quay.io/seldon/seldon-operator-certified:v${VERSION} --package seldon-operator --channels alpha --overwrite -b docker


bundle_certified_push:
source ~/.config/seldon/seldon-core/redhat-image-passwords.sh && \
echo $${rh_password_operator_bundle} | docker login -u unused scan.connect.redhat.com --password-stdin
docker tag quay.io/seldon/seldon-operator-certified:v${VERSION} scan.connect.redhat.com/ospid-78efc0cc-a4a5-4244-a31d-6820eae1ccb1/seldon-operator-certified:${VERSION}
docker push scan.connect.redhat.com/ospid-78efc0cc-a4a5-4244-a31d-6820eae1ccb1/seldon-operator-certified:${VERSION}
19 changes: 6 additions & 13 deletions operator/PROJECT
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
version: "2"
domain: seldon.io
repo: github.com/seldonio/seldon-core/operator
multigroup: true
resources:
- group: machinelearning
version: v1alpha2
kind: SeldonDeployment
- group: machinelearning
version: v1alpha3
kind: SeldonDeployment
- group: machinelearning
version: v1
kind: SeldonDeployment
layout: go.kubebuilder.io/v2
projectName: seldon-operator
repo: github.com/seldonio/seldon-core
version: 3-alpha
plugins:
go.sdk.operatorframework.io/v2-alpha: {}
17 changes: 17 additions & 0 deletions operator/bundle.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM scratch

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=seldon-operator
LABEL operators.operatorframework.io.bundle.channels.v1=alpha
LABEL operators.operatorframework.io.bundle.channel.default.v1=
LABEL operators.operatorframework.io.metrics.builder=operator-sdk-v1.0.1
LABEL operators.operatorframework.io.metrics.mediatype.v1=metrics+v1
LABEL operators.operatorframework.io.metrics.project_layout=go.kubebuilder.io/v2
LABEL operators.operatorframework.io.test.config.v1=tests/scorecard/
LABEL operators.operatorframework.io.test.mediatype.v1=scorecard+v1

COPY bundle/manifests /manifests/
COPY bundle/metadata /metadata/
COPY bundle/tests/scorecard /tests/scorecard/
Loading

0 comments on commit 4be2412

Please sign in to comment.