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

use the distroless image for development with a cluster #41

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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 .dockerignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# More info: https://docs.docker.com/engine/reference/builder/#dockerignore-file
# Ignore build and test binaries.
bin/
!bin/manager
testbin/
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ LABEL maintainer="The Perses Authors <[email protected]>"

USER nobody

COPY --chown=nobody:nobody operator /bin/operator
COPY --chown=nobody:nobody bin/manager /bin/manager
COPY --chown=nobody:nobody LICENSE /LICENSE
COPY --from=build-env --chown=nobody:nobody /etc/mime.types /etc/mime.types

EXPOSE 8080
ENTRYPOINT [ "/bin/operator" ]
ENTRYPOINT [ "/bin/manager" ]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the location of the binary shouldn't be at root ? /manager (Based on the previous issue #38 )

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The deployment was using a command to point to the /manager but I removed it so it uses the default image entrypoint . Which for consistency is now /bin/manager

35 changes: 0 additions & 35 deletions Dockerfile.dev

This file was deleted.

4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,8 @@ run: manifests generate fmt vet ## Run a controller from your host.
# (i.e. docker build --platform linux/arm64 ). However, you must enable docker buildKit for it.
# More info: https://docs.docker.com/develop/develop-images/build_enhancements/
.PHONY: image-build
image-build: test ## Build docker image with the manager.
${CONTAINER_RUNTIME} build -f Dockerfile.dev -t ${IMG} .
image-build: build test ## Build docker image with the manager.
${CONTAINER_RUNTIME} build -f Dockerfile -t ${IMG} .

.PHONY: image-push
image-push: ## Push docker image with the manager.
Expand Down
12 changes: 3 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,13 @@ make install
kubectl apply -k config/samples
```

3. Build and push your image to the location specified by `IMG`:
3. Usint the the location specified by `IMG`, build and push the image to the registry, then deploy the controller to the cluster:

```sh
make image-build image-push IMG=<some-registry>/perses-operator:tag
IMG=<some-registry>/perses-operator:tag make image-build image-push deploy
```

4. Deploy the controller to the cluster with the image specified by `IMG`:

```sh
make deploy IMG=<some-registry>/perses-operator:tag
```

6. Access the Perses UI at `http://localhost:8080`
5. Access the Perses UI at `http://localhost:8080` by port-forwarding the service:

```sh
kubectl port-forward svc/perses-sample 8080:8080
Expand Down
2 changes: 1 addition & 1 deletion config/default/manager_auth_proxy_patch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,5 @@ spec:
- name: manager
args:
- "--health-probe-bind-address=:8081"
- "--metrics-bind-address=127.0.0.1:8080"
- "--metrics-bind-address=127.0.0.1:8082"
- "--leader-elect"
6 changes: 3 additions & 3 deletions config/manager/manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ spec:
# - linux
securityContext:
runAsNonRoot: true
runAsGroup: 65532
runAsUser: 65532
containers:
- command:
- /manager
args:
- args:
- --leader-elect
image: controller:latest
imagePullPolicy: Always
Expand Down
4 changes: 2 additions & 2 deletions distroless-debug.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ LABEL maintainer="The Perses Authors <[email protected]>"

USER nobody

COPY --chown=nobody:nobody operator /bin/operator
COPY --chown=nobody:nobody bin/manager /bin/operator
COPY --chown=nobody:nobody LICENSE /LICENSE
COPY --from=build-env --chown=nobody:nobody /etc/mime.types /etc/mime.types

EXPOSE 8080
ENTRYPOINT [ "/bin/operator" ]
ENTRYPOINT [ "/bin/manager" ]
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func main() {
var enableHTTP2 bool
var persesServerURL string

flag.StringVar(&metricsAddr, "metrics-bind-address", ":8080", "The address the metric endpoint binds to.")
flag.StringVar(&metricsAddr, "metrics-bind-address", ":8082", "The address the metric endpoint binds to.")
flag.StringVar(&probeAddr, "health-probe-bind-address", ":8081", "The address the probe endpoint binds to.")
flag.BoolVar(&enableLeaderElection, "leader-elect", false,
"Enable leader election for controller manager. "+
Expand Down
2 changes: 1 addition & 1 deletion scripts/generate-goreleaser/.goreleaser.base.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: 2
builds:
- id: "operator"
main: ./main.go
binary: "operator"
binary: "/bin/manager"
goos:
- linux
- windows
Expand Down
Loading