Skip to content

Instantly share code, notes, and snippets.

View ThomasBuchinger's full-sized avatar

Thomas Buchinger ThomasBuchinger

View GitHub Profile
@ThomasBuchinger
ThomasBuchinger / 0_README.md
Last active August 29, 2022 18:59
create-or-update Vault-Secret in Terraform

Secrets

Unfortunately the secret handling in this module is quite complex. The problem is that:

  • The provider cannot update individual values in a secret, it always replaces the whole thing
  • You can use a datasource in terraform to read the current secret and merge it with the new data
  • A datasource cannot be optional. a secret mathing the name MUST exist in vault

Solution:

  • Compute all the paths where secrets should be stored
  • Check if a secret with that name already exists
@ThomasBuchinger
ThomasBuchinger / secret.yaml.j2
Created November 29, 2021 19:00
Kubernetes Secret from Jinja2-Template
---
apiVersion: v1
kind: Secret
metadata:
name: regcred
data:
.dockerconfigjson: {{ ('{"auths":{"https://registry.gitlab.com":{"username":"'+ var_api_user +'","password":"'+ var_api_token +'","auth":"'+ ((var_api_user +':'+ var_api_token) | b64encode) +'"}}}') | b64encode }}
type: kubernetes.io/dockerconfigjson
[Unit]
Description=Set the battery charge threshold
After=multi-user.target
StartLimitBurst=0
[Service]
Type=oneshot
Restart=on-failure
ExecStart=/bin/bash -c 'echo 60 > /sys/class/power_supply/BAT0/charge_control_end_threshold'

⚠️ I have not finished the project, therefore I do not yet know if anything is missing.

Main Parts

Part Link Notes
Wires -
3 Double-throw toggle switch -
up to 3RPI Header Pins reichelt.de Optional, but some components (switches) don't fit securely into the breadboard
apiVersion: operators.coreos.com/v1alpha1
kind: CatalogSource
metadata:
labels:
opsrc-provider: hub
name: operatorhub
namespace: openshift-marketplace
spec:
image: 'quay.io/operator-framework/upstream-community-operators:latest'
sourceType: grpc
@ThomasBuchinger
ThomasBuchinger / AeLoader.rb
Last active February 17, 2020 20:12
ManageIQ embedded Method Loader for rails console
class AeLoader
attr_accessor :handle
def initialize(handle=$evm)
# use the provides AeWorkspace or create a new one
@handle = handle.presence || get_evm
# this accessor method is needed (I know it is not pretty)
def @handle.workspace
@workspace
end