TIL: a bit more of YAML and kubectl

For some reason I needed a running pod to be able to access the value of its own container image(s). I initially thought of the Downward API but while it can give you the pod’s name, IP and other stuff, and even access resource limits per container using their name, the image is one of the attributes that is not immediately available. But the Downward API allows for metadata annotations to be available. So one can define a pod like:

apiVersion: v1
kind: Pod
metadata:
  annotations:
    nginx_container: bitnami/nginx:1.23.2
  labels:
    app: nginx
  name: nginx
spec:
  containers:
  - image: bitnami/nginx:1.23.2
    name: nginx
    env:
    - name: IMAGE
      valueFrom:
        fieldRef:
          fieldPath: metadata.annotations['nginx_container']

But this has the drawback of defining the image value in two places in the same file. Unless you can template this out with helm, or you generate the YAML via some other automation, this is an invitation for a bug the time when you will forget to update both places. Is there a better way?

Of course there is, and I might have seen it sooner had I not been fixed on utilizing the Downward API. The answer is YAML anchors and aliases:

apiVersion: v1
kind: Pod
metadata:
  labels:
    app: nginx
  name: nginx
spec:
  containers:
  - image: &nginx_image bitnami/nginx:1.23.2
    name: nginx
    env:
    - name: IMAGE
      value: *nginx_image

“You cannot always work with the best”

It has been a while since I last blogged, and I find myself repeating the following story in discussions lately, so why not put it down here too:

When I was serving at the Air Force, for some reason we got into a discussion with the Warrant Officer in charge about manning the posts and specific persons on location. And he told me:

George, you cannot always work with the best

This struck me very hard, because up until that time, I was very used to work with "the best" in environments that allowed for rapid personal growth and learning and had not internalised my luck of having world class scientists allowing me to work with them.

The second reason why this struck me was because of Joy’s Law

no matter who you are, most of the smartest people work for someone else

and all this was happening in a discussion about guard duty.

A different kind of life

Williams: A Different Kind of LifeWilliams: A Different Kind of Life by Virginia Williams
My rating: 5 of 5 stars

This is a very important book regardless of whether you are a F1 fan or not. Actually there is very little F1 racing in the book. This is a book about pivotal life changes. It describes the life Virginia Williams had with Frank before and after the accident that left him paralyzed from the neck down.

As such this book is about caregivers; the untrained, totally unprepared family members who are suddenly efforted to be a complete support infrastructure 24×7.

There are many books about disabled persons who overcame and thrived. There are none about caregivers and what it means to them.

I recognized every bit of hope, pain and frustration expressed in the book. Even to the point of (over)using painkillers as a crutch to make it though the day dealing with both the emotional and physical pain.

View all my reviews

TuneIn as a poor-man’s network alert

I used to get irked when colleagues streamed music from radio stations to their desktop at work, when they could have the same result with a cheap radio without eating up bandwidth. Nowadays not so much, all of them are remote, so do what you want in your space.

However, with the rise of digital assistants and the smart speakers you can cast a local station or even stream something from TuneIn (Alexa play Jazz24) and with home bandwidth improving you can get better sound quality than FM stereo.

And of course be alerted when your network is down. Because streaming stops. Just like in the old days when people sonified pings on the Ethernet or even actual traffic.

Yes, it is kind of a slow day today…

It’s a trap; say no

It happened that I switched jobs at the end of August. Upon hearing that this was about to happen, a friend pinged me and asked whether he could hire my services for "one to two hours per week". I rejected the offer. I specifically told my friend that "one hour per week is a trap":

A week is 168 hours. You sleep 56 of them, so let’s say that you have to give 1 hour out of 112. To be more precise, 1 hour out of 72 you can spare. Surely you can allow yourself 1 hour of a side-gig, right? But then it is Monday. And you start your working day, and "oh, I’ll deal with this tomorrow" and this goes on until Friday and you say, "I’ll do it Saturday morning before the other chores". And you squeeze that hour somewhat grudgingly, between Saturday and Sunday night.

If I’m wrong, why are then all those Udemy / whatever vocational courses you’ve purchased unfinished? Did interest wane down on all of them right after the first couple of hours?

So say no to "one hour per week engagements". You’re setting up yourself for frustration and failure.

As for me, I’ve arranged for virtual coffee with my friend once per month to discuss his vision and progress. Because everyone needs someone to talk to.

email is still your best backup social network

We communicate through a host of applications using our own devices. In my phone I count 29 installed. Granted, not all of them are in frequent use, but all of them are installed for a reason: Some contact of mine is using some application, be it much popular, or less, or even something like Amazon Chime which you need to converse with AWS people.

Sometimes, infrastructures supporting those applications suffer outages and depending the userbase, pain gets expressed in Twitter, Facebook or LinkedIn, or even internal jokes like "Slack is down, let’s increase productivity until it gets up".

So it occurred to me, that even though every 5 years or so we see a new application claiming to solve texting, email is still the best backup solution:

  • even though it is mostly controlled by 5 big walled gardens, they are not one garden and you can always run your own with some varying success of compatibility if you wish to undertake the pain.
  • while I used to complain about "email not being FTP", it is still used as a file transfer mechanism.
  • while I used to complain about top posting in replies (I used to prefer inline replies), regardless of how ugly it may seem at times, you have a complete log of the communication history.
  • you can use your email store as document database (yes it was not designed for this, I hated the fact, but let’s move on; people search their emails to find stuff they remember being there).
  • while I used to complain a lot about HTML email, you still have the ability to at least send as plain or flashy emails as you like and they will be received and read (in the majority of cases) as you expect.
  • you are not confined to a single application for reading and sending email. People still write mail clients.
  • almost any booking / purchasing system you use sends you an email of what you transacted about. They do not seek your Skype, Messenger, Discord or what. They fall back to your best backup social network: email.
  • while it is not instant messaging, as I still tell people, most emails arrive soon enough to feel like it is.
  • it can be a 1:1 communication medium, 1 to many (a newsletter), or even many to many (mailing lists, Reply All).
  • spammers and other cyber villains still attack through it, so it is in wide use, even if it is not the cool kid in town.

