1
0
Fork 0
mirror of https://github.com/prometheus-operator/prometheus-operator.git synced 2025-04-07 01:24:29 +00:00

Use prometheus-alertmanager-test-webhook image from quay.io/prometheus-operator (#5025)

* example/alertmanager-webhook: build image for amd64 and arm64

Closes #5012

Signed-off-by: Simon Pasquier <spasquie@redhat.com>

* test/e2e: remove use of legacy coreos image

Signed-off-by: Simon Pasquier <spasquie@redhat.com>

Signed-off-by: Simon Pasquier <spasquie@redhat.com>
This commit is contained in:
Simon Pasquier 2022-09-19 16:52:23 +02:00 committed by GitHub
parent 323a8f5de2
commit 2961a0f1e2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 44 additions and 10 deletions

1
.gitignore vendored
View file

@ -2,6 +2,7 @@
/admission-webhook
/po-lint
/prometheus-config-reloader
example/alertmanager-webhook/linux/
.build/
*~
*.tgz

View file

@ -0,0 +1,7 @@
FROM scratch
ARG ARCH="amd64"
COPY linux/${ARCH}/alertmanager-webhook /bin/alertmanager-webhook
ENTRYPOINT ["/bin/alertmanager-webhook"]

View file

@ -0,0 +1,14 @@
IMAGE ?= quay.io/prometheus-operator/prometheus-alertmanager-test-webhook
TAG ?= latest
.PHONY: build
build:
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -tags netgo -o linux/amd64/ .
GOOS=linux GOARCH=arm64 CGO_ENABLED=0 go build -tags netgo -o linux/arm64/ .
.PHONY: push
push: build
buildah manifest create $(IMAGE):$(TAG)
buildah bud --arch amd64 --build-arg ARCH=amd64 --manifest $(IMAGE):$(TAG) -t $(IMAGE):$(TAG)-amd64 .
buildah bud --arch arm64 --build-arg ARCH=arm64 --manifest $(IMAGE):$(TAG) -t $(IMAGE):$(TAG)-arm64 .
buildah manifest push --all $(IMAGE):$(TAG) docker://$(IMAGE):$(TAG)

View file

@ -0,0 +1,15 @@
This directory contains a very simple program that can receive alert
notifications from Alertmanager. It is used by the end-to-end tests to verify
that Alertmanager works as expected.
The program is available at `quay.io/prometheus-operator/prometheus-alertmanager-test-webhook:latest`.
## Updating the image on quay.io
The image requires very few updates since the program is very simple and only used for testing.
Pre-requisites:
* Credentials to push the image to `quay.io/prometheus-operator/prometheus-alertmanager-test-webhook`.
* Buildah CLI + the `qemu-user-static` package.
Running `make manifest` should be all that is needed.

View file

@ -19,8 +19,13 @@ import (
"net/http"
)
const (
port = "5001"
)
func main() {
_ = http.ListenAndServe(":5001", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
fmt.Printf("Listening for Alertmanager notifications on :%s\n", port)
_ = http.ListenAndServe(":"+port, http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
fmt.Println("Alertmanager Notification Payload Received")
}))
}

View file

@ -1,5 +0,0 @@
FROM quay.io/prometheus/busybox:latest
COPY main /bin/main
ENTRYPOINT ["/bin/main"]

View file

@ -1,3 +0,0 @@
all:
CGO_ENABLED=0 go build --installsuffix cgo main.go
docker build -t quay.io/coreos/prometheus-alertmanager-test-webhook .

View file

@ -528,7 +528,7 @@ func testAMZeroDowntimeRollingDeployment(t *testing.T) {
Containers: []v1.Container{
{
Name: "webhook-server",
Image: "quay.io/coreos/prometheus-alertmanager-test-webhook",
Image: "quay.io/prometheus-operator/prometheus-alertmanager-test-webhook:latest",
Ports: []v1.ContainerPort{
{
Name: "web",