Skip to content

Commit 38fa6ee

Browse files
authored
Merge branch 'main' into K8SPG-532_add_logs
2 parents 22b45a0 + 53693c4 commit 38fa6ee

141 files changed

Lines changed: 2235 additions & 3946 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/reviewdog.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
go-version: '^1.23'
1111
- uses: actions/checkout@v4
1212
- name: golangci-lint
13-
uses: golangci/golangci-lint-action@v6
13+
uses: golangci/golangci-lint-action@v7
1414
with:
1515
version: latest
1616
only-new-issues: true

.golangci.next.yaml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ linters:
1010
enable:
1111
- contextcheck
1212
- err113
13-
- errchkjson
1413
- gocritic
1514
- godot
1615
- godox
@@ -28,13 +27,16 @@ linters:
2827
- wastedassign
2928

3029
issues:
30+
exclude-rules:
31+
# We call external linters when they are installed: Flake8, ShellCheck, etc.
32+
- linters: [gosec]
33+
path: '_test[.]go$'
34+
text: 'G204: Subprocess launched with variable'
35+
3136
# https://github.com/golangci/golangci-lint/issues/2239
3237
exclude-use-default: false
3338

3439
linters-settings:
35-
errchkjson:
36-
check-error-free-encoding: true
37-
3840
thelper:
3941
# https://github.com/kulti/thelper/issues/27
4042
tb: { begin: true, first: true }

.golangci.yaml

