Skip to content
EN

Back to the catalog

andrew-kirkpatrick.com
rss2British English

Andrew Kirkpatrick

andrew-kirkpatrick.com · British English

rss2 wordpress content slash wfw atom dc sy

Open the feed

https://www.andrew-kirkpatrick.com/feed/

Last post
Nov 15, 2024
Posts in 24 h · 7 days · 30 days
0 · 0 · 0
Our last check
Answering
Served from
United Kingdom
Text score at discovery
1,703
Format
rss2
Features in the feed
content, slash, wfw, atom, dc, sy
Community
wordpress

Posts

What our queue read from this feed. Open one to read it here, or go to the site that published it.

  1. Generate JWT and access Token for GitHub API using App credentials
    Nov 15, 2024 · original
    For some reason the GitHub API will either take a JWT or an access token depending on which endpoint you are accessing. It’s often not clear which is required, but it’s useful to have both available so that you can access the broad spectrum of endpoints they provide. If you are using a GitHub App you can generate these using the PEM private key. View the code on Gist .
  2. Automatically print usage for Golang Cobra CLI sub-commands
    Nov 8, 2024 · original
    When you run a Cobra (Golang CLI) application, it will print out nicely-formatted usage information derived from the root command. However it is up to you to print out subsequent usage information for commands underneath and their subcommands. $ go run main.go Various functionality for doing things from the CLI. Usage: your-binary [command] Available Commands: ... By accessing fields in the command and the sub-commands you can print similar usage information as the root command. View the code on Gist . $ go run main.go exp Testing various functionality for this application. Usage: your-binary test [subcommand] Available Subcommands: delete Delete a test release Release a test
  3. Use ElasticMQ to test AWS SQS using AWS SDK v2 in Golang
    Jun 17, 2024 · original
    AWS SQS can be great low-friction service for developing applications that use a queue. But being a cloud-based managed service, how would you write isolated integration tests for it? Without either sharing a queue, or creating new queues in AWS each time, you can run ElasticMQ as an SQS-compatible queue and configure the AWS SDK to use that instead. There are less examples for version 2 (v2) of the AWS SDK, but the concept works similarly in Golang as with other programming languages. The main different between the AWS SDK v1 and v2 is needing to use an endpoint resolver to force the SDK to talk to ElasticMQ, since it will not respect the endpoint provided as part of the queue URL anymore. View the code on Gist . You can either create a new queue using the AWS SDK and use the returned queue URL to send and receive messages or you can configure ElasticMQ to create specific queues on star
  4. Convert existing namespace to subnamespace using Hierarchial Namespace Controller
    Apr 19, 2024 · original
    The Hierachial Namespace Controller is great for simplifying managing multiple namespaces that can be grouped together, but what if you already have all your namespaces created and being used? Since Kubernetes is declarative we can update the existing namespaces and add configuration to tell the controller what we are trying to do. If you have the kubectl-hns plugin installed you can see a hierarchial tree view of all namespaces. Initially it will appear flat. $ kubectl hns tree --all-namespaces # pepperoni # pizzeria To change and convert a namespace to become a subnamespace we need to create a relationship between them. This can be done with an annotation and a CustomResourceDefinition called a SubnamespaceAnchor . View the code on Gist . If those commands run successfully then the hierarchial tree view of all namespaces should now show the child namespace as a subnamespace of the pare
  5. Scheduled Deployment Pod rollout restarts using Kubernetes CronJob
    Apr 15, 2024 · original
    Most of the time your Deployments will self-heal when your Pods crash, Nodes go down or other unexpected circumstances. When your Pods get stuck, projects like https://github.com/kubernetes-sigs/descheduler do a good job of automatically restarting or rescheduling them. But what if you just want a simple restart every so often (say once a week) or on specific days of the month? Then all you need is a CronJob. Have included placeholders where the Helm release namespace would represent where these resources are created and managed, versus the namespace of the application(s) you are trying to restart. If you template this with Helm values you can avoid using a ClusterRoleBinding to allow the ServiceAccount to restart Deployments anywhere in the cluster, but only the namespaces of the applications you are restarting. View the code on Gist . Many thanks to https://stackoverflow.com/questions/
  6. Adopt existing Deployment, StatefulSet or Daemonset resources into Helm install
    Apr 28, 2023 · original
    Most Helm adoption kubectl examples will show adding the annotations and label required for Helm 3 to adopt resources, but with Deployments this may cause issues if the nested Pod spec isn’t patched also. Either way you will need to add a app.kubernetes.io/managed-by label and meta.helm.sh/release-name and meta.helm.sh/release-namespace annotations. For most resources you can simply label or annotate the spec using kubectl label and kubectl annotate commands respectively. View the code on Gist . However for the Pod spec in Deployments, StatefulSets or DaemonSets you will need to patch the nested Pod spec. Patching the Pod spec can be done with the kubectl patch command, which you can pass the label or annotation updates to with JSON. View the code on Gist .
  7. Open Policy Agent example using Terraform
    Apr 25, 2023 · original
    Simple example of how to use Open Policy Agent with Terraform including setting up a GitHub Action . The Agent can either be run as an API (that you can query) or in standalone mode (via the command line) and requires 3 things, Policies, Inputs and a Query. Documentation does not explain particularly well (for a newcomer) what each part of the supplied commands do, so please find a breakdown below. Additionally there is a slightly easier-to-read explanation of how OPA works. Here we will be looking at evaluating multiple Rules using a Query. I created a corresponding Git repository for the examples provided. What is a Policy? A Policy is simply a collection of Rules. Open Policy Agent will usually evaluate multiple Policies at once, called a Bundle (of Policies) By convention these are usually in a directory called policy . Policies are written in Rego DSL . What is a Rule? Rules are ess
  8. Setting up Workload Identity on GKE per service/namespace
    Feb 24, 2023 · original
    Workload Identity on Google Kubernetes Engine allows you to access Google Cloud services directly from a container in a Pod. This works by binding the Kubernetes Service Account to the Google Cloud Service Account, which visually looks confusing since they both have a very similar format as email addresses! The Google Cloud documentation for Workload Identity is a little abstract, so I’ve provided some code snippets for the Terraform required to create the Google Cloud Service Account and allow it to be used by a Kubernetes Service Account in GKE. View the code on Gist . You can test whether this works as expected by spinning up a Pod that uses the Kubernetes Service Account that can bind to the Google Cloud Service Account that has Workload Identity enabled. View the code on Gist . If you shell into the running Pod (or execute the command remotely) you can see whether the Google Cloud M
  9. Use Bash to wait for Docker container to start by tag
    Jan 4, 2023 · original
    If you run a container in the background and want to wait until it has started up before doing anything else, you can use a combination of docker ps and docker inspect to check within a Bash loop whether it is finally running. This can be useful if you want to run tests checking if the container is responding on a specific port for example. View the code on Gist . You can remove the --all option for docker ps and the head pipe afterwards if you know there will only be a single running instance of the container tag, but the provided example is safer (as containers in “running” status should be at the top of the list)
  10. jq error key/0 is not defined when selecting fields with numbers and dashes
    Jun 10, 2022 · original
    If you are trying to select a JSON field with a number or dash, you may get a jq compile error. As mentioned in a GitHub issue , the key gets parsed as a substraction so we need to enclose it in additional quotes. View the code on Gist .

Discovered by the rss-feed-index crawler, which checks each feed at most once a month.

Same record as JSON: https://api.agentalog.com/api/feeds/fd_andrew_kirkpatrick_com_f442a167f0f3e99f. More from this site: andrew-kirkpatrick.com in the Feeds tab.