Skip to content

Commit

Permalink
Merge pull request #49 from patoarvizu/update-upstream-schema
Browse files Browse the repository at this point in the history
Update upstream schema
  • Loading branch information
patoarvizu authored Dec 31, 2021
2 parents 4f024cb + 5940ee5 commit f40e827
Show file tree
Hide file tree
Showing 4 changed files with 379 additions and 308 deletions.
192 changes: 167 additions & 25 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,33 @@ orbs:
executors:
vm:
machine:
image: ubuntu-1604:202007-01
image: ubuntu-2004:202111-02
resource_class: large
environment:
GOLANG_VERSION: 1.13.8
GOLANG_VERSION: 1.16.12
NOTARY_VERSION: 0.6.1
KUBECTL_VERSION: 1.12.0
K3D_VERSION: 3.0.0
KUBECTL_VERSION: 1.21.5
K3D_VERSION: 4.4.8
GOPATH: /home/circleci/go
GO111MODULE: "on"
DOCKER_CLI_EXPERIMENTAL: enabled
working_directory: /home/circleci/go/src/github.com/patoarvizu/vault-dynamic-configuration-operator
vm-arm:
machine:
image: ubuntu-2004:202111-02
resource_class: arm.medium
environment:
GOLANG_VERSION: 1.16.12
NOTARY_VERSION: 0.6.1
KUBECTL_VERSION: 1.21.5
K3D_VERSION: 4.4.8
GOPATH: /home/circleci/go
GO111MODULE: "on"
DOCKER_CLI_EXPERIMENTAL: enabled
working_directory: /home/circleci/go/src/github.com/patoarvizu/vault-dynamic-configuration-operator

jobs:
build:
test:
executor: vm
steps:
- checkout
Expand Down Expand Up @@ -65,11 +79,14 @@ jobs:
name: Run all tests
command: |
export KUBECONFIG=~/.k3d/k3s-default-config
k3d cluster create --image rancher/k3s:v1.0.0 --wait
k3d cluster create --wait
k3d image import patoarvizu/vault-dynamic-configuration-operator:latest
kubectl apply -f https://raw.githubusercontent.com/patoarvizu/common-manifests/master/prometheus-operator/crds.yaml
sleep 10
kubectl apply -f https://raw.githubusercontent.com/patoarvizu/common-manifests/master/vault/vault-operator.yaml
sleep 10
kubectl apply -f https://raw.githubusercontent.com/patoarvizu/common-manifests/master/vault/vault-cluster-kubernetes-and-db.yaml
sleep 10
kubectl apply -f test/manifests/namespaces/test.yaml
helm install vault-dynamic-configuration-operator helm/vault-dynamic-configuration-operator/ -n vault
sleep 60
Expand All @@ -81,16 +98,25 @@ jobs:
key: vault-dynamic-configuration-operator-golang-cache-{{ checksum "go.sum" }}
paths:
- /home/circleci/go/pkg/mod/cache

