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

kubernetes: bottlerocket doesn't understand the "Exists" taint #1302

Closed
diranged opened this issue Feb 6, 2021 · 1 comment
Closed

kubernetes: bottlerocket doesn't understand the "Exists" taint #1302

diranged opened this issue Feb 6, 2021 · 1 comment
Assignees
Labels
area/kubernetes K8s including EKS, EKS-A, and including VMW type/bug Something isn't working

Comments

@diranged
Copy link

diranged commented Feb 6, 2021

Platform I'm building on:
Bottlerocket 1.0.5 on EKS 1.18

What I expected to happen:
Kubernetes has an Exists taint that has no value key in it. So the CLI argument looks like this:

kubelet ... --register-with-taints=MyKey:NoSchedule

and a matching Toleration would look like this:

tolerations:
  - operator: Exists
    key: MyKey
    effect: NoSchedule

However, there is no way to put that into the settings.kubernetes.node-taints configuration because the pattern is hard-coded to expect an Equals taint:

NODE_TAINTS={{join_map "=" "," "no-fail-if-missing" settings.kubernetes.node-taints}}

What actually happened:
I could not boot up nodes - they failed to parse the key and threw an error.

@jhaynes jhaynes added area/kubernetes K8s including EKS, EKS-A, and including VMW status/needs-triage Pending triage or re-evaluation labels Feb 8, 2021
@jhaynes jhaynes added priority/p0 type/bug Something isn't working and removed priority/p1 status/needs-triage Pending triage or re-evaluation labels Feb 12, 2021
@jhaynes jhaynes self-assigned this Feb 12, 2021
@etungsten etungsten assigned etungsten and unassigned jhaynes Mar 18, 2021
@etungsten
Copy link
Contributor

etungsten commented Mar 19, 2021

Hi @diranged,

The --register-with-taints argument to kubelet takes a list of taints of the form <key1>=<value1>:<effect1>,<key2>=<value2>:<effect2>. The equal sign is a necessary part of the separators. (See documentation for this argument here and here).

The problem is that the validation we have for KubernetesTaintValue currently doesn’t allow for an empty taint value.

// =^..^= =^..^= =^..^= =^..^= =^..^= =^..^= =^..^= =^..^= =^..^=
/// KubernetesTaintValue represents a string that contains a valid Kubernetes taint value, which is
/// like a label value, plus a colon, plus an "effect". It stores the original string and makes it
/// accessible through standard traits.
///
/// Note: Kubelet won't launch if you specify an effect it doesn't know about, but we don't want to
/// gatekeep all possible values, so be careful.
// Note: couldn't find an exact spec for this. Cobbling things together, and guessing a bit as to
// the syntax of the effect.
// https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#syntax-and-character-set
// https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/
#[derive(Debug, Clone, Eq, PartialEq, Hash)]
pub struct KubernetesTaintValue {
inner: String,
}
lazy_static! {
pub(crate) static ref KUBERNETES_TAINT_VALUE: Regex = Regex::new(
r"(?x)^
[[:alnum:]] # at least one alphanumeric
(
([[:alnum:]._-]{0,61})? # more characters allowed in middle
[[:alnum:]] # have to end with alphanumeric
)?
: # separate the label value from the effect
[[:alnum:]]{1,253} # effect
$"
)
.unwrap();
}

This is being fixed in #1406. Once that’s merged, you should be able to specify taints without values and use Exists tolerations. For example, in userdata:

[settings.kubernetes.node-taints]
MyKey = ":NoSchedule"
SomeOtherKey = "SomeValue:NoSchedule"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/kubernetes K8s including EKS, EKS-A, and including VMW type/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants