Tag: english

How does Kubernetes select labels?

kubectl has the feature to select objects by filtering on labels using the -l flag. Labels are key-value pairs attached to objects as metadata and they don’t have to be unique. I’ve most often seen them used to identify what project or app an individual resource belongs to. Helm uses labels to mark resources with the app, chart and revision they belong to.

But wait, if they’re not unique and there is a way to select multiple values with set operators, how does that work? The database backing Kubernetes by default, etcd is a key-value store. While it can natively select multiple records by prefix matching, it’d be hard to imagine labels working like that. There are many of them and the selectors are complex.

So I dove into Kubernetes’s source code to figure out how it works.

Partition of integer into exactly the given number of distinct parts

Ran into this issue in a programming challenge on HackerRank and I was surprised there weren’t any “simple” solutions online. The math related is mostly focused on finding the number of possible partitions of an integer, instead of generating even just one such partition.

A very naive approach might be to enumerate all partitions and then filter them down to those with exactly the wanted number of summands and then filter further to those with distinct parts and pick the first that fulfills the conditions.

But when the subject integer can be 1018 then that simply isn’t realistic. Insert sophisticated simile involving the heat death of the universe.


Using supplemental oxygen for high altitude climbs is common. I’ve even seen people use mini oxygen tanks on Mt Fuji. While it’s highly unlikely you’d need extra oxygen around that altitude (unless you go there with absolutely no training and the lung capacity of a goldfish), it can keep people alive and let them succeed above 8000m.

I don’t know who came up with the idea that climbing without supplemental oxygen is the only “fair means” to reach a summit (maybe Messner?), but I beg to differ. It is definitely a bigger achievement but that does not make using it cheating or doping.

The algorithms

Honing your skills on CodeWars or HackerRank is definitely a good idea. I’ve myself spent months on the former and some time on the latter, and right there is a display of my issue with them: I lose interest. At first it’s really nice to tackle a bunch of “interesting” problems and feel successful, but as the difficulty of the problems goes up, it soon turns into “how do I get around the shortcomings of the language I use?”

That’s naturally something worth considering, but it just feels so weird when I have to overcome performance tests aimed at C in Ruby (or Clojure). It’s doable (most of the time), but it’s a whole different kind of measure. I recall a problem for which solutions in C were mostly pretty naive loops while something similar in Ruby would fail even the first few load tests.

Counting the milliseconds

I’ve been building a Netty-based web server in Clojure. While I haven’t had the strength to do much with it these past few months because I prioritized the climbing season, now that Hacktoberfest is incoming I’m planning to go pedal to the metal with it (and with my git GUI work-in-progress).

I’m building iny (named after a fox from Fekete Istvan’s Vuk) with the clear goal to replace Aleph. While I’m a huge fan of Aleph and the libraries around it (like Manifold) it’s no longer maintained, which is simply not acceptable when we’re now looking at http/3 coming out sooner than later (support is already in browsers after all).

Going green

There is kind of a status to having your GitHub contributions chart covered in green. For those unfamiliar, it’s a calendar-like chart that shows how active you are on GitHub any given day. It’s assumed that the greener the better. I’m not so sure anymore.

From the start of May to the end of July, I tried filling it up. Do something every day. My conclusion is that this is a typical case of Goodhart’s law. Basically as soon as a certain metric (in this case turning that chart green) becomes a goal in itself, it ceases to be a meaningful metric anymore.

GitOps and Kubernetes persistence

A while back I wrote about bootstrapping a Kubernetes cluster. I’ve been refining the setup so that it requires as little manual kubectl‘ing as possible. I still use ArgoCD to get everything rolling, and there is one bit that kept going red: persistent volumes.


I got really fed up with sitting at home because of covid. So instead I rented a car and went for a snowy hike where I wouldn’t be likely to run into people: Mt Asama, an active volcano. In fact I only ran into 1-2 people on the way.

Return to Kumotori

While other countries have pretty harsh lockdown rules (from what I hear on the news), Japan is pretty lax about that. While commuting to work by train is discouraged, I figured going up in the mountains (where there are hardly any people) it can’t hurt, right?

Training for Aconcagua

After Elbrus and Kilimanjaro, I knew I can’t take Aconcagua lightly. At almost 7000m it’s the highest mountain outside of Asia and thus the second highest of the Seven Summits. Working full time, the time I had available for training was very limited. This was before covid hit either, so I actually had to commute to the office too, which is about an hour one way. So what can the man do if he only has so many hours in the day and he needs some sleep too, but training has to be done for Aconcagua?