Skip to content

Commit

Permalink
Reducing info level logging in controller, helm chart settings update…
Browse files Browse the repository at this point in the history
… and bug fix (#138)

* Fix typo

* Fix typo

* Fix typo

* Fix typo
  • Loading branch information
isindir authored Jun 25, 2023
1 parent 0992896 commit 20df0ec
Show file tree
Hide file tree
Showing 18 changed files with 211 additions and 178 deletions.
10 changes: 5 additions & 5 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,17 @@ jobs:
image: ubuntu-2204:2023.02.1
environment: &versions
# https://github.com/kubernetes/kubernetes/releases
KUBECTL_VERSION: v1.27.2
KUBECTL_VERSION: v1.27.3
# https://hub.docker.com/r/rancher/k3s/tags
K3S_VERSION: v1.27.2-k3s1
# https://github.com/rancher/k3d/releases
K3D_VERSION: v5.5.1
# https://github.com/helm/helm/releases
HELM_VERSION: v3.12.0
HELM_VERSION: v3.12.1
# https://golang.org/dl/
GOLANG_VERSION: "1.20.4"
GOLANG_VERSION: "1.20.5"
# https://github.com/kubernetes-sigs/kubebuilder/releases
KUBEBUILDER_VERSION: 3.10.0
KUBEBUILDER_VERSION: 3.11.0
# https://github.com/mozilla/sops/releases
SOPS_VERSION: v3.7.3
# https://github.com/kubernetes-sigs/kustomize/releases
Expand All @@ -43,7 +43,7 @@ jobs:
# https://github.com/git-chglog/git-chglog/releases
GIT_CHGLOG_VERSION: 0.15.4
# https://github.com/docker/buildx/releases
BUILDX_BINARY_VERSION: 0.10.5
BUILDX_BINARY_VERSION: 0.11.0

DOCKER_BUILDKIT: 1
BUILDX_PLATFORMS: linux/amd64,linux/arm64
Expand Down
9 changes: 5 additions & 4 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
# UPDATE_HERE
# https://github.com/kubernetes-sigs/kubebuilder/releases
kubebuilder 3.10.0
kubebuilder 3.11.0
# https://golang.org/dl/
golang 1.20.4
golang 1.20.5
# https://github.com/mozilla/sops/releases
sops 3.7.3
# https://github.com/kubernetes-sigs/kustomize/releases
kustomize 5.0.3
# https://github.com/rancher/k3d/releases
k3d 5.5.1
# https://github.com/kubernetes/kubernetes/releases
kubectl 1.27.2
kubectl 1.27.3
# https://github.com/helm/helm/releases
helm 3.12.0
helm 3.12.1
# https://github.com/norwoodj/helm-docs/releases
helm-docs 1.11.0
# https://github.com/instrumenta/kubeval/releases
kubeval v0.16.1
# https://github.com/git-chglog/git-chglog/releases
git-chglog 0.15.4
golangci-lint 1.53.3
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/tags?page=1&name=bullseye
FROM golang:1.20.4-bullseye as builder
FROM golang:1.20.5-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 cmd/main.go

# https://wiki.ubuntu.com/Releases
# https://hub.docker.com/_/ubuntu/tags?page=1&name=jammy
FROM ubuntu:jammy-20230425
FROM ubuntu:jammy-20230605

RUN apt-get -y update \
&& apt-get -y upgrade \
Expand Down
6 changes: 5 additions & 1 deletion 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.9.0
SOPS_SEC_OPERATOR_VERSION := 0.9.1

# https://github.com/kubernetes-sigs/controller-tools/releases
CONTROLLER_GEN_VERSION := "v0.12.0"
Expand Down Expand Up @@ -100,6 +100,10 @@ test-helm: ## Tests helm chart.

##@ Development

.PHONY: lint
lint: ## Run golangci-lint
golangci-lint run --path-prefix=. --timeout 3m --verbose

.PHONY: update-here
update-here: ## Helper target to start editing all occurances with UPDATE_HERE.
@echo "Update following files for release:"
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.27.x | v3.7.3 | 0.15.0 | 0.9.0 |
| v1.27.x | v3.7.3 | 0.15.1 | 0.9.1 |
| v1.26.x | v3.7.3 | 0.14.2 | 0.8.2 |
| v1.25.x | v3.7.3 | 0.12.5 | 0.6.4 |
| v1.24.x | v3.7.3 | 0.11.3 | 0.5.3 |
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.15.0
appVersion: 0.9.0
version: 0.15.1
appVersion: 0.9.1
type: application
description: Helm chart deploys sops-secrets-operator
name: sops-secrets-operator
Expand Down
8 changes: 5 additions & 3 deletions chart/helm3/sops-secrets-operator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,16 +134,18 @@ 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.9.0"` | Operator image tag |
| image.tag | string | `"0.9.1"` | 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 | `"jammy-20230425"` | Init container image tag |
| initImage.tag | string | `"jammy-20230605"` | 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 | object | `{"development":false,"encoder":"json","level":"info","stacktraceLevel":"error","timeEncoding":"iso8601"}` | Logging configuration section suggested values Development Mode (encoder=consoleEncoder,logLevel=Debug,stackTraceLevel=Warn). Production Mode (encoder=jsonEncoder,logLevel=Info,stackTraceLevel=Error) (default) |
| logging.development | bool | `false` | Zap Development Mode enabled |
| logging.encoder | string | `"json"` | Zap log encoding (one of 'json' or 'console') |
| logging.level | string | `"info"` | Zap Level to configure the verbosity of logging. Can be one of 'debug', 'info', 'error', or any integer value > 0 which corresponds to custom debug levels of increasing verbosity |
| logging.stacktraceLevel | string | `"error"` | Zap Level at and above which stacktraces are captured (one of 'info', 'error'). |
| logging.timeEncoding | string | `"iso8601"` | Zap time encoding (one of 'epoch', 'millis', 'nano', 'iso8601', 'rfc3339' or 'rfc3339nano'). Defaults to 'epoch'. |
| metrics.enabled | bool | `false` | Enable prometheus metrics |
| nameOverride | string | `""` | Overrides auto-generated short resource name |
| nodeSelector | object | `{}` | Node selector to use for pod configuration |
Expand Down
18 changes: 10 additions & 8 deletions chart/helm3/sops-secrets-operator/templates/operator.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,16 +70,18 @@ spec:
- /usr/local/bin/manager
args:
# The address the metric endpoint binds to. (default ":8080")
#- "--metrics-bind-address=127.0.0.1:8080"
- "--health-probe-bind-address=:{{ .Values.healthProbes.port }}"
#- "-metrics-bind-address=127.0.0.1:8080"
- "-health-probe-bind-address=:{{ .Values.healthProbes.port }}"
# Enable leader election for controller manager. Enabling this will ensure there is only one active controller manager.
- "--leader-elect"
- "--requeue-decrypt-after={{ .Values.requeueAfter }}"
- "--zap-encoder={{ .Values.logging.encoder }}"
- "--zap-log-level={{ .Values.logging.level }}"
- "--zap-stacktrace-level={{ .Values.logging.stacktraceLevel }}"
- "-leader-elect"
- "-requeue-decrypt-after={{ .Values.requeueAfter }}"
- "-zap-devel={{ .Values.logging.development }}"
- "-zap-encoder={{ .Values.logging.encoder }}"
- "-zap-log-level={{ .Values.logging.level }}"
- "-zap-stacktrace-level={{ .Values.logging.stacktraceLevel }}"
- "-zap-time-encoding={{ .Values.logging.timeEncoding }}"
{{- if .Values.kubeconfig.enabled }}
- "--kubeconfig={{ .Values.kubeconfig.path | quote }}"
- "-kubeconfig={{ .Values.kubeconfig.path | quote }}"
{{- end }}
livenessProbe:
httpGet:
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.9.0
helm.sh/chart: sops-secrets-operator-0.15.0
app.kubernetes.io/version: 0.9.1
helm.sh/chart: sops-secrets-operator-0.15.1

# custom name
- it: should correctly render custome name
Expand Down Expand Up @@ -170,7 +170,7 @@ tests:
# UPDATE_HERE
- equal:
path: spec.template.spec.containers[0].image
value: isindir/sops-secrets-operator:0.9.0
value: isindir/sops-secrets-operator:0.9.1
- equal:
path: spec.template.spec.containers[0].imagePullPolicy
value: Always
Expand Down Expand Up @@ -198,7 +198,7 @@ tests:
- equal:
path: spec.template.spec.initContainers[0].image
# UPDATE_HERE
value: ubuntu:jammy-20230425
value: ubuntu:jammy-20230605
- equal:
path: spec.template.spec.initContainers[0].imagePullPolicy
value: Always
Expand Down
9 changes: 6 additions & 3 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.9.0
tag: 0.9.1
# -- Operator image pull policy
pullPolicy: Always

Expand All @@ -22,11 +22,10 @@ initImage:
# -- Init container image name
repository: ubuntu
# -- Init container image tag
tag: jammy-20230425
tag: jammy-20230605
# -- Init container image pull policy
pullPolicy: Always


# -- Secrets to pull image from private docker repository
imagePullSecrets: []
# -- Overrides auto-generated short resource name
Expand All @@ -53,12 +52,16 @@ kubeconfig:
# Development Mode (encoder=consoleEncoder,logLevel=Debug,stackTraceLevel=Warn).
# Production Mode (encoder=jsonEncoder,logLevel=Info,stackTraceLevel=Error) (default)
logging:
# -- Zap Development Mode enabled
development: false
# -- Zap log encoding (one of 'json' or 'console')
encoder: json
# -- Zap Level to configure the verbosity of logging. Can be one of 'debug', 'info', 'error', or any integer value > 0 which corresponds to custom debug levels of increasing verbosity
level: info
# -- Zap Level at and above which stacktraces are captured (one of 'info', 'error').
stacktraceLevel: error
# -- Zap time encoding (one of 'epoch', 'millis', 'nano', 'iso8601', 'rfc3339' or 'rfc3339nano'). Defaults to 'epoch'.
timeEncoding: iso8601

healthProbes:
# -- The address the probe endpoint binds to. (default ":8081")
Expand Down
5 changes: 4 additions & 1 deletion cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,11 @@ func main() {
"Enable leader election for controller manager. "+
"Enabling this will ensure there is only one active controller manager.")
flag.Int64Var(&requeueAfter, "requeue-decrypt-after", 5, "Requeue failed reconciliation in minutes (min 1).")

opts := zap.Options{
Development: true,
}

opts.BindFlags(flag.CommandLine)
flag.Parse()

Expand All @@ -78,7 +80,8 @@ func main() {
if requeueAfter < 1 {
requeueAfter = 1
}
setupLog.Info(

setupLog.V(0).Info(
fmt.Sprintf(
"SopsSecret reconciliation will be requeued after %d minutes after decryption failures",
requeueAfter,
Expand Down
Loading

0 comments on commit 20df0ec

Please sign in to comment.