Skip to content

Commit d75fe61

Browse files
committed
fix rebase conflicts and broken tests
1 parent fa90909 commit d75fe61

14 files changed

+48
-1025
lines changed

internal/controller/clusterResourceInteractions_test.go

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -701,13 +701,18 @@ var _ = Describe("CreateOrUpdateConditionalClusterObjects handlers", func() {
701701
HaveField("Spec.Type", Equal(corev1.ServiceTypeLoadBalancer)),
702702
HaveField("Spec.LoadBalancerClass", Equal(ptr.To("someClass"))),
703703
HaveField("Spec.Ports", SatisfyAll(
704-
HaveLen(1),
705-
HaveEach(SatisfyAll(
706-
HaveField("Name", Equal("client")),
707-
HaveField("Port", Equal(int32(2379))),
708-
HaveField("Protocol", Equal(corev1.ProtocolUDP)),
709-
)),
710-
)),
704+
HaveLen(2),
705+
ContainElements(
706+
SatisfyAll(
707+
HaveField("Name", Equal("client")),
708+
HaveField("Port", Equal(int32(2379))),
709+
HaveField("Protocol", Equal(corev1.ProtocolUDP))),
710+
SatisfyAll(
711+
HaveField("Name", Equal("metrics")),
712+
HaveField("Port", Equal(int32(2381))),
713+
HaveField("Protocol", Equal(corev1.ProtocolTCP)),
714+
),
715+
))),
711716
))
712717
})
713718

internal/controller/factory/builders.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,3 @@ func contextWithGVK(ctx context.Context, resource client.Object, scheme *runtime
4747
ctx = log.WithValues(ctx, "group", gvk.GroupVersion().String(), "kind", gvk.Kind, "name", resource.GetName())
4848
return ctx, nil
4949
}
50-
<<<<<<< HEAD
51-
=======
52-
53-
>>>>>>> 641ff74 (move reconcileOwnedResource to reconcile utils)

