Skip to content

Commit 6f61067

Browse files
authored
K8S 1.25 Update (#200)
PR to Bump K8s version to 1.25 and golang to 1.19 Additionally bumped versions for the linter and underlying support packages to be compatible with the latest golang.
1 parent 8d2cd17 commit 6f61067

40 files changed

+1361
-648
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
- name: Set up Go
1818
uses: actions/setup-go@v3
1919
with:
20-
go-version: ~1.18
20+
go-version: ~1.19
2121
id: go
2222

2323
- name: Check out code into the Go module directory
@@ -56,7 +56,7 @@ jobs:
5656
- name: Set up Go
5757
uses: actions/setup-go@v3
5858
with:
59-
go-version: ~1.18
59+
go-version: ~1.19
6060
id: go
6161

6262
- name: Check out code into the Go module directory
@@ -65,7 +65,7 @@ jobs:
6565
- name: Lint
6666
uses: golangci/golangci-lint-action@v3
6767
with:
68-
version: v1.45.2
68+
version: v1.48.0
6969

7070
go-apidiff:
7171
name: go-apidiff
@@ -76,7 +76,7 @@ jobs:
7676
- name: Set up Go
7777
uses: actions/setup-go@v3
7878
with:
79-
go-version: ~1.18
79+
go-version: ~1.19
8080
id: go
8181

8282
- name: Check out code into the Go module directory

.github/workflows/deploy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
- name: Install Go
2929
uses: actions/setup-go@v3
3030
with:
31-
go-version: ~1.18
31+
go-version: ~1.19
3232

3333
- name: Create release
3434
run: |

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Build the manager binary
2-
FROM --platform=$BUILDPLATFORM golang:1.18 as builder
2+
FROM --platform=$BUILDPLATFORM golang:1.19 as builder
33
ARG TARGETOS
44
ARG TARGETARCH
55

Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,14 @@ build:
6161

6262
.PHONY: setup-lint
6363
setup-lint: ## Setup the lint
64-
fetch golangci-lint 1.45.2
64+
fetch golangci-lint 1.48.0
6565

6666
# Run various checks against code
6767
.PHONY: lint
6868
lint: setup-lint
6969
golangci-lint run
7070

71+
7172
.PHONY: fix
7273
fix: setup-lint ## Fixup files in the repo.
7374
go mod tidy

go.mod

Lines changed: 156 additions & 103 deletions
Large diffs are not rendered by default.

go.sum

Lines changed: 932 additions & 260 deletions
Large diffs are not rendered by default.

internal/metrics/metrics.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ var (
3838
)
3939
)
4040

