Skip to content

Commit

Permalink
up: controller gen and runtime, k8s, kustomize, docker images, golang (
Browse files Browse the repository at this point in the history
  • Loading branch information
isindir authored Aug 15, 2021
1 parent f433099 commit 04a595c
Show file tree
Hide file tree
Showing 15 changed files with 222 additions and 182 deletions.
22 changes: 11 additions & 11 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ jobs:
image: ubuntu-2004:202010-01
environment:
# https://golang.org/dl/
GOLANG_VERSION: 1.16.5
GOLANG_VERSION: 1.16.7
# https://github.com/kubernetes-sigs/kubebuilder/releases
KUBEBUILDER_VERSION: 3.1.0
# https://github.com/kubernetes-sigs/kustomize/releases
KUSTOMIZE_VERSION: v4.1.3
KUSTOMIZE_VERSION: v4.2.0
# https://github.com/github/hub/releases
HUB_VERSION: 2.14.2
# https://github.com/git-chglog/git-chglog/releases
GIT_CHGLOG_VERSION: 0.14.2
# https://github.com/docker/buildx/releases
BUILDX_BINARY_VERSION: 0.5.1
BUILDX_BINARY_VERSION: 0.6.1

DOCKER_BUILDKIT: 1
BUILDX_PLATFORMS: linux/amd64,linux/arm64
Expand Down Expand Up @@ -99,25 +99,25 @@ jobs:
image: ubuntu-2004:202010-01
environment:
# https://github.com/kubernetes/kubernetes/releases
K8S_VERSION: v1.20.7
KUBECTL_VERSION: v1.21.4
# https://github.com/rancher/k3d/releases
K3D_VERSION: v4.4.6
K3D_VERSION: v4.4.7
# https://github.com/helm/helm/releases
HELM_VERSION: v3.6.1
HELM_VERSION: v3.6.3
# https://golang.org/dl/
GOLANG_VERSION: 1.16.5
GOLANG_VERSION: 1.16.7
# https://github.com/kubernetes-sigs/kubebuilder/releases
KUBEBUILDER_VERSION: 3.1.0
# https://github.com/mozilla/sops/releases
SOPS_VERSION: v3.7.1
# https://github.com/kubernetes-sigs/kustomize/releases
KUSTOMIZE_VERSION: v4.1.3
KUSTOMIZE_VERSION: v4.2.0
# https://github.com/quintush/helm-unittest/releases
HELM_UNITTEST_VERSION: 0.2.6
HELM_UNITTEST_VERSION: 0.2.7
# https://github.com/instrumenta/kubeval/releases
KUBEVAL_VERSION: 0.16.1
# https://github.com/docker/buildx/releases
BUILDX_BINARY_VERSION: 0.5.1
BUILDX_BINARY_VERSION: 0.6.1

DOCKER_BUILDKIT: 1
BUILDX_PLATFORMS: linux/amd64,linux/arm64
Expand Down Expand Up @@ -213,7 +213,7 @@ jobs:
- run:
name: install kubectl
command: |
curl -sSLo kubectl https://storage.googleapis.com/kubernetes-release/release/${K8S_VERSION}/bin/linux/amd64/kubectl
curl -sSLo kubectl https://storage.googleapis.com/kubernetes-release/release/${KUBECTL_VERSION}/bin/linux/amd64/kubectl
chmod +x kubectl
sudo mv kubectl /usr/local/bin/
mkdir -p ${HOME}/.kube
Expand Down
10 changes: 5 additions & 5 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
# https://github.com/kubernetes-sigs/kubebuilder/releases
kubebuilder 3.1.0
# https://golang.org/dl/
golang 1.16.5
golang 1.16.7
# https://github.com/mozilla/sops/releases
sops 3.7.1
# https://github.com/kubernetes-sigs/kustomize/releases
kustomize 4.1.3
kustomize 4.2.0
# https://github.com/rancher/k3d/releases
k3d 4.4.6
k3d 4.4.7
# https://github.com/kubernetes/kubernetes/releases
kubectl 1.20.7
kubectl 1.21.4
# https://github.com/helm/helm/releases
helm 3.6.1
helm 3.6.3
# https://github.com/instrumenta/kubeval/releases
kubeval v0.16.1
# https://github.com/git-chglog/git-chglog/releases
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Build the manager binary
# https://hub.docker.com/_/golang?tab=tags&page=1&ordering=last_updated
FROM golang:1.16.5-buster as builder
FROM golang:1.16.7-buster as builder

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

# https://hub.docker.com/_/ubuntu?tab=tags&page=1&ordering=last_updated
FROM ubuntu:focal-20210609
FROM ubuntu:focal-20210723

RUN apt-get -y update \
&& apt-get -y upgrade \
Expand Down
25 changes: 15 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
GO := GOPROXY=https://proxy.golang.org go
SOPS_SEC_OPERATOR_VERSION := 0.3.2
SOPS_SEC_OPERATOR_VERSION := 0.3.3

# https://github.com/kubernetes-sigs/controller-tools/releases
CONTROLLER_GEN_VERSION := "v0.6.1"
CONTROLLER_GEN_VERSION := "v0.6.2"
# https://github.com/kubernetes-sigs/controller-runtime/releases
CONTROLLER_RUNTIME_VERSION := "v0.8.3"
CONTROLLER_RUNTIME_VERSION := "v0.9.6"
# https://github.com/kubernetes-sigs/kustomize/releases
KUSTOMIZE_VERSION := "v4.1.3"
KUSTOMIZE_VERSION := "v4.2.0"
# use `setup-envtest list` to obtain the list of available versions
KUBE_VERSION := "1.21.2"

# Use existing cluster instead of starting processes
USE_EXISTING_CLUSTER ?= true
Expand All @@ -27,7 +29,9 @@ GOBIN=$(shell go env GOBIN)
endif

# Setting SHELL to bash allows bash commands to be executed by recipes.
# This is a requirement for 'setup-envtest.sh' in the test target.
# This is a requirement for 'setup-envtest' in the test target.
# for more information about setup-envtest refer to
# https://github.com/kubernetes-sigs/controller-runtime/tree/v0.9.6/tools/setup-envtest
# Options are set to exit when a recipe line exits non-zero or a piped command fails.
SHELL = /usr/bin/env bash -o pipefail
.SHELLFLAGS = -ec
Expand Down Expand Up @@ -93,11 +97,8 @@ fmt: ## Run go fmt against code.
vet: ## Run go vet against code.
go vet ./...

ENVTEST_ASSETS_DIR=$(shell pwd)/testbin
test: manifests generate fmt vet ## Run tests.
mkdir -p ${ENVTEST_ASSETS_DIR}
test -f ${ENVTEST_ASSETS_DIR}/setup-envtest.sh || curl -sSLo ${ENVTEST_ASSETS_DIR}/setup-envtest.sh https://raw.githubusercontent.com/kubernetes-sigs/controller-runtime/${CONTROLLER_RUNTIME_VERSION}/hack/setup-envtest.sh
source ${ENVTEST_ASSETS_DIR}/setup-envtest.sh; fetch_envtest_tools $(ENVTEST_ASSETS_DIR); setup_envtest_env $(ENVTEST_ASSETS_DIR); go test ./... -coverprofile cover.out
test: setup-envtest manifests generate fmt vet ## Run tests.
KUBEBUILDER_ASSETS="$(shell $(SETUP_ENVTEST) use -p path --force ${KUBE_VERSION})" go test ./... -coverprofile cover.out

##@ Build

Expand Down Expand Up @@ -171,6 +172,10 @@ KUSTOMIZE = $(shell pwd)/bin/kustomize
kustomize: ## Download kustomize locally if necessary.
$(call go-get-tool,$(KUSTOMIZE),sigs.k8s.io/kustomize/kustomize/v4@${KUSTOMIZE_VERSION})

SETUP_ENVTEST = $(shell pwd)/bin/setup-envtest
setup-envtest: ## Download setup-envtest locally if necessary.
$(call go-get-tool,$(SETUP_ENVTEST),sigs.k8s.io/controller-runtime/tools/setup-envtest@latest)

# go-get-tool will 'go get' any package $2 and install it to $1
PROJECT_DIR := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST))))
define go-get-tool
Expand Down
2 changes: 1 addition & 1 deletion chart/helm2/sops-secrets-operator/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ lint:

