Skip to content

Commit

Permalink
fix: refactor to make code cleaner and bump version of golang and env…
Browse files Browse the repository at this point in the history
…test (#102)

* fix: refactor to make code cleaner

* Fix typo

* Fix typo

* Fix typo

* bump k3d and k3s

* Fix typo

* Fix typo

* update all components

* Fix typo
  • Loading branch information
isindir authored Mar 23, 2022
1 parent 4db467a commit 5cc657e
Show file tree
Hide file tree
Showing 15 changed files with 433 additions and 379 deletions.
36 changes: 18 additions & 18 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ jobs:
image: ubuntu-2004:202111-02
environment: &versions
# https://github.com/kubernetes/kubernetes/releases
KUBECTL_VERSION: v1.23.1
KUBECTL_VERSION: v1.23.3
# https://hub.docker.com/r/rancher/k3s/tags
K3S_VERSION: v1.22.5-k3s1
K3S_VERSION: v1.23.3-k3s1
# https://github.com/rancher/k3d/releases
K3D_VERSION: v4.4.8
# https://github.com/helm/helm/releases
HELM_VERSION: v3.8.1
# https://golang.org/dl/
GOLANG_VERSION: "1.17.8"
GOLANG_VERSION: "1.18"
# https://github.com/kubernetes-sigs/kubebuilder/releases
KUBEBUILDER_VERSION: 3.3.0
# https://github.com/mozilla/sops/releases
Expand All @@ -41,7 +41,7 @@ jobs:
# https://github.com/git-chglog/git-chglog/releases
GIT_CHGLOG_VERSION: 0.15.1
# https://github.com/docker/buildx/releases
BUILDX_BINARY_VERSION: 0.8.0
BUILDX_BINARY_VERSION: 0.8.1

DOCKER_BUILDKIT: 1
BUILDX_PLATFORMS: linux/amd64,linux/arm64
Expand Down Expand Up @@ -235,27 +235,17 @@ jobs:
kubectl describe node k3d-operator-server-0
kubectl describe node k3d-operator-agent-0
- run:
name: make test
name: Unit tests and envtest integration tests
command: |
make test
# run helm tests
# helm tests
- run:
name: Test helm charts
command: |
make test-helm
# k3d integration tests
- run:
name: Docker build
command: |
make docker-login
make docker-cross-build
no_output_timeout: 1h
- save_cache:
key: v2-modules-{{ .Branch }}-{{ checksum "go.sum" }}
paths:
- "/home/circleci/gogo/pkg"
# tests start here
- run:
name: Run Local Tests
name: In cluster integration tests
command: |
export GNUPGHOME="$(mktemp -d)"
cat >$GNUPGHOME/foo <<EOF
Expand Down Expand Up @@ -346,6 +336,16 @@ jobs:
exit 1
fi
rm -fr $GNUPGHOME
- run:
name: Docker build
command: |
make docker-login
make docker-cross-build
no_output_timeout: 1h
- save_cache:
key: v2-modules-{{ .Branch }}-{{ checksum "go.sum" }}
paths:
- "/home/circleci/gogo/pkg"

workflows:
version: 2
Expand Down
4 changes: 2 additions & 2 deletions .tool-versions
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
# https://github.com/kubernetes-sigs/kubebuilder/releases
kubebuilder 3.3.0
# https://golang.org/dl/
golang 1.17.8
golang 1.18
# https://github.com/mozilla/sops/releases
sops 3.7.2
# https://github.com/kubernetes-sigs/kustomize/releases
kustomize 4.5.2
# https://github.com/rancher/k3d/releases
k3d 4.4.8
# https://github.com/kubernetes/kubernetes/releases
kubectl 1.23.1
kubectl 1.23.3
# https://github.com/helm/helm/releases
helm 3.8.1
# https://github.com/norwoodj/helm-docs/releases
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Build the manager binary
# https://www.debian.org/releases/
# https://hub.docker.com/_/golang?tab=tags&page=1&ordering=last_updated
FROM golang:1.17.8-bullseye as builder
FROM golang:1.18-bullseye as builder

WORKDIR /workspace
# Copy the Go Modules manifests
Expand All @@ -22,7 +22,7 @@ RUN CGO_ENABLED=0 GO111MODULE=on go build -a -o manager main.go

# https://wiki.ubuntu.com/Releases
# https://hub.docker.com/_/ubuntu?tab=tags&page=1&ordering=last_updated
FROM ubuntu:focal-20220302
FROM ubuntu:focal-20220316

RUN apt-get -y update \
&& apt-get -y upgrade \
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# UPDATE_HERE
GO := GOPROXY=https://proxy.golang.org go
SOPS_SEC_OPERATOR_VERSION := 0.4.5
SOPS_SEC_OPERATOR_VERSION := 0.4.6

# https://github.com/kubernetes-sigs/controller-tools/releases
CONTROLLER_GEN_VERSION := "v0.8.0"
Expand All @@ -12,7 +12,7 @@ KUSTOMIZE_VERSION := "v4.5.2"
# until fixed, can't use newer version, see:
# https://github.com/kubernetes-sigs/controller-runtime/issues/1571
# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
ENVTEST_K8S_VERSION := "1.22.1"
ENVTEST_K8S_VERSION := "1.23.3"

# Use existing cluster instead of starting processes
USE_EXISTING_CLUSTER ?= true
Expand Down Expand Up @@ -221,7 +221,7 @@ controller-gen: ## Download controller-gen locally if necessary.
KUSTOMIZE = $(shell pwd)/bin/kustomize
.PHONY: kustomize
kustomize: ## Download kustomize locally if necessary.
$(call go-get-tool,$(KUSTOMIZE),sigs.k8s.io/kustomize/kustomize/v4@${KUSTOMIZE_VERSION})
$(call go-install-tool,$(KUSTOMIZE),sigs.k8s.io/kustomize/kustomize/v4@${KUSTOMIZE_VERSION})

ENVTEST = $(shell pwd)/bin/setup-envtest
.PHONY: envtest
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ encrypted files stored in `git` repository.

| Kubernetes | Sops | Chart | Operator |
|---|---|---|---|
| v1.23.x | v3.7.2 | 0.10.5 | 0.4.5 |
| v1.23.x | v3.7.2 | 0.10.6 | 0.4.6 |
| v1.22.x | v3.7.1 | 0.9.7 | 0.3.7 |
| v1.21.x | v3.7.1 | 0.9.6 | 0.3.6 |

Expand Down
4 changes: 2 additions & 2 deletions chart/helm3/sops-secrets-operator/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v2
# UPDATE_HERE
version: 0.10.5
appVersion: 0.4.5
version: 0.10.6
appVersion: 0.4.6
type: application
description: Helm chart deploys sops-secrets-operator
name: sops-secrets-operator
Expand Down
2 changes: 1 addition & 1 deletion chart/helm3/sops-secrets-operator/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ CHART_NAME?=$(shell cat Chart.yaml | awk 'BEGIN { FS=": " } $$0~/^name:/ { gsub(
VERSION_TAG?=$(shell cat Chart.yaml | awk 'BEGIN { FS=": " } $$0~/^version/ { gsub(/['\'',]/, ""); print $$2; }')

