Skip to content

Commit

Permalink
Merge branch 'main' into peering/azure/improve-log-messages
Browse files Browse the repository at this point in the history
  • Loading branch information
vandjelk authored Dec 16, 2024
2 parents 71b9bf9 + 4152b37 commit 5c467c5
Show file tree
Hide file tree
Showing 107 changed files with 300 additions and 215 deletions.
1 change: 1 addition & 0 deletions .github/workflows/merge-gate.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: Merge Gate
on:
pull_request:
types: [opened, edited, synchronize, reopened, ready_for_review, converted_to_draft, ready_for_review, labeled, unlabeled]

permissions:
checks: read
Expand Down
4 changes: 2 additions & 2 deletions api/cloud-control/v1beta1/redisinstance_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -320,11 +320,11 @@ func (in *RedisInstance) CloneForPatchStatus() client.Object {
}

func (in *RedisInstance) SetStatusStateToReady() {
in.Status.State = ReadyState
in.Status.State = StateReady
}

func (in *RedisInstance) SetStatusStateToError() {
in.Status.State = ErrorState
in.Status.State = StateError
}

//+kubebuilder:object:root=true
Expand Down
10 changes: 5 additions & 5 deletions api/cloud-control/v1beta1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ package v1beta1
type StatusState string

const (
ReadyState StatusState = "Ready"
ErrorState StatusState = "Error"
ProcessingState StatusState = "Processing"
WarningState StatusState = "Warning"
DeletingState StatusState = "Deleting"
StateReady StatusState = "Ready"
StateError StatusState = "Error"
StateProcessing StatusState = "Processing"
StateWarning StatusState = "Warning"
StateDeleting StatusState = "Deleting"
)

