Skip to content

Commit

Permalink
Remove Etcd support from the Solr Operator (apache#132)
Browse files Browse the repository at this point in the history
Signed-off-by: Houston Putman <[email protected]>
  • Loading branch information
HoustonPutman committed Oct 28, 2020
1 parent 1d1435a commit 443b1cc
Show file tree
Hide file tree
Showing 23 changed files with 1,507 additions and 2,732 deletions.
154 changes: 11 additions & 143 deletions api/v1beta1/solrcloud_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,6 @@ const (
DefaultZkVersion = "0.2.6"
DefaultZkVolumeReclaimPolicy = zk.VolumeReclaimPolicyRetain

DefaultEtcdReplicas = 3
DefaultEtcdRepo = "quay.io/coreos/etcd"
DefaultEtcdVersion = "3.2.13"

DefaultZetcdReplicas = int32(1)
DefaultZetcdRepo = "quay.io/etcd-io/zetcd"
DefaultZetcdVersion = "0.0.5"

SolrTechnologyLabel = "solr-cloud"
ZookeeperTechnologyLabel = "zookeeper"
)
Expand Down Expand Up @@ -425,38 +417,35 @@ func (ci *ZookeeperConnectionInfo) withDefaults() (changed bool) {
return changed
}

// ProvidedZookeeper defines the internal zookeeper ensemble to run
// ProvidedZookeeper defines the internal zookeeper ensemble to run with the given spec
type ProvidedZookeeper struct {
// Create a new Zookeeper Ensemble with the following spec
// Note: Requires
// - The zookeeperOperator flag to be provided to the Solr Operator
// - A zookeeper operator to be running
// DEPRECATED: Will be removed in v0.3.0
// +optional
Zookeeper *ZookeeperSpec `json:"zookeeper,omitempty"`
ZookeeperOutdated *ZookeeperSpec `json:"zookeeper,omitempty"`

// Create a new Etcd Cluster and a Zetcd proxy to connect the cluster to solr
// Create a new Zookeeper Ensemble with the following spec
// Note: Requires
// - The etcdOperator flag to be provided to the Solr Operator
// - An etcd operator to be running
// - The zookeeperOperator flag to be provided to the Solr Operator
// - A zookeeper operator to be running
// +optional
Zetcd *FullZetcdSpec `json:"zetcd,inline"`
Zookeeper ZookeeperSpec `json:",inline"`

// The ChRoot to connect solr at
// +optional
ChRoot string `json:"chroot,omitempty"`
}

func (z *ProvidedZookeeper) withDefaults() (changed bool) {
if z.Zookeeper == nil && z.Zetcd == nil {
if z.ZookeeperOutdated != nil {
changed = true
z.Zookeeper = &ZookeeperSpec{}
}
if z.Zookeeper != nil {
changed = z.Zookeeper.withDefaults() || changed
}
if z.Zetcd != nil {
changed = z.Zetcd.withDefaults() || changed
z.Zookeeper = *z.ZookeeperOutdated
z.ZookeeperOutdated = nil
}
changed = z.Zookeeper.withDefaults() || changed

if z.ChRoot == "" {
changed = true
Expand All @@ -480,7 +469,6 @@ type ZookeeperSpec struct {
Image *ContainerImage `json:"image,omitempty"`

// PersistentVolumeClaimSpec is the spec to describe PVC for the zk container
// This field is optional. If no PVC spec is provided, etcd container will use emptyDir as volume.
// WARNING: This field is DEPRECATED, please use the Persistence option
// +optional
PersistentVolumeClaimSpec *corev1.PersistentVolumeClaimSpec `json:"persistentVolumeClaimSpec,omitempty"`
Expand Down Expand Up @@ -560,116 +548,6 @@ func (z *ZookeeperSpec) withDefaults() (changed bool) {
return changed
}

// FullZetcdSpec defines the internal etcd ensemble and zetcd server to run for solr (spoofing zookeeper)
type FullZetcdSpec struct {
// +optional
EtcdSpec *EtcdSpec `json:"etcdSpec,omitempty"`

// +optional
ZetcdSpec *ZetcdSpec `json:"zetcdSpec,omitempty"`
}

func (z *FullZetcdSpec) withDefaults() (changed bool) {
if z.EtcdSpec == nil {
z.EtcdSpec = &EtcdSpec{}
}
changed = z.EtcdSpec.withDefaults() || changed

if z.ZetcdSpec == nil {
z.ZetcdSpec = &ZetcdSpec{}
}
changed = z.ZetcdSpec.withDefaults() || changed

return changed
}

// EtcdSpec defines the internal etcd ensemble to run for solr (spoofing zookeeper)
type EtcdSpec struct {
// The number of EtcdReplicas to create
// +optional
Replicas *int `json:"replicas,omitempty"`

// +optional
Image *ContainerImage `json:"image,omitempty"`

// PersistentVolumeClaimSpec is the spec to describe PVC for the zk container
// This field is optional. If no PVC spec, etcd container will use emptyDir as volume
PersistentVolumeClaimSpec *corev1.PersistentVolumeClaimSpec `json:"persistentVolumeClaimSpec,omitempty"`

// Pod resources for etcd pods
// +optional
EtcdPod EtcdPodPolicy `json:"etcdPodPolicy,omitempty"`
}

// EtcdPodPolicy defines the common pod configuration for Pods, including when used
// in deployments, stateful-sets, etc.
type EtcdPodPolicy struct {
// The scheduling constraints on pods.
// +optional
Affinity *corev1.Affinity `json:"affinity,omitempty"`

// Resources is the resource requirements for the container.
// This field cannot be updated once the cluster is created.
// +optional
Resources corev1.ResourceRequirements `json:"resources,omitempty"`
}

func (s *EtcdSpec) withDefaults() (changed bool) {
if s.Replicas == nil {
changed = true
r := DefaultEtcdReplicas
s.Replicas = &r
}

if s.Image == nil {
s.Image = &ContainerImage{}
}
changed = s.Image.withDefaults(DefaultEtcdRepo, DefaultEtcdVersion, DefaultPullPolicy) || changed

return changed
}

// ZetcdSpec defines the zetcd proxy to run connection solr and etcd
type ZetcdSpec struct {
// +optional
Replicas *int32 `json:"replicas,omitempty"`

// +optional
Image *ContainerImage `json:"image,omitempty"`

// Pod resources for zetcd pods
// +optional
ZetcdPod ZetcdPodPolicy `json:"zetcdPodPolicy,omitempty"`
}

// EtcdPodPolicy defines the common pod configuration for Pods, including when used
// in deployments, stateful-sets, etc.
type ZetcdPodPolicy struct {
// The scheduling constraints on pods.
// +optional
Affinity *corev1.Affinity `json:"affinity,omitempty"`

// Resources is the resource requirements for the container.
// This field cannot be updated once the cluster is created.
// +optional
Resources corev1.ResourceRequirements `json:"resources,omitempty"`
}

func (s *ZetcdSpec) withDefaults() (changed bool) {
if s.Replicas == nil {
changed = true
r := DefaultZetcdReplicas
s.Replicas = &r
}

if s.Image == nil {
s.Image = &ContainerImage{}
}
changed = s.Image.withDefaults(DefaultZetcdRepo, DefaultZetcdVersion, DefaultPullPolicy) || changed

return changed
}

// SolrCloudStatus defines the observed state of SolrCloud
type SolrCloudStatus struct {
// SolrNodes contain the statuses of each solr node running in this solr cloud.
Expand Down Expand Up @@ -826,16 +704,6 @@ func (sc *SolrCloud) ProvidedZookeeperAddress() string {
return fmt.Sprintf("%s-solrcloud-zookeeper-client:2181", sc.GetName())
}

// ProvidedZetcdName returns the name of the zetcd cluster
func (sc *SolrCloud) ProvidedZetcdName() string {
return fmt.Sprintf("%s-solrcloud-zetcd", sc.GetName())
}

// IngressName returns the name of the ingress for the cloud
func (sc *SolrCloud) ProvidedZetcdAddress() string {
return fmt.Sprintf("%s-solrcloud-zetcd:2181", sc.GetName())
}

// ZkConnectionString returns the zkConnectionString for the cloud
func (sc *SolrCloud) ZkConnectionString() string {
return sc.Status.ZkConnectionString()
Expand Down
134 changes: 3 additions & 131 deletions api/v1beta1/zz_generated.deepcopy.go

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

Loading

0 comments on commit 443b1cc

Please sign in to comment.