Skip to content
This repository was archived by the owner on May 24, 2023. It is now read-only.

Commit a084661

Browse files
authoredJan 19, 2022
Add missing metadata in the bundle, helper script for certification (#195)
1 parent 7d9fb2c commit a084661

7 files changed

+55
-3
lines changed
 

Diff for: ‎Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ COPY LICENSE /licenses/
2727
LABEL name="NGINX Ingress Operator" \
2828
maintainer="kubernetes@nginx.com" \
2929
vendor="NGINX Inc" \
30-
version="v${VERSION}" \
30+
version="${VERSION}" \
3131
release="1" \
3232
summary="The NGINX Ingress Operator is a Kubernetes/OpenShift component which deploys and manages one or more NGINX/NGINX Plus Ingress Controllers" \
3333
description="The NGINX Ingress Operator is a Kubernetes/OpenShift component which deploys and manages one or more NGINX/NGINX Plus Ingress Controllers"

Diff for: ‎Makefile

+9-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ VERSION ?= 0.5.0
1010
# To re-generate a bundle for other specific channels without changing the standard setup, you can:
1111
# - use the CHANNELS as arg of the bundle target (e.g make bundle CHANNELS=preview,fast,stable)
1212
# - use environment variables to overwrite this value (e.g export CHANNELS="preview,fast,stable")
13+
CHANNELS = "alpha"
1314
ifneq ($(origin CHANNELS), undefined)
1415
BUNDLE_CHANNELS := --channels=$(CHANNELS)
1516
endif
@@ -19,6 +20,7 @@ endif
1920
# To re-generate a bundle for any other default channel without changing the default setup, you can:
2021
# - use the DEFAULT_CHANNEL as arg of the bundle target (e.g make bundle DEFAULT_CHANNEL=stable)
2122
# - use environment variables to overwrite this value (e.g export DEFAULT_CHANNEL="stable")
23+
DEFAULT_CHANNEL = "alpha"
2224
ifneq ($(origin DEFAULT_CHANNEL), undefined)
2325
BUNDLE_DEFAULT_CHANNEL := --default-channel=$(DEFAULT_CHANNEL)
2426
endif
@@ -159,7 +161,8 @@ bundle: manifests kustomize ## Generate bundle manifests and metadata, then vali
159161
operator-sdk generate kustomize manifests -q
160162
cd config/manager && $(KUSTOMIZE) edit set image controller=$(IMG)
161163
$(KUSTOMIZE) build config/manifests | operator-sdk generate bundle -q --overwrite --version $(VERSION) $(BUNDLE_METADATA_OPTS)
162-
@printf "%s\n" '' 'LABEL com.redhat.openshift.versions="v4.5"' 'LABEL com.redhat.delivery.operator.bundle=true' 'LABEL com.redhat.delivery.backport=true' >> bundle.Dockerfile
164+
@printf "%s\n" '' 'LABEL com.redhat.openshift.versions="v4.6"' 'LABEL com.redhat.delivery.operator.bundle=true' 'LABEL com.redhat.delivery.backport=true' >> bundle.Dockerfile
165+
@printf "%s\n" '' ' # OpenShift annotations.' ' com.redhat.openshift.versions: v4.6' >> bundle/metadata/annotations.yaml
163166
operator-sdk bundle validate ./bundle
164167

165168
.PHONY: bundle-build
@@ -210,3 +213,8 @@ catalog-build: opm ## Build a catalog image.
210213
.PHONY: catalog-push
211214
catalog-push: ## Push a catalog image.
212215
$(MAKE) docker-push IMG=$(CATALOG_IMG)
216+
217+
# Get medatada to prepare the bundle to be submitted at https://github.com/redhat-openshift-ecosystem/certified-operators/
218+
.PHONY: get-metadata-certification
219+
get-metadata-certification:
220+
@./hack/get_image_info.sh ${IMAGE_TAG_BASE} ${VERSION}

Diff for: ‎bundle.Dockerfile

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ LABEL operators.operatorframework.io.bundle.manifests.v1=manifests/
66
LABEL operators.operatorframework.io.bundle.metadata.v1=metadata/
77
LABEL operators.operatorframework.io.bundle.package.v1=nginx-ingress-operator
88
LABEL operators.operatorframework.io.bundle.channels.v1=alpha
9+
LABEL operators.operatorframework.io.bundle.channel.default.v1=alpha
910
LABEL operators.operatorframework.io.metrics.builder=operator-sdk-v1.15.0
1011
LABEL operators.operatorframework.io.metrics.mediatype.v1=metrics+v1
1112
LABEL operators.operatorframework.io.metrics.project_layout=go.kubebuilder.io/v3
@@ -19,6 +20,6 @@ COPY bundle/manifests /manifests/
1920
COPY bundle/metadata /metadata/
2021
COPY bundle/tests/scorecard /tests/scorecard/
2122

22-
LABEL com.redhat.openshift.versions="v4.5"
23+
LABEL com.redhat.openshift.versions="v4.6"
2324
LABEL com.redhat.delivery.operator.bundle=true
2425
LABEL com.redhat.delivery.backport=true

Diff for: ‎bundle/manifests/nginx-ingress-operator.clusterserviceversion.yaml

+5
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,17 @@ metadata:
2727
categories: Monitoring, Networking
2828
certified: "true"
2929
containerImage: nginx/nginx-ingress-operator:0.5.0
30+
createdAt: placeholder
3031
description: The NGINX Ingress Operator is a Kubernetes/OpenShift component which
3132
deploys and manages one or more NGINX/NGINX Plus Ingress Controllers
3233
operators.operatorframework.io/builder: operator-sdk-v1.15.0
3334
operators.operatorframework.io/project_layout: go.kubebuilder.io/v3
3435
repository: https://github.com/nginxinc/nginx-ingress-operator
3536
support: NGINX Inc.
37+
labels:
38+
operatorframework.io/arch.amd64: supported
39+
operatorframework.io/arch.ppc64le: supported
40+
operatorframework.io/arch.s390x: supported
3641
name: nginx-ingress-operator.v0.5.0
3742
namespace: placeholder
3843
spec:

Diff for: ‎bundle/metadata/annotations.yaml

+4
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,14 @@ annotations:
55
operators.operatorframework.io.bundle.metadata.v1: metadata/
66
operators.operatorframework.io.bundle.package.v1: nginx-ingress-operator
77
operators.operatorframework.io.bundle.channels.v1: alpha
8+
operators.operatorframework.io.bundle.channel.default.v1: alpha
89
operators.operatorframework.io.metrics.builder: operator-sdk-v1.15.0
910
operators.operatorframework.io.metrics.mediatype.v1: metrics+v1
1011
operators.operatorframework.io.metrics.project_layout: go.kubebuilder.io/v3
1112

1213
# Annotations for testing.
1314
operators.operatorframework.io.test.mediatype.v1: scorecard+v1
1415
operators.operatorframework.io.test.config.v1: tests/scorecard/
16+
17+
# OpenShift annotations.
18+
com.redhat.openshift.versions: v4.6

Diff for: ‎config/manifests/bases/nginx-ingress-operator.clusterserviceversion.yaml

+5
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,15 @@ metadata:
77
categories: Monitoring, Networking
88
certified: "true"
99
containerImage: nginx/nginx-ingress-operator:0.5.0
10+
createdAt: placeholder
1011
description: The NGINX Ingress Operator is a Kubernetes/OpenShift component which
1112
deploys and manages one or more NGINX/NGINX Plus Ingress Controllers
1213
repository: https://github.com/nginxinc/nginx-ingress-operator
1314
support: NGINX Inc.
15+
labels:
16+
operatorframework.io/arch.amd64: supported
17+
operatorframework.io/arch.ppc64le: supported
18+
operatorframework.io/arch.s390x: supported
1419
name: nginx-ingress-operator.v0.0.0
1520
namespace: placeholder
1621
spec:

Diff for: ‎hack/get_image_info.sh

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/bin/bash
2+
3+
image=$1
4+
version=$2
5+
6+
kube_image=kubebuilder/kube-rbac-proxy
7+
kube_image_version=v0.8.0
8+
9+
token="$(curl 'https://auth.docker.io/token?service=registry.docker.io&scope=repository:'${image}':pull' 2>/dev/null | jq -r '.token')"
10+
11+
image_digest=$(curl -sSfL -I -H "Authorization: Bearer ${token}" -H "Accept: application/vnd.docker.distribution.manifest.list.v2+json" "https://index.docker.io/v2/${image}/manifests/${version}" | awk 'BEGIN {FS=": "}/^docker-content-digest/{gsub(/"/, "", $2); print $2}')
12+
13+
digest="$(curl -sSfL -H "Authorization: Bearer ${token}" -H "Accept: application/vnd.docker.distribution.manifest.v2+json" "https://index.docker.io/v2/${image}/manifests/${version}" | jq -r '.config.digest')"
14+
15+
created=$(curl -sSfL -H "Accept: application/vnd.docker.distribution.manifest.v2+json" -H "Authorization: Bearer ${token}" "https://index.docker.io/v2/${image}/blobs/${digest}" | jq -r '.config.Labels."org.opencontainers.image.created"')
16+
17+
proxy="./config/default/manager_auth_proxy_patch.yaml"
18+
kube_proxy=$(yq e '.spec.template.spec.containers.[0].image' $proxy)
19+
full_image=${kube_proxy%:*}
20+
kube_image=${full_image#*/}
21+
kube_version=${kube_proxy#*:}
22+
23+
kube_digest=$(curl -sSfL -I -H "Accept: application/vnd.docker.distribution.manifest.list.v2+json" "https://gcr.io/v2/${kube_image}/manifests/${kube_version}" | awk 'BEGIN {FS=": "}/^docker-content-digest/{gsub(/"/, "", $2); print $2}')
24+
25+
printf "%s\n\n" "Manually repleace the following values in bundle/manifests/nginx-ingress-operator.clusterserviceversion.yaml"
26+
printf "%s\n" "metadata.annotations.createdAt: ${created}"
27+
printf "%s\n" "metadata.annotations.containerImage: docker.io/${image}@${image_digest}"
28+
printf "%s\n" "spec.install.spec.deployments[0].spec.template.spec.containers[1].image (nginx-ingress-operator): docker.io/${image}@${image_digest}"
29+
printf "%s\n" "spec.install.spec.deployments[0].spec.template.spec.containers[0].image (kube-rbac-proxy): ${full_image}@${kube_digest}"

0 commit comments

Comments
 (0)
This repository has been archived.