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

Rebased OSB backbone #342

Merged
merged 25 commits into from
May 8, 2018
Merged
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
5a3f0ef
fixup(api/client/util): return err instead of panicking
Mar 8, 2018
ab99e88
feat(broker): add service broker service for alm
Mar 7, 2018
3a114f8
feat(deploy): add servicebroker templates
Mar 8, 2018
4492818
fix(Makefile): add '-' back to flag (rebase fix)
Apr 5, 2018
61aac0f
chore(makefile): clean up build
Apr 18, 2018
8e10fe9
chore(*): update github repo org
Apr 25, 2018
9e10d65
fix(Makefile): codegen clients correctly
Apr 25, 2018
f38cae5
fix(.): update scripts with e2e dir move
Apr 26, 2018
3628c42
rearrange(deploy/chart/templates): create secret before clusterservic…
Apr 26, 2018
82cb197
fix(deploy/chart/templates/01-alm-operator.serviceaccount): specify p…
Apr 26, 2018
558eca6
chore(Makefile): add target to run e2e with minishift
Apr 26, 2018
6d20105
chore(servicebroker/apiserver): update broker interface types
Apr 27, 2018
3428585
fix(Makefile): update makefile recipes for rearrangement
Apr 27, 2018
50806f4
chore(rename): fix path in catalog version tests
ecordell May 4, 2018
2999494
chore(deps): update lockfile
ecordell May 4, 2018
0c361b4
fix(makefile): xargs working cross-platform
ecordell May 4, 2018
c98759b
fix(broker): use updated imports for osb
ecordell May 4, 2018
19d0adf
fix(makefile): always build targets so that dockerfile builds work
ecordell May 4, 2018
f33f9e2
fix(makefile): support ocs and ccomponent catalogs
ecordell May 4, 2018
0623b0d
fix(deploy): chart naming after rebase
ecordell May 4, 2018
c367d2c
fix(makefile): fix release scripts
ecordell May 4, 2018
8dd5b4f
chore(ci): simplify container builds
ecordell May 4, 2018
06a5ee8
feat(ci): multi-stage builds and verify codegen and catalog during build
ecordell May 4, 2018
e1f817d
fix(makefile): add build-coverage command back for e2e testing
ecordell May 8, 2018
9343ffc
fix(ci): fix e2e test runner
ecordell May 8, 2018
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -461,3 +461,4 @@ __pycache__/
vendor
*.bak
**/resources/*
build
44 changes: 15 additions & 29 deletions .gitlab-ci.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ local images = vars.images;
local docker = utils.docker;
local stages_list = [
// gitlab-ci stages
'sanity',
'docker_base',
'docker_build',
'deploy_preview',
Expand Down Expand Up @@ -42,38 +41,24 @@ local jobs = {
only: ["schedules", "tags"],
},

'sanity-checks': baseJob.sanityCheck {
stage: 'sanity',
script: [
"make vendor",
"make verify-catalog",
"make verify-codegen",
],
},

'container-build': baseJob.dockerBuild {
// Build and push the alm container.
// Docker Tag is the branch/tag name
stage: stages.docker_build,
before_script+: ["mkdir -p $PWD/bin"],
script:
docker.build_and_push(images.ci.alm.name,
cache=false,
extra_opts=["-f alm-ci.Dockerfile"]) +
docker.build_and_push(images.ci.catalog.name,
cache=false,
extra_opts=["-f catalog-ci.Dockerfile"]) +
docker.cp(images.ci.alm.name, src="/bin/alm", dest="bin/alm") +
docker.cp(images.ci.catalog.name, src="/bin/catalog", dest="bin/catalog") +
docker.build_and_push(images.prerelease.alm.name,
cache=false,
extra_opts=["-f alm-pre.Dockerfile"]) +
docker.build_and_push(images.prerelease.catalog.name,
cache=false,
extra_opts=["-f catalog-pre.Dockerfile"]) +
docker.build_and_push(images.e2e.name,
cache=false,
extra_opts=["-f e2e-run.Dockerfile"]),
before_script+: [
"mkdir -p $PWD/bin",
],

// builds a single multistage dockerfile and tags images based on labels
// on the intermediate builds
script: docker.multibuild_and_push("Dockerfile", labelImageMap={
'builder': images.ci.alm.name,
'olm': images.prerelease.alm.name,
'catalog': images.prerelease.catalog.name,
'broker': images.prerelease.servicebroker.name,
'e2e': images.e2e.name,
}) +
docker.run(images.ci.alm.name, "make verify-codegen verify-catalog")
},

'container-release': baseJob.dockerBuild {
Expand All @@ -84,6 +69,7 @@ local jobs = {
script:
docker.rename(images.prerelease.alm.name, images.release.alm.name) +
docker.rename(images.prerelease.catalog.name, images.release.catalog.name) +
docker.rename(images.prerelease.servicebroker.name, images.release.servicebroker.name) +
docker.rename(images.e2e.name, images.e2elatest.name),

} + onlyMaster,
Expand Down
37 changes: 14 additions & 23 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,18 @@ container-build:
- mkdir -p $PWD/bin
image: docker:git
script:
- 'docker build --no-cache -f alm-ci.Dockerfile -t quay.io/coreos/alm-ci:${CI_COMMIT_REF_SLUG} . '
- docker build -f Dockerfile .
- "docker tag $(docker images --filter 'label=broker=true' --format '{{.CreatedAt}}\t{{.ID}}' | sort -nr | head -n 1 | cut -f2) quay.io/coreos/alm-service-broker-ci:${CI_COMMIT_REF_SLUG}-pre"
- "docker tag $(docker images --filter 'label=builder=true' --format '{{.CreatedAt}}\t{{.ID}}' | sort -nr | head -n 1 | cut -f2) quay.io/coreos/alm-ci:${CI_COMMIT_REF_SLUG}"
- "docker tag $(docker images --filter 'label=catalog=true' --format '{{.CreatedAt}}\t{{.ID}}' | sort -nr | head -n 1 | cut -f2) quay.io/coreos/catalog-ci:${CI_COMMIT_REF_SLUG}-pre"
- "docker tag $(docker images --filter 'label=e2e=true' --format '{{.CreatedAt}}\t{{.ID}}' | sort -nr | head -n 1 | cut -f2) quay.io/coreos/alm-e2e:${CI_COMMIT_REF_SLUG}-${SHA8}"
- "docker tag $(docker images --filter 'label=olm=true' --format '{{.CreatedAt}}\t{{.ID}}' | sort -nr | head -n 1 | cut -f2) quay.io/coreos/alm-ci:${CI_COMMIT_REF_SLUG}-pre"
- docker push quay.io/coreos/alm-service-broker-ci:${CI_COMMIT_REF_SLUG}-pre
- docker push quay.io/coreos/alm-ci:${CI_COMMIT_REF_SLUG}
- 'docker build --no-cache -f catalog-ci.Dockerfile -t quay.io/coreos/catalog-ci:${CI_COMMIT_REF_SLUG} . '
- docker push quay.io/coreos/catalog-ci:${CI_COMMIT_REF_SLUG}
- docker create quay.io/coreos/alm-ci:${CI_COMMIT_REF_SLUG} | xargs -I{} docker cp {}:/bin/alm bin/alm
- docker create quay.io/coreos/catalog-ci:${CI_COMMIT_REF_SLUG} | xargs -I{} docker cp {}:/bin/catalog bin/catalog
- 'docker build --no-cache -f alm-pre.Dockerfile -t quay.io/coreos/alm-ci:${CI_COMMIT_REF_SLUG}-pre . '
- docker push quay.io/coreos/alm-ci:${CI_COMMIT_REF_SLUG}-pre
- 'docker build --no-cache -f catalog-pre.Dockerfile -t quay.io/coreos/catalog-ci:${CI_COMMIT_REF_SLUG}-pre . '
- docker push quay.io/coreos/catalog-ci:${CI_COMMIT_REF_SLUG}-pre
- 'docker build --no-cache -f e2e-run.Dockerfile -t quay.io/coreos/alm-e2e:${CI_COMMIT_REF_SLUG}-${SHA8} . '
- docker push quay.io/coreos/alm-e2e:${CI_COMMIT_REF_SLUG}-${SHA8}
- docker push quay.io/coreos/alm-ci:${CI_COMMIT_REF_SLUG}-pre
- docker run quay.io/coreos/alm-ci:${CI_COMMIT_REF_SLUG} make verify-codegen verify-catalog
stage: docker_build
tags:
- kubernetes
Expand All @@ -56,6 +56,9 @@ container-release:
- docker pull quay.io/coreos/catalog-ci:${CI_COMMIT_REF_SLUG}-pre
- docker tag quay.io/coreos/catalog-ci:${CI_COMMIT_REF_SLUG}-pre quay.io/coreos/catalog:${CI_COMMIT_REF_SLUG}-${SHA8}
- docker push quay.io/coreos/catalog:${CI_COMMIT_REF_SLUG}-${SHA8}
- docker pull quay.io/coreos/alm-service-broker-ci:${CI_COMMIT_REF_SLUG}-pre
- docker tag quay.io/coreos/alm-service-broker-ci:${CI_COMMIT_REF_SLUG}-pre quay.io/coreos/alm-service-broker:${CI_COMMIT_REF_SLUG}-${SHA8}
- docker push quay.io/coreos/alm-service-broker:${CI_COMMIT_REF_SLUG}-${SHA8}
- docker pull quay.io/coreos/alm-e2e:${CI_COMMIT_REF_SLUG}-${SHA8}
- docker tag quay.io/coreos/alm-e2e:${CI_COMMIT_REF_SLUG}-${SHA8} quay.io/coreos/alm-e2e:latest
- docker push quay.io/coreos/alm-e2e:latest
Expand Down Expand Up @@ -215,8 +218,8 @@ e2e_tests:
- 'kubectl -n e2e-${CI_COMMIT_REF_SLUG}-${SHA8} patch serviceaccount default -p ''{"imagePullSecrets": [{"name": "coreos-pull-secret"}]}'' || true'
- kubectl -n e2e-${CI_COMMIT_REF_SLUG}-${SHA8} create rolebinding e2e-admin-rb --clusterrole=cluster-admin --serviceaccount=e2e-${CI_COMMIT_REF_SLUG}-${SHA8}:default --namespace=e2e-${CI_COMMIT_REF_SLUG}-${SHA8}
|| true
- charttmpdir=`mktemp -d 2>/dev/null || mktemp -d -t 'charttmpdir'`;mkdir -p ${charttmpdir};pushd e2e/chart/templates;filenames=$(ls *.yaml);popd;for f in ${filenames};do helm template --set namespace=e2e-${CI_COMMIT_REF_SLUG}-${SHA8}
e2e/chart -x templates/${f} --set e2e.image.ref=quay.io/coreos/alm-e2e:${CI_COMMIT_REF_SLUG}-${SHA8} --set job_name=e2e-${CI_COMMIT_REF_SLUG}-${SHA8} --set namespace=e2e-${CI_COMMIT_REF_SLUG}-${SHA8}
- charttmpdir=`mktemp -d 2>/dev/null || mktemp -d -t 'charttmpdir'`;mkdir -p ${charttmpdir};pushd test/e2e/chart/templates;filenames=$(ls *.yaml);popd;for f in ${filenames};do helm template --set namespace=e2e-${CI_COMMIT_REF_SLUG}-${SHA8}
test/e2e/chart -x templates/${f} --set e2e.image.ref=quay.io/coreos/alm-e2e:${CI_COMMIT_REF_SLUG}-${SHA8} --set job_name=e2e-${CI_COMMIT_REF_SLUG}-${SHA8} --set namespace=e2e-${CI_COMMIT_REF_SLUG}-${SHA8}
> ${charttmpdir}/${f};done;kubectl apply -f ${charttmpdir}
- until kubectl -n e2e-${CI_COMMIT_REF_SLUG}-${SHA8} logs job/e2e-${CI_COMMIT_REF_SLUG}-${SHA8} | grep -v 'ContainerCreating'; do echo 'waiting for job to run' && sleep 1; done
- kubectl -n e2e-${CI_COMMIT_REF_SLUG}-${SHA8} logs job/e2e-${CI_COMMIT_REF_SLUG}-${SHA8} -f
Expand All @@ -228,19 +231,7 @@ e2e_tests:
variables:
K8S_NAMESPACE: e2e-${CI_COMMIT_REF_SLUG}-${SHA8}
NAMESPACE: e2e-${CI_COMMIT_REF_SLUG}-${SHA8}
sanity-checks:
before_script:
- mkdir -p $GOPATH/src/github.com/operator-framework/operator-lifecycle-manager
- cp -a $CI_PROJECT_DIR/. $GOPATH/src/github.com/operator-framework/operator-lifecycle-manager
- cd $GOPATH/src/github.com/operator-framework/operator-lifecycle-manager
image: quay.io/coreos/alm-ci:base
script:
- make vendor
- make verify-catalog
- make verify-codegen
stage: sanity
stages:
- sanity
- docker_base
- docker_build
- deploy_preview
Expand Down
12 changes: 1 addition & 11 deletions .gitlab-ci/base_jobs.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,6 @@ local appr = utils.appr;
{
local job_tags = { tags: ["kubernetes"] },

sanityCheck: {
before_script: [
"mkdir -p %s" % vars.paths.alm.src,
"cp -a $CI_PROJECT_DIR/. %s" % vars.paths.alm.src,
"cd %s" % vars.paths.alm.src,
],
// base job for running sanity checks before building containers
image: vars.images.base.name,
},

dockerBuild: {
// base job to manage containers (build / push)
image: "docker:git",
Expand Down Expand Up @@ -47,7 +37,7 @@ local appr = utils.appr;
appname: self.namespace,
namespace: "e2e-%s" % "${CI_COMMIT_REF_SLUG}-${SHA8}",
jobname: "e2e-%s" % "${CI_COMMIT_REF_SLUG}-${SHA8}",
chart: "e2e/chart",
chart: "test/e2e/chart",
appversion: "1.0.0-e2e-%s" % self.image.alm.tag,
helm_opts: [],
params: {
Expand Down
22 changes: 20 additions & 2 deletions .gitlab-ci/utils.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@
login(server, user, password):: [
"docker login -u %s -p %s %s" % [user, password, server],
],

cp(image, src, dest):: [
"docker create %s | xargs -I{} docker cp {}:%s %s" % [image, src, dest],
],
Expand All @@ -69,7 +68,22 @@
Docker.push(image)
),

build(image, cache=true, args={}, extra_opts=[]):: [
multibuild_and_push(dockerfile, labelImageMap={}):: (
Docker.build_file(dockerfile) +
Docker.tag_from_labels(labelImageMap) +
Docker.push_all([labelImageMap[label] for label in std.objectFields(labelImageMap)])
),

build_file(dockerfile):: [
'docker build -f %s .' % [dockerfile],
],

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

build(image, cache=true, args={},extra_opts=[]):: [
local cache_opt = if cache == false
then '--no-cache'
else if std.type(cache) == 'boolean'
Expand All @@ -86,6 +100,10 @@
push(image):: [
'docker push %s' % image,
],

push_all(images=[]):: (
['docker push %s' % image for image in images]
),

rename(src, dest):: [
'docker pull %s' % src,
Expand Down
15 changes: 10 additions & 5 deletions .gitlab-ci/vars.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ local utils = import "utils.libsonnet";
tag: "${CI_COMMIT_REF_SLUG}-${SHA8}",
name: utils.containerName(self.repo, self.tag),
},
servicebroker: {
repo: "quay.io/coreos/alm-service-broker",
tag: "${CI_COMMIT_REF_SLUG}-${SHA8}",
name: utils.containerName(self.repo, self.tag),
},
},

ci: {
Expand All @@ -45,11 +50,6 @@ local utils = import "utils.libsonnet";
tag: "${CI_COMMIT_REF_SLUG}",
name: utils.containerName(self.repo, self.tag),
},
catalog: {
repo: "quay.io/coreos/catalog-ci",
tag: "${CI_COMMIT_REF_SLUG}",
name: utils.containerName(self.repo, self.tag),
},
},

e2e: {
Expand All @@ -75,6 +75,11 @@ local utils = import "utils.libsonnet";
tag: "${CI_COMMIT_REF_SLUG}-pre",
name: utils.containerName(self.repo, self.tag),
},
servicebroker: {
repo: "quay.io/coreos/alm-service-broker-ci",
tag: "${CI_COMMIT_REF_SLUG}-pre",
name: utils.containerName(self.repo, self.tag),
},
},
},
}
38 changes: 38 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
FROM quay.io/coreos/alm-ci:base as builder
LABEL builder=true
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
# Cache Dep first
COPY Gopkg.toml Gopkg.lock Makefile ./
RUN make vendor
COPY . .
RUN make build
RUN go test -c -o /bin/e2e ./test/e2e/...

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

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 broker
LABEL broker=true
WORKDIR /
COPY --from=builder /go/src/github.com/operator-framework/operator-lifecycle-manager/bin/servicebroker /bin/servicebroker
EXPOSE 8080
EXPOSE 8005
CMD ["/bin/servicebroker"]

FROM quay.io/coreos/alm-ci:base
LABEL e2e=true
COPY --from=builder /bin/e2e /bin/e2e
COPY --from=builder /bin/jq /bin/jq
CMD ["/bin/e2e"]
15 changes: 14 additions & 1 deletion Documentation/install/install.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,19 @@ catalog:
service:
# port for readiness/liveness probes
internalPort: 8080

# alm service broker run configuration
servicebroker:
# OLM Service Broker doesn't need to be HA; scale with load
replicaCount: 1
image:
ref: quay.io/coreos/olm-service-broker:local
pullPolicy: IfNotPresent
service:
# port for readiness/liveness probes
internalPort: 8080
# port exposing OLM's service broker API
brokerPort: 8005
```

To configure a release of OLM for installation in a cluster:
Expand Down Expand Up @@ -101,7 +114,7 @@ apiVersion: app.coreos.com/v1alpha1
kind: Subscription-v1
metadata:
name: etcd
namespace: local
namespace: local
spec:
channel: alpha
name: etcd
Expand Down
9 changes: 9 additions & 0 deletions Documentation/install/local-values-shift.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,12 @@ catalog:
pullPolicy: IfNotPresent
service:
internalPort: 8080

servicebroker:
replicaCount: 1
image:
ref: quay.io/coreos/alm-service-broker:local
pullPolicy: IfNotPresent
service:
internalPort: 8080
brokerPort: 8005
9 changes: 9 additions & 0 deletions Documentation/install/local-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,12 @@ catalog:
pullPolicy: IfNotPresent
service:
internalPort: 8080

servicebroker:
replicaCount: 1
image:
ref: quay.io/coreos/alm-service-broker:local
pullPolicy: IfNotPresent
service:
internalPort: 8080
brokerPort: 8005
Loading