Skip to content

Commit

Permalink
Migrating from ibmcom to cinple dockerhub repo (#2)
Browse files Browse the repository at this point in the history
* Migrating from ibmcom to cinple dockerhub repo

* Updated versions and moved gh repo

* Removing quotes from variables in Makefile

* Updated e2e tests for k8s 1.26

* Added additional k8s versions for e2e tests
  • Loading branch information
cin authored Apr 9, 2023
1 parent 54c5aff commit 9bdf53e
Show file tree
Hide file tree
Showing 70 changed files with 815 additions and 1,370 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/containers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
uses: docker/build-push-action@v3
with:
platforms: linux/amd64,linux/arm64
tags: ibmcom/varnish-operator:${{ steps.get_version.outputs.VERSION }}
tags: ${{ secrets.DOCKERHUB_REPO }}/varnish-operator:${{ steps.get_version.outputs.VERSION }}
file: ./Dockerfile
build-args: |
VERSION=${{ steps.get_version.outputs.VERSION }}
Expand All @@ -48,7 +48,7 @@ jobs:
uses: docker/build-push-action@v3
with:
platforms: linux/amd64,linux/arm64
tags: ibmcom/varnish:${{ steps.get_version.outputs.VERSION }}
tags: ${{ secrets.DOCKERHUB_REPO }}/varnish:${{ steps.get_version.outputs.VERSION }}
file: ./Dockerfile.varnishd
push: ${{ github.event_name == 'release' && github.event.action == 'created' }}
varnish-controller:
Expand All @@ -68,7 +68,7 @@ jobs:
uses: docker/build-push-action@v3
with:
platforms: linux/amd64,linux/arm64
tags: ibmcom/varnish-controller:${{ steps.get_version.outputs.VERSION }}
tags: ${{ secrets.DOCKERHUB_REPO }}/varnish-controller:${{ steps.get_version.outputs.VERSION }}
file: ./Dockerfile.controller
build-args: |
VERSION=${{ steps.get_version.outputs.VERSION }}
Expand All @@ -90,6 +90,6 @@ jobs:
uses: docker/build-push-action@v3
with:
platforms: linux/amd64,linux/arm64
tags: ibmcom/varnish-metrics-exporter:${{ steps.get_version.outputs.VERSION }}
tags: ${{ secrets.DOCKERHUB_REPO }}/varnish-metrics-exporter:${{ steps.get_version.outputs.VERSION }}
file: ./Dockerfile.exporter
push: ${{ github.event_name == 'release' && github.event.action == 'created' }}
4 changes: 2 additions & 2 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
cd docs_generated/
git init
git add .
git config --local user.name \"Tomash Sidei\"
git config --local user.email \"[email protected]\"
git config --global user.email "[email protected]"
git config --global user.name "gh-actions"
git commit -m "Deploy Docs from Actions"
git push --force --quiet https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }} HEAD:gh-pages
32 changes: 16 additions & 16 deletions .github/workflows/e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,31 +10,31 @@ jobs:
strategy:
fail-fast: false
matrix:
kubernetes-version: [ "1.25", "1.24", "1.23", "1.22"]
kubernetes-version: [ "1.26", "1.25", "1.24", "1.23"]
include:
- kubernetes-version: "1.26"
kind-node: kindest/node:v1.26.3@sha256:61b92f38dff6ccc29969e7aa154d34e38b89443af1a2c14e6cfbd2df6419c66f
- kubernetes-version: "1.25"
kind-node: kindest/node:v1.25.2@sha256:9be91e9e9cdf116809841fc77ebdb8845443c4c72fe5218f3ae9eb57fdb4bace
kind-node: kindest/node:v1.25.8@sha256:00d3f5314cc35327706776e95b2f8e504198ce59ac545d0200a89e69fce10b7f
- kubernetes-version: "1.24"
kind-node: kindest/node:v1.24.6@sha256:97e8d00bc37a7598a0b32d1fabd155a96355c49fa0d4d4790aab0f161bf31be1
kind-node: kindest/node:v1.24.12@sha256:1e12918b8bc3d4253bc08f640a231bb0d3b2c5a9b28aa3f2ca1aee93e1e8db16
- kubernetes-version: "1.23"
kind-node: kindest/node:v1.23.12@sha256:9402cf1330bbd3a0d097d2033fa489b2abe40d479cc5ef47d0b6a6960613148a
- kubernetes-version: "1.22"
kind-node: kindest/node:v1.22.15@sha256:bfd5eaae36849bfb3c1e3b9442f3da17d730718248939d9d547e86bbac5da586
kind-node: kindest/node:v1.23.17@sha256:e5fd1d9cd7a9a50939f9c005684df5a6d145e8d695e78463637b79464292e66c
steps:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: ^1.19
go-version: ^1.20
- name: Check out code into the Go module directory
uses: actions/checkout@v3
- name: Get dependencies
run: go mod download
- name: build images
run: |
docker build --platform linux/amd64 -f Dockerfile -t ibmcom/varnish-operator:local .
docker build --platform linux/amd64 -f Dockerfile.varnishd -t ibmcom/varnish:local .
docker build --platform linux/amd64 -f Dockerfile.controller -t ibmcom/varnish-controller:local .
docker build --platform linux/amd64 -f Dockerfile.exporter -t ibmcom/varnish-metrics-exporter:local .
docker build --platform linux/amd64 -f Dockerfile -t ${{ secrets.DOCKERHUB_REPO }}/varnish-operator:local .
docker build --platform linux/amd64 -f Dockerfile.varnishd -t ${{ secrets.DOCKERHUB_REPO }}/varnish:local .
docker build --platform linux/amd64 -f Dockerfile.controller -t ${{ secrets.DOCKERHUB_REPO }}/varnish-controller:local .
docker build --platform linux/amd64 -f Dockerfile.exporter -t ${{ secrets.DOCKERHUB_REPO }}/varnish-metrics-exporter:local .
- name: Create k8s Kind Cluster ${{ matrix.kubernetes-version }}
uses: helm/[email protected]
with:
Expand All @@ -46,13 +46,13 @@ jobs:
run: kubectl create namespace varnish-operator
- name: load images
run: |
kind load --name e2e-tests docker-image ibmcom/varnish-operator:local
kind load --name e2e-tests docker-image ibmcom/varnish:local
kind load --name e2e-tests docker-image ibmcom/varnish-controller:local
kind load --name e2e-tests docker-image ibmcom/varnish-metrics-exporter:local
kind load --name e2e-tests docker-image ${{ secrets.DOCKERHUB_REPO }}/varnish-operator:local
kind load --name e2e-tests docker-image ${{ secrets.DOCKERHUB_REPO }}/varnish:local
kind load --name e2e-tests docker-image ${{ secrets.DOCKERHUB_REPO }}/varnish-controller:local
kind load --name e2e-tests docker-image ${{ secrets.DOCKERHUB_REPO }}/varnish-metrics-exporter:local
- name: install operator
id: helm
run: helm install varnish-operator --debug --namespace=varnish-operator varnish-operator --wait --set container.imagePullPolicy=Never --set container.image=ibmcom/varnish-operator:local
run: helm install varnish-operator --debug --namespace=varnish-operator varnish-operator --wait --set container.imagePullPolicy=Never --set container.image=${{ secrets.DOCKERHUB_REPO }}/varnish-operator:local
- name: run tests
id: e2e
run: go test -count=1 ./tests #-count=1 is to disable tests caching.
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
- name: Setup-go installation
uses: actions/setup-go@v3
with:
go-version: ^1.19
go-version: ^1.20
- name: Run golangci-lint
uses: golangci/golangci-lint-action@v3
with:
Expand All @@ -26,7 +26,7 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: ^1.19
go-version: ^1.20
id: go
- name: Setup Kubebuilder assets
run: |
Expand All @@ -41,4 +41,4 @@ jobs:
run: go mod download
- name: Unit tests
run: |
go test github.com/ibm/varnish-operator/pkg/... github.com/ibm/varnish-operator/cmd/... github.com/ibm/varnish-operator/api/... -coverprofile cover.out
go test github.com/cin/varnish-operator/pkg/... github.com/cin/varnish-operator/cmd/... github.com/cin/varnish-operator/api/... -coverprofile cover.out
8 changes: 4 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ARG BUILDPLATFORM=linux/amd64
FROM --platform=$BUILDPLATFORM golang:1.19.5-bullseye AS builder
FROM --platform=$BUILDPLATFORM golang:1.20-bullseye AS builder

