Skip to content

Commit

Permalink
bump go module version to v2
Browse files Browse the repository at this point in the history
Signed-off-by: Zbynek Roubalik <zroubali@redhat.com>
  • Loading branch information
Zbynek Roubalik committed Nov 12, 2020
1 parent 50bec80 commit 716ba8a
Show file tree
Hide file tree
Showing 87 changed files with 161 additions and 176 deletions.
3 changes: 0 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -233,9 +233,6 @@ clientset-verify: clientset-prepare
.PHONY: clientset-generate
clientset-generate: clientset-prepare
./hack/update-codegen.sh
find ./pkg/generated -type f -name "*.go" |\
xargs sed -i".out" -e "s#github.com/kedacore/keda/api/keda/v1alpha1#github.com/kedacore/keda/api/v1alpha1#g"
find ./pkg/generated -type f -name "*.go.out" | xargs rm -rf
rm -rf api/keda

##################################################
Expand Down
10 changes: 5 additions & 5 deletions adapter/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ import (
basecmd "github.com/kubernetes-incubator/custom-metrics-apiserver/pkg/cmd"
"github.com/kubernetes-incubator/custom-metrics-apiserver/pkg/provider"

kedav1alpha1 "github.com/kedacore/keda/api/v1alpha1"
prommetrics "github.com/kedacore/keda/pkg/metrics"
kedaprovider "github.com/kedacore/keda/pkg/provider"
"github.com/kedacore/keda/pkg/scaling"
"github.com/kedacore/keda/version"
kedav1alpha1 "github.com/kedacore/keda/v2/api/v1alpha1"
prommetrics "github.com/kedacore/keda/v2/pkg/metrics"
kedaprovider "github.com/kedacore/keda/v2/pkg/provider"
"github.com/kedacore/keda/v2/pkg/scaling"
"github.com/kedacore/keda/v2/version"
)

// Adapter creates External Metrics Provider
Expand Down
6 changes: 3 additions & 3 deletions controllers/hpa.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ import (
"fmt"

"github.com/go-logr/logr"
version "github.com/kedacore/keda/version"
version "github.com/kedacore/keda/v2/version"
autoscalingv2beta2 "k8s.io/api/autoscaling/v2beta2"
"k8s.io/apimachinery/pkg/api/equality"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"sigs.k8s.io/controller-runtime/pkg/controller/controllerutil"

kedav1alpha1 "github.com/kedacore/keda/api/v1alpha1"
kedacontrollerutil "github.com/kedacore/keda/controllers/util"
kedav1alpha1 "github.com/kedacore/keda/v2/api/v1alpha1"
kedacontrollerutil "github.com/kedacore/keda/v2/controllers/util"
)

