Kernel Module Management testing

Following on the Using Kcli to prepare for OCM testing, we’re going to prepare KMM testing in Hub-Spoke approach. First we need to prepare our .docker/config.json with the contents of our OpenShift pull secret used with Kcli. mkdir -p ~/.docker/ cp openshift_pull.json ~/.docker/config.json Warning advisories Note Semi-scripted version available at automate.sh Warning We’re using pre-release bits of the software, that’s why we need to define a custom catalog for both the Hub and the Spokes. Once KMM is released it will be available from the official one and just the Policy will be needed. ...

January 19, 2023 · 6 min · Pablo Iranzo Gómez

Using Kcli to prepare for Open Cluster Management testing

Kcli allows to quickly interact with different virtualization platforms to build machines with some specific configurations, and via the use of plans it allows to automate most of the setup required to have an environment ready. In our case, let’s setup an environment to practice with Open Cluster Management but instead of using kind clusters, let’s use VM’s. Note We’ll require to setup an openshift_pull.json file for Kcli to consume when accessing the required resources for this to work. That file, contains the credentials for accessing several container registries used for the deployment. ...

December 23, 2022 · 5 min · Pablo Iranzo Gómez

[python] Generate ranges from items

Some years ago, I added a script for updating headers for (C) in the python files I was developing for Risu. In this way, the header got the list of authors and years working on the files updated automatically. With the pass of the years, the list started to became a bit too long, so I worked on creating code for getting ranges instead. This is the code I used: def getranges(data): """ From list of strings representing numbers, get ranges and return list of strings :param data: list of strings representing numbers :return: list of strings with number ranges when > 1 """ # Convert to integers data = [int(i) for i in data] result = [] if not data: return result # Prepare iteration loop idata = iter(data) first = prev = next(idata) first = first prev = prev # Process next item for following in idata: if following - prev == 1: # Years are continuum, just update previous prev = following else: # Years are not continuum, end range and start again if first == prev: result.append(first) else: if first + 1 == prev: # Only one item in difference, append items individually result.append(first) result.append(prev) else: result.append("%s-%s" % (first, prev)) first = prev = following # Catchall for regular execution or last remaining range if first == prev: result.append(first) else: if first + 1 == prev: # Only one item in difference, append items individually result.append(first) result.append(prev) else: result.append("%s-%s" % (first, prev)) # Convert back to text result = [str(i) for i in result] return result With it, previous headers like: ...

November 25, 2022 · 2 min · Pablo Iranzo Gómez

Automate code build and deployment with ansible

Let’s say that we want to keep our system updated with some code which is not distributed as a regular package, but as a code in a repository (which unfortunately, it’s a pretty common situation). As a part of the ansible playbooks used for the hosts, I can add a snippet like this: gitrepos: - { url: "https://github.com/myrepo/repo.git", tag: "tagtocheckout", folder: "/root/path-for-check-out", chdir: "subdir to enter", build: "make build", exec: "build/mybuiltbinary", } With this definition in the host inventory, we can then in our playbook to perform several steps: ...

November 9, 2022 · 3 min · Pablo Iranzo Gómez

OpenShift's oc debug and parallel execution

A colleague reported some issues in the OpenShift troubleshooting and diagnosis scripts at OpenShift-checks. Some time ago I did contribute some changes to use functions and allow using the RISU wrapper to the scripts, helping consuming the results via RISU’s HTML interface. As my colleague reported, for some plugins, the output of the command was not shown in the HTML Interface. After some investigation, it was found that parallel execution for the plugins was causing no output to be shown, but when filtering to individual ones via risu -i XXXXXXX/plugin -l it was working fine… the problem was not the check itself, as both of them worked fine when executed individually but failed when executing them together. ...

November 3, 2022 · 2 min · Pablo Iranzo Gómez
This blog is a participant in the Amazon Associate Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.