41-
//RegisterBuildInfo registers buildInfo Collector to be included in metrics collection
41+
// RegisterBuildInfo registers buildInfo Collector to be included in metrics collection
4242
func RegisterBuildInfo(r prometheus.Registerer) {
4343
buildInfo.Set(1)
4444
r.MustRegister(buildInfo)

internal/testutils/utils.go

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import (
1919
"bytes"
2020
"errors"
2121
"fmt"
22-
"io/ioutil"
2322
"os"
2423
"path/filepath"
2524
"regexp"
@@ -95,15 +94,15 @@ func ReplaceInFile(path, old, new string) error {
9594
if err != nil {
9695
return err
9796
}
98-
b, err := ioutil.ReadFile(path)
97+
b, err := os.ReadFile(path)
9998
if err != nil {
10099
return err
101100
}
102101
if !strings.Contains(string(b), old) {
103102
return errors.New("unable to find the content to be replaced")
104103
}
105104
s := strings.Replace(string(b), old, new, -1)
106-
err = ioutil.WriteFile(path, []byte(s), info.Mode())
105+
err = os.WriteFile(path, []byte(s), info.Mode())
107106
if err != nil {
108107
return err
109108
}
@@ -122,15 +121,15 @@ func ReplaceRegexInFile(path, match, replace string) error {
122121
if err != nil {
123122
return err
124123
}
125-
b, err := ioutil.ReadFile(path)
124+
b, err := os.ReadFile(path)
126125
if err != nil {
127126
return err
128127
}
129128
s := matcher.ReplaceAllString(string(b), replace)
130129
if s == string(b) {
131130
return errors.New("unable to find the content to be replaced")
132131
}
133-
err = ioutil.WriteFile(path, []byte(s), info.Mode())
132+
err = os.WriteFile(path, []byte(s), info.Mode())
134133
if err != nil {
135134
return err
136135
}
@@ -142,7 +141,7 @@ func ReplaceRegexInFile(path, match, replace string) error {
142141
// todo(camilamacedo86): this func exists in upstream/kb but there the error is not thrown. We need to
143142
// push this change. See: https://github.com/kubernetes-sigs/kubebuilder/blob/master/test/e2e/utils/util.go
144143
func UncommentCode(filename, target, prefix string) error {
145-
content, err := ioutil.ReadFile(filename)
144+
content, err := os.ReadFile(filename)
146145
if err != nil {
147146
return err
148147
}
@@ -184,5 +183,5 @@ func UncommentCode(filename, target, prefix string) error {
184183
}
185184
// false positive
186185
// nolint:gosec
187-
return ioutil.WriteFile(filename, out.Bytes(), 0644)
186+
return os.WriteFile(filename, out.Bytes(), 0644)
188187
}

pkg/annotation/annotation.go

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,23 +21,22 @@ limitations under the License.
2121
//
2222
// To disable hooks based on annotations the InstallDisableHooks is passed to the reconciler as an option.
2323
//
24-
// r, err := reconciler.New(
25-
// reconciler.WithChart(*w.Chart),
26-
// reconciler.WithGroupVersionKind(w.GroupVersionKind),
27-
// reconciler.WithInstallAnnotations(annotation.InstallDisableHook{}),
28-
// )
24+
// r, err := reconciler.New(
25+
// reconciler.WithChart(*w.Chart),
26+
// reconciler.WithGroupVersionKind(w.GroupVersionKind),
27+
// reconciler.WithInstallAnnotations(annotation.InstallDisableHook{}),
28+
// )
2929
//
3030
// If the reconciler detects an annotation named "helm.sdk.operatorframework.io/install-disable-hooks"
3131
// on the watched custom resource it sets the install.DisableHooks option to the annotations value. For more information
3232
// take a look at the InstallDisableHooks.InstallOption method.
3333
//
34-
// kind: OperatorHelmKind
35-
// apiVersion: test.example.com/v1
36-
// metadata:
37-
// name: nginx-sample
38-
// annotations:
39-
// "helm.sdk.operatorframework.io/install-disable-hooks": true
40-
//
34+
// kind: OperatorHelmKind
35+
// apiVersion: test.example.com/v1
36+
// metadata:
37+
// name: nginx-sample
38+
// annotations:
39+
// "helm.sdk.operatorframework.io/install-disable-hooks": true
4140
package annotation
4241

4342
import (

pkg/plugins/helm/v1/chartutil/chart.go

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ package chartutil
1717
import (
1818
"bytes"
1919
"fmt"
20-
"io/ioutil"
2120
"os"
2221
"path/filepath"
2322

@@ -52,7 +51,7 @@ type Options struct {
5251
// NewChart creates a new helm chart for the project from helm's default template.
5352
// It returns a chart.Chart that references the newly created chart or an error.
5453
func NewChart(name string) (*chart.Chart, error) {
55-
tmpDir, err := ioutil.TempDir("", "osdk-helm-chart")
54+
tmpDir, err := os.MkdirTemp("", "osdk-helm-chart")
5655
if err != nil {
5756
return nil, err
5857
}
@@ -86,22 +85,22 @@ func NewChart(name string) (*chart.Chart, error) {
8685
// If opts.Repo is not specified, the following chart reference formats are supported:
8786
//
8887
// - <repoName>/<chartName>: Fetch the helm chart named chartName from the helm
89-
// chart repository named repoName, as specified in the
90-
// $HELM_HOME/repositories/repositories.yaml file.
88+
// chart repository named repoName, as specified in the
89+
// $HELM_HOME/repositories/repositories.yaml file.
9190
//
9291
// - <url>: Fetch the helm chart archive at the specified URL.
9392
//
9493
// If opts.Repo is specified, only one chart reference format is supported:
9594
//
9695
// - <chartName>: Fetch the helm chart named chartName in the helm chart repository
97-
// specified by opts.Repo
96+
// specified by opts.Repo
9897
//
9998
// If opts.Version is not set, it will fetch the latest available version of the helm
10099
// chart. Otherwise, it will fetch the specified version.
101100
// opts.Version is not used when opts.Chart itself refers to a specific version, for
102101
// example when it is a local path or a URL.
103102
func LoadChart(opts Options) (*chart.Chart, error) {
104-
tmpDir, err := ioutil.TempDir("", "osdk-helm-chart")
103+
tmpDir, err := os.MkdirTemp("", "osdk-helm-chart")
105104
if err != nil {
106105
return nil, err
107106
}
@@ -152,7 +151,7 @@ func downloadChart(destDir string, opts Options) (string, error) {
152151

153152
// ScaffoldChart scaffolds the provided chart.Chart to a known directory relative to projectDir
154153
//
155-
// It also fetches the dependencies and reloads the chart.Chart
154+
// # It also fetches the dependencies and reloads the chart.Chart
156155
//
157156
// It returns the reloaded chart, the relative path, or an error.
158157
func ScaffoldChart(chrt *chart.Chart, projectDir string) (*chart.Chart, string, error) {

0 commit comments

Comments
 (0)