const (
Expand Down
4 changes: 2 additions & 2 deletions controllers/scaledjob_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import (
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/predicate"

kedav1alpha1 "github.com/kedacore/keda/api/v1alpha1"
"github.com/kedacore/keda/pkg/scaling"
kedav1alpha1 "github.com/kedacore/keda/v2/api/v1alpha1"
"github.com/kedacore/keda/v2/pkg/scaling"
)

// +kubebuilder:rbac:groups=keda.sh,resources=scaledjobs;scaledjobs/finalizers;scaledjobs/status,verbs="*"
Expand Down
4 changes: 2 additions & 2 deletions controllers/scaledjob_finalizer.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (

"github.com/go-logr/logr"

kedav1alpha1 "github.com/kedacore/keda/api/v1alpha1"
"github.com/kedacore/keda/controllers/util"
kedav1alpha1 "github.com/kedacore/keda/v2/api/v1alpha1"
"github.com/kedacore/keda/v2/controllers/util"
)

const (
Expand Down
8 changes: 4 additions & 4 deletions controllers/scaledobject_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ import (
"sigs.k8s.io/controller-runtime/pkg/manager"
"sigs.k8s.io/controller-runtime/pkg/predicate"

kedav1alpha1 "github.com/kedacore/keda/api/v1alpha1"
kedacontrollerutil "github.com/kedacore/keda/controllers/util"
"github.com/kedacore/keda/pkg/scaling"
kedautil "github.com/kedacore/keda/pkg/util"
kedav1alpha1 "github.com/kedacore/keda/v2/api/v1alpha1"
kedacontrollerutil "github.com/kedacore/keda/v2/controllers/util"
"github.com/kedacore/keda/v2/pkg/scaling"
kedautil "github.com/kedacore/keda/v2/pkg/util"
)

// +kubebuilder:rbac:groups=keda.sh,resources=scaledobjects;scaledobjects/finalizers;scaledobjects/status,verbs="*"
Expand Down
4 changes: 2 additions & 2 deletions controllers/scaledobject_finalizer.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

kedav1alpha1 "github.com/kedacore/keda/api/v1alpha1"
"github.com/kedacore/keda/controllers/util"
kedav1alpha1 "github.com/kedacore/keda/v2/api/v1alpha1"
"github.com/kedacore/keda/v2/controllers/util"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion controllers/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import (
"sigs.k8s.io/controller-runtime/pkg/envtest/printer"
logf "sigs.k8s.io/controller-runtime/pkg/log"
"sigs.k8s.io/controller-runtime/pkg/log/zap"
//kedav1alpha1 "github.com/kedacore/keda/api/v1alpha1"
//kedav1alpha1 "github.com/kedacore/keda/v2/api/v1alpha1"
// +kubebuilder:scaffold:imports
)

Expand Down
2 changes: 1 addition & 1 deletion controllers/util/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"k8s.io/apimachinery/pkg/runtime"
runtimeclient "sigs.k8s.io/controller-runtime/pkg/client"

kedav1alpha1 "github.com/kedacore/keda/api/v1alpha1"
kedav1alpha1 "github.com/kedacore/keda/v2/api/v1alpha1"
)

// SetStatusConditions patches given object with passed list of conditions based on the object's type or returns an error.
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/kedacore/keda
module github.com/kedacore/keda/v2

go 1.15

Expand Down
40 changes: 7 additions & 33 deletions go.sum

Large diffs are not rendered by default.

19 changes: 16 additions & 3 deletions hack/update-codegen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,22 @@ CODEGEN_PKG=${CODEGEN_PKG:-$(cd "${SCRIPT_ROOT}"; ls -d -1 ./vendor/k8s.io/code-
# bash "${CODEGEN_PKG}"/generate-groups.sh "deepcopy,client,informer,lister" \
# Deepcopy is generated by operator-sdk
bash "${CODEGEN_PKG}"/generate-groups.sh "client,informer,lister" \
github.com/kedacore/keda/pkg/generated github.com/kedacore/keda/api \
github.com/kedacore/keda/v2/pkg/generated github.com/kedacore/keda/v2/api \
keda:v1alpha1 \
--go-header-file "${SCRIPT_ROOT}"/hack/boilerplate.go.txt

# To use your own boilerplate text append:
# --go-header-file "${SCRIPT_ROOT}"/hack/custom-boilerplate.go.txt
# (Zbynek): If v2 is specified in go.mod, codegen unfortunately outputs to 'v2/pkg/generated' instead of 'pkg/generated',
# therefore we need to move the generated code around the repo a bit
if [ -d v2/pkg/generated ]; then
rm -rf pkg/generated
mv v2/pkg/generated pkg/
rm -rf v2
fi

# (Zbynek): Kubebuilder project layout has api under 'api/v1alpha1'
# client-go codegen expects group name in the path ie. 'api/keda/v1alpha'
# Because there's no way how to modify any of these settings,
# we need to hack things a little bit (replace the name of package)
find pkg/generated -type f -name "*.go" |\
xargs sed -i".out" -e "s#github.com/kedacore/keda/v2/api/keda/v1alpha1#github.com/kedacore/keda/v2/api/v1alpha1#g"
find pkg/generated -type f -name "*.go.out" | xargs rm -rf
5 changes: 3 additions & 2 deletions hack/verify-codegen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,12 @@ cp -a "${DIFFROOT}"/* "${TMP_DIFFROOT}"

"${SCRIPT_ROOT}/hack/update-codegen.sh"

# Kubebuilder project layout has api under 'api/v1alpha1'
# (Zbynek): Kubebuilder project layout has api under 'api/v1alpha1'
# client-go codegen expects group name in the path ie. 'api/keda/v1alpha'
# Because there's no way how to modify any of these settings,
# we need to hack things a little bit (replace the name of package)
find "${DIFFROOT}/generated" -type f -name "*.go" | xargs sed -i "s#github.com/kedacore/keda/api/keda/v1alpha1#github.com/kedacore/keda/api/v1alpha1#g"
find "${DIFFROOT}/generated" -type f -name "*.go" |\
xargs sed -i "s#github.com/kedacore/keda/v2/api/keda/v1alpha1#github.com/kedacore/keda/v2/api/v1alpha1#g"

echo "diffing ${DIFFROOT} against freshly generated codegen"
ret=0
Expand Down
6 changes: 3 additions & 3 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ import (
"sigs.k8s.io/controller-runtime/pkg/healthz"
"sigs.k8s.io/controller-runtime/pkg/log/zap"

kedav1alpha1 "github.com/kedacore/keda/api/v1alpha1"
"github.com/kedacore/keda/controllers"
"github.com/kedacore/keda/version"
kedav1alpha1 "github.com/kedacore/keda/v2/api/v1alpha1"
"github.com/kedacore/keda/v2/controllers"
"github.com/kedacore/keda/v2/version"
// +kubebuilder:scaffold:imports
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/generated/clientset/versioned/clientset.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions pkg/generated/clientset/versioned/fake/clientset_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pkg/generated/clientset/versioned/fake/register.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pkg/generated/clientset/versioned/scheme/register.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions pkg/generated/informers/externalversions/factory.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pkg/generated/informers/externalversions/generic.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pkg/generated/informers/externalversions/keda/interface.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pkg/generated/listers/keda/v1alpha1/scaledjob.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 716ba8a

Please sign in to comment.