Skip to content
This repository has been archived by the owner on Apr 4, 2023. It is now read-only.

Commit

Permalink
Rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
kragniz committed Mar 27, 2018
1 parent e13293f commit 3541a6d
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 17 deletions.
2 changes: 1 addition & 1 deletion pkg/apis/navigator/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ type CassandraClusterNodePool struct {
Datacenter string
Resources v1.ResourceRequirements
SchedulerName string
Seeds *int64
Seeds *int32
}

type CassandraClusterStatus struct {
Expand Down
4 changes: 2 additions & 2 deletions pkg/apis/navigator/v1alpha1/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package v1alpha1
import (
"k8s.io/apimachinery/pkg/runtime"

"github.com/jetstack/navigator/pkg/util"
"github.com/jetstack/navigator/pkg/util/ptr"
)

const (
Expand All @@ -25,6 +25,6 @@ func SetDefaults_CassandraClusterNodePool(np *CassandraClusterNodePool) {

// default to 1 seed if not specified
if np.Seeds == nil {
np.Seeds = util.Int64Ptr(1)
np.Seeds = ptr.Int32(1)
}
}
2 changes: 1 addition & 1 deletion pkg/apis/navigator/v1alpha1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ type CassandraClusterNodePool struct {
// Seeds specifies the number of seed nodes to allocate in this nodepool. By
// default, 1 is selected.
// +optional
Seeds *int64 `json:"seeds,omitempty"`
Seeds *int32 `json:"seeds,omitempty"`
}

type CassandraClusterStatus struct {
Expand Down
4 changes: 2 additions & 2 deletions pkg/apis/navigator/v1alpha1/zz_generated.conversion.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ func autoConvert_v1alpha1_CassandraClusterNodePool_To_navigator_CassandraCluster
out.Datacenter = in.Datacenter
out.Resources = in.Resources
out.SchedulerName = in.SchedulerName
out.Seeds = (*int64)(unsafe.Pointer(in.Seeds))
out.Seeds = (*int32)(unsafe.Pointer(in.Seeds))
return nil
}

Expand All @@ -193,7 +193,7 @@ func autoConvert_navigator_CassandraClusterNodePool_To_v1alpha1_CassandraCluster
out.Datacenter = in.Datacenter
out.Resources = in.Resources
out.SchedulerName = in.SchedulerName
out.Seeds = (*int64)(unsafe.Pointer(in.Seeds))
out.Seeds = (*int32)(unsafe.Pointer(in.Seeds))
return nil
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/apis/navigator/v1alpha1/zz_generated.deepcopy.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ func (in *CassandraClusterNodePool) DeepCopyInto(out *CassandraClusterNodePool)
if *in == nil {
*out = nil
} else {
*out = new(int64)
*out = new(int32)
**out = **in
}
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/apis/navigator/zz_generated.deepcopy.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ func (in *CassandraClusterNodePool) DeepCopyInto(out *CassandraClusterNodePool)
if *in == nil {
*out = nil
} else {
*out = new(int64)
*out = new(int32)
**out = **in
}
}
Expand Down
10 changes: 5 additions & 5 deletions pkg/controllers/cassandra/seedlabeller/control.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func (c *defaultSeedLabeller) labelSeedNodes(
np *v1alpha1.CassandraClusterNodePool,
set *appsv1beta1.StatefulSet,
) error {
for i := int64(0); i < np.Replicas; i++ {
for i := int32(0); i < np.Replicas; i++ {
pod, err := c.pods.Pods(cluster.Namespace).Get(fmt.Sprintf("%s-%d", set.Name, i))
if err != nil {
glog.Warningf("Couldn't get stateful set pod: %v", err)
Expand All @@ -59,11 +59,11 @@ func (c *defaultSeedLabeller) labelSeedNodes(

desiredLabel := ""
if isSeed {
desiredLabel = seedprovider.SeedLabelValue
desiredLabel = service.SeedLabelValue
}

labels := pod.Labels
value := labels[seedprovider.SeedLabelKey]
value := labels[service.SeedLabelKey]
if value == desiredLabel {
continue
}
Expand All @@ -72,9 +72,9 @@ func (c *defaultSeedLabeller) labelSeedNodes(
}

if isSeed {
labels[seedprovider.SeedLabelKey] = desiredLabel
labels[service.SeedLabelKey] = desiredLabel
} else {
delete(labels, seedprovider.SeedLabelKey)
delete(labels, service.SeedLabelKey)
}

podCopy := pod.DeepCopy()
Expand Down
4 changes: 0 additions & 4 deletions pkg/util/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,3 @@ func CalculateQuorum(num int32) int32 {
}
return (num / 2) + 1
}

func Int64Ptr(i int64) *int64 {
return &i
}

0 comments on commit 3541a6d

Please sign in to comment.