build-and-push-amd64-image:
executor: vm
steps:
- checkout
- run:
name: Install notary
command: |
curl -L https://github.com/theupdateframework/notary/releases/download/v${NOTARY_VERSION}/notary-Linux-amd64 -o notary
curl -L https://github.com/theupdateframework/notary/releases/download/v0.6.1/notary-Linux-amd64 -o notary
chmod +x notary
sudo mv notary /usr/local/bin
- run:
name: Build operator
name: Log in to Docker Hub
command: |
docker login --username $DOCKER_HUB_USER --password $DOCKER_HUB_ACCESS_TOKEN
- run:
name: Build and push amd64 image
command: |
docker buildx create --name cci-builder --use
echo $ENCODED_NOTARY_ROLE_KEY | base64 -d > ${HOME}/vault-dynamic-configuration-operator-circleci.key
export NOTARY_DELEGATION_PASSPHRASE=$NOTARY_ROLE_PASSPHRASE
notary -s https://notary.docker.io -d ~/.docker/trust key import ${HOME}/vault-dynamic-configuration-operator-circleci.key --role vault-dynamic-configuration-operator-circleci
Expand All @@ -102,66 +128,182 @@ jobs:
docker push patoarvizu/vault-dynamic-configuration-operator:latest-amd64
docker push patoarvizu/vault-dynamic-configuration-operator:$CIRCLE_SHA1-amd64
docker push patoarvizu/vault-dynamic-configuration-operator:$VERSION-amd64
no_output_timeout: 30m
push-multi-arch:
build-arm64-image:
executor: vm-arm
steps:
- checkout
- run:
name: Build arm64 image
command: |
docker buildx create --name cci-builder --use
OPERATOR_BUILD_ARGS="--build-arg GIT_COMMIT=$CIRCLE_SHA1 --build-arg GIT_TAG=$CIRCLE_TAG --build-arg COMMIT_TIMESTAMP=$(git log -1 --format=%at) --build-arg AUTHOR_EMAIL=$(git log -1 --format=%ae) --build-arg SIGNATURE_KEY=$(git log -1 --format=%GK)"
docker buildx build --progress=plain --platform=linux/arm64 --cache-to=type=local,dest=/tmp/latest-arm64-cache,mode=max $OPERATOR_BUILD_ARGS . -t patoarvizu/vault-dynamic-configuration-operator:latest-arm64
- persist_to_workspace:
root: /tmp/
paths:
- latest-arm64-cache

push-arm64-image:
executor: vm
steps:
- checkout
- attach_workspace:
at: /tmp/
- run:
name: Install notary
command: |
curl -L https://github.com/theupdateframework/notary/releases/download/v0.6.1/notary-Linux-amd64 -o notary
chmod +x notary
sudo mv notary /usr/local/bin
- run:
name: Push multi-arch images
name: Log in to Docker Hub
command: |
docker login --username $DOCKER_HUB_USER --password $DOCKER_HUB_ACCESS_TOKEN
- run:
name: Sign and push arm64 image
command: |
sudo apt-get update
sudo apt-get install qemu-user -y
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
docker buildx create --name cci-builder --use
docker login --username $DOCKER_HUB_USER --password $DOCKER_HUB_ACCESS_TOKEN
echo $ENCODED_NOTARY_ROLE_KEY | base64 -d > ${HOME}/vault-dynamic-configuration-operator-circleci.key
export NOTARY_DELEGATION_PASSPHRASE=$NOTARY_ROLE_PASSPHRASE
notary -s https://notary.docker.io -d ~/.docker/trust key import ${HOME}/vault-dynamic-configuration-operator-circleci.key --role vault-dynamic-configuration-operator-circleci
export DOCKER_CONTENT_TRUST_REPOSITORY_PASSPHRASE=$NOTARY_DELEGATION_PASSPHRASE
OPERATOR_BUILD_ARGS="--build-arg GIT_COMMIT=$CIRCLE_SHA1 --build-arg GIT_TAG=$CIRCLE_TAG --build-arg COMMIT_TIMESTAMP=$(git log -1 --format=%at) --build-arg AUTHOR_EMAIL=$(git log -1 --format=%ae) --build-arg SIGNATURE_KEY=$(git log -1 --format=%GK)"
export DOCKER_CONTENT_TRUST=1
VERSION=${CIRCLE_TAG:-latest}
docker buildx build --progress=plain --platform=linux/arm64 --load $OPERATOR_BUILD_ARGS . -t patoarvizu/vault-dynamic-configuration-operator:latest-arm64 -t patoarvizu/vault-dynamic-configuration-operator:$CIRCLE_SHA1-arm64 -t patoarvizu/vault-dynamic-configuration-operator:$VERSION-arm64
docker buildx build --progress=plain --platform=linux/arm/v7 --load $OPERATOR_BUILD_ARGS . -t patoarvizu/vault-dynamic-configuration-operator:latest-arm7 -t patoarvizu/vault-dynamic-configuration-operator:$CIRCLE_SHA1-arm7 -t patoarvizu/vault-dynamic-configuration-operator:$VERSION-arm7
docker buildx build --progress=plain --platform=linux/arm64 --cache-from=type=local,src=/tmp/latest-arm64-cache --load $OPERATOR_BUILD_ARGS . -t patoarvizu/vault-dynamic-configuration-operator:latest-arm64
docker tag patoarvizu/vault-dynamic-configuration-operator:latest-arm64 patoarvizu/vault-dynamic-configuration-operator:$CIRCLE_SHA1-arm64
docker tag patoarvizu/vault-dynamic-configuration-operator:latest-arm64 patoarvizu/vault-dynamic-configuration-operator:$VERSION-arm64
docker push patoarvizu/vault-dynamic-configuration-operator:latest-arm64
docker push patoarvizu/vault-dynamic-configuration-operator:$CIRCLE_SHA1-arm64
docker push patoarvizu/vault-dynamic-configuration-operator:$VERSION-arm64
no_output_timeout: 60m

