#!/bin/bash export DOCKER_CLI_EXPERIMENTAL=enabled REPO=carlosedp AOR_VERSION=2.1 KSM_VERSION=v1.4.0 PROM_OP_VERSION=v0.26.0 PROMCONFIGRELOADER_VERSION=v0.20.0 PROM_ADAPTER_VERSION=v0.4.1 PROM_CONFIG_RELOADER_VERSION=v0.26.0 KUBE_RBAC_VERSION=v0.4.0 CONFIGMAP_RELOAD_VERSION=v0.2.2 #------------------------------------------------------------------------------- # Kubernetes addon-resizer # Retag Addon-resizer google images to have unified manifest on DockerHub docker pull gcr.io/google-containers/addon-resizer-arm:$AOR_VERSION docker pull gcr.io/google-containers/addon-resizer-arm64:$AOR_VERSION docker pull gcr.io/google-containers/addon-resizer-amd64:$AOR_VERSION docker tag gcr.io/google-containers/addon-resizer-arm:$AOR_VERSION $REPO/addon-resizer:$AOR_VERSION-arm docker tag gcr.io/google-containers/addon-resizer-arm64:$AOR_VERSION $REPO/addon-resizer:$AOR_VERSION-arm64 docker tag gcr.io/google-containers/addon-resizer-amd64:$AOR_VERSION $REPO/addon-resizer:$AOR_VERSION-amd64 docker push $REPO/addon-resizer:$AOR_VERSION-arm docker push $REPO/addon-resizer:$AOR_VERSION-arm64 docker push $REPO/addon-resizer:$AOR_VERSION-amd64 docker rmi gcr.io/google-containers/addon-resizer-arm:$AOR_VERSION docker rmi gcr.io/google-containers/addon-resizer-arm64:$AOR_VERSION docker rmi gcr.io/google-containers/addon-resizer-amd64:$AOR_VERSION docker rmi $REPO/addon-resizer:$AOR_VERSION-arm docker rmi $REPO/addon-resizer:$AOR_VERSION-arm64 docker rmi $REPO/addon-resizer:$AOR_VERSION-amd64 manifest-tool-linux-arm64 push from-args --platforms linux/arm,linux/arm64,linux/amd64 --template $REPO/addon-resizer:$AOR_VERSION-ARCH --target $REPO/addon-resizer:$AOR_VERSION manifest-tool-linux-arm64 push from-args --platforms linux/arm,linux/arm64,linux/amd64 --template $REPO/addon-resizer:$AOR_VERSION-ARCH --target $REPO/addon-resizer:latest #------------------------------------------------------------------------------- # Prometheus-adapter # Retag prometheus-adapter from directxman12 images to have unified manifest on DockerHub docker pull directxman12/k8s-prometheus-adapter-arm:$PROM_ADAPTER_VERSION docker pull directxman12/k8s-prometheus-adapter-arm64:$PROM_ADAPTER_VERSION docker pull directxman12/k8s-prometheus-adapter-amd64:$PROM_ADAPTER_VERSION docker tag directxman12/k8s-prometheus-adapter-arm:$PROM_ADAPTER_VERSION $REPO/k8s-prometheus-adapter:$PROM_ADAPTER_VERSION-arm docker tag directxman12/k8s-prometheus-adapter-arm64:$PROM_ADAPTER_VERSION $REPO/k8s-prometheus-adapter:$PROM_ADAPTER_VERSION-arm64 docker tag directxman12/k8s-prometheus-adapter-amd64:$PROM_ADAPTER_VERSION $REPO/k8s-prometheus-adapter:$PROM_ADAPTER_VERSION-amd64 docker push $REPO/k8s-prometheus-adapter:$PROM_ADAPTER_VERSION-arm docker push $REPO/k8s-prometheus-adapter:$PROM_ADAPTER_VERSION-arm64 docker push $REPO/k8s-prometheus-adapter:$PROM_ADAPTER_VERSION-amd64 docker rmi directxman12/k8s-prometheus-adapter-arm:$PROM_ADAPTER_VERSION docker rmi directxman12/k8s-prometheus-adapter-arm64:$PROM_ADAPTER_VERSION docker rmi directxman12/k8s-prometheus-adapter-amd64:$PROM_ADAPTER_VERSION docker rmi $REPO/k8s-prometheus-adapter:$PROM_ADAPTER_VERSION-arm docker rmi $REPO/k8s-prometheus-adapter:$PROM_ADAPTER_VERSION-arm64 docker rmi $REPO/k8s-prometheus-adapter:$PROM_ADAPTER_VERSION-amd64 IMAGE=$REPO/k8s-prometheus-adapter VERSION=$PROM_ADAPTER_VERSION ALL_ARCH='amd64 arm arm64' docker manifest create --amend $IMAGE:$VERSION `echo $ALL_ARCH | sed -e "s~[^ ]*~$IMAGE:$VERSION\-&~g"` for arch in $ALL_ARCH; do docker manifest annotate --arch $arch $IMAGE:$VERSION $IMAGE:$VERSION-$arch; done docker manifest push $IMAGE:$VERSION #------------------------------------------------------------------------------- # Kube-state-metrics IMAGE=carlosedp/kube-state-metrics ALL_ARCH='amd64 arm arm64' VERSION=$KSM_VERSION go get github.com/kubernetes/kube-state-metrics #mv $HOME/go/src/github.com/kubernetes/kube-state-metrics $HOME/go/src/k8s.io/kube-state-metrics pushd $GOPATH/src/k8s.io/kube-state-metrics git checkout ${KSM_VERSION} cat Dockerfile |sed -e 's/\.build\/linux-amd64\/operator/operator/' |sed -e 's/^FROM.*/FROM arm32v6\/alpine:3.7/' > Dockerfile.arm cat Dockerfile |sed -e 's/\.build\/linux-amd64\/operator/operator/' |sed -e 's/^FROM.*/FROM arm64v8\/alpine:3.7/' > Dockerfile.arm64 cat Dockerfile |sed -e 's/\.build\/linux-amd64\/operator/operator/' |sed -e 's/^FROM.*/FROM amd64\/alpine:3.7/' > Dockerfile.amd64 GOOS=linux GOARCH=arm go build . docker build -t $REPO/kube-state-metrics:${KSM_VERSION}-arm -f Dockerfile.arm . GOOS=linux GOARCH=arm64 go build . docker build -t $REPO/kube-state-metrics:${KSM_VERSION}-arm64 -f Dockerfile.arm64 . GOOS=linux GOARCH=amd64 go build . docker build -t $REPO/kube-state-metrics:${KSM_VERSION}-amd64 -f Dockerfile.amd64 . docker push $REPO/kube-state-metrics:$KSM_VERSION-arm docker push $REPO/kube-state-metrics:$KSM_VERSION-arm64 docker push $REPO/kube-state-metrics:$KSM_VERSION-amd64 docker rmi $REPO/kube-state-metrics:$KSM_VERSION-arm docker rmi $REPO/kube-state-metrics:$KSM_VERSION-arm64 docker rmi $REPO/kube-state-metrics:$KSM_VERSION-amd64 docker manifest create --amend $IMAGE:$VERSION `echo $ALL_ARCH | sed -e "s~[^ ]*~$IMAGE:$VERSION\-&~g"` for arch in $ALL_ARCH; do docker manifest annotate --arch $arch $IMAGE:$VERSION $IMAGE:$VERSION-$arch; done docker manifest push $IMAGE:$VERSION popd #------------------------------------------------------------------------------- # Prometheus-operator IMAGE=carlosedp/prometheus-operator ALL_ARCH='amd64 arm arm64' VERSION=$PROM_OP_VERSION go get github.com/coreos/prometheus-operator cd $HOME/go/src/github.com/coreos/prometheus-operator git checkout ${VERSION} go get -u github.com/prometheus/promu cat Dockerfile |sed -e 's/\.build\/linux-amd64\/operator/operator/' |sed -e 's/^FROM.*/FROM arm32v6\/busybox/' > Dockerfile.arm cat Dockerfile |sed -e 's/\.build\/linux-amd64\/operator/operator/' |sed -e 's/^FROM.*/FROM arm64v8\/busybox/' > Dockerfile.arm64 cat Dockerfile |sed -e 's/\.build\/linux-amd64\/operator/operator/' |sed -e 's/^FROM.*/FROM amd64\/busybox/' > Dockerfile.amd64 GOOS=linux GOARCH=arm $GOPATH/bin/promu build --prefix `pwd` docker build -t $REPO/prometheus-operator:${VERSION}-arm -f Dockerfile.arm . GOOS=linux GOARCH=arm64 $GOPATH/bin/promu build --prefix `pwd` docker build -t $REPO/prometheus-operator:${VERSION}-arm64 -f Dockerfile.arm64 . GOOS=linux GOARCH=amd64 $GOPATH/bin/promu build --prefix `pwd` docker build -t $REPO/prometheus-operator:${VERSION}-amd64 -f Dockerfile.amd64 . docker push $REPO/prometheus-operator:$VERSION-arm docker push $REPO/prometheus-operator:$VERSION-arm64 docker push $REPO/prometheus-operator:$VERSION-amd64 docker manifest create --amend $IMAGE:$VERSION `echo $ALL_ARCH | sed -e "s~[^ ]*~$IMAGE:$VERSION\-&~g"` for arch in $ALL_ARCH; do docker manifest annotate --arch $arch $IMAGE:$VERSION $IMAGE:$VERSION-$arch; done docker manifest push $IMAGE:$VERSION rm Dockerfile.arm rm Dockerfile.arm64 #------------------------------------------------------------------------------- # kube-rbac-proxy IMAGE=carlosedp/kube-rbac-proxy VERSION=$KUBE_RBAC_VERSION ALL_ARCH='amd64 arm arm64' go get github.com/brancz/kube-rbac-proxy cd $HOME/go/src/github.com/brancz/kube-rbac-proxy git checkout ${VERSION} cat > Dockerfile.arm < Dockerfile.arm64 < Dockerfile.amd64 < Dockerfile.arm cat Dockerfile |sed -e 's/\.build\/linux-amd64\/operator/operator/' |sed -e 's/^FROM.*/FROM arm64v8\/busybox/' > Dockerfile.arm64 cat Dockerfile |sed -e 's/\.build\/linux-amd64\/operator/operator/' |sed -e 's/^FROM.*/FROM amd64\/busybox/' > Dockerfile.amd64 GOOS=linux GOARCH=arm CGO_ENABLED=0 go build -o prometheus-config-reloader main.go docker build -t $IMAGE:$VERSION-arm -f Dockerfile.arm . GOOS=linux GOARCH=arm64 CGO_ENABLED=0 go build -o prometheus-config-reloader main.go docker build -t $IMAGE:$VERSION-arm64 -f Dockerfile.arm64 . GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -o prometheus-config-reloader main.go docker build -t $IMAGE:$VERSION-amd64 -f Dockerfile.amd64 . docker push $IMAGE:$VERSION-arm docker push $IMAGE:$VERSION-arm64 docker push $IMAGE:$VERSION-amd64 docker manifest create --amend $IMAGE:$VERSION `echo $ALL_ARCH | sed -e "s~[^ ]*~$IMAGE:$VERSION\-&~g"` for arch in $ALL_ARCH; do docker manifest annotate --arch $arch $IMAGE:$VERSION $IMAGE:$VERSION-$arch; done docker manifest push $IMAGE:$VERSION rm Dockerfile.arm rm Dockerfile.arm64 #------------------------------------------------------------------------------- # configmap-reload IMAGE=carlosedp/configmap-reload VERSION=$CONFIGMAP_RELOAD_VERSION ALL_ARCH='amd64 arm arm64' go get github.com/openshift/configmap-reload cd $HOME/go/src/github.com/openshift/configmap-reload #git checkout ${VERSION} cat > Dockerfile.arm < Dockerfile.arm64 < Dockerfile.amd64 <