Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ linters:
- pkg: sigs.k8s.io/controller-runtime
alias: ctrl
# CAPI
- pkg: sigs.k8s.io/cluster-api/api/v1beta1
- pkg: sigs.k8s.io/cluster-api/api/core/v1beta2
alias: clusterv1
- pkg: sigs.k8s.io/cluster-api/cmd/clusterctl/api/v1alpha3
alias: clusterctlv1
Expand Down
6 changes: 3 additions & 3 deletions api/v1alpha2/addonprovider_wrapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@ limitations under the License.
package v1alpha2

import (
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

var _ GenericProvider = &AddonProvider{}

func (b *AddonProvider) GetConditions() clusterv1.Conditions {
func (b *AddonProvider) GetConditions() []metav1.Condition {
return b.Status.Conditions
}

func (b *AddonProvider) SetConditions(conditions clusterv1.Conditions) {
func (b *AddonProvider) SetConditions(conditions []metav1.Condition) {
b.Status.Conditions = conditions
}

Expand Down
6 changes: 3 additions & 3 deletions api/v1alpha2/bootstrapprovider_wrapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@ limitations under the License.
package v1alpha2

import (
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

var _ GenericProvider = &BootstrapProvider{}

func (b *BootstrapProvider) GetConditions() clusterv1.Conditions {
func (b *BootstrapProvider) GetConditions() []metav1.Condition {
return b.Status.Conditions
}

func (b *BootstrapProvider) SetConditions(conditions clusterv1.Conditions) {
func (b *BootstrapProvider) SetConditions(conditions []metav1.Condition) {
b.Status.Conditions = conditions
}

Expand Down
11 changes: 6 additions & 5 deletions api/v1alpha2/conditions_consts.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,9 @@ limitations under the License.

package v1alpha2

import clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"

const (
// PreflightCheckCondition documents a Provider that has not passed preflight checks.
PreflightCheckCondition clusterv1.ConditionType = "PreflightCheckPassed"
PreflightCheckCondition string = "PreflightCheckPassed"

// MoreThanOneProviderInstanceExistsReason (Severity=Info) documents that more than one instance of provider
// exists in the cluster.
Expand Down Expand Up @@ -71,14 +69,17 @@ const (
// NoDeploymentAvailableConditionReason documents that there is no Available condition for provider deployment yet.
NoDeploymentAvailableConditionReason = "NoDeploymentAvailableConditionReason"

// DeploymentAvailableReason documents that the provider deployment is available.
DeploymentAvailableReason = "DeploymentAvailable"

// UnsupportedProviderDowngradeReason documents that the provider downgrade is not supported.
UnsupportedProviderDowngradeReason = "UnsupportedProviderDowngradeReason"
)

const (
// ProviderInstalledCondition documents a Provider that has been installed.
ProviderInstalledCondition clusterv1.ConditionType = "ProviderInstalled"
ProviderInstalledCondition string = "ProviderInstalled"

// ProviderUpgradedCondition documents a Provider that has been recently upgraded.
ProviderUpgradedCondition clusterv1.ConditionType = "ProviderUpgraded"
ProviderUpgradedCondition string = "ProviderUpgraded"
)
6 changes: 3 additions & 3 deletions api/v1alpha2/controlplaneprovider_wrapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@ limitations under the License.
package v1alpha2

import (
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

var _ GenericProvider = &ControlPlaneProvider{}

func (c *ControlPlaneProvider) GetConditions() clusterv1.Conditions {
func (c *ControlPlaneProvider) GetConditions() []metav1.Condition {
return c.Status.Conditions
}

func (c *ControlPlaneProvider) SetConditions(conditions clusterv1.Conditions) {
func (c *ControlPlaneProvider) SetConditions(conditions []metav1.Condition) {
c.Status.Conditions = conditions
}

Expand Down
6 changes: 3 additions & 3 deletions api/v1alpha2/coreprovider_wrapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@ limitations under the License.
package v1alpha2

import (
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

var _ GenericProvider = &CoreProvider{}

func (c *CoreProvider) GetConditions() clusterv1.Conditions {
func (c *CoreProvider) GetConditions() []metav1.Condition {
return c.Status.Conditions
}

func (c *CoreProvider) SetConditions(conditions clusterv1.Conditions) {
func (c *CoreProvider) SetConditions(conditions []metav1.Condition) {
c.Status.Conditions = conditions
}

Expand Down
2 changes: 2 additions & 0 deletions api/v1alpha2/genericprovider_interfaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,14 @@ package v1alpha2

import (
"sigs.k8s.io/cluster-api/util/conditions"
"sigs.k8s.io/controller-runtime/pkg/client"
)

// GenericProvider interface describes operations applicable to the provider type.
//
// +kubebuilder:object:generate=false
type GenericProvider interface {
client.Object
conditions.Setter
GetSpec() ProviderSpec
SetSpec(in ProviderSpec)
Expand Down
6 changes: 3 additions & 3 deletions api/v1alpha2/infrastructureprovider_wrapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@ limitations under the License.
package v1alpha2

import (
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

var _ GenericProvider = &InfrastructureProvider{}

func (c *InfrastructureProvider) GetConditions() clusterv1.Conditions {
func (c *InfrastructureProvider) GetConditions() []metav1.Condition {
return c.Status.Conditions
}

func (c *InfrastructureProvider) SetConditions(conditions clusterv1.Conditions) {
func (c *InfrastructureProvider) SetConditions(conditions []metav1.Condition) {
c.Status.Conditions = conditions
}

Expand Down
6 changes: 3 additions & 3 deletions api/v1alpha2/ipamprovider_wrapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@ limitations under the License.
package v1alpha2

import (
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

var _ GenericProvider = &IPAMProvider{}

func (p *IPAMProvider) GetConditions() clusterv1.Conditions {
func (p *IPAMProvider) GetConditions() []metav1.Condition {
return p.Status.Conditions
}

func (p *IPAMProvider) SetConditions(conditions clusterv1.Conditions) {
func (p *IPAMProvider) SetConditions(conditions []metav1.Condition) {
p.Status.Conditions = conditions
}

Expand Down
3 changes: 1 addition & 2 deletions api/v1alpha2/provider_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ package v1alpha2
import (
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
)

const (
Expand Down Expand Up @@ -263,7 +262,7 @@ type ProviderStatus struct {

// Conditions define the current service state of the provider.
// +optional
Conditions clusterv1.Conditions `json:"conditions,omitempty"`
Conditions []metav1.Condition `json:"conditions,omitempty"`

// ObservedGeneration is the latest generation observed by the controller.
// +optional
Expand Down
6 changes: 3 additions & 3 deletions api/v1alpha2/runtimeextensionprovider_wrapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@ limitations under the License.
package v1alpha2

import (
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

var _ GenericProvider = &RuntimeExtensionProvider{}

func (p *RuntimeExtensionProvider) GetConditions() clusterv1.Conditions {
func (p *RuntimeExtensionProvider) GetConditions() []metav1.Condition {
return p.Status.Conditions
}

func (p *RuntimeExtensionProvider) SetConditions(conditions clusterv1.Conditions) {
func (p *RuntimeExtensionProvider) SetConditions(conditions []metav1.Condition) {
p.Status.Conditions = conditions
}

Expand Down
3 changes: 1 addition & 2 deletions api/v1alpha2/zz_generated.deepcopy.go

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

2 changes: 1 addition & 1 deletion cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import (
"k8s.io/klog/v2"
"k8s.io/klog/v2/textlogger"
"sigs.k8s.io/cluster-api-operator/internal/webhook"
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
clusterv1 "sigs.k8s.io/cluster-api/api/core/v1beta2"
clusterctlv1 "sigs.k8s.io/cluster-api/cmd/clusterctl/api/v1alpha3"
"sigs.k8s.io/cluster-api/util/flags"
"sigs.k8s.io/cluster-api/version"
Expand Down
6 changes: 3 additions & 3 deletions cmd/plugin/cmd/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ import (

"github.com/spf13/cobra"

corev1 "k8s.io/api/core/v1"
apierrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/wait"
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
clusterv1 "sigs.k8s.io/cluster-api/api/core/v1beta2"
clusterctlv1 "sigs.k8s.io/cluster-api/cmd/clusterctl/api/v1alpha3"
"sigs.k8s.io/cluster-api/cmd/clusterctl/client/cluster"
configclient "sigs.k8s.io/cluster-api/cmd/clusterctl/client/config"
Expand Down Expand Up @@ -354,7 +354,7 @@ func checkProviderReadiness(ctx context.Context, client ctrlclient.Client, gener

// Checking Ready condition for the provider.
for _, cond := range genericProvider.GetConditions() {
if cond.Type == clusterv1.ReadyCondition && cond.Status == corev1.ConditionTrue {
if cond.Type == clusterv1.ReadyCondition && cond.Status == metav1.ConditionTrue {
log.Info("Provider is ready", "Type", genericProvider.GetType(), "Name", genericProvider.GetName(), "Namespace", genericProvider.GetNamespace())

return true, nil
Expand Down
4 changes: 2 additions & 2 deletions cmd/plugin/cmd/upgrade_plan.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (
"github.com/spf13/cobra"
appsv1 "k8s.io/api/apps/v1"

clusterv1 "sigs.k8s.io/cluster-api/api/v1beta1"
clusterv1 "sigs.k8s.io/cluster-api/api/core/v1beta2"
clusterctlv1 "sigs.k8s.io/cluster-api/cmd/clusterctl/api/v1alpha3"
"sigs.k8s.io/cluster-api/cmd/clusterctl/client/cluster"
configclient "sigs.k8s.io/cluster-api/cmd/clusterctl/client/config"
Expand Down Expand Up @@ -348,7 +348,7 @@ func getInstalledProviders(ctx context.Context, client ctrlclient.Client) ([]ope
// Iterate through installed providers and create a list of upgrade plans.
genericProviders := []operatorv1.GenericProvider{}

contract := "v1beta1"
contract := "v1beta2"

// Get Core Providers.
var coreProviderList operatorv1.CoreProviderList
Expand Down
6 changes: 3 additions & 3 deletions cmd/plugin/cmd/upgrade_plan_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func TestUpgradePlan(t *testing.T) {
{
name: "no providers",
wantedUpgradePlan: upgradePlan{
Contract: "v1beta1",
Contract: "v1beta2",
Providers: []upgradeItem{},
},
wantErr: false,
Expand All @@ -49,7 +49,7 @@ func TestUpgradePlan(t *testing.T) {
{
name: "builtin core provider",
wantedUpgradePlan: upgradePlan{
Contract: "v1beta1",
Contract: "v1beta2",
Providers: []upgradeItem{
{
Name: "cluster-api",
Expand All @@ -74,7 +74,7 @@ func TestUpgradePlan(t *testing.T) {
name: "custom infra provider",
customURL: "https://github.com/kubernetes-sigs/cluster-api/releases/latest/core-components.yaml",
wantedUpgradePlan: upgradePlan{
Contract: "v1beta1",
Contract: "v1beta2",
Providers: []upgradeItem{
{
Name: "docker",
Expand Down
Loading