Skip to content

Instantly share code, notes, and snippets.

@micahhausler
micahhausler / custom-duration-seconds-example.yaml
Last active August 9, 2023 21:20
Example ConfigMap, ServiceAccount, and Pod with a custom duration_seconds
apiVersion: v1
kind: ConfigMap
metadata:
name: aws-config
data:
credential-process: |
#!/usr/bin/env bash
aws sts assume-role-with-web-identity \
--duration-seconds 43200 \
--web-identity-token file:///var/run/secrets/eks.amazonaws.com/serviceaccount/token \
@micahhausler
micahhausler / config.ini
Created August 9, 2023 13:25
AWS config file
[default]
region = us-west-2
role_arn = arn:aws:iam::123456789012:role/role-name
web_identity_token_file = /var/run/secrets/eks.amazonaws.com/serviceaccount/token
duration_seconds = 43200 # 12 hours, maximum
# role_session_name = pod_name
@micahhausler
micahhausler / test_runner.go
Created February 10, 2023 16:07
Reflective Go Test Runner
package tests
import (
"reflect"
"strings"
"testing"
)
type TestRunner struct{}
@micahhausler
micahhausler / policy.json
Last active July 3, 2022 13:04
unifi dream router podman configs
{
"default": [
{
"type": "insecureAcceptAnything"
}
],
"transports":
{
"docker-daemon":
{
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "sts:AssumeRole",
"Resource": "arn:aws:iam::444455556666:role/account-n-role"
}
]
}
@micahhausler
micahhausler / Makefile.diff
Last active June 13, 2021 16:13
Tinkerbell hook config for Intel NUC
diff --git a/Makefile b/Makefile
index 253d32b..7329f04 100644
--- a/Makefile
+++ b/Makefile
@@ -22,11 +22,11 @@ export DOCKER_CLI_EXPERIMENTAL := enabled
image-amd64:
mkdir -p out
- linuxkit build -docker -disable-content-trust -pull -format kernel+initrd -name hook-x86_64 -dir out $(LINUXKIT_CONFIG)
+ linuxkit build -docker -format kernel+initrd -name hook-x86_64 -dir out $(LINUXKIT_CONFIG)
syntax = "proto3";
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
import "google/protobuf/any.proto";
package v1alpha1;
service TokenGeneratorService {
// Generate a token with the provided claims
rpc GenerateToken(GenerateTokenRequest) returns (GenerateTokenResponse) {}
@micahhausler
micahhausler / service.proto
Created February 5, 2021 18:11
k8s external token generator
syntax = "proto3";
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
package v1alpha1;
service TokenGeneratorService {
// Generate a token with the provided claims
rpc GenerateToken(GenerateTokenRequest) returns (GenerateTokenResponse) {}
// List all active public keys
@micahhausler
micahhausler / Dockerfile
Created February 10, 2020 18:40
amazon-eks-pod-identity-webhook-issue-34
FROM php:alpine
RUN apk -U add composer && \
composer require aws/aws-sdk-php
ADD ./script.php /opt/code/script.php
CMD php /opt/code/script.php
@micahhausler
micahhausler / main.go
Last active August 22, 2019 01:37
CloudConfig loop vs global map benchmark
package main
import (
"fmt"
"github.com/aws/aws-sdk-go/aws/endpoints"
"gopkg.in/gcfg.v1"
)
type CloudConfig struct {