-
Notifications
You must be signed in to change notification settings - Fork 1
Affinity
R.deployment :backend do
pod_spec.affinity.node_affinity.required.add_term do
preference.match_expressions.exists 'backend-log-collector'
end
end
Schedule backend deployment pods to nodes that are labeled with backend-log-collector
label.
Sunstone property | Kubernetes property | Type |
---|---|---|
node_affinity | nodeAffinity | NodeAffinity |
pod_affinity | podAffinity | PodAffinity |
pod_anti_affinity | podAntiAffinity | PodAntiAffinity |
Sunstone property | Kubernetes property | Type |
---|---|---|
preferred | preferredDuringSchedulingIgnoredDuringExecution | Array of PreferredSchedulingTerm |
required | requiredDuringSchedulingIgnoredDuringExecution | NodeSelector |
Creates an instance of PreferredSchedulingTerm, calls optional block to initialize the term and then adds that term to the preferred
array:
R.deployment :backend do
pod_spec.affinity.node_affinity.add_preffered_term do
# Setup newly created term
end
end
Sunstone property | Kubernetes property | Type |
---|---|---|
preference | preference | NodeSelectorTerm |
weight | weight | Integer |
Sunstone property | Kubernetes property | Type |
---|---|---|
match_expressions | matchExpressions | NodeSelectorRequirementArray |
match_fields | matchFields | NodeSelectorRequirementArray |
An array with helper methods to add NodeSelectorRequirement instances.
Adds a NodeSelectorRequirement with specified key and operator Exists:
R.deployment :backend do
pod_spec.affinity.node_affinity.add_preffered_term do
preference.match_expressions.exists 'backend-log-collector'
end
end
Adds a NodeSelectorRequirement with specified key and operator DoesNotExists:
R.deployment :backend do
pod_spec.affinity.node_affinity.add_preffered_term do
preference.match_expressions.does_not_exists 'node-for-frontends'
end
end
Adds a NodeSelectorRequirement with specified key and values and operator In:
R.deployment :backend do
pod_spec.affinity.node_affinity.add_preffered_term do
preference.match_expressions.in :kind, 'php-backends', 'ruby-backends', 'dotnet-backends'
end
end
Adds a NodeSelectorRequirement with specified key and values and operator NotIn:
R.deployment :backend do
pod_spec.affinity.node_affinity.add_preffered_term do
preference.match_expressions.not_in :kind, 'frontends', 'service-workers'
end
end
Adds a NodeSelectorRequirement with specified key and integer value and operator Lt:
R.deployment :backend do
pod_spec.affinity.node_affinity.add_preffered_term do
preference.match_expressions.lt :volume, 42
end
end
Helper lt
has an alias less_than
for aesthetic purposes.
Adds a NodeSelectorRequirement with specified key and integer value and operator Gt:
R.deployment :backend do
pod_spec.affinity.node_affinity.add_preffered_term do
preference.match_expressions.gt :volume, 42
end
end
Helper gt
has an alias greater_than
for aesthetic purposes.
Sunstone property | Kubernetes property | Type |
---|---|---|
key | key | String |
operator | operator | String |
values | values | Array of String |
Sunstone property | Kubernetes property | Type |
---|---|---|
node_selector_terms | nodeSelectorTerms | Array of NodeSelectorTerm |
Helper to add and initialize term to the node_selector_terms
array:
R.deployment :backend do
pod_spec.affinity.node_affinity.required.add_term do
preference.match_expressions.exists 'backend-log-collector'
end
end
Sunstone property | Kubernetes property | Type |
---|---|---|
preferred | preferredDuringSchedulingIgnoredDuringExecution | Array of WeightedPodAffinityTerm |
required | requiredDuringSchedulingIgnoredDuringExecution | Array of PodAffinityTerm |
Helper to create, initialize and add an item to the preferred
array:
R.deployment :backend do
pod_spec.affinity.pod_affinity.add_preferred_term do
# Initialize newly created item
end
end
Helper to create, initialize and add an item to the required
array:
R.deployment :backend do
pod_spec.affinity.pod_affinity.add_required_term do
# Initialize newly created item
end
end
Sunstone property | Kubernetes property | Type |
---|---|---|
pod_affinity_term | podAffinityTerm | PodAffinityTerm |
weight | weight | Integer |
Sunstone property | Kubernetes property | Type |
---|---|---|
label_selector | labelSelector | LabelSelector |
namespaces | namespaces | Array of String |
topology_key | topologyKey | String |
Without arguments namespaces
helper returns current list of namespaces. If one or more values is passed to the helper they are added to the list of namespaces:
R.deployment :backend do
pod_spec.affinity.pod_affinity.add_required_term do
pod_affinity_term do
namespaces 'master', 'production'
end
end
end
For aesthetic purposes an alias namespace
is provided.
Sunstone property | Kubernetes property | Type |
---|---|---|
preferred | preferredDuringSchedulingIgnoredDuringExecution | Array of WeightedPodAffinityTerm |
required | requiredDuringSchedulingIgnoredDuringExecution | Array of PodAffinityTerm |
Helper to create, initialize and add an item to the preferred
array:
R.deployment :backend do
pod_spec.affinity.pod_affinity.add_preferred_term do
# Initialize newly created item
end
end
Helper to create, initialize and add an item to the required
array:
R.deployment :backend do
pod_spec.affinity.pod_affinity.add_required_term do
# Initialize newly created item
end
end