Skip to content

Commit

Permalink
Bundle all controller versions in the image (#421)
Browse files Browse the repository at this point in the history
  • Loading branch information
alculquicondor authored Sep 2, 2021
1 parent b9141c0 commit db6930d
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 13 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ bin/
profile.cov

# Additional
.dockerignore
Dockerfile
.gitignore
.github/
deploy/
Expand Down
10 changes: 3 additions & 7 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,17 +74,13 @@ make images dev_manifest
kubectl apply -k manifests/overlays/dev
```

You can build an image using a legacy controller by setting `CONTROLLER_VERSION`

```bash
make CONTROLLER_VERSION=v1 images dev_manifest
kubectl apply -k manifests/overlays/dev
```
The image comes bundled with all the controller versions. For example, you can
find the v1 controller binary at `/opt/mpi-operator.v1`.

If you need to use a different registry, or a different tag, you can do:

```bash
make IMAGE_NAME=example.com/mpi-operator CONTROLLER_VERSION=v1 RELEASE_VERSION=dev make images dev_manifest
make IMAGE_NAME=example.com/mpi-operator RELEASE_VERSION=dev make images dev_manifest
```

To look at the controller's logs, you can do:
Expand Down
8 changes: 4 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
FROM golang:1.15.13 AS build
ARG version=v1alpha2
ARG version=v2

ADD . /go/src/github.com/kubeflow/mpi-operator
WORKDIR /go/src/github.com/kubeflow/mpi-operator
RUN make mpi-operator.$version
RUN make mpi-operator.v1alpha2 mpi-operator.v1 mpi-operator.v2
RUN ln -s mpi-operator.$version _output/cmd/bin/mpi-operator

FROM gcr.io/distroless/base-debian10:latest
ARG version=v1alpha2
COPY --from=build /go/src/github.com/kubeflow/mpi-operator/_output/cmd/bin/mpi-operator.$version /opt/mpi-operator
COPY --from=build /go/src/github.com/kubeflow/mpi-operator/_output/cmd/bin/* /opt/
COPY third_party/library/license.txt /opt/license.txt

ENTRYPOINT ["/opt/mpi-operator"]
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -236,10 +236,10 @@ You can use the following Dockerfile to build the image yourself:
Alternative, you can build the image using make:

```bash
make RELEASE_VERSION=dev images
make RELEASE_VERSION=dev IMAGE_NAME=registry.example.com/mpi-operator images
```

This will produce an image with the tag `kubeflow/mpi-operator:dev`.
This will produce an image with the tag `registry.example.com/mpi-operator:dev`.

## Contributing

Expand Down
1 change: 1 addition & 0 deletions deploy/v1alpha2/mpi-operator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ spec:
containers:
- name: mpi-operator
image: mpioperator/mpi-operator:latest
command: ["/opt/mpi-operator.v1alpha2"]
args: [
"-alsologtostderr",
"--kubectl-delivery-image",
Expand Down

0 comments on commit db6930d

Please sign in to comment.