Skip to content

Commit

Permalink
Only bump the version for v3 and not v2
Browse files Browse the repository at this point in the history
  • Loading branch information
rashmigottipati committed Oct 14, 2020
1 parent ab77d54 commit 9c62d77
Show file tree
Hide file tree
Showing 9 changed files with 11 additions and 9 deletions.
4 changes: 3 additions & 1 deletion pkg/plugin/internal/util/go_version.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ func fetchAndCheckGoVersion() error {
return nil
}

// checkGoVersion should only ever check if the Go version >= 1.13, since the kubebuilder binary only cares
// that the go binary supports go modules which were stabilized in that version (i.e. in go 1.13) by default
func checkGoVersion(verStr string) error {
goVerRegex := `^go?([0-9]+)\.([0-9]+)([\.0-9A-Za-z\-]+)?$`
m := regexp.MustCompile(goVerRegex).FindStringSubmatch(verStr)
Expand All @@ -69,7 +71,7 @@ func checkGoVersion(verStr string) error {
}

if major < 1 || minor < 13 {
return fmt.Errorf("requires version >= 1.15")
return fmt.Errorf("requires version >= 1.13")
}

return nil
Expand Down
2 changes: 1 addition & 1 deletion pkg/plugin/v2/scaffolds/internal/templates/dockerfile.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func (f *Dockerfile) SetTemplateDefaults() error {
}

const dockerfileTemplate = `# Build the manager binary
FROM golang:1.15 as builder
FROM golang:1.13 as builder
WORKDIR /workspace
# Copy the Go Modules manifests
Expand Down
2 changes: 1 addition & 1 deletion pkg/plugin/v2/scaffolds/internal/templates/gomod.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func (f *GoMod) SetTemplateDefaults() error {
const goModTemplate = `
module {{ .Repo }}
go 1.15
go 1.13
require (
sigs.k8s.io/controller-runtime {{ .ControllerRuntimeVersion }}
Expand Down
2 changes: 1 addition & 1 deletion testdata/project-v2-addon/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build the manager binary
FROM golang:1.15 as builder
FROM golang:1.13 as builder

WORKDIR /workspace
# Copy the Go Modules manifests
Expand Down
2 changes: 1 addition & 1 deletion testdata/project-v2-addon/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module sigs.k8s.io/kubebuilder/testdata/project-v2-addon

go 1.15
go 1.13

require (
github.com/go-logr/logr v0.1.0
Expand Down
2 changes: 1 addition & 1 deletion testdata/project-v2-multigroup/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build the manager binary
FROM golang:1.15 as builder
FROM golang:1.13 as builder

WORKDIR /workspace
# Copy the Go Modules manifests
Expand Down
2 changes: 1 addition & 1 deletion testdata/project-v2-multigroup/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module sigs.k8s.io/kubebuilder/testdata/project-v2-multigroup

go 1.15
go 1.13

require (
github.com/go-logr/logr v0.1.0
Expand Down
2 changes: 1 addition & 1 deletion testdata/project-v2/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build the manager binary
FROM golang:1.15 as builder
FROM golang:1.13 as builder

WORKDIR /workspace
# Copy the Go Modules manifests
Expand Down
2 changes: 1 addition & 1 deletion testdata/project-v2/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module sigs.k8s.io/kubebuilder/testdata/project-v2

go 1.15
go 1.13

require (
github.com/go-logr/logr v0.1.0
Expand Down

0 comments on commit 9c62d77

Please sign in to comment.