Skip to content

Commit

Permalink
chore(deploy): put all binaries in the same image
Browse files Browse the repository at this point in the history
  • Loading branch information
ecordell committed Oct 10, 2018
1 parent 5ef057c commit b69fcd5
Show file tree
Hide file tree
Showing 17 changed files with 103 additions and 164 deletions.
30 changes: 6 additions & 24 deletions .gitlab-ci.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ local jobs = {
},

'container-build': baseJob.dockerBuild {
// Build and push the alm container.
// Build and push the olm container.
// Docker Tag is the branch/tag name
stage: stages.docker_build,
before_script+: [
Expand All @@ -54,13 +54,11 @@ local jobs = {
// builds a single multistage dockerfile and tags images based on labels
// on the intermediate builds
script: docker.multibuild_and_push("upstream.Dockerfile", labelImageMap={
'builder': images.ci.alm.name,
'olm': images.prerelease.alm.name,
'catalog': images.prerelease.catalog.name,
'package-server': images.prerelease.package.name,
'builder': images.ci.olm.name,
'olm': images.prerelease.olm.name,
'e2e': images.e2e.name,
}) +
docker.run(images.ci.alm.name, "make verify-codegen verify-catalog")
docker.run(images.ci.olm.name, "make verify-codegen verify-catalog")
},

'container-release': baseJob.dockerBuild {
Expand All @@ -69,7 +67,7 @@ local jobs = {
stage: stages.docker_release,
before_script+: ["mkdir -p $PWD/bin"],
script:
docker.rename(images.prerelease.alm.name, images.release.alm.name) +
docker.rename(images.prerelease.olm.name, images.release.olm.name) +
docker.rename(images.prerelease.catalog.name, images.release.catalog.name) +
docker.rename(images.prerelease.package.name, images.release.package.name) +
docker.rename(images.e2e.name, images.e2elatest.name),
Expand All @@ -82,7 +80,7 @@ local jobs = {
stage: stages.docker_release,
before_script+: ["mkdir -p $PWD/bin"],
script:
docker.rename(images.prerelease.alm.name, images.tag.alm.name) +
docker.rename(images.prerelease.olm.name, images.tag.olm.name) +
docker.rename(images.prerelease.catalog.name, images.tag.catalog.name) +
docker.rename(images.prerelease.package.name, images.tag.package.name) +
docker.rename(images.e2e.name, images.e2elatest.name),
Expand All @@ -93,22 +91,6 @@ local jobs = {
stage: stages.wait_in_queue,
},

// Unit-tests
local unittest_stage = baseJob.AlmTest {
stage: stages.tests,
},

'unit-tests': unittest_stage {
coverage: @"/\d\d\.\d.$/",
script: [
"make vendor",
"make verify-catalog",
"make verify-codegen",
"make coverage",
],
},


'e2e-setup': baseJob.Deploy {
local _vars = self.localvars,
localvars+:: {
Expand Down
103 changes: 42 additions & 61 deletions .gitlab-ci.yml

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions .gitlab-ci/base_jobs.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ local appr = utils.appr;
"cd %s" % vars.paths.alm.src,
],
// base job to test the container
image: vars.images.ci.alm.name,
image: vars.images.ci.olm.name,
} + job_tags,

WaitInQueue: {
Expand Down Expand Up @@ -87,21 +87,21 @@ local appr = utils.appr;
local this = self,
local _vars = self.localvars,
localvars:: {
appversion: "1.0.0-%s" % self.image.alm.tag,
appversion: "1.0.0-%s" % self.image.olm.tag,
apprepo: "quay.io/coreos/alm-ci-app",
appname: self.namespace,
chart: "deploy/chart",
app: "%s@%s" % [self.apprepo, self.appversion],
domain: "alm-%s.k8s.devtable.com" % "${CI_COMMIT_REF_SLUG}",
namespace: "ci-alm-%s" % "${CI_COMMIT_REF_SLUG}",
domain: "olm-%s.k8s.devtable.com" % "${CI_COMMIT_REF_SLUG}",
namespace: "ci-olm-%s" % "${CI_COMMIT_REF_SLUG}",
image: vars.images.prerelease,
channel: null,
helm_opts: [],
kubeconfig: "$CD_KUBECONFIG",
params: {
"alm.image.ref": _vars.image.alm.name,
"catalog.image.ref": _vars.image.catalog.name,
"package.image.ref": _vars.image.package.name,
"olm.image.ref": _vars.image.olm.name,
"catalog.image.ref": _vars.image.olm.name,
"package.image.ref": _vars.image.olm.name,
watchedNamespaces: _vars.namespace,
catalog_namespace: _vars.namespace,
namespace: _vars.namespace,
Expand Down
2 changes: 1 addition & 1 deletion .gitlab-ci/utils.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@
],

tag_from_labels(labelImageMap={}):: [
"docker tag $(docker images --filter 'label=%s=true' --format '{{.CreatedAt}}\t{{.ID}}' | sort -nr | head -n 1 | cut -f2) %s"
"docker tag $(docker images --filter 'label=stage=%s' --format '{{.CreatedAt}}\t{{.ID}}' | sort -nr | head -n 1 | cut -f2) %s"
% [label, labelImageMap[label]] for label in std.objectFields(labelImageMap)
],

Expand Down
8 changes: 4 additions & 4 deletions .gitlab-ci/vars.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ local utils = import "utils.libsonnet";

// release is a copy of the quayci image to the 'prod' repository
release: {
alm: {
olm: {
repo: "quay.io/coreos/olm",
tag: "${CI_COMMIT_REF_SLUG}-${SHA8}",
name: utils.containerName(self.repo, self.tag),
Expand All @@ -45,7 +45,7 @@ local utils = import "utils.libsonnet";
},

tag: {
alm: {
olm: {
repo: "quay.io/coreos/olm",
tag: "${CI_COMMIT_TAG}",
name: utils.containerName(self.repo, self.tag),
Expand All @@ -64,7 +64,7 @@ local utils = import "utils.libsonnet";


ci: {
alm: {
olm: {
repo: "quay.io/coreos/alm-ci",
tag: "${CI_COMMIT_REF_SLUG}",
name: utils.containerName(self.repo, self.tag),
Expand All @@ -84,7 +84,7 @@ local utils = import "utils.libsonnet";
},

prerelease: {
alm: {
olm: {
repo: "quay.io/coreos/alm-ci",
tag: "${CI_COMMIT_REF_SLUG}-pre",
name: utils.containerName(self.repo, self.tag),
Expand Down
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ COPY --from=builder /go/src/github.com/operator-framework/operator-lifecycle-man
USER 1001

EXPOSE 8080
EXPOSE 443

# Apply labels as needed. ART build automation fills in others required for
# shipping, including component NVR (name-version-release) and image name. OSBS
Expand Down
6 changes: 3 additions & 3 deletions Documentation/install/local-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ namespace: local
watchedNamespaces: local
catalog_namespace: local

alm:
olm:
replicaCount: 1
image:
ref: quay.io/coreos/olm:local
Expand All @@ -14,15 +14,15 @@ alm:
catalog:
replicaCount: 1
image:
ref: quay.io/coreos/catalog:local
ref: quay.io/coreos/olm:local
pullPolicy: IfNotPresent
service:
internalPort: 8080

package:
replicaCount: 1
image:
ref: quay.io/coreos/package-server:local
ref: quay.io/coreos/olm:local
pullPolicy: IfNotPresent
service:
internalPort: 443
Expand Down
24 changes: 12 additions & 12 deletions deploy/chart/templates/0000_30_10-olm-operator.deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ metadata:
spec:
strategy:
type: RollingUpdate
replicas: {{ .Values.alm.replicaCount }}
replicas: {{ .Values.olm.replicaCount }}
selector:
matchLabels:
app: olm-operator
Expand All @@ -26,35 +26,35 @@ spec:
- -watchedNamespaces
- {{ .Values.watchedNamespaces }}
{{- end }}
{{- if .Values.alm.commandArgs }}
- {{ .Values.alm.commandArgs }}
{{- if .Values.olm.commandArgs }}
- {{ .Values.olm.commandArgs }}
{{- end }}
image: {{ .Values.alm.image.ref }}
imagePullPolicy: {{ .Values.alm.image.pullPolicy }}
image: {{ .Values.olm.image.ref }}
imagePullPolicy: {{ .Values.olm.image.pullPolicy }}
ports:
- containerPort: {{ .Values.alm.service.internalPort }}
- containerPort: {{ .Values.olm.service.internalPort }}
livenessProbe:
httpGet:
path: /healthz
port: {{ .Values.alm.service.internalPort }}
port: {{ .Values.olm.service.internalPort }}
readinessProbe:
httpGet:
path: /healthz
port: {{ .Values.alm.service.internalPort }}
port: {{ .Values.olm.service.internalPort }}
env:
- name: OPERATOR_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: OPERATOR_NAME
value: olm-operator
{{- if .Values.alm.resources }}
{{- if .Values.olm.resources }}
resources:
{{ toYaml .Values.alm.resources | indent 12 }}
{{ toYaml .Values.olm.resources | indent 12 }}
{{- end}}
{{- if .Values.alm.nodeSelector }}
{{- if .Values.olm.nodeSelector }}
nodeSelector:
{{ toYaml .Values.alm.nodeSelector | indent 8 }}
{{ toYaml .Values.olm.nodeSelector | indent 8 }}
{{- end }}
imagePullSecrets:
- name: coreos-pull-secret
6 changes: 3 additions & 3 deletions deploy/chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ rbacApiVersion: rbac.authorization.k8s.io
namespace: operator-lifecycle-manager
catalog_namespace: operator-lifecycle-manager
imagestream: false
alm:
olm:
replicaCount: 1
image:
ref: quay.io/coreos/olm:master
Expand All @@ -13,15 +13,15 @@ alm:
catalog:
replicaCount: 1
image:
ref: quay.io/coreos/catalog:master
ref: quay.io/coreos/olm:master
pullPolicy: Always
service:
internalPort: 8080

package:
replicaCount: 1
image:
ref: quay.io/coreos/package-server:master
ref: quay.io/coreos/olm:master
pullPolicy: Always
service:
internalPort: 443
Expand Down
4 changes: 2 additions & 2 deletions deploy/ocp/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ rbacApiVersion: rbac.authorization.k8s.io
namespace: openshift-operator-lifecycle-manager
catalog_namespace: openshift-operator-lifecycle-manager
imagestream: true
alm:
olm:
replicaCount: 1
image:
ref: quay.io/coreos/olm@sha256:058731fac9ecad9a35276612ec79bed76f506aaecd80c8c1fe9d68a262edcddb
Expand All @@ -25,4 +25,4 @@ package:
internalPort: 443
catalog_sources:
- rh-operators
- certified-operators
- certified-operators
4 changes: 2 additions & 2 deletions deploy/okd/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ rbacApiVersion: rbac.authorization.k8s.io
namespace: openshift-operator-lifecycle-manager
catalog_namespace: openshift-operator-lifecycle-manager
imagestream: false
alm:
olm:
replicaCount: 1
image:
ref: quay.io/coreos/olm@sha256:058731fac9ecad9a35276612ec79bed76f506aaecd80c8c1fe9d68a262edcddb
Expand All @@ -24,4 +24,4 @@ package:
service:
internalPort: 443
catalog_sources:
- rh-operators
- rh-operators
4 changes: 2 additions & 2 deletions deploy/upstream/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ rbacApiVersion: rbac.authorization.k8s.io
namespace: olm
catalog_namespace: olm
imagestream: false
alm:
olm:
replicaCount: 1
image:
ref: quay.io/coreos/olm@sha256:058731fac9ecad9a35276612ec79bed76f506aaecd80c8c1fe9d68a262edcddb
Expand All @@ -24,4 +24,4 @@ package:
service:
internalPort: 443
catalog_sources:
- rh-operators
- rh-operators
21 changes: 5 additions & 16 deletions e2e.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
FROM golang:1.10 as builder
LABEL builder=true
LABEL stage=builder
WORKDIR /go/src/github.com/operator-framework/operator-lifecycle-manager
RUN curl -L https://github.com/stedolan/jq/releases/download/jq-1.5/jq-linux64 -o /bin/jq
RUN chmod +x /bin/jq
Expand All @@ -14,28 +14,17 @@ RUN make build-coverage
RUN go test -c -o /bin/e2e ./test/e2e/...

FROM alpine:latest as olm
LABEL olm=true
LABEL stage=olm
WORKDIR /
COPY --from=builder /go/src/github.com/operator-framework/operator-lifecycle-manager/bin/olm /bin/olm
EXPOSE 8080
CMD ["/bin/olm"]

FROM alpine:latest as catalog
LABEL catalog=true
WORKDIR /
COPY --from=builder /go/src/github.com/operator-framework/operator-lifecycle-manager/bin/catalog /bin/catalog
EXPOSE 8080
CMD ["/bin/catalog"]

FROM alpine:latest as package-server
LABEL package-server=true
WORKDIR /
COPY --from=builder /go/src/github.com/operator-framework/operator-lifecycle-manager/bin/package-server /bin/package-server
EXPOSE 8080
EXPOSE 443
CMD ["/bin/package-server"]
CMD ["/bin/olm"]

FROM golang:1.10
LABEL e2e=true
LABEL stage=e2e
RUN mkdir -p /var/e2e
WORKDIR /var/e2e
COPY --from=builder /bin/e2e /bin/e2e
Expand Down
6 changes: 2 additions & 4 deletions scripts/build_local.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,5 @@ ps x | grep -q [m]inikube || minikube start --kubernetes-version="v1.11.1" --ext
eval $(minikube docker-env) || { echo 'Cannot switch to minikube docker'; exit 1; }
kubectl config use-context minikube
docker build -f e2e.Dockerfile .
docker tag $(docker images --filter 'label=catalog=true' --format '{{.CreatedAt}}\t{{.ID}}' | sort -nr | head -n 1 | cut -f2) quay.io/coreos/catalog:local
docker tag $(docker images --filter 'label=e2e=true' --format '{{.CreatedAt}}\t{{.ID}}' | sort -nr | head -n 1 | cut -f2) quay.io/coreos/olm-e2e:local
docker tag $(docker images --filter 'label=olm=true' --format '{{.CreatedAt}}\t{{.ID}}' | sort -nr | head -n 1 | cut -f2) quay.io/coreos/olm:local
docker tag $(docker images --filter 'label=package-server=true' --format '{{.CreatedAt}}\t{{.ID}}' | sort -nr | head -n 1 | cut -f2) quay.io/coreos/package-server:local
docker tag $(docker images --filter 'label=stage=olm' --format '{{.CreatedAt}}\t{{.ID}}' | sort -nr | head -n 1 | cut -f2) quay.io/coreos/olm:local
docker tag $(docker images --filter 'label=stage=e2e' --format '{{.CreatedAt}}\t{{.ID}}' | sort -nr | head -n 1 | cut -f2) quay.io/coreos/olm-e2e:local
7 changes: 3 additions & 4 deletions test/e2e/e2e-values-shift.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
alm:
olm:
replicaCount: 1
image:
ref: quay.io/coreos/olm:local
Expand All @@ -10,7 +10,7 @@ alm:
catalog:
replicaCount: 1
image:
ref: quay.io/coreos/catalog:local
ref: quay.io/coreos/olm:local
pullPolicy: IfNotPresent
service:
internalPort: 8080
Expand All @@ -19,7 +19,7 @@ catalog:
package:
replicaCount: 1
image:
ref: quay.io/coreos/package-server:local
ref: quay.io/coreos/olm:local
pullPolicy: Always
service:
internalPort: 443
Expand All @@ -31,6 +31,5 @@ e2e:

job_name: e2e


catalog_sources:
- rh-operators
Loading

0 comments on commit b69fcd5

Please sign in to comment.