Skip to content

Commit

Permalink
feat(config): Add options to control scheduling on nodes (#441)
Browse files Browse the repository at this point in the history
* #332

* correct indentation

* recent changes

* test changes

* rebase

* mr comments

* regenerate bundle

* Update internal/controllers/common/resource_definitions/resource_definitions.go

Co-authored-by: Elliott Baron <ebaron@redhat.com>

* go fmt blank line reduced

Co-authored-by: Elliott Baron <ebaron@redhat.com>

* Alignment fix

Co-authored-by: Elliott Baron <ebaron@redhat.com>

* test fix

Co-authored-by: John Barguti <jbarguti@redhat.com>
Co-authored-by: Elliott Baron <ebaron@redhat.com>
  • Loading branch information
3 people authored Oct 3, 2022
1 parent c9b23f9 commit ffa9cbf
Show file tree
Hide file tree
Showing 10 changed files with 4,362 additions and 254 deletions.
40 changes: 40 additions & 0 deletions api/v1beta1/cryostat_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@ type CryostatSpec struct {
// +optional
// +operator-sdk:csv:customresourcedefinitions:type=spec,xDescriptors={"urn:alm:descriptor:com.tectonic.ui:advanced"}
SecurityOptions *SecurityOptions `json:"securityOptions,omitempty"`
// Options to configure scheduling for the Cryostat deployment
// +optional
// +operator-sdk:csv:customresourcedefinitions:type=spec
SchedulingOptions *SchedulingConfiguration `json:"schedulingOptions,omitempty"`
}

type ResourceConfigList struct {
Expand Down Expand Up @@ -193,6 +197,42 @@ type ReportConfiguration struct {
// +optional
// +operator-sdk:csv:customresourcedefinitions:type=spec,xDescriptors={"urn:alm:descriptor:com.tectonic.ui:advanced"}
SecurityOptions *ReportsSecurityOptions `json:"securityOptions,omitempty"`
// Options to configure scheduling for the reports deployment
// +optional
// +operator-sdk:csv:customresourcedefinitions:type=spec
SchedulingOptions *SchedulingConfiguration `json:"schedulingOptions,omitempty"`
}

// SchedulingConfiguration contains multiple choices to control scheduling of Cryostat pods
type SchedulingConfiguration struct {
// Label selector used to schedule a Cryostat pod to a node. See: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/
// +optional
// +operator-sdk:csv:customresourcedefinitions:type=spec,xDescriptors={"urn:alm:descriptor:com.tectonic.ui:selector:core:v1:Node"}
NodeSelector map[string]string `json:"nodeSelector,omitempty"`
// Affinity rules for scheduling Cryostat pods.
// +optional
// +operator-sdk:csv:customresourcedefinitions:type=spec
Affinity *Affinity `json:"affinity,omitempty"`
// Tolerations to allow scheduling of Cryostat pods to tainted nodes. See: https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/
// +optional
// +operator-sdk:csv:customresourcedefinitions:type=spec
Tolerations []corev1.Toleration `json:"tolerations,omitempty"`
}

// Affinity groups different kinds of affinity configurations for Cryostat pods
type Affinity struct {
// Node affinity scheduling rules for a Cryostat pod. See: https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/pod-v1/#NodeAffinity
// +optional
// +operator-sdk:csv:customresourcedefinitions:type=spec,xDescriptors={"urn:alm:descriptor:com.tectonic.ui:nodeAffinity"}
NodeAffinity *corev1.NodeAffinity `json:"nodeAffinity,omitempty"`
// Pod affinity scheduling rules for a Cryostat pod. See: https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/pod-v1/#PodAffinity
// +optional
// +operator-sdk:csv:customresourcedefinitions:type=spec,xDescriptors={"urn:alm:descriptor:com.tectonic.ui:podAffinity"}
PodAffinity *corev1.PodAffinity `json:"podAffinity,omitempty"`
// Pod anti-affinity scheduling rules for a Cryostat pod. See: https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/pod-v1/#PodAntiAffinity
// +optional
// +operator-sdk:csv:customresourcedefinitions:type=spec,xDescriptors={"urn:alm:descriptor:com.tectonic.ui:podAntiAffinity"}
PodAntiAffinity *corev1.PodAntiAffinity `json:"podAntiAffinity,omitempty"`
}

// ServiceConfig provides customization for a service created
Expand Down
74 changes: 74 additions & 0 deletions api/v1beta1/zz_generated.deepcopy.go

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

64 changes: 64 additions & 0 deletions bundle/manifests/cryostat-operator.clusterserviceversion.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,38 @@ spec:
path: reportOptions.resources
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:resourceRequirements
- description: Options to configure scheduling for the reports deployment
displayName: Scheduling Options
path: reportOptions.schedulingOptions
- description: Affinity rules for scheduling Cryostat pods.
displayName: Affinity
path: reportOptions.schedulingOptions.affinity
- description: 'Node affinity scheduling rules for a Cryostat pod. See: https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/pod-v1/#NodeAffinity'
displayName: Node Affinity
path: reportOptions.schedulingOptions.affinity.nodeAffinity
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:nodeAffinity
- description: 'Pod affinity scheduling rules for a Cryostat pod. See: https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/pod-v1/#PodAffinity'
displayName: Pod Affinity
path: reportOptions.schedulingOptions.affinity.podAffinity
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:podAffinity
- description: 'Pod anti-affinity scheduling rules for a Cryostat pod. See:
https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/pod-v1/#PodAntiAffinity'
displayName: Pod Anti Affinity
path: reportOptions.schedulingOptions.affinity.podAntiAffinity
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:podAntiAffinity
- description: 'Label selector used to schedule a Cryostat pod to a node. See:
https://kubernetes.io/docs/concepts/configuration/assign-pod-node/'
displayName: Node Selector
path: reportOptions.schedulingOptions.nodeSelector
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:selector:core:v1:Node
- description: 'Tolerations to allow scheduling of Cryostat pods to tainted
nodes. See: https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/'
displayName: Tolerations
path: reportOptions.schedulingOptions.tolerations
- description: Options to configure the Security Contexts for the Cryostat report
generator.
displayName: Security Options
Expand Down Expand Up @@ -260,6 +292,38 @@ spec:
path: resources.grafanaResources
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:resourceRequirements
- description: Options to configure scheduling for the Cryostat deployment
displayName: Scheduling Options
path: schedulingOptions
- description: Affinity rules for scheduling Cryostat pods.
displayName: Affinity
path: schedulingOptions.affinity
- description: 'Node affinity scheduling rules for a Cryostat pod. See: https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/pod-v1/#NodeAffinity'
displayName: Node Affinity
path: schedulingOptions.affinity.nodeAffinity
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:nodeAffinity
- description: 'Pod affinity scheduling rules for a Cryostat pod. See: https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/pod-v1/#PodAffinity'
displayName: Pod Affinity
path: schedulingOptions.affinity.podAffinity
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:podAffinity
- description: 'Pod anti-affinity scheduling rules for a Cryostat pod. See:
https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/pod-v1/#PodAntiAffinity'
displayName: Pod Anti Affinity
path: schedulingOptions.affinity.podAntiAffinity
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:podAntiAffinity
- description: 'Label selector used to schedule a Cryostat pod to a node. See:
https://kubernetes.io/docs/concepts/configuration/assign-pod-node/'
displayName: Node Selector
path: schedulingOptions.nodeSelector
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:selector:core:v1:Node
- description: 'Tolerations to allow scheduling of Cryostat pods to tainted
nodes. See: https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/'
displayName: Tolerations
path: schedulingOptions.tolerations
- description: Options to configure the Security Contexts for the Cryostat application.
displayName: Security Options
path: securityOptions
Expand Down
Loading

0 comments on commit ffa9cbf

Please sign in to comment.