Skip to content

Commit

Permalink
Merge branch 'main' into docs/design
Browse files Browse the repository at this point in the history
  • Loading branch information
lllamnyp authored Dec 17, 2024
2 parents 3708e26 + ca39d30 commit ba4a76f
Show file tree
Hide file tree
Showing 82 changed files with 4,175 additions and 802 deletions.
10 changes: 10 additions & 0 deletions .crd-docs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
processor:
ignoreTypes:
- "(EtcdCluster)List$"
- "(EtcdCluster)Status$"
ignoreFields:
- "status$"
- "TypeMeta$"

render:
kubernetesVersion: 1.30.0
9 changes: 4 additions & 5 deletions .github/workflows/docker-publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,13 @@ jobs:

steps:
- name: Checkout repository
uses: actions/[email protected].4
uses: actions/[email protected].7

# Install the cosign tool except on PR
# https://github.com/sigstore/cosign-installer
- name: Install cosign
if: github.event_name != 'pull_request'
uses: sigstore/[email protected]
with:
cosign-release: 'v2.1.1'

# Set up BuildKit Docker container builder to be able to build
# multi-platform images and export cache
Expand All @@ -49,7 +47,7 @@ jobs:
# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@v3.1.0
uses: docker/login-action@v3.2.0
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
Expand All @@ -67,12 +65,13 @@ jobs:
# https://github.com/docker/build-push-action
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@v5.3.0
uses: docker/build-push-action@v5.4.0
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64, linux/arm64
cache-from: type=gha
cache-to: type=gha,mode=max

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/helm-publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/[email protected].4
uses: actions/[email protected].7

- name: Install Helm
uses: azure/[email protected]
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/hugo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
- name: Install Dart Sass
run: sudo snap install dart-sass
- name: Checkout
uses: actions/[email protected].4
uses: actions/[email protected].7
with:
submodules: recursive
fetch-depth: 0
Expand Down
18 changes: 12 additions & 6 deletions .github/workflows/make-test-e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,28 @@ jobs:
strategy:
matrix:
k8s:
- version: 1.28.3
- version: v1.28.0
attribute: penultimate
- version: 1.29.3
- version: v1.29.0
attribute: previous
- version: 1.30.0
- version: default
attribute: latest
runs-on: ubuntu-22.04
steps:
- uses: actions/[email protected].4
- uses: actions/[email protected].7
- uses: actions/[email protected]
with:
go-version: 1.22.2
go-version: 1.22.4
- uses: docker/[email protected]
- uses: tale/[email protected]
with:
kubectl-version: v1.30.0
# Empty kubeconfig file
base64-kube-config: "YXBpVmVyc2lvbjogdjEKa2luZDogQ29uZmlnCnByZWZlcmVuY2VzOiB7fQo="
- run: ENVTEST_K8S_VERSION=${{ matrix.k8s.version }} make test-e2e
- run: |
if [ "${{ matrix.k8s.version }}" = "default" ]; then
# For latest version use default from Makefile
make test-e2e
else
K8S_VERSION=${{ matrix.k8s.version }} make test-e2e
fi
18 changes: 12 additions & 6 deletions .github/workflows/make-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,22 @@ jobs:
strategy:
matrix:
k8s:
- version: 1.28.3
- version: v1.28.0
attribute: penultimate
- version: 1.29.3
- version: v1.29.0
attribute: previous
- version: 1.30.0
- version: default
attribute: latest
runs-on: ubuntu-22.04
steps:
- uses: actions/[email protected].4
- uses: actions/[email protected].7
- uses: actions/[email protected]
with:
go-version: 1.22.2
- run: ENVTEST_K8S_VERSION=${{ matrix.k8s.version }} make test
go-version: 1.22.4
- run: |
if [ "${{ matrix.k8s.version }}" = "default" ]; then
# For latest version use default from Makefile
make test
else
K8S_VERSION=${{ matrix.k8s.version }} make test
fi
4 changes: 2 additions & 2 deletions .github/workflows/nilaway-lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ jobs:
nilaway-lint:
runs-on: ubuntu-22.04
steps:
- uses: actions/[email protected].4
- uses: actions/[email protected].7
- uses: actions/[email protected]
with:
go-version: 1.22.2
go-version: 1.22.4
- run: make nilaway-lint
4 changes: 2 additions & 2 deletions .github/workflows/pre-commit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ jobs:
pre-commit:
runs-on: ubuntu-22.04
steps:
- uses: actions/[email protected].4
- uses: actions/[email protected].7
- uses: actions/[email protected]
with:
go-version: 1.22.2
go-version: 1.22.4
- uses: pre-commit/[email protected]
4 changes: 2 additions & 2 deletions .github/workflows/release-assets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ jobs:
permissions:
contents: write
steps:
- uses: actions/[email protected].4
- uses: actions/[email protected].7
- uses: actions/[email protected]
with:
go-version: 1.22.2
go-version: 1.22.4
- name: Get tag from current run
run: |
TAG=${{ github.ref_name }}
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ vendor