build-arm7-image:
executor: vm-arm
steps:
- checkout
- run:
name: Build arm7 image
command: |
docker buildx create --name cci-builder --use
OPERATOR_BUILD_ARGS="--build-arg GIT_COMMIT=$CIRCLE_SHA1 --build-arg GIT_TAG=$CIRCLE_TAG --build-arg COMMIT_TIMESTAMP=$(git log -1 --format=%at) --build-arg AUTHOR_EMAIL=$(git log -1 --format=%ae) --build-arg SIGNATURE_KEY=$(git log -1 --format=%GK)"
docker buildx build --progress=plain --platform=linux/arm/v7 --cache-to=type=local,dest=/tmp/latest-arm7-cache,mode=max $OPERATOR_BUILD_ARGS . -t patoarvizu/vault-dynamic-configuration-operator:latest-arm7
- persist_to_workspace:
root: /tmp/
paths:
- latest-arm7-cache

push-arm7-image:
executor: vm
steps:
- checkout
- attach_workspace:
at: /tmp/
- run:
name: Install notary
command: |
curl -L https://github.com/theupdateframework/notary/releases/download/v0.6.1/notary-Linux-amd64 -o notary
chmod +x notary
sudo mv notary /usr/local/bin
- run:
name: Log in to Docker Hub
command: |
docker login --username $DOCKER_HUB_USER --password $DOCKER_HUB_ACCESS_TOKEN
- run:
name: Sign and push arm7 image
command: |
sudo apt-get update
sudo apt-get install qemu-user -y
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
docker buildx create --name cci-builder --use
echo $ENCODED_NOTARY_ROLE_KEY | base64 -d > ${HOME}/vault-dynamic-configuration-operator-circleci.key
export NOTARY_DELEGATION_PASSPHRASE=$NOTARY_ROLE_PASSPHRASE
notary -s https://notary.docker.io -d ~/.docker/trust key import ${HOME}/vault-dynamic-configuration-operator-circleci.key --role vault-dynamic-configuration-operator-circleci
export DOCKER_CONTENT_TRUST_REPOSITORY_PASSPHRASE=$NOTARY_DELEGATION_PASSPHRASE
OPERATOR_BUILD_ARGS="--build-arg GIT_COMMIT=$CIRCLE_SHA1 --build-arg GIT_TAG=$CIRCLE_TAG --build-arg COMMIT_TIMESTAMP=$(git log -1 --format=%at) --build-arg AUTHOR_EMAIL=$(git log -1 --format=%ae) --build-arg SIGNATURE_KEY=$(git log -1 --format=%GK)"
export DOCKER_CONTENT_TRUST=1
VERSION=${CIRCLE_TAG:-latest}
docker buildx build --progress=plain --platform=linux/arm/v7 --cache-from=type=local,src=/tmp/latest-arm7-cache --load $OPERATOR_BUILD_ARGS . -t patoarvizu/vault-dynamic-configuration-operator:latest-arm7
docker tag patoarvizu/vault-dynamic-configuration-operator:latest-arm7 patoarvizu/vault-dynamic-configuration-operator:$CIRCLE_SHA1-arm7
docker tag patoarvizu/vault-dynamic-configuration-operator:latest-arm7 patoarvizu/vault-dynamic-configuration-operator:$VERSION-arm7
docker push patoarvizu/vault-dynamic-configuration-operator:latest-arm7
docker push patoarvizu/vault-dynamic-configuration-operator:$CIRCLE_SHA1-arm7
docker push patoarvizu/vault-dynamic-configuration-operator:$VERSION-arm7
docker buildx build --progress=plain --platform=linux/amd64,linux/arm64,linux/arm/v7 --push $OPERATOR_BUILD_ARGS . -t patoarvizu/vault-dynamic-configuration-operator:latest -t patoarvizu/vault-dynamic-configuration-operator:$CIRCLE_SHA1 -t patoarvizu/vault-dynamic-configuration-operator:$VERSION
DIGEST=$(docker buildx imagetools inspect patoarvizu/vault-dynamic-configuration-operator:$CIRCLE_SHA1 | grep Digest | cut -d':' -f3)
LENGTH=$(( $(docker buildx imagetools inspect patoarvizu/vault-dynamic-configuration-operator:$CIRCLE_SHA1 --raw | wc -c) - 1 ))
no_output_timeout: 60m

