mirror of
https://github.com/project-zot/zot.git
synced 2024-12-30 22:34:13 -05:00
Renamed zot-exporter to zxp and added its image to zot release
Signed-off-by: Alexei Dodon <adodon@cisco.com>
This commit is contained in:
parent
cec66f6bc2
commit
c9a81baa10
13 changed files with 108 additions and 21 deletions
21
.github/workflows/ci-cd.yml
vendored
21
.github/workflows/ci-cd.yml
vendored
|
@ -97,6 +97,27 @@ jobs:
|
|||
tags: |
|
||||
ghcr.io/${{ github.repository }}-minimal:${{ github.event.release.tag_name }}
|
||||
ghcr.io/${{ github.repository }}-minimal:latest
|
||||
- name: Build zot-exporter container image
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
build-args: |
|
||||
COMMIT=${{ github.event.release.tag_name }}-${{ github.sha }}
|
||||
push: true
|
||||
file: Dockerfile-zxp
|
||||
tags: |
|
||||
ghcr.io/${{ github.repository }}-zxp:${{ github.event.release.tag_name }}
|
||||
ghcr.io/${{ github.repository }}-zxp:latest
|
||||
- name: Build zot-exporter container image (arm64)
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
build-args: |
|
||||
COMMIT=${{ github.event.release.tag_name }}-${{ github.sha }}
|
||||
ARCH=arm64
|
||||
push: true
|
||||
file: Dockerfile-arch-zxp
|
||||
tags: |
|
||||
ghcr.io/${{ github.repository }}-arm64-zxp:${{ github.event.release.tag_name }}
|
||||
ghcr.io/${{ github.repository }}-arm64-zxp:latest
|
||||
- name: Build container image (arm64)
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
|
|
|
@ -68,7 +68,7 @@ make binary-container
|
|||
.
|
||||
...
|
||||
├── cmd/zot # Source code contains the main logic
|
||||
├── cmd/exporter # Source code contains the main logic for node exporter
|
||||
├── cmd/zxp # Source code contains the main logic for node exporter
|
||||
├── docs # Source code for Swagger docs
|
||||
├── errors # Source code for errors
|
||||
├── examples # Configuration examples to enable various features
|
||||
|
|
33
Dockerfile-arch-zxp
Normal file
33
Dockerfile-arch-zxp
Normal file
|
@ -0,0 +1,33 @@
|
|||
# ---
|
||||
# Stage 1: Build binary, create default config file
|
||||
# ---
|
||||
FROM ghcr.io/project-zot/golang:1.17 AS builder
|
||||
ARG COMMIT
|
||||
ARG ARCH
|
||||
RUN mkdir -p /go/src/github.com/project-zot/zot
|
||||
WORKDIR /go/src/github.com/project-zot/zot
|
||||
COPY . .
|
||||
RUN make COMMIT=$COMMIT ARCH=$ARCH clean exporter-minimal
|
||||
RUN echo '{\n\
|
||||
"Server": {\n\
|
||||
"protocol": "http",\n\
|
||||
"host": "127.0.0.1",\n\
|
||||
"port": "5000"\n\
|
||||
},\n\
|
||||
"Exporter": {\n\
|
||||
"port": "5001",\n\
|
||||
"log": {\n\
|
||||
"level": "debug"\n\
|
||||
}\n\
|
||||
}\n\
|
||||
}\n' > config.json && cat config.json
|
||||
|
||||
# ---
|
||||
# Stage 2: Final image with nothing but binary and default config file
|
||||
# ---
|
||||
FROM scratch AS final
|
||||
COPY --from=builder /go/src/github.com/project-zot/zot/bin/zxp /zxp
|
||||
COPY --from=builder /go/src/github.com/project-zot/zot/config.json /etc/zxp/config.json
|
||||
ENTRYPOINT ["/zxp"]
|
||||
EXPOSE 5001
|
||||
CMD ["config", "/etc/zxp/config.json"]
|
31
Dockerfile-zxp
Normal file
31
Dockerfile-zxp
Normal file
|
@ -0,0 +1,31 @@
|
|||
# ---
|
||||
# Stage 1: Build binary, create default config file
|
||||
# ---
|
||||
FROM ghcr.io/project-zot/golang:1.17 AS builder
|
||||
RUN mkdir -p /go/src/github.com/project-zot/zot
|
||||
WORKDIR /go/src/github.com/project-zot/zot
|
||||
COPY . .
|
||||
RUN make clean exporter-minimal
|
||||
RUN echo '{\n\
|
||||
"Server": {\n\
|
||||
"protocol": "http",\n\
|
||||
"host": "127.0.0.1",\n\
|
||||
"port": "5000"\n\
|
||||
},\n\
|
||||
"Exporter": {\n\
|
||||
"port": "5001",\n\
|
||||
"log": {\n\
|
||||
"level": "debug"\n\
|
||||
}\n\
|
||||
}\n\
|
||||
}\n' > config.json && cat config.json
|
||||
|
||||
# ---
|
||||
# Stage 2: Final image with nothing but binary and default config file
|
||||
# ---
|
||||
FROM scratch AS final
|
||||
COPY --from=builder /go/src/github.com/project-zot/zot/bin/zxp /zxp
|
||||
COPY --from=builder /go/src/github.com/project-zot/zot/config.json /etc/zxp/config.json
|
||||
ENTRYPOINT ["/zxp"]
|
||||
EXPOSE 5001
|
||||
CMD ["config", "/etc/zxp/config.json"]
|
8
Makefile
8
Makefile
|
@ -54,8 +54,12 @@ bench-arch:
|
|||
env CGO_ENABLED=0 GOOS=$(OS) GOARCH=$(ARCH) go build -o bin/zb-$(ARCH) -tags extended,containers_image_openpgp -v -trimpath -ldflags "-X zotregistry.io/zot/pkg/api/config.Commit=${COMMIT} -X zotregistry.io/zot/pkg/api/config.BinaryType=extended -X zotregistry.io/zot/pkg/api/config.GoVersion=${GO_VERSION} -s -w" ./cmd/zb
|
||||
|
||||
.PHONY: exporter-minimal
|
||||
exporter-minimal: swagger
|
||||
env CGO_ENABLED=0 GOOS=$(OS) GOARCH=$(ARCH) go build -o bin/zot-exporter -tags minimal,containers_image_openpgp -v -trimpath ./cmd/exporter
|
||||
exporter-minimal:
|
||||
env CGO_ENABLED=0 GOOS=$(OS) GOARCH=$(ARCH) go build -o bin/zxp -tags minimal,containers_image_openpgp -v -trimpath ./cmd/zxp
|
||||
|
||||
.PHONY: exporter-arch-minimal
|
||||
exporter-arch-minimal:
|
||||
env CGO_ENABLED=0 GOOS=$(OS) GOARCH=$(ARCH) go build -o bin/zxp-$(ARCH) -tags minimal,containers_image_openpgp -v -trimpath ./cmd/zxp
|
||||
|
||||
.PHONY: test
|
||||
test: check-skopeo $(NOTATION)
|
||||
|
|
|
@ -280,7 +280,7 @@ The dist-spec-only zot exposes internal metrics into a Prometheus format through
|
|||
The configuration of node exporter contains connection details for the zot server it is intend to scrape metrics from. See a [configuration example](./examples/metrics/exporter/config-minimal.json). The metrics are automatically enabled in the zot server on first scrape from the Node Exporter (no extra configuration option is needed). Similarly, the metrics are automatically disabled when Node Exporter did not perform any scrapings in a while.
|
||||
|
||||
```
|
||||
bin/zot-exporter config _config-file_
|
||||
bin/zxp config _config-file_
|
||||
```
|
||||
|
||||
## Enable Metrics
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# ---
|
||||
# Stage 1: Install certs, build binary, create default config file
|
||||
# Stage 1: Build binary, create default config file
|
||||
# ---
|
||||
FROM ghcr.io/project-zot/golang:1.17 AS builder
|
||||
RUN mkdir -p /go/src/github.com/project-zot/zot
|
||||
|
@ -21,12 +21,11 @@ RUN echo '{\n\
|
|||
}\n' > config.json && cat config.json
|
||||
|
||||
# ---
|
||||
# Stage 2: Final image with nothing but certs, binary, and default config file
|
||||
# Stage 2: Final image with nothing but binary and default config file
|
||||
# ---
|
||||
FROM scratch AS final
|
||||
COPY --from=builder /go/src/github.com/project-zot/zot/bin/zot-exporter /zot-exporter
|
||||
COPY --from=builder /go/src/github.com/project-zot/zot/config.json /etc/zot/config.json
|
||||
ENTRYPOINT ["/zot-exporter"]
|
||||
COPY --from=builder /go/src/github.com/project-zot/zot/bin/zxp /zxp
|
||||
COPY --from=builder /go/src/github.com/project-zot/zot/config.json /etc/zxp/config.json
|
||||
ENTRYPOINT ["/zxp"]
|
||||
EXPOSE 5051
|
||||
VOLUME ["/var/lib/registry"]
|
||||
CMD ["config", "/etc/zot/config.json"]
|
||||
CMD ["config", "/etc/zxp/config.json"]
|
|
@ -20,9 +20,8 @@ run-minimal-container:
|
|||
|
||||
.PHONY: binary-exporter-container
|
||||
binary-exporter-container:
|
||||
${CONTAINER_RUNTIME} build -f Dockerfile-exporter -t zot-exporter:latest ../../.
|
||||
${CONTAINER_RUNTIME} build -f Dockerfile-zxp -t zxp:latest ../../.
|
||||
|
||||
.PHONY: run-exporter-container
|
||||
run-exporter-container:
|
||||
${CONTAINER_RUNTIME} run --rm --security-opt label=disable -v $$(pwd)/../..:/go/src/github.com/project-zot/zot \
|
||||
zot-exporter:latest
|
||||
${CONTAINER_RUNTIME} run --rm --security-opt label=disable zxp:latest
|
||||
|
|
|
@ -24,5 +24,5 @@ At the end of the script below ports are locally available (using *kubectl port-
|
|||
* 9090 - for accessing Prometheus server
|
||||
* 5000 - for zot with all extensions enabled
|
||||
* 5050 - for accessing dist-spec-only zot server
|
||||
* 5051 - for zot-exporter access (a Prometheus Node exporter)
|
||||
* 5051 - for zxp access (a Prometheus Node exporter)
|
||||
|
||||
|
|
|
@ -40,14 +40,14 @@ kind load docker-image quay.io/prometheus-operator/prometheus-operator:v0.51.2 -
|
|||
kind load docker-image quay.io/prometheus-operator/prometheus-config-reloader:v0.51.2 --name ${CLUSTER_NAME}
|
||||
kind load docker-image quay.io/prometheus/prometheus:v2.22.1 --name ${CLUSTER_NAME}
|
||||
|
||||
## Build zot & zot-exporter related images
|
||||
## Build zot & zxp images
|
||||
make binary-container
|
||||
make binary-minimal-container
|
||||
make binary-exporter-container
|
||||
|
||||
kind load docker-image zot-build:latest --name ${CLUSTER_NAME}
|
||||
kind load docker-image zot-minimal:latest --name ${CLUSTER_NAME}
|
||||
kind load docker-image zot-exporter:latest --name ${CLUSTER_NAME}
|
||||
kind load docker-image zxp:latest --name ${CLUSTER_NAME}
|
||||
|
||||
## Deploy prometheus operator
|
||||
kubectl create -f kubernetes/prometheus/bundle.yaml
|
||||
|
|
|
@ -22,7 +22,7 @@ spec:
|
|||
- name: zot-minimal
|
||||
containerPort: 5050
|
||||
- name: zot-exporter
|
||||
image: zot-exporter:latest
|
||||
image: zxp:latest
|
||||
imagePullPolicy: IfNotPresent
|
||||
ports:
|
||||
- name: zot-exporter
|
||||
|
|
|
@ -41,9 +41,9 @@ func NewExporterCmd() *cobra.Command {
|
|||
|
||||
// "node_exporter"
|
||||
exporterCmd := &cobra.Command{
|
||||
Use: "zot_exporter",
|
||||
Short: "`zot_exporter`",
|
||||
Long: "`zot_exporter`",
|
||||
Use: "zxp",
|
||||
Short: "`zxp`",
|
||||
Long: "`zxp`",
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
_ = cmd.Usage()
|
||||
cmd.SilenceErrors = false
|
||||
|
|
Loading…
Reference in a new issue