ENV DEBIAN_FRONTEND=noninteractive INSTALL_DIRECTORY=/usr/local/bin

Expand All @@ -8,7 +8,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
curl \
&& rm -rf /var/lib/apt/lists/*

WORKDIR /go/src/github.com/ibm/varnish-operator
WORKDIR /go/src/github.com/cin/varnish-operator

ENV GOPROXY=https://proxy.golang.org

Expand All @@ -29,7 +29,7 @@ RUN CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH \
-ldflags "-X main.Version=$VERSION" \
-a \
-o varnish-operator \
github.com/ibm/varnish-operator/cmd/varnish-operator
github.com/cin/varnish-operator/cmd/varnish-operator


FROM --platform=$BUILDPLATFORM debian:bullseye-slim
Expand All @@ -45,7 +45,7 @@ RUN apt-get update && apt-get upgrade -y \

RUN addgroup --gid 901 varnish-operator && adduser --uid 901 --gid 901 varnish-operator

COPY --from=builder /go/src/github.com/ibm/varnish-operator/varnish-operator .
COPY --from=builder /go/src/github.com/cin/varnish-operator/varnish-operator .

USER varnish-operator

Expand Down
6 changes: 3 additions & 3 deletions Dockerfile.controller
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
ARG BUILDPLATFORM=linux/amd64
FROM --platform=$BUILDPLATFORM golang:1.19.5-bullseye AS builder
FROM --platform=$BUILDPLATFORM golang:1.20-bullseye AS builder

ENV DEBIAN_FRONTEND=noninteractive INSTALL_DIRECTORY=/usr/local/bin

RUN apt-get update && apt-get upgrade -y && apt-get install -y --no-install-recommends git curl

WORKDIR /go/src/github.com/ibm/varnish-operator
WORKDIR /go/src/github.com/cin/varnish-operator

ENV GOPROXY=https://proxy.golang.org

Expand Down Expand Up @@ -45,7 +45,7 @@ RUN apt-get update && apt-get upgrade -y && apt-get install -y --no-install-reco
&& chown -R varnish /etc/varnish /var/lib/varnish

COPY --from=binary /usr/bin/varnishadm /usr/bin/varnishstat /usr/bin/
COPY --from=builder /go/src/github.com/ibm/varnish-operator/varnish-controller /varnish-controller
COPY --from=builder /go/src/github.com/cin/varnish-operator/varnish-controller /varnish-controller

USER varnish

Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.exporter
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ARG BUILDPLATFORM=linux/amd64
FROM --platform=$BUILDPLATFORM golang:1.19.5-bullseye AS builder
FROM --platform=$BUILDPLATFORM golang:1.20-bullseye AS builder
ARG TARGETOS=linux
ARG TARGETARCH=amd64
ARG PROMETHEUS_VARNISH_EXPORTER_VERSION=1.6.1
Expand Down
21 changes: 11 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Image URL to use in all building/pushing image targets
ROOT_DIR := $(dir $(realpath $(lastword $(MAKEFILE_LIST))))
VERSION ?= "local"
PUBLISH_IMG ?= ibmcom/varnish-operator:${VERSION}
VERSION ?= local
REPO ?= cinple
PUBLISH_IMG ?= ${REPO}/varnish-operator:${VERSION}
IMG ?= ${PUBLISH_IMG}-dev
VARNISH_PUBLISH_IMG ?= varnish:${VERSION}
VARNISH_IMG ?= ${VARNISH_PUBLISH_IMG}-dev
Expand All @@ -18,19 +19,19 @@ all: test varnish-operator varnish-controller

# Run tests
test: generate fmt vet manifests
go test github.com/ibm/varnish-operator/pkg/... github.com/ibm/varnish-operator/cmd/... github.com/ibm/varnish-operator/api/... -coverprofile cover.out
go test github.com/cin/varnish-operator/pkg/... github.com/cin/varnish-operator/cmd/... github.com/cin/varnish-operator/api/... -coverprofile cover.out

# Run lint tools
lint:
golangci-lint run

# Build varnish-operator binary
varnish-operator: generate fmt vet
go build -o ${ROOT_DIR}bin/varnish-operator github.com/ibm/varnish-operator/cmd/varnish-operator
go build -o ${ROOT_DIR}bin/varnish-operator github.com/cin/varnish-operator/cmd/varnish-operator

# Run against the configured Kubernetes cluster in ~/.kube/config
run: generate fmt vet
NAMESPACE=${NAMESPACE} LOGLEVEL=debug LOGFORMAT=console CONTAINER_IMAGE=ibmcom/${VARNISH_IMG} LEADERELECTION_ENABLED=false WEBHOOKS_ENABLED=false go run ${ROOT_DIR}cmd/varnish-operator/main.go
NAMESPACE=${NAMESPACE} LOGLEVEL=debug LOGFORMAT=console CONTAINER_IMAGE=${REPO}/${VARNISH_IMG} LEADERELECTION_ENABLED=false WEBHOOKS_ENABLED=false go run ${ROOT_DIR}cmd/varnish-operator/main.go

# Deploy controller in the configured Kubernetes cluster in ~/.kube/config
install: manifests
Expand Down Expand Up @@ -71,7 +72,7 @@ docker-build: test
# Tag and push the docker image
docker-tag-push:
ifndef REPO_PATH
$(error must set REPO_PATH, eg "make docker-tag-push REPO_PATH=ibmcom")
$(error must set REPO_PATH, eg "make docker-tag-push REPO_PATH=${REPO}")
endif
ifndef PUBLISH
docker tag ${IMG} ${REPO_PATH}/${IMG}
Expand All @@ -90,7 +91,7 @@ docker-build-varnish:

docker-tag-push-varnish:
ifndef REPO_PATH
$(error must set REPO_PATH, eg "make docker-tag-push REPO_PATH=ibmcom")
$(error must set REPO_PATH, eg "make docker-tag-push REPO_PATH=${REPO}")
endif
ifndef PUBLISH
docker tag ${VARNISH_IMG} ${REPO_PATH}/${VARNISH_IMG}
Expand All @@ -106,7 +107,7 @@ docker-build-varnish-controller: fmt vet

docker-tag-push-varnish-controller:
ifndef REPO_PATH
$(error must set REPO_PATH, eg "make docker-tag-push REPO_PATH=ibmcom")
$(error must set REPO_PATH, eg "make docker-tag-push REPO_PATH=${REPO}")
endif
ifndef PUBLISH
docker tag ${VARNISH_CONTROLLER_IMG} ${REPO_PATH}/${VARNISH_CONTROLLER_IMG}
Expand All @@ -122,7 +123,7 @@ docker-build-varnish-exporter:

docker-tag-push-varnish-exporter:
ifndef REPO_PATH
$(error must set REPO_PATH, eg "make docker-tag-push REPO_PATH=ibmcom")
$(error must set REPO_PATH, eg "make docker-tag-push REPO_PATH=${REPO}")
endif
ifndef PUBLISH
docker tag ${VARNISH_METRICS_IMG} ${REPO_PATH}/${VARNISH_METRICS_IMG}
Expand All @@ -139,7 +140,7 @@ docker-tag-push-pod: docker-tag-push-varnish docker-tag-push-varnish-exporter do
# download controller-gen if necessary
controller-gen:
ifeq (, $(shell which controller-gen))
go install sigs.k8s.io/controller-tools/cmd/[email protected].1
go install sigs.k8s.io/controller-tools/cmd/[email protected].3
CONTROLLER_GEN=$(GOBIN)/controller-gen
else
CONTROLLER_GEN=$(shell which controller-gen)
Expand Down
4 changes: 2 additions & 2 deletions PROJECT
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
domain: ibm.com
layout: go.kubebuilder.io/v3
projectName: varnish-operator
repo: github.com/ibm/varnish-operator
repo: github.com/cin/varnish-operator
resources:
- api:
crdVersion: v1
Expand All @@ -10,7 +10,7 @@ resources:
domain: ibm.com
group: caching
kind: VarnishCluster
path: github.com/ibm/varnish-operator/api/v1alpha1
path: github.com/cin/varnish-operator/api/v1alpha1
version: v1alpha1
version: "3"
plugins:
Expand Down
2 changes: 1 addition & 1 deletion api/v1alpha1/groupversion_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// Package v1alpha1 contains API Schema definitions for v1alpha1 API group
// +k8s:openapi-gen=true
// +k8s:deepcopy-gen=package,register
// +k8s:conversion-gen=github.com/ibm/varnish-operator/api/v1alpha1
// +k8s:conversion-gen=github.com/cin/varnish-operator/api/v1alpha1
// +k8s:defaulter-gen=TypeMeta
// +kubebuilder:object:generate=true
// +groupName=caching.ibm.com
Expand Down
2 changes: 1 addition & 1 deletion api/v1alpha1/varnishcluster_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"regexp"
"strings"

"github.com/ibm/varnish-operator/pkg/logger"
"github.com/cin/varnish-operator/pkg/logger"

"go.uber.org/zap"

Expand Down
12 changes: 6 additions & 6 deletions cmd/varnish-controller/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ import (
"fmt"
"log"

"github.com/ibm/varnish-operator/api/v1alpha1"
"github.com/ibm/varnish-operator/pkg/logger"
"github.com/ibm/varnish-operator/pkg/varnishcontroller/config"
"github.com/ibm/varnish-operator/pkg/varnishcontroller/controller"
varnishMetrics "github.com/ibm/varnish-operator/pkg/varnishcontroller/metrics"
"github.com/ibm/varnish-operator/pkg/varnishcontroller/varnishadm"
"github.com/cin/varnish-operator/api/v1alpha1"
"github.com/cin/varnish-operator/pkg/logger"
"github.com/cin/varnish-operator/pkg/varnishcontroller/config"
"github.com/cin/varnish-operator/pkg/varnishcontroller/controller"
varnishMetrics "github.com/cin/varnish-operator/pkg/varnishcontroller/metrics"
"github.com/cin/varnish-operator/pkg/varnishcontroller/varnishadm"

controllerMetrics "sigs.k8s.io/controller-runtime/pkg/metrics"

Expand Down
8 changes: 4 additions & 4 deletions cmd/varnish-operator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ import (
"fmt"
"log"

"github.com/ibm/varnish-operator/api/v1alpha1"
"github.com/ibm/varnish-operator/pkg/logger"
vccfg "github.com/ibm/varnish-operator/pkg/varnishcluster/config"
"github.com/ibm/varnish-operator/pkg/varnishcluster/controller"
"github.com/cin/varnish-operator/api/v1alpha1"
"github.com/cin/varnish-operator/pkg/logger"
vccfg "github.com/cin/varnish-operator/pkg/varnishcluster/config"
"github.com/cin/varnish-operator/pkg/varnishcluster/controller"

"k8s.io/apimachinery/pkg/runtime"
"sigs.k8s.io/controller-runtime/pkg/healthz"
Expand Down
Loading

0 comments on commit 9bdf53e

Please sign in to comment.