Skip to content

Commit b59b205

Browse files
authored
Merge pull request #198 from sergenyalcin/crossplane-v2-migration
crossplane v2: namespaced MRs
2 parents 7599dfd + cfeeea2 commit b59b205

File tree

102 files changed

+5597
-1091
lines changed

Some content is hidden

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

102 files changed

+5597
-1091
lines changed

.golangci.yml

Lines changed: 130 additions & 176 deletions
Original file line numberDiff line numberDiff line change
@@ -1,187 +1,141 @@
1-
run:
2-
timeout: 30m
1+
# SPDX-FileCopyrightText: 2025 The Crossplane Authors <https://crossplane.io>
2+
#
3+
# SPDX-License-Identifier: CC0-1.0
34

5+
version: "2"
46
output:
5-
# colored-line-number|line-number|json|tab|checkstyle|code-climate, default is "colored-line-number"
67
formats:
7-
- format: colored-line-number
8-
print-linter-name: true
9-
show-stats: true
10-
11-
linters-settings:
12-
errcheck:
13-
# report about not checking of errors in type assetions: `a := b.(MyStruct)`;
14-
# default is false: such cases aren't reported by default.
15-
check-type-assertions: false
16-
17-
# report about assignment of errors to blank identifier: `num, _ := strconv.Atoi(numStr)`;
18-
# default is false: such cases aren't reported by default.
19-
check-blank: true
20-
21-
# Updated to use exclude-functions instead of ignore
22-
exclude-functions: fmt:.*,io/ioutil:^Read.*
23-
24-
govet:
25-
# report about shadowed variables
26-
check-shadowing: false
27-
28-
revive:
29-
# confidence for issues, default is 0.8
30-
confidence: 0.8
31-
32-
gofmt:
33-
# simplify code: gofmt with `-s` option, true by default
34-
simplify: true
35-
36-
goimports:
37-
# put imports beginning with prefix after 3rd-party packages;
38-
# it's a comma-separated list of prefixes
39-
local-prefixes: github.com/upbound/provider-aws
40-
41-
gocyclo:
42-
# minimal code complexity to report, 30 by default (but we recommend 10-20)
43-
min-complexity: 10
44-
45-
dupl:
46-
# tokens count to trigger issue, 150 by default
47-
threshold: 100
48-
49-
goconst:
50-
# minimal length of string constant, 3 by default
51-
min-len: 3
52-
# minimal occurrences count to trigger, 3 by default
53-
min-occurrences: 5
54-
55-
lll:
56-
# tab width in spaces. Default to 1.
57-
tab-width: 1
58-
59-
unparam:
60-
# Inspect exported functions, default is false. Set to true if no external program/library imports your code.
61-
# XXX: if you enable this setting, unparam will report a lot of false-positives in text editors:
62-
# if it's called for subdir of a project it can't find external interfaces. All text editor integrations
63-
# with golangci-lint call it on a directory with the changed file.
64-
check-exported: false
65-
66-
nakedret:
67-
# make an issue if func has more lines of code than this setting and it has naked returns; default is 30
68-
max-func-lines: 30
69-
70-
prealloc:
71-
# XXX: we don't recommend using this linter before doing performance profiling.
72-
# For most programs usage of prealloc will be a premature optimization.
73-
74-
# Report preallocation suggestions only on simple loops that have no returns/breaks/continues/gotos in them.
75-
# True by default.
76-
simple: true
77-
range-loops: true # Report preallocation suggestions on range loops, true by default
78-
for-loops: false # Report preallocation suggestions on for loops, false by default
79-
80-
gocritic:
81-
# Enable multiple checks by tags, run `GL_DEBUG=gocritic golangci-lint` run to see all tags and checks.
82-
# Empty list by default. See https://github.com/go-critic/go-critic#usage -> section "Tags".
83-
enabled-tags:
84-
- performance
85-
86-
settings: # settings passed to gocritic
87-
captLocal: # must be valid enabled check name
88-
paramsOnly: true
89-
rangeValCopy:
90-
sizeThreshold: 32
91-
8+
text:
9+
path: stdout
9210
linters:
9311
enable:
94-
- govet
95-
- gocyclo
96-
- gocritic
12+
- asasalint
13+
- asciicheck
14+
- bidichk
15+
- bodyclose
16+
- contextcheck
17+
- durationcheck
18+
- errchkjson
19+
- errorlint
20+
- exhaustive
21+
- gocheckcompilerdirectives
22+
- gochecksumtype
9723
- goconst
98-
- goimports
99-
- gofmt # We enable this as well as goimports for its simplify mode.
100-
- gosimple
24+
- gocritic
25+
- gocyclo
26+
- gosec
27+
- gosmopolitan
28+
- loggercheck
29+
- makezero
30+
- misspell
31+
- musttag
32+
- nakedret
33+
- nilerr
34+
- nilnesserr
35+
- noctx
10136
- prealloc
37+
- protogetter
38+
- reassign
39+
- recvcheck
10240
- revive
103-
- staticcheck
41+
- rowserrcheck
42+
- spancheck
43+
- sqlclosecheck
44+
- testifylint
10445
- unconvert
105-
- unused
106-
- misspell
107-
- nakedret
108-
109-
presets:
110-
- bugs
111-
- unused
112-
fast: false
113-
114-
46+
- unparam
47+
- zerologlint
48+
settings:
49+
dupl:
50+
threshold: 100
51+
errcheck:
52+
check-type-assertions: false
53+
check-blank: false
54+
exclude-functions:
55+
- io/ioutil.ReadFile
56+
- io/ioutil.ReadDir
57+
- io/ioutil.ReadAll
58+
goconst:
59+
min-len: 3
60+
min-occurrences: 5
61+
gocritic:
62+
enabled-tags:
63+
- performance
64+
settings:
65+
captLocal:
66+
paramsOnly: true
67+
rangeValCopy:
68+
sizeThreshold: 32
69+
gocyclo:
70+
min-complexity: 15
71+
lll:
72+
tab-width: 1
73+
nakedret:
74+
max-func-lines: 30
75+
prealloc:
76+
simple: true
77+
range-loops: true
78+
for-loops: false
79+
revive:
80+
confidence: 0.8
81+
unparam:
82+
check-exported: false
83+
exclusions:
84+
generated: lax
85+
rules:
86+
- linters:
87+
- dupl
88+
- errcheck
89+
- gocyclo
90+
- gosec
91+
- scopelint
92+
- unparam
93+
path: _test(ing)?\.go
94+
- linters:
95+
- gocritic
96+
path: _test\.go
97+
text: (unnamedResult|exitAfterDefer)
98+
- linters:
99+
- gocritic
100+
text: '(hugeParam|rangeValCopy):'
101+
- linters:
102+
- staticcheck
103+
text: 'SA3000:'
104+
- linters:
105+
- gosec
106+
text: 'G101:'
107+
- linters:
108+
- gosec
109+
text: 'G104:'
110+
- linters:
111+
- staticcheck
112+
text: 'QF1008:'
113+
- linters:
114+
- staticcheck
115+
text: 'QF1001:'
116+
paths:
117+
- zz_\..+\.go$
118+
- third_party$
119+
- builtin$
120+
- examples$
115121
issues:
116-
# Added the exclude-files configuration here to replace run.skip-files
117-
exclude-files:
118-
- "zz_generated\\..+\\.go$"
119-
120-
# Excluding configuration per-path and per-linter
121-
exclude-rules:
122-
# Exclude some linters from running on tests files.
123-
- path: _test(ing)?\.go
124-
linters:
125-
- gocyclo
126-
- errcheck
127-
- dupl
128-
- gosec
129-
- scopelint
130-
- unparam
131-
132-
# Ease some gocritic warnings on test files.
133-
- path: _test\.go
134-
text: "(unnamedResult|exitAfterDefer)"
135-
linters:
136-
- gocritic
137-
138-
# These are performance optimisations rather than style issues per se.
139-
# They warn when function arguments or range values copy a lot of memory
140-
# rather than using a pointer.
141-
- text: "(hugeParam|rangeValCopy):"
142-
linters:
143-
- gocritic
144-
145-
# This "TestMain should call os.Exit to set exit code" warning is not clever
146-
# enough to notice that we call a helper method that calls os.Exit.
147-
- text: "SA3000:"
148-
linters:
149-
- staticcheck
150-
151-
- text: "k8s.io/api/core/v1"
152-
linters:
153-
- goimports
154-
155-
# This is a "potential hardcoded credentials" warning. It's triggered by
156-
# any variable with 'secret' in the same, and thus hits a lot of false
157-
# positives in Kubernetes land where a Secret is an object type.
158-
- text: "G101:"
159-
linters:
160-
- gosec
161-
- gas
162-
163-
# This is an 'errors unhandled' warning that duplicates errcheck.
164-
- text: "G104:"
165-
linters:
166-
- gosec
167-
- gas
168-
169-
# Independently from option `exclude` we use default exclude patterns,
170-
# it can be disabled by this option. To list all
171-
# excluded by default patterns execute `golangci-lint run --help`.
172-
# Default value for this option is true.
173-
exclude-use-default: false
174-
175-
# Show only new issues: if there are unstaged changes or untracked files,
176-
# only those changes are analyzed, else only changes in HEAD~ are analyzed.
177-
# It's a super-useful option for integration of golangci-lint into existing
178-
# large codebase. It's not practical to fix all existing issues at the moment
179-
# of integration: much better don't allow issues in new code.
180-
# Default is false.
181-
new: false
182-
183-
# Maximum issues count per one linter. Set to 0 to disable. Default is 50.
184-
max-per-linter: 0
185-
186-
# Maximum count of issues with the same text. Set to 0 to disable. Default is 3.
122+
max-issues-per-linter: 0
187123
max-same-issues: 0
124+
new: false
125+
formatters:
126+
enable:
127+
- gofmt
128+
- goimports
129+
settings:
130+
gofmt:
131+
simplify: true
132+
goimports:
133+
local-prefixes:
134+
- github.com/upbound/provider-terraform
135+
exclusions:
136+
generated: lax
137+
paths:
138+
- zz_\..+\.go$
139+
- third_party$
140+
- builtin$
141+
- examples$

