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

settings: adds new node-labels, node-taints settings #390

Merged
merged 1 commit into from
Oct 15, 2019
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
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,19 @@ See the [setup guide](INSTALL.md) for *much* more detail on setting up Thar and
* `settings.kubernetes.cluster-certificate`: This is the base64-encoded certificate authority of the cluster.
* `settings.kubernetes.api-server`: This is the cluster's Kubernetes API endpoint.

The following settings can be optionally set to customize the node labels and taints.
* `settings.kubernetes.node-labels`: [Labels](https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/) in the form of key, value pairs added when registering the node in the cluster.
* `settings.kubernetes.node-taints`: [Taints](https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/) in the form of key, value and effect entries added when registering the node in the cluster.
* Example user data for setting up labels and taints:
```
[settings.kubernetes.node-labels]
label1 = "foo"
label2 = "bar"
[settings.kubernetes.node-taints]
dedicated = "experimental:PreferNoSchedule"
special = "true:NoSchedule"
```

The following settings are set for you automatically by [pluto](workspaces/api/) based on runtime instance information, but you can override them if you know what you're doing!
* `settings.kubernetes.max-pods`: The maximum number of pods that can be scheduled on this node (limited by number of available IPv4 addresses)
* `settings.kubernetes.cluster-dns-ip`: The CIDR block of the primary network interface.
Expand Down
2 changes: 2 additions & 0 deletions packages/kubernetes/kubelet-env
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
NODE_IP={{settings.kubernetes.node-ip}}
NODE_LABELS={{join_map "=" "," "no-fail-if-missing" settings.kubernetes.node-labels}}
NODE_TAINTS={{join_map "=" "," "no-fail-if-missing" settings.kubernetes.node-taints}}
POD_INFRA_CONTAINER_IMAGE={{settings.kubernetes.pod-infra-container-image}}
2 changes: 2 additions & 0 deletions packages/kubernetes/kubelet.service
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ ExecStart=/usr/bin/kubelet \
--cert-dir /var/lib/kubelet/pki \
--volume-plugin-dir /var/lib/kubelet/plugins/volume/exec \
--node-ip ${NODE_IP} \
--node-labels "${NODE_LABELS}" \
--register-with-taints "${NODE_TAINTS}" \
Comment on lines +22 to +23
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are the quotes needed? The curly-brace form of the variable should ensure that it's passed as a single argument.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use quotes anyway, even if it's the same, to clarify purpose? systemd's behavior is confusing; quotes aren't.

--pod-infra-container-image ${POD_INFRA_CONTAINER_IMAGE}

Restart=on-failure
Expand Down
6 changes: 6 additions & 0 deletions workspaces/api/apiserver/src/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@ pub struct KubernetesSettings {
#[serde(skip_serializing_if = "Option::is_none")]
pub api_server: Option<String>,

#[serde(skip_serializing_if = "Option::is_none")]
pub node_labels: Option<HashMap<SingleLineString, SingleLineString>>,

#[serde(skip_serializing_if = "Option::is_none")]
pub node_taints: Option<HashMap<SingleLineString, SingleLineString>>,

// Dynamic settings.

#[serde(skip_serializing_if = "Option::is_none")]
Expand Down