# editor and IDE paraphernalia
.idea
.vscode
*.swp
*.swo
*~
3 changes: 3 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ issues:
linters:
- dupl
- lll
- path: _test\.go
linters:
- dupl
linters:
disable-all: true
enable:
Expand Down
7 changes: 6 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ repos:
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
exclude: "^charts/etcd-operator/(values.schema.json|README.md)$"
exclude: "^charts/etcd-operator/(values.schema.json|README.md)|site/content/en/docs/v([.0-9]+)/reference/api.md$"
- id: check-added-large-files
- repo: local
hooks:
Expand All @@ -24,6 +24,11 @@ repos:
entry: sh -c "make lint-fix"
language: system
require_serial: true
- id: make-generate-docs
name: make-generate-docs
entry: sh -c "make generate-docs"
language: system
require_serial: true
- id: make-mod-tidy
name: make-mod-tidy
entry: sh -c "make mod-tidy"
Expand Down
21 changes: 11 additions & 10 deletions CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
/.github @hiddenmarten @AlexGluck
/api @sircthulhu @Kirill-Garbar
/charts @hiddenmarten @AlexGluck
/cmd @sircthulhu @Kirill-Garbar
/config @sircthulhu @Kirill-Garbar
/hack @sircthulhu @Kirill-Garbar
/internal @sircthulhu @Kirill-Garbar @sergeyshevch
/test @sircthulhu @Kirill-Garbar @hiddenmarten @AlexGluck
/site @sergeyshevch @Kirill-Garbar
/*.md @kvaps @Kirill-Garbar
/.github @kvaps @lllamnyp @Kirill-Garbar @aobort
/api @kvaps @lllamnyp @Kirill-Garbar @aobort
/charts @kvaps @lllamnyp @Kirill-Garbar @aobort
/cmd @kvaps @lllamnyp @Kirill-Garbar @aobort
/config @kvaps @lllamnyp @Kirill-Garbar @aobort
/hack @kvaps @lllamnyp @Kirill-Garbar @aobort
/internal @kvaps @lllamnyp @Kirill-Garbar @aobort
/pkg @kvaps @lllamnyp @Kirill-Garbar @aobort
/test @kvaps @lllamnyp @Kirill-Garbar @aobort
/site @kvaps @lllamnyp @Kirill-Garbar @aobort
/*.md @kvaps @lllamnyp @Kirill-Garbar @aobort
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build the manager binary
FROM golang:1.22.2 AS builder
FROM golang:1.22.4 AS builder
ARG TARGETOS TARGETARCH

WORKDIR /workspace
Expand All @@ -11,7 +11,7 @@ COPY go.mod go.sum ./
RUN go mod download

# Copy the go source
COPY cmd/main.go ./cmd/
COPY cmd/ ./cmd/
COPY api/ ./api/
COPY internal/ ./internal/

Expand All @@ -20,7 +20,7 @@ COPY internal/ ./internal/
# was called. For example, if we call make docker-build in a local env which has the Apple Silicon M1 SO
# the docker BUILDPLATFORM arg will be linux/arm64 when for Apple x86 it will be linux/amd64. Therefore,
# by leaving it empty we can ensure that the container and binary shipped on it will have the same platform.
RUN CGO_ENABLED=0 GOOS="${TARGETOS:-linux}" GOARCH="${TARGETARCH}" go build -a -o manager cmd/main.go
RUN CGO_ENABLED=0 GOOS="${TARGETOS:-linux}" GOARCH="${TARGETARCH}" go build -a -o manager cmd/manager/main.go

# Use distroless as minimal base image to package the manager binary
# Refer to https://github.com/GoogleContainerTools/distroless for more details
Expand Down
46 changes: 32 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@

# Image URL to use all building/pushing image targets
IMG ?= ghcr.io/aenix-io/etcd-operator:latest
# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
# K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
# renovate: datasource=github-tags depName=kubernetes/kubernetes
ENVTEST_K8S_VERSION ?= v1.30.0
ENVTEST_K8S_VERSION_TRIMMED_V = $(subst v,,$(ENVTEST_K8S_VERSION))
K8S_VERSION ?= v1.30.0
K8S_VERSION_TRIMMED_V = $(subst v,,$(K8S_VERSION))

# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
ifeq (,$(shell go env GOBIN))
Expand Down Expand Up @@ -55,6 +55,11 @@ manifests: controller-gen yq ## Generate WebhookConfiguration, ClusterRole and C
generate: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..."

.PHONY: generate-docs
generate-docs: yq crd-ref-docs ## Generate CRD reference documentation.
@$(eval VERSION := $(shell $(YQ) '.params.version' site/hugo.yaml))
$(CRD_REF_DOCS) --config=.crd-docs.yaml --renderer=markdown --templates-dir="site/reference-templates" --output-path="site/content/en/docs/$(VERSION)/reference/api.md"

.PHONY: fmt
fmt: ## Run go fmt against code.
go fmt ./...
Expand All @@ -69,7 +74,9 @@ mod-tidy: ## Run go mod tidy against code.

.PHONY: test
test: manifests generate fmt vet envtest ## Run tests.
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION_TRIMMED_V) --bin-dir $(LOCALBIN) -p path)" go test $$(go list ./... | grep -v /e2e) -coverprofile cover.out
@echo "Check for kubernetes version $(K8S_VERSION_TRIMMED_V) in $(ENVTEST)"
@$(ENVTEST) list | grep -q $(K8S_VERSION_TRIMMED_V)
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(K8S_VERSION_TRIMMED_V) --bin-dir $(LOCALBIN) -p path)" go test $$(go list ./... | grep -v /e2e) -coverprofile cover.out

# Utilize Kind or modify the e2e tests to load the image locally, enabling compatibility with other vendors.
.PHONY: test-e2e # Run the e2e tests against a Kind k8s instance that is spun up.
Expand Down Expand Up @@ -111,7 +118,10 @@ helm-crd-copy: yq kustomize ## Copy CRDs from kustomize to helm-chart

.PHONY: build
build: manifests generate fmt vet ## Build manager binary.
go build -o bin/manager cmd/main.go
go build -o bin/manager cmd/manager/main.go

build-plugin:
go build -o bin/kubectl-etcd cmd/kubectl-etcd/main.go

.PHONY: run
run: manifests generate fmt vet ## Run a controller from your host.
Expand Down Expand Up @@ -155,9 +165,9 @@ KIND_CLUSTER_NAME ?= etcd-operator-kind
NAMESPACE ?= etcd-operator-system

# renovate: datasource=github-tags depName=prometheus-operator/prometheus-operator
PROMETHEUS_OPERATOR_VERSION ?= v0.73.2
PROMETHEUS_OPERATOR_VERSION ?= v0.74.0
# renovate: datasource=github-tags depName=jetstack/cert-manager
CERT_MANAGER_VERSION ?= v1.14.5
CERT_MANAGER_VERSION ?= v1.15.0

ifndef ignore-not-found
ignore-not-found = false
Expand Down Expand Up @@ -191,9 +201,12 @@ kind-load: docker-build kind ## Build and upload docker image to the local Kind
$(KIND) load docker-image ${IMG} --name $(KIND_CLUSTER_NAME)

.PHONY: kind-create
kind-create: kind ## Create kubernetes cluster using Kind.
kind-create: kind yq ## Create kubernetes cluster using Kind.
@if ! $(KIND) get clusters | grep -q $(KIND_CLUSTER_NAME); then \
$(KIND) create cluster --name $(KIND_CLUSTER_NAME); \
$(KIND) create cluster --name $(KIND_CLUSTER_NAME) --image kindest/node:$(K8S_VERSION) --config test/e2e/config.yaml; \
elif ! $(CONTAINER_TOOL) container inspect $$($(KIND) get nodes --name $(KIND_CLUSTER_NAME)) | $(YQ) e '.[0].Config.Image' | grep -q $(K8S_VERSION); then \
$(KIND) delete cluster --name $(KIND_CLUSTER_NAME); \
$(KIND) create cluster --name $(KIND_CLUSTER_NAME) --image kindest/node:$(K8S_VERSION) --config test/e2e/config.yaml; \
fi

.PHONY: kind-delete
Expand Down Expand Up @@ -234,6 +247,7 @@ KIND ?= $(LOCALBIN)/kind
HELM ?= $(LOCALBIN)/helm
HELM_DOCS ?= $(LOCALBIN)/helm-docs
YQ = $(LOCALBIN)/yq
CRD_REF_DOCS ?= $(LOCALBIN)/crd-ref-docs

## Tool Versions
# renovate: datasource=github-tags depName=kubernetes-sigs/kustomize
Expand All @@ -242,17 +256,17 @@ KUSTOMIZE_VERSION ?= v5.3.0
CONTROLLER_TOOLS_VERSION ?= v0.15.0
ENVTEST_VERSION ?= latest
# renovate: datasource=github-tags depName=golangci/golangci-lint
GOLANGCI_LINT_VERSION ?= v1.58.0
GOLANGCI_LINT_VERSION ?= v1.59.1
# renovate: datasource=github-tags depName=kubernetes-sigs/kind
KIND_VERSION ?= v0.22.0
KIND_VERSION ?= v0.23.0
# renovate: datasource=github-tags depName=helm/helm
HELM_VERSION ?= v3.14.4
HELM_VERSION ?= v3.15.2
# renovate: datasource=github-tags depName=losisin/helm-values-schema-json
HELM_SCHEMA_VERSION ?= v1.3.0
HELM_SCHEMA_VERSION ?= v1.4.1
# renovate: datasource=github-tags depName=norwoodj/helm-docs
HELM_DOCS_VERSION ?= v1.13.1
# renovate: datasource=github-tags depName=mikefarah/yq
YQ_VERSION ?= v4.43.1
YQ_VERSION ?= v4.44.1

## Tool install scripts
KUSTOMIZE_INSTALL_SCRIPT ?= "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh"
Expand All @@ -274,6 +288,10 @@ controller-gen: $(LOCALBIN)
envtest: $(LOCALBIN)
@test -x $(ENVTEST) || GOBIN=$(LOCALBIN) go install sigs.k8s.io/controller-runtime/tools/setup-envtest@$(ENVTEST_VERSION)

.PHONY: crd-ref-docs
crd-ref-docs: $(LOCALBIN)
@test -x $(CRD_REF_DOCS) || GOBIN=$(LOCALBIN) go install github.com/elastic/crd-ref-docs@latest

.PHONY: golangci-lint
golangci-lint: $(LOCALBIN)
@test -x $(GOLANGCI_LINT) && $(GOLANGCI_LINT) version | grep -q $(GOLANGCI_LINT_VERSION) || \
Expand Down
Loading

0 comments on commit ba4a76f

Please sign in to comment.