Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix logsearchapi toleration #1272

Merged
merged 4 commits into from
Sep 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions helm/operator/templates/minio.min.io_tenants.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2238,6 +2238,22 @@ spec:
type: string
storageClassName:
type: string
tolerations:
items:
properties:
effect:
type: string
key:
type: string
operator:
type: string
tolerationSeconds:
format: int64
type: integer
value:
type: string
type: object
type: array
topologySpreadConstraints:
items:
properties:
Expand Down Expand Up @@ -7260,6 +7276,22 @@ spec:
type: string
storageClassName:
type: string
tolerations:
items:
properties:
effect:
type: string
key:
type: string
operator:
type: string
tolerationSeconds:
format: int64
type: integer
value:
type: string
type: object
type: array
topologySpreadConstraints:
items:
properties:
Expand Down
33 changes: 21 additions & 12 deletions helm/tenant/templates/tenant.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -211,10 +211,14 @@ spec:
nodeSelector:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with (dig "prometheus" "affinity" (dict) .) }}
affinity:
nodeAffinity: { }
podAffinity: { }
podAntiAffinity: { }
{{- toYaml . | nindent 6 }}
{{- end }}
{{- with (dig "prometheus" "tolerations" (list) .) }}
tolerations:
{{- toYaml . | nindent 6 }}
{{- end }}
{{- with (dig "resources" (dict) .) }}
resources:
{{- toYaml . | nindent 4 }}
Expand Down Expand Up @@ -243,11 +247,14 @@ spec:
nodeSelector:
{{ toYaml . | nindent 4 }}
{{- end }}
{{- with (dig "log" "affinity" (dict) .) }}
affinity:
nodeAffinity: { }
podAffinity: { }
podAntiAffinity: { }
tolerations: [ ]
{{- toYaml . | nindent 6 }}
{{- end }}
{{- with (dig "log" "tolerations" (list) .) }}
tolerations:
{{- toYaml . | nindent 6 }}
{{- end }}
{{- with (dig "annotations" (dict) .) }}
annotations:
{{ toYaml . | nindent 4 }}
Expand Down Expand Up @@ -288,12 +295,14 @@ spec:
nodeSelector:
{{ toYaml . | nindent 4 }}
{{- end }}
{{- with (dig "log" "db" "affinity" (dict) .) }}
affinity:
nodeAffinity: { }
podAffinity: { }
podAntiAffinity: { }
tolerations: [ ]

{{- toYaml . | nindent 8 }}
{{- end }}
{{- with (dig "log" "db" "tolerations" (list) .) }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with (dig "annotations" (dict) .) }}
annotations:
{{ toYaml . | nindent 4 }}
Expand Down
1 change: 1 addition & 0 deletions helm/tenant/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ tenant:
annotations: { }
labels: { }
nodeSelector: { }
tolerations: [ ]
affinity:
nodeAffinity: { }
podAffinity: { }
Expand Down
5 changes: 5 additions & 0 deletions pkg/apis/minio.min.io/v2/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -843,6 +843,11 @@ type PrometheusConfig struct {
Affinity *corev1.Affinity `json:"affinity,omitempty"`
// *Optional* +
//
// Specify one or more https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/[Kubernetes tolerations] to apply to the Prometheus pods.
// +optional
Tolerations []corev1.Toleration `json:"tolerations,omitempty"`
// *Optional* +
//
// Specify one or more https://kubernetes.io/docs/concepts/workloads/pods/pod-topology-spread-constraints/[Kubernetes Topology Spread Constraints] to apply to pods deployed in the MinIO pool.
// +optional
TopologySpreadConstraints []corev1.TopologySpreadConstraint `json:"topologySpreadConstraints,omitempty"`
Expand Down
7 changes: 7 additions & 0 deletions pkg/apis/minio.min.io/v2/zz_generated.deepcopy.go

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

10 changes: 5 additions & 5 deletions pkg/resources/deployments/log-search-api.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,15 +181,15 @@ func NewForLogSearchAPI(t *miniov2.Tenant) *appsv1.Deployment {

if t.Spec.Log.Db != nil {
// attach affinity clauses
if t.Spec.Log.Db.Affinity != nil {
apiPod.Spec.Affinity = t.Spec.Log.Db.Affinity
if t.Spec.Log.Affinity != nil {
apiPod.Spec.Affinity = t.Spec.Log.Affinity
}
// attach node selector clauses
apiPod.Spec.NodeSelector = t.Spec.Log.Db.NodeSelector
apiPod.Spec.NodeSelector = t.Spec.Log.NodeSelector
// attach tolerations
apiPod.Spec.Tolerations = t.Spec.Log.Db.Tolerations
apiPod.Spec.Tolerations = t.Spec.Log.Tolerations
// attach topology spread constraints
apiPod.Spec.TopologySpreadConstraints = t.Spec.Log.Db.TopologySpreadConstraints
apiPod.Spec.TopologySpreadConstraints = t.Spec.Log.TopologySpreadConstraints
}

d := &appsv1.Deployment{
Expand Down
1 change: 1 addition & 0 deletions pkg/resources/statefulsets/prometheus.go
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ func NewForPrometheus(t *miniov2.Tenant, serviceName string) *appsv1.StatefulSet
SchedulerName: t.Scheduler.Name,
NodeSelector: t.Spec.Prometheus.NodeSelector,
Affinity: t.Spec.Prometheus.Affinity,
Tolerations: t.Spec.Prometheus.Tolerations,
TopologySpreadConstraints: t.Spec.Prometheus.TopologySpreadConstraints,
InitContainers: initContainers,
SecurityContext: securityContext,
Expand Down
32 changes: 32 additions & 0 deletions resources/base/crds/minio.min.io_tenants.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2238,6 +2238,22 @@ spec:
type: string
storageClassName:
type: string
tolerations:
items:
properties:
effect:
type: string
key:
type: string
operator:
type: string
tolerationSeconds:
format: int64
type: integer
value:
type: string
type: object
type: array
topologySpreadConstraints:
items:
properties:
Expand Down Expand Up @@ -7260,6 +7276,22 @@ spec:
type: string
storageClassName:
type: string
tolerations:
items:
properties:
effect:
type: string
key:
type: string
operator:
type: string
tolerationSeconds:
format: int64
type: integer
value:
type: string
type: object
type: array
topologySpreadConstraints:
items:
properties:
Expand Down