push-combined-image:
executor: vm
steps:
- checkout
- run:
name: Install notary
command: |
curl -L https://github.com/theupdateframework/notary/releases/download/v0.6.1/notary-Linux-amd64 -o notary
chmod +x notary
sudo mv notary /usr/local/bin
- run:
name: Log in to Docker Hub
command: |
docker login --username $DOCKER_HUB_USER --password $DOCKER_HUB_ACCESS_TOKEN
- run:
name: Sign and push combined image
command: |
docker buildx create --name cci-builder --use
echo $ENCODED_NOTARY_ROLE_KEY | base64 -d > ${HOME}/vault-dynamic-configuration-operator-circleci.key
export NOTARY_DELEGATION_PASSPHRASE=$NOTARY_ROLE_PASSPHRASE
notary -s https://notary.docker.io -d ~/.docker/trust key import ${HOME}/vault-dynamic-configuration-operator-circleci.key --role vault-dynamic-configuration-operator-circleci
export DOCKER_CONTENT_TRUST_REPOSITORY_PASSPHRASE=$NOTARY_DELEGATION_PASSPHRASE
export DOCKER_CONTENT_TRUST=1
VERSION=${CIRCLE_TAG:-latest}
docker manifest create patoarvizu/vault-dynamic-configuration-operator:latest --amend patoarvizu/vault-dynamic-configuration-operator:latest-amd64 --amend patoarvizu/vault-dynamic-configuration-operator:latest-arm64 patoarvizu/vault-dynamic-configuration-operator:latest-arm7
docker manifest push patoarvizu/vault-dynamic-configuration-operator:latest
docker manifest create patoarvizu/vault-dynamic-configuration-operator:$CIRCLE_SHA1 --amend patoarvizu/vault-dynamic-configuration-operator:$CIRCLE_SHA1-amd64 --amend patoarvizu/vault-dynamic-configuration-operator:$CIRCLE_SHA1-arm64 patoarvizu/vault-dynamic-configuration-operator:$CIRCLE_SHA1-arm7
docker manifest push patoarvizu/vault-dynamic-configuration-operator:$CIRCLE_SHA1
docker manifest create patoarvizu/vault-dynamic-configuration-operator:$VERSION --amend patoarvizu/vault-dynamic-configuration-operator:$VERSION-amd64 --amend patoarvizu/vault-dynamic-configuration-operator:$VERSION-arm64 patoarvizu/vault-dynamic-configuration-operator:$VERSION-arm7
docker manifest push patoarvizu/vault-dynamic-configuration-operator:$VERSION
DIGEST=$(docker buildx imagetools inspect patoarvizu/vault-dynamic-configuration-operator:latest | grep Digest | cut -d':' -f3)
LENGTH=$(( $(docker buildx imagetools inspect patoarvizu/vault-dynamic-configuration-operator:latest --raw | wc -c) - 1 ))
export NOTARY_AUTH=$(echo $DOCKER_HUB_USER:$DOCKER_HUB_ACCESS_TOKEN | base64)
notary -s https://notary.docker.io -d ~/.docker/trust addhash -p docker.io/patoarvizu/vault-dynamic-configuration-operator latest $LENGTH --sha256 $DIGEST -r targets/releases
notary -s https://notary.docker.io -d ~/.docker/trust addhash -p docker.io/patoarvizu/vault-dynamic-configuration-operator $CIRCLE_SHA1 $LENGTH --sha256 $DIGEST -r targets/releases
notary -s https://notary.docker.io -d ~/.docker/trust addhash -p docker.io/patoarvizu/vault-dynamic-configuration-operator $VERSION $LENGTH --sha256 $DIGEST -r targets/releases
no_output_timeout: 30m
workflows:
version: 2
build-operator:
jobs:
- build:
- test:
context: authentication-tokens
filters:
tags:
only: /^v\d+\.\d+.\d+$/
- push-multi-arch:
- build-and-push-amd64-image:
requires:
- test
context: authentication-tokens
- build-arm64-image:
requires:
- test
- push-arm64-image:
requires:
- build-arm64-image
context: authentication-tokens
- build-arm7-image:
requires:
- test
- push-arm7-image:
requires:
- build-arm7-image
context: authentication-tokens
- push-combined-image:
requires:
- build
- build-and-push-amd64-image
- push-arm64-image
- push-arm7-image
context: authentication-tokens
filters:
branches:
ignore: /^.*$/
only: /^master$/
tags:
only: /^v\d+\.\d+.\d+$/
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build the manager binary
FROM golang:1.13 as builder
FROM golang:1.16 as builder
ARG TARGETARCH
ARG TARGETVARIANT