Makefile

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -10,29 +10,24 @@ PLATFORMS ?= linux_amd64 linux_arm64
1010
-include build/makelib/output.mk
1111

1212
# Setup Go
13-
GO_REQUIRED_VERSION ?= 1.23
13+
GO_REQUIRED_VERSION ?= 1.24
1414
NPROCS ?= 1
15-
# GOLANGCILINT_VERSION is inherited from build submodule by default.
16-
# Uncomment below if you need to override the version.
17-
# GOLANGCILINT_VERSION ?= 1.50.0
15+
GOLANGCILINT_VERSION = 2.1.2
1816
GO_TEST_PARALLEL := $(shell echo $$(( $(NPROCS) / 2 )))
1917
GO_STATIC_PACKAGES = $(GO_PROJECT)/cmd/provider
2018
GO_LDFLAGS += -X $(GO_PROJECT)/pkg/version.Version=$(VERSION)
21-
GO_SUBDIRS += cmd internal apis
19+
GO_SUBDIRS += cmd internal apis generate
2220
GO111MODULE = on
2321

2422
-include build/makelib/golang.mk
2523

2624
# ====================================================================================
2725
# Setup Kubernetes tools
2826

29-
# Uncomment below to override the versions from the build module
30-
#KIND_VERSION = v0.27.0
27+
KIND_VERSION = v0.29.0
3128
UP_VERSION = v0.34.2
3229
UP_CHANNEL = stable
3330
UPTEST_VERSION = v1.1.2
34-
UPTEST_LOCAL_VERSION = v0.13.0
35-
UPTEST_LOCAL_CHANNEL = stable
3631
KUSTOMIZE_VERSION = v5.3.0
3732
YQ_VERSION = v4.40.5
3833
CROSSPLANE_VERSION = 1.17.1
@@ -43,16 +38,6 @@ export UP_CHANNEL := $(UP_CHANNEL)
4338

