Skip to content

Commit

Permalink
Updates imports for v1alpha4 types
Browse files Browse the repository at this point in the history
- Adds imports for controllers and test methods
- Removes v1alpha3 webhooks from manager

Signed-off-by: Sagar Muchhal <[email protected]>
  • Loading branch information
srm09 committed Oct 11, 2020
1 parent ec4adf1 commit 63e40e9
Show file tree
Hide file tree
Showing 136 changed files with 320 additions and 482 deletions.
162 changes: 0 additions & 162 deletions bootstrap/kubeadm/api/v1alpha3/kubeadmbootstrapconfig_types_test.go

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -1156,7 +1156,7 @@ spec:
format: date-time
type: string
value:
description: Required. The taint value corresponding to the taint key.
description: The taint value corresponding to the taint key.
type: string
required:
- effect
Expand Down Expand Up @@ -1265,7 +1265,7 @@ spec:
format: date-time
type: string
value:
description: Required. The taint value corresponding to the taint key.
description: The taint value corresponding to the taint key.
type: string
required:
- effect
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1117,7 +1117,7 @@ spec:
format: date-time
type: string
value:
description: Required. The taint value corresponding to the taint key.
description: The taint value corresponding to the taint key.
type: string
required:
- effect
Expand Down Expand Up @@ -1226,7 +1226,7 @@ spec:
format: date-time
type: string
value:
description: Required. The taint value corresponding to the taint key.
description: The taint value corresponding to the taint key.
type: string
required:
- effect
Expand Down
2 changes: 1 addition & 1 deletion bootstrap/kubeadm/config/crd/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
commonLabels:
cluster.x-k8s.io/v1alpha2: v1alpha2
cluster.x-k8s.io/v1alpha3: v1alpha3
cluster.x-k8s.io/v1alpha4: v1alpha4

# This kustomization.yaml is not intended to be run by itself,
# since it depends on service name and namespace that are out of this kustomize package.
Expand Down
6 changes: 3 additions & 3 deletions bootstrap/kubeadm/controllers/kubeadmconfig_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,14 @@ import (
"k8s.io/apimachinery/pkg/types"
kerrors "k8s.io/apimachinery/pkg/util/errors"
"k8s.io/utils/pointer"
clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3"
bootstrapv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha3"
clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4"
bootstrapv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha4"
"sigs.k8s.io/cluster-api/bootstrap/kubeadm/internal/cloudinit"
"sigs.k8s.io/cluster-api/bootstrap/kubeadm/internal/locking"
kubeadmv1beta1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/types/v1beta1"
bsutil "sigs.k8s.io/cluster-api/bootstrap/util"
"sigs.k8s.io/cluster-api/controllers/remote"
expv1 "sigs.k8s.io/cluster-api/exp/api/v1alpha3"
expv1 "sigs.k8s.io/cluster-api/exp/api/v1alpha4"
"sigs.k8s.io/cluster-api/feature"
"sigs.k8s.io/cluster-api/util"
"sigs.k8s.io/cluster-api/util/annotations"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/client"

bootstrapv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha3"
bootstrapv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha4"
)