const (
Expand Down
6 changes: 0 additions & 6 deletions api/cloud-resources/v1beta1/gcpredisinstance_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,6 @@ const (
GcpRedisTierP6 GcpRedisTier = "P6"
)

type AuthSecretSpec struct {
Name string `json:"name,omitempty"`
Labels map[string]string `json:"labels,omitempty"`
Annotations map[string]string `json:"annotations,omitempty"`
}

type TimeOfDay struct {
// Hours of day in 24 hour format. Should be from 0 to 23.
// +kubebuilder:validation:Required
Expand Down
7 changes: 7 additions & 0 deletions api/cloud-resources/v1beta1/redisinstance_authsecret.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package v1beta1

type AuthSecretSpec struct {
Name string `json:"name,omitempty"`
Labels map[string]string `json:"labels,omitempty"`
Annotations map[string]string `json:"annotations,omitempty"`
}
4 changes: 2 additions & 2 deletions docs/user/resources/04-30-30-azure-vpc-peering.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# AzureVpcPeering Custom Resource

The `azurevpcpeering.cloud-resources.kyma-project.io` custom resource (CR) specifies the virtual network peering between
Kyma and the remote Azure Virtual Private Cloud (VPC) network. Virtual network peering is only possible within the networks
of the same cloud provider.
Kyma and the remote Azure Virtual Private Cloud (VPC) network. Virtual network peering is only possible within Azure
networks whose subscriptions are sharing the same tenant determined by the Kyma underlying cloud provider subscription.

Once an `AzureVpcPeering` CR is created and reconciled, the Cloud Manager controller creates a VPC peering connection in
the VPC network of the Kyma cluster in the underlying cloud provider subscription, and accepts a VPC peering connection in
Expand Down
2 changes: 1 addition & 1 deletion docs/user/tutorials/01-30-30-azure-vpc-peering.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ This tutorial explains how to create a Virtual Private Cloud (VPC) peering conne

```shell
export SUBSCRIPTION_ID=$(az account show --query id -o tsv)
export PRINCIPAL_NAME=kyma-cloud-manager-peering-dev
export PRINCIPAL_NAME=kyma-cloud-manager-peering-stage
export OBJECT_ID=$(az ad sp list --display-name $PRINCIPAL_NAME --query "[].id" -o tsv)
az role assignment create --assignee $OBJECT_ID \
Expand Down
5 changes: 3 additions & 2 deletions internal/controller/cloud-control/iprange_azure_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package cloudcontrol

import (
"fmt"

"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v5"
"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/privatedns/armprivatedns"
cloudcontrolv1beta1 "github.com/kyma-project/cloud-manager/api/cloud-control/v1beta1"
Expand Down Expand Up @@ -140,7 +141,7 @@ var _ = Describe("Feature: KCP IpRange for Azure", func() {
})

By("When KCP CM Network has Ready condition", func() {
kcpNetworkCm.Status.State = string(cloudcontrolv1beta1.ReadyState)
kcpNetworkCm.Status.State = string(cloudcontrolv1beta1.StateReady)
meta.SetStatusCondition(&kcpNetworkCm.Status.Conditions, metav1.Condition{
Type: cloudcontrolv1beta1.ConditionTypeReady,
Status: metav1.ConditionTrue,
Expand Down Expand Up @@ -181,7 +182,7 @@ var _ = Describe("Feature: KCP IpRange for Azure", func() {
})

By("When KCP VpcPeering has Ready condition", func() {
kcpVpcPeering.Status.State = string(cloudcontrolv1beta1.ReadyState)
kcpVpcPeering.Status.State = string(cloudcontrolv1beta1.StateReady)
meta.SetStatusCondition(&kcpVpcPeering.Status.Conditions, metav1.Condition{
Type: cloudcontrolv1beta1.ConditionTypeReady,
Status: metav1.ConditionTrue,
Expand Down
5 changes: 3 additions & 2 deletions internal/controller/cloud-control/iprange_delete_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package cloudcontrol

import (
"fmt"

ec2Types "github.com/aws/aws-sdk-go-v2/service/ec2/types"
"github.com/elliotchance/pie/v2"
cloudcontrolv1beta1 "github.com/kyma-project/cloud-manager/api/cloud-control/v1beta1"
Expand Down Expand Up @@ -118,7 +119,7 @@ var _ = Describe("Feature: KCP IpRange deletion with dependant objects", func()
Eventually(LoadAndCheck).
WithArguments(infra.Ctx(), infra.KCP().Client(), iprange,
NewObjActions(),
HavingState(string(cloudcontrolv1beta1.WarningState)),
HavingState(string(cloudcontrolv1beta1.StateWarning)),
).
Should(Succeed())
})
Expand Down Expand Up @@ -263,7 +264,7 @@ var _ = Describe("Feature: KCP IpRange deletion with dependant objects", func()
Eventually(LoadAndCheck).
WithArguments(infra.Ctx(), infra.KCP().Client(), iprange,
NewObjActions(),
HavingState(string(cloudcontrolv1beta1.WarningState)),
HavingState(string(cloudcontrolv1beta1.StateWarning)),
).
Should(Succeed())
})
Expand Down
2 changes: 1 addition & 1 deletion internal/controller/cloud-control/network_azure_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ var _ = Describe("Feature: KCP Azure managed Network", func() {

By("Then KCP Network state is Ready", func() {
Eventually(LoadAndCheck).
WithArguments(infra.Ctx(), infra.KCP().Client(), net, NewObjActions(), HavingState(string(cloudcontrolv1beta1.ReadyState))).
WithArguments(infra.Ctx(), infra.KCP().Client(), net, NewObjActions(), HavingState(string(cloudcontrolv1beta1.StateReady))).
Should(Succeed())
})

Expand Down
21 changes: 11 additions & 10 deletions internal/controller/cloud-control/network_reference_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package cloudcontrol

import (
"time"

cloudcontrolv1beta1 "github.com/kyma-project/cloud-manager/api/cloud-control/v1beta1"
"github.com/kyma-project/cloud-manager/pkg/common"
kcpiprange "github.com/kyma-project/cloud-manager/pkg/kcp/iprange"
Expand All @@ -12,7 +14,6 @@ import (
"k8s.io/apimachinery/pkg/api/meta"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"sigs.k8s.io/controller-runtime/pkg/controller/controllerutil"
"time"
)

var _ = Describe("Feature: KCP Network reference", func() {
Expand Down Expand Up @@ -43,7 +44,7 @@ var _ = Describe("Feature: KCP Network reference", func() {

By("Then Network state is Ready", func() {
Eventually(LoadAndCheck).
WithArguments(infra.Ctx(), infra.KCP().Client(), net, NewObjActions(), HavingState(string(cloudcontrolv1beta1.ReadyState))).
WithArguments(infra.Ctx(), infra.KCP().Client(), net, NewObjActions(), HavingState(string(cloudcontrolv1beta1.StateReady))).
Should(Succeed())
})

Expand Down Expand Up @@ -103,7 +104,7 @@ var _ = Describe("Feature: KCP Network reference", func() {

By("And Given Network state is Ready", func() {
Eventually(LoadAndCheck).
WithArguments(infra.Ctx(), infra.KCP().Client(), net, NewObjActions(), HavingState(string(cloudcontrolv1beta1.ReadyState))).
WithArguments(infra.Ctx(), infra.KCP().Client(), net, NewObjActions(), HavingState(string(cloudcontrolv1beta1.StateReady))).
Should(Succeed())
})

Expand Down Expand Up @@ -131,7 +132,7 @@ var _ = Describe("Feature: KCP Network reference", func() {
Eventually(LoadAndCheck).
WithArguments(infra.Ctx(), infra.KCP().Client(), net,
NewObjActions(),
HavingState(string(cloudcontrolv1beta1.WarningState)),
HavingState(string(cloudcontrolv1beta1.StateWarning)),
).
Should(Succeed())
})
Expand Down Expand Up @@ -189,7 +190,7 @@ var _ = Describe("Feature: KCP Network reference", func() {

By("And Given local Network state is Ready", func() {
Eventually(LoadAndCheck).
WithArguments(infra.Ctx(), infra.KCP().Client(), localNet, NewObjActions(), HavingState(string(cloudcontrolv1beta1.ReadyState))).
WithArguments(infra.Ctx(), infra.KCP().Client(), localNet, NewObjActions(), HavingState(string(cloudcontrolv1beta1.StateReady))).
Should(Succeed())
})

Expand All @@ -201,7 +202,7 @@ var _ = Describe("Feature: KCP Network reference", func() {

By("And Given remote Network state is Ready", func() {
Eventually(LoadAndCheck).
WithArguments(infra.Ctx(), infra.KCP().Client(), remoteNet, NewObjActions(), HavingState(string(cloudcontrolv1beta1.ReadyState))).
WithArguments(infra.Ctx(), infra.KCP().Client(), remoteNet, NewObjActions(), HavingState(string(cloudcontrolv1beta1.StateReady))).
Should(Succeed())
})

Expand Down Expand Up @@ -230,7 +231,7 @@ var _ = Describe("Feature: KCP Network reference", func() {
Eventually(LoadAndCheck).
WithArguments(infra.Ctx(), infra.KCP().Client(), localNet,
NewObjActions(),
HavingState(string(cloudcontrolv1beta1.WarningState)),
HavingState(string(cloudcontrolv1beta1.StateWarning)),
).
Should(Succeed())
})
Expand Down Expand Up @@ -296,7 +297,7 @@ var _ = Describe("Feature: KCP Network reference", func() {

By("And Given local Network state is Ready", func() {
Eventually(LoadAndCheck).
WithArguments(infra.Ctx(), infra.KCP().Client(), localNet, NewObjActions(), HavingState(string(cloudcontrolv1beta1.ReadyState))).
WithArguments(infra.Ctx(), infra.KCP().Client(), localNet, NewObjActions(), HavingState(string(cloudcontrolv1beta1.StateReady))).
Should(Succeed())
})

Expand All @@ -308,7 +309,7 @@ var _ = Describe("Feature: KCP Network reference", func() {

By("And Given remote Network state is Ready", func() {
Eventually(LoadAndCheck).
WithArguments(infra.Ctx(), infra.KCP().Client(), remoteNet, NewObjActions(), HavingState(string(cloudcontrolv1beta1.ReadyState))).
WithArguments(infra.Ctx(), infra.KCP().Client(), remoteNet, NewObjActions(), HavingState(string(cloudcontrolv1beta1.StateReady))).
Should(Succeed())
})

Expand Down Expand Up @@ -337,7 +338,7 @@ var _ = Describe("Feature: KCP Network reference", func() {
Eventually(LoadAndCheck).
WithArguments(infra.Ctx(), infra.KCP().Client(), remoteNet,
NewObjActions(),
HavingState(string(cloudcontrolv1beta1.WarningState)),
HavingState(string(cloudcontrolv1beta1.StateWarning)),
).
Should(Succeed())
})
Expand Down
11 changes: 6 additions & 5 deletions internal/controller/cloud-control/nfsinstance_gcp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ package cloudcontrol

import (
"context"
"github.com/kyma-project/cloud-manager/pkg/composed"
"time"

"github.com/kyma-project/cloud-manager/pkg/composed"

cloudcontrolv1beta1 "github.com/kyma-project/cloud-manager/api/cloud-control/v1beta1"
iprangePkg "github.com/kyma-project/cloud-manager/pkg/kcp/iprange"
client2 "github.com/kyma-project/cloud-manager/pkg/kcp/provider/gcp/client"
Expand Down Expand Up @@ -105,7 +106,7 @@ var _ = Describe("Feature: KCP NFSVolume for GCP", func() {
Should(BeTrue(), "expected NfsInstance for GCP with Ready condition")
})
By("And KCP NfsVolume has Ready state", func() {
Expect(gcpNfsInstance.Status.State).To(Equal(cloudcontrolv1beta1.ReadyState))
Expect(gcpNfsInstance.Status.State).To(Equal(cloudcontrolv1beta1.StateReady))
})
})

Expand Down Expand Up @@ -139,7 +140,7 @@ var _ = Describe("Feature: KCP NFSVolume for GCP", func() {
if err != nil {
return false, err
}
exists = gcpNfsInstance.Status.State == cloudcontrolv1beta1.ReadyState
exists = gcpNfsInstance.Status.State == cloudcontrolv1beta1.StateReady
return exists, nil
}, timeout, interval)
})
Expand Down Expand Up @@ -533,7 +534,7 @@ var _ = Describe("Feature: KCP NFSVolume for GCP", func() {
Should(BeTrue(), "expected NfsInstance for GCP with Ready condition")
})
By("And KCP NfsVolume has Ready state", func() {
Expect(gcpNfsInstance.Status.State).To(Equal(cloudcontrolv1beta1.ReadyState))
Expect(gcpNfsInstance.Status.State).To(Equal(cloudcontrolv1beta1.StateReady))
})
})

Expand Down Expand Up @@ -567,7 +568,7 @@ var _ = Describe("Feature: KCP NFSVolume for GCP", func() {
if err != nil {
return false, err
}
exists = gcpNfsInstance.Status.State == cloudcontrolv1beta1.ReadyState
exists = gcpNfsInstance.Status.State == cloudcontrolv1beta1.StateReady
return exists, nil
}, timeout, interval)
})
Expand Down
5 changes: 3 additions & 2 deletions internal/controller/cloud-control/redisinstance_azure_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@ package cloudcontrol

import (
"fmt"
"time"

"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/redis/armredis"
azurecommon "github.com/kyma-project/cloud-manager/pkg/kcp/provider/azure/common"
azuremeta "github.com/kyma-project/cloud-manager/pkg/kcp/provider/azure/meta"
"k8s.io/utils/ptr"
"time"

cloudcontrolv1beta1 "github.com/kyma-project/cloud-manager/api/cloud-control/v1beta1"
iprangePkg "github.com/kyma-project/cloud-manager/pkg/kcp/iprange"
Expand Down Expand Up @@ -124,7 +125,7 @@ var _ = Describe("Feature: KCP RedisInstance", func() {
})

By("And Then KCP RedisInstance has status state Ready", func() {
Expect(redisInstance.Status.State).To(Equal(cloudcontrolv1beta1.ReadyState))
Expect(redisInstance.Status.State).To(Equal(cloudcontrolv1beta1.StateReady))
})

By("And Then KCP RedisInstance has .status.primaryEndpoint set", func() {
Expand Down
5 changes: 3 additions & 2 deletions internal/controller/cloud-control/vpcpeering_aws_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package cloudcontrol
import (
"errors"
"fmt"

ec2Types "github.com/aws/aws-sdk-go-v2/service/ec2/types"
cloudcontrolv1beta1 "github.com/kyma-project/cloud-manager/api/cloud-control/v1beta1"
"github.com/kyma-project/cloud-manager/pkg/common"
Expand Down Expand Up @@ -463,7 +464,7 @@ var _ = Describe("Feature: KCP VpcPeering", func() {
To(Succeed())

localKcpNet.Status.Network = localKcpNet.Spec.Network.Reference.DeepCopy()
localKcpNet.Status.State = string(cloudcontrolv1beta1.ReadyState)
localKcpNet.Status.State = string(cloudcontrolv1beta1.StateReady)
meta.SetStatusCondition(&localKcpNet.Status.Conditions, metav1.Condition{
Type: cloudcontrolv1beta1.ConditionTypeReady,
Status: metav1.ConditionTrue,
Expand All @@ -487,7 +488,7 @@ var _ = Describe("Feature: KCP VpcPeering", func() {
Should(Succeed())

remoteKcpNet.Status.Network = remoteKcpNet.Spec.Network.Reference.DeepCopy()
remoteKcpNet.Status.State = string(cloudcontrolv1beta1.ReadyState)
remoteKcpNet.Status.State = string(cloudcontrolv1beta1.StateReady)
meta.SetStatusCondition(&remoteKcpNet.Status.Conditions, metav1.Condition{
Type: cloudcontrolv1beta1.ConditionTypeReady,
Status: metav1.ConditionTrue,
Expand Down
5 changes: 3 additions & 2 deletions internal/controller/cloud-control/vpcpeering_azure_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package cloudcontrol

import (
"errors"

"github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork/v5"
cloudcontrolv1beta1 "github.com/kyma-project/cloud-manager/api/cloud-control/v1beta1"
"github.com/kyma-project/cloud-manager/pkg/common"
Expand Down Expand Up @@ -356,7 +357,7 @@ var _ = Describe("Feature: KCP VpcPeering", func() {
Should(Succeed())

localKcpNet.Status.Network = localKcpNet.Spec.Network.Reference.DeepCopy()
localKcpNet.Status.State = string(cloudcontrolv1beta1.ReadyState)
localKcpNet.Status.State = string(cloudcontrolv1beta1.StateReady)
meta.SetStatusCondition(&localKcpNet.Status.Conditions, metav1.Condition{
Type: cloudcontrolv1beta1.ConditionTypeReady,
Status: metav1.ConditionTrue,
Expand All @@ -380,7 +381,7 @@ var _ = Describe("Feature: KCP VpcPeering", func() {
Should(Succeed())

remoteKcpNet.Status.Network = remoteKcpNet.Spec.Network.Reference.DeepCopy()
remoteKcpNet.Status.State = string(cloudcontrolv1beta1.ReadyState)
remoteKcpNet.Status.State = string(cloudcontrolv1beta1.StateReady)
meta.SetStatusCondition(&remoteKcpNet.Status.Conditions, metav1.Condition{
Type: cloudcontrolv1beta1.ConditionTypeReady,
Status: metav1.ConditionTrue,
Expand Down
Loading

0 comments on commit 5c467c5

Please sign in to comment.