druid-io / druid-operator

Druid Kubernetes Operator
Other
205 stars 93 forks source link

Refactor types.go + init container support #254

Open AdheipSingh opened 2 years ago

AdheipSingh commented 2 years ago
  1. Have a common spec which shall include all key/values common to all nodeSpec, druidSpec.
  2. a common spec to have a spec having key/values common to both.
  3. a container spec to have container specific key/value common to container as well as initContainer

pseudo

type DruidSpec struct {
      .......
      .......
      CommmonSpec `json:",inline,omitempty"`
      ......
}

type DruidNodeSpec struct {
     .......
      .......
      CommmonSpec `json:",inline,omitempty"`
      ......
}
type CommmonSpec struct {
    // Optional: node selector to be used by Druid statefulsets
    NodeSelector map[string]string `json:"nodeSelector,omitempty"`

    // Optional: toleration to be used in order to run Druid on nodes tainted
    Tolerations []v1.Toleration `json:"tolerations,omitempty"`

    // Optional: affinity to be used to for enabling node, pod affinity and anti-affinity
    Affinity *v1.Affinity `json:"affinity,omitempty"`
}

All changes will fully compatible with the current CR structure.

cc @himanshug @nishantmonu51