var _ = Describe("KubeadmConfigReconciler", func() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ import (
"k8s.io/apimachinery/pkg/types"
bootstrapapi "k8s.io/cluster-bootstrap/token/api"
"k8s.io/utils/pointer"
clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3"
bootstrapv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha3"
clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4"
bootstrapv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha4"
kubeadmv1beta1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/types/v1beta1"
fakeremote "sigs.k8s.io/cluster-api/controllers/remote/fake"
expv1 "sigs.k8s.io/cluster-api/exp/api/v1alpha3"
expv1 "sigs.k8s.io/cluster-api/exp/api/v1alpha4"
"sigs.k8s.io/cluster-api/feature"
"sigs.k8s.io/cluster-api/test/helpers"
"sigs.k8s.io/cluster-api/util"
Expand Down
2 changes: 1 addition & 1 deletion bootstrap/kubeadm/internal/cloudinit/cloudinit.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
"text/template"

"github.com/pkg/errors"
bootstrapv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha3"
bootstrapv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha4"
)

const (
Expand Down
4 changes: 2 additions & 2 deletions bootstrap/kubeadm/internal/cloudinit/cloudinit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import (
. "github.com/onsi/gomega"

"k8s.io/utils/pointer"
bootstrapv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha3"
infrav1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha3"
bootstrapv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha4"
infrav1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha4"
"sigs.k8s.io/cluster-api/util/certs"
"sigs.k8s.io/cluster-api/util/secret"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (
apicorev1 "k8s.io/api/core/v1"
apierrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3"
clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4"
"sigs.k8s.io/controller-runtime/pkg/client"
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import (
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/types"
clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3"
clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/client/fake"
Expand Down
14 changes: 10 additions & 4 deletions bootstrap/kubeadm/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,13 @@ import (
"k8s.io/klog"
"k8s.io/klog/klogr"
clusterv1alpha3 "sigs.k8s.io/cluster-api/api/v1alpha3"
clusterv1alpha4 "sigs.k8s.io/cluster-api/api/v1alpha4"
kubeadmbootstrapv1alpha3 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha3"
kubeadmbootstrapv1alpha4 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha4"
kubeadmbootstrapcontrollers "sigs.k8s.io/cluster-api/bootstrap/kubeadm/controllers"
"sigs.k8s.io/cluster-api/cmd/version"
expv1alpha3 "sigs.k8s.io/cluster-api/exp/api/v1alpha3"
expv1alpha4 "sigs.k8s.io/cluster-api/exp/api/v1alpha4"
"sigs.k8s.io/cluster-api/feature"
"sigs.k8s.io/cluster-api/util"
ctrl "sigs.k8s.io/controller-runtime"
Expand All @@ -52,8 +55,11 @@ func init() {

_ = clientgoscheme.AddToScheme(scheme)
_ = clusterv1alpha3.AddToScheme(scheme)
_ = clusterv1alpha4.AddToScheme(scheme)
_ = expv1alpha3.AddToScheme(scheme)
_ = expv1alpha4.AddToScheme(scheme)
_ = kubeadmbootstrapv1alpha3.AddToScheme(scheme)
_ = kubeadmbootstrapv1alpha4.AddToScheme(scheme)
// +kubebuilder:scaffold:scheme
}

Expand Down Expand Up @@ -173,19 +179,19 @@ func setupWebhooks(mgr ctrl.Manager) {
return
}

if err := (&kubeadmbootstrapv1alpha3.KubeadmConfig{}).SetupWebhookWithManager(mgr); err != nil {
if err := (&kubeadmbootstrapv1alpha4.KubeadmConfig{}).SetupWebhookWithManager(mgr); err != nil {
setupLog.Error(err, "unable to create webhook", "webhook", "KubeadmConfig")
os.Exit(1)
}
if err := (&kubeadmbootstrapv1alpha3.KubeadmConfigList{}).SetupWebhookWithManager(mgr); err != nil {
if err := (&kubeadmbootstrapv1alpha4.KubeadmConfigList{}).SetupWebhookWithManager(mgr); err != nil {
setupLog.Error(err, "unable to create webhook", "webhook", "KubeadmConfigList")
os.Exit(1)
}
if err := (&kubeadmbootstrapv1alpha3.KubeadmConfigTemplate{}).SetupWebhookWithManager(mgr); err != nil {
if err := (&kubeadmbootstrapv1alpha4.KubeadmConfigTemplate{}).SetupWebhookWithManager(mgr); err != nil {
setupLog.Error(err, "unable to create webhook", "webhook", "KubeadmConfigTemplate")
os.Exit(1)
}
if err := (&kubeadmbootstrapv1alpha3.KubeadmConfigTemplateList{}).SetupWebhookWithManager(mgr); err != nil {
if err := (&kubeadmbootstrapv1alpha4.KubeadmConfigTemplateList{}).SetupWebhookWithManager(mgr); err != nil {
setupLog.Error(err, "unable to create webhook", "webhook", "KubeadmConfigTemplateList")
os.Exit(1)
}
Expand Down
4 changes: 2 additions & 2 deletions bootstrap/util/configowner.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/runtime/schema"
clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3"
clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4"
"sigs.k8s.io/cluster-api/controllers/external"
expv1 "sigs.k8s.io/cluster-api/exp/api/v1alpha3"
expv1 "sigs.k8s.io/cluster-api/exp/api/v1alpha4"
"sigs.k8s.io/cluster-api/feature"
"sigs.k8s.io/controller-runtime/pkg/client"
)
Expand Down
6 changes: 3 additions & 3 deletions bootstrap/util/configowner_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/utils/pointer"
clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3"
bootstrapv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha3"
expv1 "sigs.k8s.io/cluster-api/exp/api/v1alpha3"
clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4"
bootstrapv1 "sigs.k8s.io/cluster-api/bootstrap/kubeadm/api/v1alpha4"
expv1 "sigs.k8s.io/cluster-api/exp/api/v1alpha4"
"sigs.k8s.io/cluster-api/feature"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/client/fake"
Expand Down
2 changes: 1 addition & 1 deletion cmd/example-provider/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (

"k8s.io/client-go/kubernetes/scheme"
"k8s.io/klog"
clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3"
clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4"
"sigs.k8s.io/cluster-api/controllers"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/controller"
Expand Down
2 changes: 1 addition & 1 deletion config/crd/bases/exp.cluster.x-k8s.io_machinepools.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,7 @@ spec:
nodeRefs:
description: NodeRefs will point to the corresponding Nodes if it they exist.
items:
description: ObjectReference contains enough information to let you inspect or modify the referred object.
description: 'ObjectReference contains enough information to let you inspect or modify the referred object. --- New uses of this type are discouraged because of difficulty describing its usage when embedded in APIs. 1. Ignored fields. It includes many fields which are not generally honored. For instance, ResourceVersion and FieldPath are both very rarely valid in actual usage. 2. Invalid usage help. It is impossible to add specific help for individual usage. In most embedded usages, there are particular restrictions like, "must refer only to types A and B" or "UID not honored" or "name must be restricted". Those cannot be well described when embedded. 3. Inconsistent validation. Because the usages are different, the validation rules are different by usage, which makes it hard for users to predict what will happen. 4. The fields are both imprecise and overly precise. Kind is not a precise mapping to a URL. This can produce ambiguity during interpretation and require a REST mapping. In most cases, the dependency is on the group,resource tuple and the version of the actual struct is irrelevant. 5. We cannot easily change it. Because this type is embedded in many locations, updates to this type will affect numerous schemas. Don''t make new APIs embed an underspecified API type they do not control. Instead of using this type, create a locally provided and used type that is well-focused on your reference. For example, ServiceReferences for admission registration: https://github.com/kubernetes/api/blob/release-1.17/admissionregistration/v1/types.go#L533 .'
properties:
apiVersion:
description: API version of the referent.
Expand Down
2 changes: 1 addition & 1 deletion controllers/cluster_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import (
kerrors "k8s.io/apimachinery/pkg/util/errors"
"k8s.io/client-go/rest"
"k8s.io/client-go/tools/record"
clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3"
clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4"
"sigs.k8s.io/cluster-api/controllers/external"
expv1alpha3 "sigs.k8s.io/cluster-api/exp/api/v1alpha3"
"sigs.k8s.io/cluster-api/feature"
Expand Down
2 changes: 1 addition & 1 deletion controllers/cluster_controller_phases.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import (
corev1 "k8s.io/api/core/v1"
apierrors "k8s.io/apimachinery/pkg/api/errors"
"k8s.io/utils/pointer"
clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha3"
clusterv1 "sigs.k8s.io/cluster-api/api/v1alpha4"
"sigs.k8s.io/cluster-api/controllers/external"
capierrors "sigs.k8s.io/cluster-api/errors"
"sigs.k8s.io/cluster-api/util"
Expand Down
Loading

0 comments on commit 63e40e9

Please sign in to comment.