internal/controller/factory/configmap.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,9 @@ func TemplateClusterStateConfigMap(
7272

7373
initialClusterMembers := make([]string, replicas)
7474
clusterService := fmt.Sprintf(
75-
<<<<<<< HEAD
7675
"%s.%s.svc:2380",
7776
GetHeadlessServiceName(cluster), cluster.Namespace)
7877

79-
=======
80-
"%s.%s.svc:2380", GetHeadlessServiceName(cluster), cluster.Namespace)
81-
>>>>>>> 641ff74 (move reconcileOwnedResource to reconcile utils)
8278
for i := 0; i < replicas; i++ {
8379
podName := fmt.Sprintf("%s-%d", cluster.Name, i)
8480
initialClusterMembers[i] = fmt.Sprintf("%s=https://%s.%s",

internal/controller/factory/configmap_test.go

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ var _ = Describe("ClusterStateConfigMap factory", func() {
6363
Eventually(Get(&etcdcluster)).Should(Succeed())
6464
DeferCleanup(k8sClient.Delete, &etcdcluster)
6565
})
66-
<<<<<<< HEAD
6766

6867
It("should successfully create the configmap object", func() {
6968
By("processing new etcd cluster", func() {
@@ -113,16 +112,6 @@ var _ = Describe("ClusterStateConfigMap factory", func() {
113112
Expect(err).ShouldNot(HaveOccurred())
114113
Expect(configMapObj).NotTo(BeNil())
115114
Expect(configMapObj.Data["ETCD_INITIAL_CLUSTER_STATE"]).To(Equal("existing"))
116-
=======
117-
118-
It("should successfully create the configmap object", func() {
119-
By("processing new etcd cluster", func() {
120-
configMapObj, err := GetClusterStateConfigMap(ctx, &etcdcluster, k8sClient)
121-
Expect(err).ShouldNot(HaveOccurred())
122-
Expect(configMapObj).NotTo(BeNil())
123-
Expect(configMapObj.Data["ETCD_INITIAL_CLUSTER_STATE"]).To(Equal("new"))
124-
})
125-
>>>>>>> 641ff74 (move reconcileOwnedResource to reconcile utils)
126115
})
127116
})
128117
})

internal/controller/factory/pdb.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,10 @@ func GetPdb(
3737
) (*v1.PodDisruptionBudget, error) {
3838
var err error
3939

40-
<<<<<<< HEAD
4140
if cluster.Spec.PodDisruptionBudgetTemplate == nil {
4241
return nil, fmt.Errorf("can't get pdb - PodDisruptionBudgetTemplate is nil")
4342
}
4443

45-
=======
46-
>>>>>>> 641ff74 (move reconcileOwnedResource to reconcile utils)
4744
pdb := &v1.PodDisruptionBudget{
4845
ObjectMeta: metav1.ObjectMeta{
4946
Namespace: cluster.Namespace,

internal/controller/factory/pdb_test.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ var _ = Describe("Pdb factory", func() {
9696
pdbObj, err := GetPdb(ctx, &etcdcluster, k8sClient)
9797
Expect(err).ShouldNot(HaveOccurred())
9898
Expect(pdbObj).ShouldNot(BeNil())
99-
<<<<<<< HEAD
10099
})
101100
})
102101

@@ -235,8 +234,6 @@ var _ = Describe("Pdb factory", func() {
235234
pdbObj, err := GetPdb(ctx, &etcdcluster, k8sClient)
236235
Expect(err).ShouldNot(HaveOccurred())
237236
Expect(pdbObj.Spec.MinAvailable).To(Equal(ptr.To(intstr.FromInt32(1))))
238-
=======
239-
>>>>>>> 641ff74 (move reconcileOwnedResource to reconcile utils)
240237
})
241238
})
242239
})

internal/controller/factory/statefulset.go

Lines changed: 0 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -46,21 +46,6 @@ func TemplateStatefulSet() *appsv1.StatefulSet {
4646
panic("not yet implemented")
4747
}
4848

49-
<<<<<<< HEAD
50-
=======
51-
func PodLabels(cluster *etcdaenixiov1alpha1.EtcdCluster) map[string]string {
52-
labels := NewLabelsBuilder().WithName().WithInstance(cluster.Name).WithManagedBy()
53-
54-
if cluster.Spec.PodTemplate.Labels != nil {
55-
for key, value := range cluster.Spec.PodTemplate.Labels {
56-
labels[key] = value
57-
}
58-
}
59-
60-
return labels
61-
}
62-
63-
>>>>>>> 641ff74 (move reconcileOwnedResource to reconcile utils)
6449
func GetStatefulSet(
6550
ctx context.Context,
6651
cluster *etcdaenixiov1alpha1.EtcdCluster,
@@ -147,58 +132,6 @@ func PodLabels(cluster *etcdaenixiov1alpha1.EtcdCluster) map[string]string {
147132
return labels
148133
}
149134

150-
<<<<<<< HEAD
151-
=======
152-
func generateVolumeMounts(cluster *etcdaenixiov1alpha1.EtcdCluster) []corev1.VolumeMount {
153-
154-
volumeMounts := []corev1.VolumeMount{}
155-
156-
volumeMounts = append(volumeMounts, corev1.VolumeMount{
157-
Name: "data",
158-
ReadOnly: false,
159-
MountPath: "/var/run/etcd",
160-
})
161-
162-
if cluster.Spec.Security != nil && cluster.Spec.Security.TLS.PeerSecret != "" {
163-
volumeMounts = append(volumeMounts, []corev1.VolumeMount{
164-
{
165-
Name: "peer-trusted-ca-certificate",
166-
ReadOnly: true,
167-
MountPath: "/etc/etcd/pki/peer/ca",
168-
},
169-
{
170-
Name: "peer-certificate",
171-
ReadOnly: true,
172-
MountPath: "/etc/etcd/pki/peer/cert",
173-
},
174-
}...)
175-
}
176-
177-
if cluster.Spec.Security != nil && cluster.Spec.Security.TLS.ServerSecret != "" {
178-
volumeMounts = append(volumeMounts, []corev1.VolumeMount{
179-
{
180-
Name: "server-certificate",
181-
ReadOnly: true,
182-
MountPath: "/etc/etcd/pki/server/cert",
183-
},
184-
}...)
185-
}
186-
187-
if cluster.Spec.Security != nil && cluster.Spec.Security.TLS.ClientSecret != "" {
188-
189-
volumeMounts = append(volumeMounts, []corev1.VolumeMount{
190-
{
191-
Name: "client-trusted-ca-certificate",
192-
ReadOnly: true,
193-
MountPath: "/etc/etcd/pki/client/ca",
194-
},
195-
}...)
196-
}
197-
198-
return volumeMounts
199-
}
200-
201-
>>>>>>> 641ff74 (move reconcileOwnedResource to reconcile utils)
202135
func GenerateEtcdCommand() []string {
203136
return []string{
204137
"etcd",

internal/controller/factory/statefulset_test.go

Lines changed: 1 addition & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -17,26 +17,19 @@ limitations under the License.
1717
package factory
1818

1919
import (
20+
appsv1 "k8s.io/api/apps/v1"
2021
"k8s.io/apimachinery/pkg/api/resource"
2122
"k8s.io/utils/ptr"
2223

2324
. "github.com/onsi/ginkgo/v2"
2425
. "github.com/onsi/gomega"
25-
. "sigs.k8s.io/controller-runtime/pkg/envtest/komega"
2626
corev1 "k8s.io/api/core/v1"
2727
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
28-
<<<<<<< HEAD
2928
. "sigs.k8s.io/controller-runtime/pkg/envtest/komega"
3029

3130
etcdaenixiov1alpha1 "github.com/aenix-io/etcd-operator/api/v1alpha1"
3231
"github.com/google/uuid"
3332
"k8s.io/apimachinery/pkg/types"
34-
=======
35-
36-
etcdaenixiov1alpha1 "github.com/aenix-io/etcd-operator/api/v1alpha1"
37-
"k8s.io/apimachinery/pkg/types"
38-
"github.com/google/uuid"
39-
>>>>>>> 641ff74 (move reconcileOwnedResource to reconcile utils)
4033
)
4134

4235
var _ = Describe("StatefulSet factory", func() {
@@ -52,23 +45,14 @@ var _ = Describe("StatefulSet factory", func() {
5245
DeferCleanup(k8sClient.Delete, ns)
5346
})
5447

55-
<<<<<<< HEAD
5648
Context("PodLabels", func() {
5749
It("should return base labels with custom labels merged", func() {
5850
cluster := &etcdaenixiov1alpha1.EtcdCluster{
59-
=======
60-
Context("when create statefulSet", func() {
61-
var etcdcluster etcdaenixiov1alpha1.EtcdCluster
62-
63-
BeforeEach(func() {
64-
etcdcluster = etcdaenixiov1alpha1.EtcdCluster{
65-
>>>>>>> 641ff74 (move reconcileOwnedResource to reconcile utils)
6651
ObjectMeta: metav1.ObjectMeta{
6752
Name: "test-cluster",
6853
},
6954
Spec: etcdaenixiov1alpha1.EtcdClusterSpec{},
7055
}
71-
<<<<<<< HEAD
7256

7357
cluster.Spec.PodTemplate.Labels = map[string]string{
7458
"custom-label": "value",
@@ -89,19 +73,6 @@ var _ = Describe("StatefulSet factory", func() {
8973
labels := PodLabels(cluster)
9074
Expect(labels).Should(HaveLen(3))
9175
})
92-
=======
93-
Expect(k8sClient.Create(ctx, &etcdcluster)).Should(Succeed())
94-
Eventually(Get(&etcdcluster)).Should(Succeed())
95-
DeferCleanup(k8sClient.Delete, &etcdcluster)
96-
97-
})
98-
It("should successfully create statefulSet object with empty spec", func (){
99-
statefulSetObj, err := GetStatefulSet(ctx, &etcdcluster, k8sClient)
100-
Expect(err).ShouldNot(HaveOccurred())
101-
Expect(statefulSetObj).ShouldNot(BeNil())
102-
})
103-
104-
>>>>>>> 641ff74 (move reconcileOwnedResource to reconcile utils)
10576
})
10677

10778
Context("GenerateEtcdArgs", func() {

internal/controller/factory/suite_test.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,7 @@ import (
4545

4646
var cfg *rest.Config
4747
var k8sClient client.Client
48-
<<<<<<< HEAD
4948

50-
=======
51-
>>>>>>> 641ff74 (move reconcileOwnedResource to reconcile utils)
5249
// var clientWithEmptyScheme client.Client
5350
var testEnv *envtest.Environment
5451

internal/controller/factory/svc.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,7 @@ func GetClientService(
9898
ctx context.Context,
9999
cluster *etcdaenixiov1alpha1.EtcdCluster,
100100
rclient client.Client,
101-
<<<<<<< HEAD
102101
) (*corev1.Service, error) {
103-
=======
104-
) (*corev1.Service, error) {
105-
>>>>>>> 641ff74 (move reconcileOwnedResource to reconcile utils)
106102
var err error
107103

108104
svc := corev1.Service{
@@ -141,9 +137,5 @@ func GetClientService(
141137
return nil, fmt.Errorf("cannot set controller reference: %w", err)
142138
}
143139

144-
<<<<<<< HEAD
145140
return &svc, nil
146-
=======
147-
return &svc, nil
148-
>>>>>>> 641ff74 (move reconcileOwnedResource to reconcile utils)
149141
}

0 commit comments

Comments
 (0)