# UPDATE_HERE
K8S_VERSION := "1.23.1"
K8S_VERSION := "1.23.3"

SHELL=/bin/bash

Expand Down
4 changes: 2 additions & 2 deletions chart/helm3/sops-secrets-operator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,11 @@ The following table lists the configurable parameters of the Sops-secrets-operat
| healthProbes.readiness | object | `{"initialDelaySeconds":5,"periodSeconds":10}` | Readiness probe configuration |
| image.pullPolicy | string | `"Always"` | Operator image pull policy |
| image.repository | string | `"isindir/sops-secrets-operator"` | Operator image name |
| image.tag | string | `"0.4.5"` | Operator image tag |
| image.tag | string | `"0.4.6"` | Operator image tag |
| imagePullSecrets | list | `[]` | Secrets to pull image from private docker repository |
| initImage.pullPolicy | string | `"Always"` | Init container image pull policy |
| initImage.repository | string | `"ubuntu"` | Init container image name |
| initImage.tag | string | `"focal-20220113"` | Init container image tag |
| initImage.tag | string | `"focal-20220316"` | Init container image tag |
| kubeconfig | object | `{"enabled":false,"path":null}` | Paths to a kubeconfig. Only required if out-of-cluster. |
| logging | object | `{"encoder":"json","level":"info","stacktraceLevel":"error"}` | Logging configuration section suggested values Development Mode (encoder=consoleEncoder,logLevel=Debug,stackTraceLevel=Warn). Production Mode (encoder=jsonEncoder,logLevel=Info,stackTraceLevel=Error) (default) |
| logging.encoder | string | `"json"` | Zap log encoding (one of 'json' or 'console') |
Expand Down
8 changes: 4 additions & 4 deletions chart/helm3/sops-secrets-operator/tests/operator_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ tests:
app.kubernetes.io/instance: sops
app.kubernetes.io/managed-by: Helm
app.kubernetes.io/name: sops-secrets-operator
app.kubernetes.io/version: 0.4.5
helm.sh/chart: sops-secrets-operator-0.10.5
app.kubernetes.io/version: 0.4.6
helm.sh/chart: sops-secrets-operator-0.10.6

# custom name
- it: should correctly render custome name
Expand Down Expand Up @@ -171,7 +171,7 @@ tests:
# UPDATE_HERE
- equal:
path: spec.template.spec.containers[0].image
value: isindir/sops-secrets-operator:0.4.5
value: isindir/sops-secrets-operator:0.4.6
- equal:
path: spec.template.spec.containers[0].imagePullPolicy
value: Always
Expand Down Expand Up @@ -199,7 +199,7 @@ tests:
- equal:
path: spec.template.spec.initContainers[0].image
# UPDATE_HERE
value: ubuntu:focal-20220113
value: ubuntu:focal-20220316
- equal:
path: spec.template.spec.initContainers[0].imagePullPolicy
value: Always
Expand Down
4 changes: 2 additions & 2 deletions chart/helm3/sops-secrets-operator/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ image:
# -- Operator image name
repository: isindir/sops-secrets-operator
# -- Operator image tag
tag: 0.4.5
tag: 0.4.6
# -- Operator image pull policy
pullPolicy: Always

Expand All @@ -22,7 +22,7 @@ initImage:
# -- Init container image name
repository: ubuntu
# -- Init container image tag
tag: focal-20220113
tag: focal-20220316
# -- Init container image pull policy
pullPolicy: Always

Expand Down
Loading

0 comments on commit 5cc657e

Please sign in to comment.