## validate: validate rendered chart templates using 'kubeval'
validate:
helm template . | kubeval --ignore-missing-schemas --force-color -
helm template . | kubeval --strict --schema-location https://raw.githubusercontent.com/yannh/kubernetes-json-schema/master/ --ignore-missing-schemas --force-color -
@echo '--------------------'

## docs: generate chart documentation to stdout, if firgate is installed
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,6 +1,6 @@
apiVersion: v2
version: 0.9.2
appVersion: 0.3.2
version: 0.9.3
appVersion: 0.3.3
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 @@ -43,5 +43,5 @@ validate: ## validates rendered chart templates using 'kubeval'
--force-color \
--strict \
--schema-location https://raw.githubusercontent.com/Onemind-Services-LLC/kubernetes-json-schema/master/schema \
--kubernetes-version 1.20.7 -
--kubernetes-version v1.21.4 -
@echo '--------------------'
2 changes: 1 addition & 1 deletion chart/helm3/sops-secrets-operator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ 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.3.2"` | Operator image tag |
| image.tag | string | `"0.3.3"` | Operator image tag |
| imagePullSecrets | list | `[]` | Secrets to pull image from private docker repository |
| 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) |
Expand Down
6 changes: 3 additions & 3 deletions chart/helm3/sops-secrets-operator/tests/operator_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,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.3.2
helm.sh/chart: sops-secrets-operator-0.9.2
app.kubernetes.io/version: 0.3.3
helm.sh/chart: sops-secrets-operator-0.9.3

# template metadata and spec selector
- it: should correctly render template metadata and spec selector
Expand Down Expand Up @@ -140,7 +140,7 @@ tests:
asserts:
- equal:
path: spec.template.spec.containers[0].image
value: isindir/sops-secrets-operator:0.3.2
value: isindir/sops-secrets-operator:0.3.3
- equal:
path: spec.template.spec.containers[0].imagePullPolicy
value: Always
Expand Down
2 changes: 1 addition & 1 deletion chart/helm3/sops-secrets-operator/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ image:
# -- Operator image name
repository: isindir/sops-secrets-operator
# -- Operator image tag
tag: 0.3.2
tag: 0.3.3
# -- Operator image pull policy
pullPolicy: Always

Expand Down
2 changes: 1 addition & 1 deletion config/crd/bases/isindir.github.com_sopssecrets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.6.1
controller-gen.kubebuilder.io/version: v0.6.2
creationTimestamp: null
name: sopssecrets.isindir.github.com
spec:
Expand Down
Loading

0 comments on commit 04a595c

Please sign in to comment.