4439
-include build/makelib/k8s_tools.mk
4540

46-
# uptest download and install
47-
UPTEST_LOCAL := $(TOOLS_HOST_DIR)/uptest-$(UPTEST_LOCAL_VERSION)
48-
49-
$(UPTEST_LOCAL):
50-
@$(INFO) installing uptest $(UPTEST_LOCAL)
51-
@mkdir -p $(TOOLS_HOST_DIR)
52-
@curl -fsSLo $(UPTEST_LOCAL) https://s3.us-west-2.amazonaws.com/crossplane.uptest.releases/$(UPTEST_LOCAL_CHANNEL)/$(UPTEST_LOCAL_VERSION)/bin/$(SAFEHOST_PLATFORM)/uptest || $(FAIL)
53-
@chmod +x $(UPTEST_LOCAL)
54-
@$(OK) installing uptest $(UPTEST_LOCAL)
55-
5641
# Setup Images
5742
REGISTRY_ORGS ?= xpkg.upbound.io/upbound
5843
IMAGES = provider-terraform
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
1616

17-
// Package apis contains Kubernetes API for the terraform provider.
18-
package apis
17+
// Package cluster contains Kubernetes API for the terraform provider.
18+
package cluster
1919

2020
import (
2121
"k8s.io/apimachinery/pkg/runtime"
2222

23-
"github.com/upbound/provider-terraform/apis/v1beta1"
23+
"github.com/upbound/provider-terraform/apis/cluster/v1beta1"
2424
)
2525

2626
func init() {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ package v1beta1
1919
import (
2020
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2121

22-
xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1"
22+
xpv1 "github.com/crossplane/crossplane-runtime/v2/apis/common/v1"
2323
)
2424

2525
// A ProviderConfigSpec defines the desired state of a ProviderConfig.

0 commit comments

Comments
 (0)