Lines changed: 111 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,78 +1,119 @@
1-
# https://golangci-lint.run/usage/configuration/
2-
1+
version: "2"
2+
run:
3+
build-tags:
4+
- envtest
35
linters:
4-
disable:
5-
- contextcheck
6-
- errchkjson
7-
- gci
8-
- gofumpt
9-
- goimports
106
enable:
7+
- asasalint
8+
- asciicheck
9+
- bidichk
10+
- bodyclose
1111
- depguard
12+
- durationcheck
13+
- errchkjson
14+
- errorlint
15+
- exhaustive
16+
- gocheckcompilerdirectives
17+
- gochecksumtype
1218
- gomodguard
13-
- gosimple
19+
- gosec
20+
- gosmopolitan
1421
- importas
22+
- loggercheck
23+
- makezero
1524
- misspell
25+
- musttag
26+
- nilerr
27+
- nilnesserr
28+
- noctx
29+
- protogetter
30+
- reassign
31+
- recvcheck
32+
- rowserrcheck
33+
- spancheck
34+
- sqlclosecheck
35+
- testifylint
1636
- unconvert
17-
presets:
18-
- bugs
19-
- format
20-
- unused
21-
22-
linters-settings:
23-
gci:
24-
sections:
25-
- standard
26-
- default
27-
- prefix(github.com/percona)
28-
29-
depguard:
37+
- unparam
38+
- zerologlint
39+
disable:
40+
- contextcheck
41+
settings:
42+
depguard:
43+
rules:
44+
everything:
45+
deny:
46+
- pkg: io/ioutil
47+
desc: |
48+
Use the "io" and "os" packages instead. See https://go.dev/doc/go1.16#ioutil
49+
not-tests:
50+
files:
51+
- '!$test'
52+
deny:
53+
- pkg: net/http/httptest
54+
desc: Should be used only in tests.
55+
- pkg: testing/*
56+
desc: The "testing" packages should be used only in tests.
57+
- pkg: github.com/percona/percona-postgresql-operator/internal/testing/*
58+
desc: The "internal/testing" packages should be used only in tests.
59+
tests:
60+
files:
61+
- $test
62+
deny:
63+
- pkg: github.com/pkg/errors
64+
desc: Use the "errors" package unless you are interacting with stack traces.
65+
errchkjson:
66+
check-error-free-encoding: true
67+
exhaustive:
68+
default-signifies-exhaustive: true
69+
gomodguard:
70+
blocked:
71+
modules:
72+
- gopkg.in/yaml.v2:
73+
recommendations:
74+
- sigs.k8s.io/yaml
75+
- gopkg.in/yaml.v3:
76+
recommendations:
77+
- sigs.k8s.io/yaml
78+
- gotest.tools:
79+
recommendations:
80+
- gotest.tools/v3
81+
- k8s.io/kubernetes:
82+
reason: |
83+
k8s.io/kubernetes is for managing dependencies of the Kubernetes project, i.e. building kubelet and kubeadm.
84+
importas:
85+
alias:
86+
- pkg: k8s.io/api/(\w+)/(v[\w\w]+)
87+
alias: $1$2
88+
- pkg: k8s.io/apimachinery/pkg/apis/(\w+)/(v[\w\d]+)
89+
alias: $1$2
90+
no-unaliased: true
91+
exclusions:
92+
presets:
93+
- comments
94+
- common-false-positives
95+
- legacy
96+
- std-error-handling
3097
rules:
31-
everything:
32-
deny:
33-
- pkg: io/ioutil
34-
desc: >
35-
Use the "io" and "os" packages instead.
36-
See https://go.dev/doc/go1.16#ioutil
37-
38-
not-tests:
39-
files: ['!$test']
40-
deny:
41-
- pkg: net/http/httptest
42-
desc: Should be used only in tests.
43-
44-
- pkg: testing/*
45-
desc: The "testing" packages should be used only in tests.
46-
47-
- pkg: github.com/percona/percona-postgresql-operator/internal/testing/*
48-
desc: The "internal/testing" packages should be used only in tests.
49-
50-
exhaustive:
51-
default-signifies-exhaustive: true
52-
53-
gomodguard:
54-
blocked:
55-
modules:
56-
- gopkg.in/yaml.v2: { recommendations: [sigs.k8s.io/yaml] }
57-
- gopkg.in/yaml.v3: { recommendations: [sigs.k8s.io/yaml] }
58-
- gotest.tools: { recommendations: [gotest.tools/v3] }
59-
- k8s.io/kubernetes:
60-
reason: >
61-
k8s.io/kubernetes is for managing dependencies of the Kubernetes
62-
project, i.e. building kubelet and kubeadm.
63-
64-
importas:
65-
alias:
66-
- pkg: k8s.io/api/(\w+)/(v[\w\w]+)
67-
alias: $1$2
68-
- pkg: k8s.io/apimachinery/pkg/apis/(\w+)/(v[\w\d]+)
69-
alias: $1$2
70-
no-unaliased: true
71-
72-
run:
73-
build-tags:
74-
- envtest
75-
issues:
76-
exclude-dirs:
77-
- pkg/generated
78-
- hack
98+
- linters:
99+
- recvcheck
100+
path: internal/pki/pki.go
101+
text: methods of "(Certificate|PrivateKey)"
102+
paths:
103+
- third_party$
104+
- builtin$
105+
- examples$
106+
formatters:
107+
enable:
108+
- gofmt
109+
settings:
110+
gci:
111+
sections:
112+
- standard
113+
- default
114+
- prefix(github.com/percona)
115+
exclusions:
116+
paths:
117+
- third_party$
118+
- builtin$
119+
- examples$

Makefile

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@ PGMONITOR_DIR ?= hack/tools/pgmonitor
99
PGMONITOR_VERSION ?= v4.11.0
1010
QUERIES_CONFIG_DIR ?= hack/tools/queries
1111

12-
EXTERNAL_SNAPSHOTTER_DIR ?= hack/tools/external-snapshotter
13-
EXTERNAL_SNAPSHOTTER_VERSION ?= v8.0.1
14-
1512
# Buildah's "build" used to be "bud". Use the alias to be compatible for a while.
1613
BUILDAH_BUILD ?= buildah bud
1714

@@ -56,12 +53,6 @@ get-pgmonitor:
5653
cp -r '$(PGMONITOR_DIR)/postgres_exporter/common/.' '${QUERIES_CONFIG_DIR}'
5754
cp '$(PGMONITOR_DIR)/postgres_exporter/linux/queries_backrest.yml' '${QUERIES_CONFIG_DIR}'
5855

59-
.PHONY: get-external-snapshotter
60-
get-external-snapshotter:
61-
git -C '$(dir $(EXTERNAL_SNAPSHOTTER_DIR))' clone https://github.com/kubernetes-csi/external-snapshotter.git || git -C '$(EXTERNAL_SNAPSHOTTER_DIR)' fetch origin
62-
@git -C '$(EXTERNAL_SNAPSHOTTER_DIR)' checkout '$(EXTERNAL_SNAPSHOTTER_VERSION)'
63-
@git -C '$(EXTERNAL_SNAPSHOTTER_DIR)' config pull.ff only
64-
6556
.PHONY: clean
6657
clean: ## Clean resources
6758
clean: clean-deprecated
@@ -209,7 +200,7 @@ check: get-pgmonitor
209200
check-envtest: ## Run check using envtest and a mock kube api
210201
check-envtest: ENVTEST_USE = hack/tools/setup-envtest --bin-dir=$(CURDIR)/hack/tools/envtest use $(ENVTEST_K8S_VERSION)
211202
check-envtest: SHELL = bash
212-
check-envtest: get-pgmonitor get-external-snapshotter
203+
check-envtest: get-pgmonitor tools/setup-envtest
213204
GOBIN='$(CURDIR)/hack/tools' $(GO) install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest
214205
@$(ENVTEST_USE) --print=overview && echo
215206
source <($(ENVTEST_USE) --print=env) && PGO_NAMESPACE="postgres-operator" QUERIES_CONFIG_DIR="$(CURDIR)/${QUERIES_CONFIG_DIR}" \
@@ -221,7 +212,7 @@ check-envtest: get-pgmonitor get-external-snapshotter
221212
# make check-envtest-existing PGO_TEST_TIMEOUT_SCALE=1.2
222213
.PHONY: check-envtest-existing
223214
check-envtest-existing: ## Run check using envtest and an existing kube api
224-
check-envtest-existing: get-pgmonitor get-external-snapshotter
215+
check-envtest-existing: get-pgmonitor
225216
check-envtest-existing: createnamespaces
226217
kubectl apply --server-side -k ./config/dev
227218
USE_EXISTING_CLUSTER=true PGO_NAMESPACE="postgres-operator" QUERIES_CONFIG_DIR="$(CURDIR)/${QUERIES_CONFIG_DIR}" \

0 commit comments

Comments
 (0)