Skip to content

23rd Week of 2022

Coding

Generic Coding Practices

Use warnings to evolve your code

  • New: Change signature of method if you can.

    You can take the chance of the deprecation to change the signature of the function, so that if the user is using the old argument, it uses the old behaviour and gets the warning, and if it's using the new argument, it uses the new. The advantage of changing the signature is that you don't need to do another deprecation for the temporal argument flag.

Python

  • New: Add huey.

    huey is a little task queue for python.

DevOps

Infrastructure as Code

Helmfile

  • Correction: Tweak the update process to make it more resilient.

    • Check that all the helm deployments are well deployed with helm list -A | grep -v deployed
    • Change the context to the production cluster before running the production steps
  • New: Fix Cannot patch X field is immutable error.

    You may think that deleting the resource, usually a deployment or daemonset will fix it, but helmfile apply will end without any error, the resource won't be recreated , and if you do a helm list, the deployment will be marked as failed.

    The solution we've found is disabling the resource in the chart's values so that it's uninstalled an install it again.

    This can be a problem with the resources that have persistence. To patch it, edit the volume resource with kubectl edit pv -n namespace volume_pvc, change the persistentVolumeReclaimPolicy to Retain, apply the changes to uninstall, and when reinstalling configure the chart to use that volume (easier said than done).

Automating Processes

cruft

  • New: Use skip to avoid problems with .git.

    Since 2.10.0 you can add a skip category inside the .cruft.json, so that it doesn't check that directory:

    {
      "template": "xxx",
      "commit": "xxx",
      "checkout": null,
      "context": {
        "cookiecutter": {
           ...
        }
      },
      "directory": null,
      "skip": [
        ".git"
      ]
    }