I’ve come to terms with this kind of underground success: It does everything almost good enough and in the background. It is nobody’s first choice, but it is everybody’s common denominator because of the good enough factor.

Now if only I could persuade my children to fill the Subject: line when emailing me…

Programming languages I spend my time on

I do not remember the podcast episode where the guest mentioned something that stuck with me: JVM is the single piece of software that has been so thoroughly engineered. Exaggeration aside, the guest was mostly right. We deploy tons of stuff that runs on JVM and we have to turn a multitude of knobs (usually by copy-pasting from SO/SF) until it somehow works. That’s why I learned Groovy. To be able to write 10 lines of code that would run on the JVM.

Erlang’s BEAM is another platform that needs to be mentioned. It still does not have the adoption it should given that we now run distributed systems all the time and need to orchestrate stuff. We prefer to hit our hammers on Kubernetes instead. Maybe this is because of the Prolog-like feeling of Erlang. That’s why Elixir has been in my bucket list. I’ve not written a single line of code yet.

Golang is the obvious suspect when you’re paid to run stuff on Kubernetes. The combination is like C and Unix: Go and Kubernetes. There’s nothing more to add here.

LLVM is other thing to look into. It seems to be the compiler backend, especially when you’re not writing a compiler of your own. Guess what? Julia is the thing I’m looking into. At a point in time, you’re going to need something different than Python and Pandas or other combination. My bet is Julia. I have written 10 lines of code in it :)

Anything more exotic? Well, as I am approaching 50, I’m thinking of visiting APL. But not without a project at hand.

I could have invested all this time and learn a single language instead: C++

When you quickly need a proxy server

Sometimes you need a proxy server. Not because you really want to proxy and cache stuff, but because you want to study the behavior. Yesterday was such a day for me. I just wanted to see what calls were made by a program and I needed something to intervene. Not something fancy. I went to DockerHub searched for squid in the box and sure enough, Canonical has an image uploaded:

docker run --rm -p 3128:3128 ubuntu/squid

That single line pushed things a bit forward for me last night.

Random thoughts on clouds and computers

Things that returned to my mind as I sat today in front of the screen:

  • The Datacenter as a Computer, book. A PDF can be found here.
  • AWS, Azure, Google Cloud, Alibaba, Digital Ocean
  • Thomas Watson saying “I think there is a world market for maybe five computers”
  • Ken Thompson saying “The future of OS is just a stream to the cloud. Doesn’t see “universal cloud computer” Companies will try to dominate.” Cloud Drives, your music from a streaming service, even your Office documents, etc.

    Right now I am subscribed to two cloud drives and am battling migrating from one to the other. It took about a year for one client to not crash when downloading the whole content locally.
  • An old post of mine that I never expanded on, just like this one.

I’m too old for this sh*t – part II

Yesterday my daughter’s phone was permanently stuck in fastboot. She tried a couple of remedies from YouTube videos and managed to boot it, but still on every reboot the fastboot logo was there and she had to press Volume Up and Power to boot it. On top of that, the Volume Down button was not responsive and the Volume Up was working, however after setting it, volume was immediately reset to zero.

No worries kid, you have device backup, so let’s try to factory reset the phone and restore from the latest backup. Oh, but the phone is on Family Link and it cannot be factory reset. Family Link should be able to reset it, however "if the option is not there you need to add an account to the phone". OK, let’s add the account to the phone. Only I cannot add my account to the phone, only a school account. Well, there are no Greek Public School accounts in Google. Still no option to reset.

Out of "random acts of panic" (an expression coined by a good friend of mine), I did random pressings of Volume Up, Volume Down and the Power button. I was either greeted by the fastboot logo, or the OS with the erratic button behavior.

Random googling directed me to install the Android Platform Tools. Really? I have to be a developer just to unlock the phone. So be it. Well neither adb devices nor fastboot devices showed any connected device. Of course the phone needs to have the Developer Options enabled. And of course this is prohibited by Family Link. Thankfully it allowed for it to be enabled. Now interestingly adb devices listed the phone but fastboot devices did not. I reboot the phone. adb devices does not list it, fastboot devices does. Random googling says fastboot reboot should clear the issue. It does not. I’m also told fastboot wipe data will wipe the phone (which is what I want). It does not because the phone is locked and you need to download Mi unlock for which you need a Mi account. Oh but we do not remember yet another password (The Mi account was created with Google auth). And right now the phone refuses to boot and accept SMS to reset the password, and I’m really bored / torn down to move the SIM to an older phone (I do not even think I have a SIM adapter for the older phones around).

I’m kind of angry and after a couple of fastboot reboot with no result (remember the definition of insanity?) I just press Volume Up (or Down, I can’t remember) and the Power button. And I am greeted with the holy menu that allows me to wipe the phone. The Volume Down button still does not navigate but thankfully the Volume Up circles through and I reach the treasure.

The phone is wiped out, restored and operational again.

I’m really, really tired.

I only want to yell