Skip to content

Commit

Permalink
feat: support upgrades to Kubernetes 1.28
Browse files Browse the repository at this point in the history
Bump deps on the way.

Signed-off-by: Andrey Smirnov <[email protected]>
  • Loading branch information
smira committed Jul 10, 2023
1 parent 5a3df5b commit 69fea5b
Show file tree
Hide file tree
Showing 8 changed files with 173 additions and 163 deletions.
8 changes: 6 additions & 2 deletions .drone.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
# THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT.
#
# Generated on 2023-02-17T14:37:43Z by kres 2cbfdd9.
# Generated on 2023-07-10T14:13:06Z by kres latest.

kind: pipeline
type: kubernetes
Expand Down Expand Up @@ -174,7 +174,7 @@ steps:

services:
- name: docker
image: docker:23.0-dind
image: docker:24.0-dind
entrypoint:
- dockerd
commands:
Expand Down Expand Up @@ -212,6 +212,10 @@ trigger:
exclude:
- renovate/*
- dependabot/*
event:
exclude:
- promote
- cron

---
kind: pipeline
Expand Down
15 changes: 9 additions & 6 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT.
#
# Generated on 2023-02-17T14:37:43Z by kres 2cbfdd9.
# Generated on 2023-07-10T14:13:06Z by kres latest.

# options for analysis running
run:
Expand Down Expand Up @@ -36,7 +36,7 @@ linters-settings:
lines: 60
statements: 40
gci:
local-prefixes: github.com/siderolabs/go-kubernetes
local-prefixes: github.com/siderolabs/go-kubernetes/
gocognit:
min-complexity: 30
ireturn:
Expand Down Expand Up @@ -65,7 +65,7 @@ linters-settings:
gofmt:
simplify: true
goimports:
local-prefixes: github.com/siderolabs/go-kubernetes
local-prefixes: github.com/siderolabs/go-kubernetes/
golint:
min-confidence: 0.8
gomnd:
Expand All @@ -74,9 +74,6 @@ linters-settings:
govet:
check-shadowing: true
enable-all: true
depguard:
list-type: blacklist
include-go-root: false
lll:
line-length: 200
tab-width: 4
Expand Down Expand Up @@ -118,6 +115,10 @@ linters-settings:
cyclop:
# the maximal code complexity to report
max-complexity: 20
# depguard:
# Main:
# deny:
# - github.com/OpenPeeDeeP/depguard # this is just an example

linters:
enable-all: true
Expand Down Expand Up @@ -145,6 +146,8 @@ linters:
- typecheck
- varnamelen
- wrapcheck
- depguard # Disabled because starting with golangci-lint 1.53.0 it doesn't allow denylist alone anymore
- tagalign
# abandoned linters for which golangci shows the warning that the repo is archived by the owner
- interfacer
- maligned
Expand Down
31 changes: 18 additions & 13 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@

# THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT.
#
# Generated on 2023-02-20T09:15:28Z by kres 2cbfdd9-dirty.
# Generated on 2023-07-10T14:13:06Z by kres latest.

ARG TOOLCHAIN

# cleaned up specs and compiled versions
FROM scratch AS generate

# runs markdownlint
FROM docker.io/node:19.6.0-alpine3.16 AS lint-markdown
FROM docker.io/node:20.3.1-alpine3.18 AS lint-markdown
WORKDIR /src
RUN npm i -g markdownlint-cli@0.33.0
RUN npm i -g markdownlint-cli@0.34.0
RUN npm i [email protected]
COPY .markdownlint.json .
COPY ./README.md ./README.md
Expand All @@ -28,26 +28,27 @@ ENV GO111MODULE on
ARG CGO_ENABLED
ENV CGO_ENABLED ${CGO_ENABLED}
ENV GOPATH /go
ARG DEEPCOPY_VERSION
RUN --mount=type=cache,target=/root/.cache/go-build --mount=type=cache,target=/go/pkg go install github.com/siderolabs/deep-copy@${DEEPCOPY_VERSION} \
&& mv /go/bin/deep-copy /bin/deep-copy
ARG GOLANGCILINT_VERSION
RUN --mount=type=cache,target=/root/.cache/go-build --mount=type=cache,target=/go/pkg go install github.com/golangci/golangci-lint/cmd/golangci-lint@${GOLANGCILINT_VERSION} \
&& mv /go/bin/golangci-lint /bin/golangci-lint
ARG GOFUMPT_VERSION
RUN go install mvdan.cc/gofumpt@${GOFUMPT_VERSION} \
&& mv /go/bin/gofumpt /bin/gofumpt
RUN --mount=type=cache,target=/root/.cache/go-build --mount=type=cache,target=/go/pkg go install golang.org/x/vuln/cmd/govulncheck@latest \
&& mv /go/bin/govulncheck /bin/govulncheck
ARG GOIMPORTS_VERSION
RUN --mount=type=cache,target=/root/.cache/go-build --mount=type=cache,target=/go/pkg go install golang.org/x/tools/cmd/goimports@${GOIMPORTS_VERSION} \
&& mv /go/bin/goimports /bin/goimports
ARG DEEPCOPY_VERSION
RUN --mount=type=cache,target=/root/.cache/go-build --mount=type=cache,target=/go/pkg go install github.com/siderolabs/deep-copy@${DEEPCOPY_VERSION} \
&& mv /go/bin/deep-copy /bin/deep-copy
ARG GOFUMPT_VERSION
RUN go install mvdan.cc/gofumpt@${GOFUMPT_VERSION} \
&& mv /go/bin/gofumpt /bin/gofumpt

# tools and sources
FROM tools AS base
WORKDIR /src
COPY ./go.mod .
COPY ./go.sum .
COPY go.mod go.mod
COPY go.sum go.sum
RUN cd .
RUN --mount=type=cache,target=/go/pkg go mod download
RUN --mount=type=cache,target=/go/pkg go mod verify
COPY ./kubernetes ./kubernetes
Expand All @@ -59,28 +60,32 @@ RUN FILES="$(gofumpt -l .)" && test -z "${FILES}" || (echo -e "Source code is no

# runs goimports
FROM base AS lint-goimports
RUN FILES="$(goimports -l -local github.com/siderolabs/go-kubernetes .)" && test -z "${FILES}" || (echo -e "Source code is not formatted with 'goimports -w -local github.com/siderolabs/go-kubernetes .':\n${FILES}"; exit 1)
RUN FILES="$(goimports -l -local github.com/siderolabs/go-kubernetes/ .)" && test -z "${FILES}" || (echo -e "Source code is not formatted with 'goimports -w -local github.com/siderolabs/go-kubernetes/ .':\n${FILES}"; exit 1)

# runs golangci-lint
FROM base AS lint-golangci-lint
WORKDIR /src
COPY .golangci.yml .
ENV GOGC 50
RUN --mount=type=cache,target=/root/.cache/go-build --mount=type=cache,target=/root/.cache/golangci-lint --mount=type=cache,target=/go/pkg golangci-lint run --config .golangci.yml

# runs govulncheck
FROM base AS lint-govulncheck
WORKDIR /src
RUN --mount=type=cache,target=/root/.cache/go-build --mount=type=cache,target=/go/pkg govulncheck ./...

# runs unit-tests with race detector
FROM base AS unit-tests-race
WORKDIR /src
ARG TESTPKGS
RUN --mount=type=cache,target=/root/.cache/go-build --mount=type=cache,target=/go/pkg --mount=type=cache,target=/tmp CGO_ENABLED=1 go test -v -race -count 1 ${TESTPKGS}

# runs unit-tests
FROM base AS unit-tests-run
WORKDIR /src
ARG TESTPKGS
RUN --mount=type=cache,target=/root/.cache/go-build --mount=type=cache,target=/go/pkg --mount=type=cache,target=/tmp go test -v -covermode=atomic -coverprofile=coverage.txt -coverpkg=${TESTPKGS} -count 1 ${TESTPKGS}

FROM scratch AS unit-tests
COPY --from=unit-tests-run /src/coverage.txt /coverage.txt
COPY --from=unit-tests-run /src/coverage.txt /coverage-unit-tests.txt

24 changes: 13 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,27 +1,28 @@
# THIS FILE WAS AUTOMATICALLY GENERATED, PLEASE DO NOT EDIT.
#
# Generated on 2023-02-20T18:08:53Z by kres 19295f6-dirty.
# Generated on 2023-07-10T14:13:06Z by kres latest.

# common variables

SHA := $(shell git describe --match=none --always --abbrev=8 --dirty)
TAG := $(shell git describe --tag --always --dirty)
ABBREV_TAG := $(shell git describe --tags >/dev/null 2>/dev/null && git describe --tag --always --match v[0-9]\* --abbrev=0 || echo 'undefined')
BRANCH := $(shell git rev-parse --abbrev-ref HEAD)
ARTIFACTS := _out
WITH_DEBUG ?= false
WITH_RACE ?= false
REGISTRY ?= ghcr.io
USERNAME ?= siderolabs
REGISTRY_AND_USERNAME ?= $(REGISTRY)/$(USERNAME)
GOLANGCILINT_VERSION ?= v1.51.2
GOFUMPT_VERSION ?= v0.4.0
GO_VERSION ?= 1.20
GOIMPORTS_VERSION ?= v0.6.0
PROTOBUF_GO_VERSION ?= 1.28.1
GRPC_GO_VERSION ?= 1.2.0
GRPC_GATEWAY_VERSION ?= 2.15.0
GRPC_GO_VERSION ?= 1.3.0
GRPC_GATEWAY_VERSION ?= 2.16.0
VTPROTOBUF_VERSION ?= 0.4.0
DEEPCOPY_VERSION ?= v0.5.5
GOLANGCILINT_VERSION ?= v1.53.3
GOFUMPT_VERSION ?= v0.5.0
GO_VERSION ?= 1.20
GOIMPORTS_VERSION ?= v0.11.0
GO_BUILDFLAGS ?=
GO_LDFLAGS ?=
CGO_ENABLED ?= 0
Expand All @@ -43,20 +44,21 @@ COMMON_ARGS += --push=$(PUSH)
COMMON_ARGS += --build-arg=ARTIFACTS="$(ARTIFACTS)"
COMMON_ARGS += --build-arg=SHA="$(SHA)"
COMMON_ARGS += --build-arg=TAG="$(TAG)"
COMMON_ARGS += --build-arg=ABBREV_TAG="$(ABBREV_TAG)"
COMMON_ARGS += --build-arg=USERNAME="$(USERNAME)"
COMMON_ARGS += --build-arg=REGISTRY="$(REGISTRY)"
COMMON_ARGS += --build-arg=TOOLCHAIN="$(TOOLCHAIN)"
COMMON_ARGS += --build-arg=CGO_ENABLED="$(CGO_ENABLED)"
COMMON_ARGS += --build-arg=GO_BUILDFLAGS="$(GO_BUILDFLAGS)"
COMMON_ARGS += --build-arg=GO_LDFLAGS="$(GO_LDFLAGS)"
COMMON_ARGS += --build-arg=GOLANGCILINT_VERSION="$(GOLANGCILINT_VERSION)"
COMMON_ARGS += --build-arg=GOFUMPT_VERSION="$(GOFUMPT_VERSION)"
COMMON_ARGS += --build-arg=GOIMPORTS_VERSION="$(GOIMPORTS_VERSION)"
COMMON_ARGS += --build-arg=PROTOBUF_GO_VERSION="$(PROTOBUF_GO_VERSION)"
COMMON_ARGS += --build-arg=GRPC_GO_VERSION="$(GRPC_GO_VERSION)"
COMMON_ARGS += --build-arg=GRPC_GATEWAY_VERSION="$(GRPC_GATEWAY_VERSION)"
COMMON_ARGS += --build-arg=VTPROTOBUF_VERSION="$(VTPROTOBUF_VERSION)"
COMMON_ARGS += --build-arg=DEEPCOPY_VERSION="$(DEEPCOPY_VERSION)"
COMMON_ARGS += --build-arg=GOLANGCILINT_VERSION="$(GOLANGCILINT_VERSION)"
COMMON_ARGS += --build-arg=GOIMPORTS_VERSION="$(GOIMPORTS_VERSION)"
COMMON_ARGS += --build-arg=GOFUMPT_VERSION="$(GOFUMPT_VERSION)"
COMMON_ARGS += --build-arg=TESTPKGS="$(TESTPKGS)"
TOOLCHAIN ?= docker.io/golang:1.20-alpine

Expand Down Expand Up @@ -150,7 +152,7 @@ unit-tests-race: ## Performs unit tests with race detection enabled.

.PHONY: coverage
coverage: ## Upload coverage data to codecov.io.
bash -c "bash <(curl -s https://codecov.io/bash) -f $(ARTIFACTS)/coverage.txt -X fix"
bash -c "bash <(curl -s https://codecov.io/bash) -f $(ARTIFACTS)/coverage-unit-tests.txt -X fix"

.PHONY: lint-markdown
lint-markdown: ## Runs markdownlint.
Expand Down
64 changes: 32 additions & 32 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,45 +3,46 @@ module github.com/siderolabs/go-kubernetes
go 1.20

require (
github.com/cosi-project/runtime v0.2.1
github.com/cosi-project/runtime v0.3.0
github.com/hashicorp/go-version v1.6.0
github.com/hexops/gotextdiff v1.0.3
github.com/siderolabs/gen v0.4.3
github.com/siderolabs/gen v0.4.5
github.com/siderolabs/go-retry v0.3.2
github.com/siderolabs/talos/pkg/machinery v1.3.5
github.com/stretchr/testify v1.8.1
k8s.io/api v0.26.1
k8s.io/apimachinery v0.26.1
k8s.io/client-go v0.26.1
github.com/siderolabs/talos/pkg/machinery v1.4.6
github.com/stretchr/testify v1.8.4
k8s.io/api v0.27.3
k8s.io/apimachinery v0.27.3
k8s.io/client-go v0.27.3
sigs.k8s.io/yaml v1.3.0
)

require (
github.com/ProtonMail/go-crypto v0.0.0-20220930113650-c6815a8c17ad // indirect
github.com/ProtonMail/go-mime v0.0.0-20220302105931-303f85f7fe0f // indirect
github.com/ProtonMail/gopenpgp/v2 v2.4.10 // indirect
github.com/ProtonMail/go-crypto v0.0.0-20230124153114-0acdc8ae009b // indirect
github.com/ProtonMail/go-mime v0.0.0-20221031134845-8fd9bc37cf08 // indirect
github.com/ProtonMail/gopenpgp/v2 v2.5.2 // indirect
github.com/adrg/xdg v0.4.0 // indirect
github.com/cloudflare/circl v1.1.0 // indirect
github.com/containerd/go-cni v1.1.7 // indirect
github.com/containerd/go-cni v1.1.9 // indirect
github.com/containernetworking/cni v1.1.2 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/emicklei/go-restful/v3 v3.9.0 // indirect
github.com/gertd/go-pluralize v0.2.1 // indirect
github.com/go-logr/logr v1.2.3 // indirect
github.com/go-openapi/jsonpointer v0.19.5 // indirect
github.com/go-openapi/jsonreference v0.20.0 // indirect
github.com/go-openapi/swag v0.19.14 // indirect
github.com/go-openapi/jsonpointer v0.19.6 // indirect
github.com/go-openapi/jsonreference v0.20.1 // indirect
github.com/go-openapi/swag v0.22.3 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/gnostic v0.5.7-v3refs // indirect
github.com/google/go-cmp v0.5.9 // indirect
github.com/google/gofuzz v1.1.0 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.13.0 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.15.2 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/mailru/easyjson v0.7.6 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
Expand All @@ -53,27 +54,26 @@ require (
github.com/siderolabs/go-api-signature v0.2.2 // indirect
github.com/siderolabs/go-pointer v1.0.0 // indirect
github.com/siderolabs/protoenc v0.2.0 // indirect
github.com/sirupsen/logrus v1.7.0 // indirect
go.uber.org/atomic v1.10.0 // indirect
go.uber.org/multierr v1.8.0 // indirect
go.uber.org/zap v1.23.0 // indirect
go.uber.org/zap v1.24.0 // indirect
golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4 // indirect
golang.org/x/net v0.7.0 // indirect
golang.org/x/oauth2 v0.1.0 // indirect
golang.org/x/sys v0.5.0 // indirect
golang.org/x/term v0.5.0 // indirect
golang.org/x/text v0.7.0 // indirect
golang.org/x/time v0.0.0-20220210224613-90d013bbcef8 // indirect
golang.org/x/net v0.8.0 // indirect
golang.org/x/oauth2 v0.5.0 // indirect
golang.org/x/sys v0.6.0 // indirect
golang.org/x/term v0.6.0 // indirect
golang.org/x/text v0.8.0 // indirect
golang.org/x/time v0.3.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20221118155620-16455021b5e6 // indirect
google.golang.org/grpc v1.51.0 // indirect
google.golang.org/protobuf v1.28.1 // indirect
google.golang.org/genproto v0.0.0-20230330154414-c0448cd141ea // indirect
google.golang.org/grpc v1.54.0 // indirect
google.golang.org/protobuf v1.30.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/klog/v2 v2.80.1 // indirect
k8s.io/kube-openapi v0.0.0-20221012153701-172d655c2280 // indirect
k8s.io/utils v0.0.0-20221107191617-1a15be271d1d // indirect
sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2 // indirect
k8s.io/klog/v2 v2.90.1 // indirect
k8s.io/kube-openapi v0.0.0-20230501164219-8b0f38b5fd1f // indirect
k8s.io/utils v0.0.0-20230209194617-a36077c30491 // indirect
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
)
Loading

0 comments on commit 69fea5b

Please sign in to comment.