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 api/v1beta1/loadbalancer_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ type LoadBalancerLogForward struct {
LokiURL string `json:"lokiUrl"`
// ProxyUrl defines the http proxy url to use for connection to loki
// +optional
ProxyURL string `json:"proxyUrl"`
ProxyURL string `json:"proxyUrl,omitempty"`
// Labels define extra labels for loki.
// +optional
Labels map[string]string `json:"labels"`
Expand Down
59 changes: 59 additions & 0 deletions internal/helper/loadbalancermachine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
. "github.com/onsi/gomega"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/utils/ptr"

yawolv1beta1 "github.com/stackitcloud/yawol/api/v1beta1"
)
Expand Down Expand Up @@ -310,3 +311,61 @@ makestep 1 3
`))
})
})

var _ = DescribeTable("GetHashForLoadBalancerMachineSet",
func(lb *yawolv1beta1.LoadBalancer, expectedHash string) {
hash, err := GetHashForLoadBalancerMachineSet(lb)
Expect(err).ToNot(HaveOccurred())
Expect(hash).To(Equal(expectedHash))
},
Entry("empty config", &yawolv1beta1.LoadBalancer{}, "ogwzb3hasmo2o2tj"),
Entry("basic config", &yawolv1beta1.LoadBalancer{
ObjectMeta: metav1.ObjectMeta{
Name: "test",
Namespace: "testspace",
},
Spec: yawolv1beta1.LoadBalancerSpec{
DebugSettings: yawolv1beta1.LoadBalancerDebugSettings{
Enabled: true,
SshkeyName: "key",
},
Options: yawolv1beta1.LoadBalancerOptions{
LogForward: yawolv1beta1.LoadBalancerLogForward{
Enabled: true,
LokiURL: "url",
},
ServerGroupPolicy: "affinity",
},
},
Status: yawolv1beta1.LoadBalancerStatus{
PortID: ptr.To("port"),
ServerGroupName: ptr.To("group-name"),
},
}, "5h3dhrkdncr5csa7"),
Entry("basic config with extra fields but same hash", &yawolv1beta1.LoadBalancer{
ObjectMeta: metav1.ObjectMeta{
Name: "test",
Namespace: "testspace",
},
Spec: yawolv1beta1.LoadBalancerSpec{
DebugSettings: yawolv1beta1.LoadBalancerDebugSettings{
Enabled: true,
SshkeyName: "key",
},
Options: yawolv1beta1.LoadBalancerOptions{
LogForward: yawolv1beta1.LoadBalancerLogForward{
Enabled: true,
LokiURL: "url",
},
ServerGroupPolicy: "affinity",
InternalLB: true, // extra
},
Replicas: 3, // extra
},
Status: yawolv1beta1.LoadBalancerStatus{
PortID: ptr.To("port"),
ServerGroupName: ptr.To("group-name"),
ExternalIP: ptr.To("1.2.3.4"), // extra
},
}, "5h3dhrkdncr5csa7"),
)