Skip to content

Commit

Permalink
KO-440 Provide an easy way for people to specify additional seeds in …
Browse files Browse the repository at this point in the history
…the crd (#136)

* add an additionalSeeds field to the crd to specify a static list of seeds to include
  • Loading branch information
sandoichi authored Jun 25, 2020
1 parent b8bbbf1 commit 0125b1f
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ spec:
spec:
description: CassandraDatacenterSpec defines the desired state of a CassandraDatacenter
properties:
additionalSeeds:
items:
type: string
type: array
allowMultipleNodesPerWorker:
description: Turning this option on allows multiple server pods to be
created on a k8s worker node. By default the operator creates just
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ spec:
spec:
description: CassandraDatacenterSpec defines the desired state of a CassandraDatacenter
properties:
additionalSeeds:
items:
type: string
type: array
allowMultipleNodesPerWorker:
description: Turning this option on allows multiple server pods to be
created on a k8s worker node. By default the operator creates just
Expand Down
12 changes: 8 additions & 4 deletions operator/pkg/apis/cassandra/v1beta1/cassandradatacenter_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func getImageForServerVersion(server, version string) (string, error) {

type CassandraUser struct {
SecretName string `json:"secretName"`
Superuser bool `json:"superuser"`
Superuser bool `json:"superuser"`
}

// CassandraDatacenterSpec defines the desired state of a CassandraDatacenter
Expand Down Expand Up @@ -165,6 +165,8 @@ type CassandraDatacenterSpec struct {

// Cassandra users to bootstrap
Users []CassandraUser `json:"users,omitempty"`

AdditionalSeeds []string `json:"additionalSeeds,omitempty"`
}

type StorageConfig struct {
Expand Down Expand Up @@ -229,8 +231,8 @@ func NewDatacenterCondition(conditionType DatacenterConditionType, status corev1
type CassandraDatacenterStatus struct {
Conditions []DatacenterCondition `json:"conditions,omitempty"`

// Deprecated. Use usersUpserted instead. The timestamp at
// which CQL superuser credentials were last upserted to the
// Deprecated. Use usersUpserted instead. The timestamp at
// which CQL superuser credentials were last upserted to the
// management API
// +optional
SuperUserUpserted metav1.Time `json:"superUserUpserted,omitempty"`
Expand Down Expand Up @@ -432,7 +434,9 @@ func (dc *CassandraDatacenter) GetConfigAsJSON() (string, error) {
// We use the cluster seed-service name here for the seed list as it will
// resolve to the seed nodes. This obviates the need to update the
// cassandra.yaml whenever the seed nodes change.
modelValues := serverconfig.GetModelValues([]string{dc.GetSeedServiceName()}, dc.Spec.ClusterName, dc.Name)
seeds := []string{dc.GetSeedServiceName()}
seeds = append(seeds, dc.Spec.AdditionalSeeds...)
modelValues := serverconfig.GetModelValues(seeds, dc.Spec.ClusterName, dc.Name)

var modelBytes []byte

Expand Down
5 changes: 5 additions & 0 deletions operator/pkg/apis/cassandra/v1beta1/zz_generated.deepcopy.go

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

4 changes: 2 additions & 2 deletions operator/pkg/reconciliation/constructor.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ func newStatefulSetForCassandraDatacenterWithDefunctPvcManagedBy(
rackName string,
dc *api.CassandraDatacenter,
replicaCount int) (*appsv1.StatefulSet, error) {

return newStatefulSetForCassandraDatacenterHelper(rackName, dc, replicaCount, true)
}

Expand All @@ -132,7 +132,7 @@ func usesDefunctPvcManagedByLabel(sts *appsv1.StatefulSet) bool {
if ok && value == oplabels.ManagedByLabelDefunctValue {
usesDefunct = true
break
}
}
}

return usesDefunct
Expand Down

0 comments on commit 0125b1f

Please sign in to comment.