Expand Down
22 changes: 13 additions & 9 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,22 +1,26 @@
module github.com/patoarvizu/vault-dynamic-configuration-operator

go 1.13
go 1.16

require (
github.com/banzaicloud/bank-vaults v1.7.1-0.20210215124259-db2bdd2dc82d
github.com/go-logr/logr v0.2.1
github.com/onsi/ginkgo v1.14.0
github.com/onsi/gomega v1.10.1
k8s.io/api v0.19.3
k8s.io/apimachinery v0.19.3
k8s.io/client-go v11.0.0+incompatible
sigs.k8s.io/controller-runtime v0.6.2
github.com/banzaicloud/bank-vaults v1.14.3-0.20211011063455-e2138a966538
github.com/go-logr/logr v0.4.0
github.com/onsi/ginkgo v1.15.0
github.com/onsi/gomega v1.10.5
k8s.io/api v0.21.1
k8s.io/apimachinery v0.21.1
k8s.io/client-go v0.21.1
sigs.k8s.io/controller-runtime v0.9.0-beta.5
)

replace (
github.com/go-logr/zapr => github.com/go-logr/zapr v0.4.0
github.com/onsi/ginkgo => github.com/onsi/ginkgo v1.14.0
github.com/onsi/gomega => github.com/onsi/gomega v1.10.1
google.golang.org/grpc => google.golang.org/grpc v1.29.1
k8s.io/api => k8s.io/api v0.19.3
k8s.io/apiextensions-apiserver => k8s.io/apiextensions-apiserver v0.19.3
k8s.io/apimachinery => k8s.io/apimachinery v0.19.3
k8s.io/client-go => k8s.io/client-go v0.19.3
sigs.k8s.io/controller-runtime => sigs.k8s.io/controller-runtime v0.6.2
)
Loading

0 comments on commit f40e827

Please sign in to comment.