Skip to content

Instantly share code, notes, and snippets.

View sergsoares's full-sized avatar

Sergio Soares sergsoares

View GitHub Profile
@sergsoares
sergsoares / plan.md
Created March 7, 2026 20:20
Ralphex Plan file output

Deploy snotes to k0scluster via Flux

Overview

Build the apps/snotes project as a container image tagged docker.io/localhost/snotes:latest, import it directly into k0s containerd (no SSH needed — same machine), and create Flux-managed Kubernetes manifests in clusters/thelab/snotes/ following the clusters/thelab/apps/ pattern. Git sync is explicitly disabled via env var. imagePullPolicy is Never so k0s uses the locally imported image.

apiVersion: k0sctl.k0sproject.io/v1beta1
kind: Cluster
metadata:
name: k0s-cluster
user: admin
spec:
hosts:
- ssh:
address: localhost
user: root
@sergsoares
sergsoares / Justfile
Created May 29, 2023 17:59
Justfile to apply argocd inside a cluster
init:
colima start argocd-selfmanaged --kubernetes
kubectl-get-nodes:
kubectl get nodes
kubectl get pods -A
kubectl-apply-argocd:
kubectl create namespace argocd
kubectl apply -n argocd -f https://raw.githubusercontent.com/argoproj/argo-cd/stable/manifests/install.yaml
@sergsoares
sergsoares / Makefile
Created April 11, 2023 00:12
Makefile for select specific resource inside a main.tf
target:
SELECTED=`cat main.tf | grep resource | tr -d '"' | awk '{ print $$2 "." $$3 }' | fzf` ; \
terraform apply -target=$$SELECTED
@sergsoares
sergsoares / main.go
Created February 1, 2023 05:27
Simple main.go to process a Key/Value bookmarks as .command for be used in MacOS.
package main
import (
"encoding/json"
"os"
"path/filepath"
)
const (
output = "shortcuts"
{
"aws-cli-reference": "https://docs.aws.amazon.com/cli/latest/reference/index.html",
"aws-cli-acm": "https://docs.aws.amazon.com/cli/latest/reference/acm/index.html",
"aws-cli-acm-pca": "https://docs.aws.amazon.com/cli/latest/reference/acm-pca/index.html",
"aws-cli-alexaforbusiness": "https://docs.aws.amazon.com/cli/latest/reference/alexaforbusiness/index.html",
"aws-cli-amplify": "https://docs.aws.amazon.com/cli/latest/reference/amplify/index.html",
"aws-cli-apigateway": "https://docs.aws.amazon.com/cli/latest/reference/apigateway/index.html",
"aws-cli-apigatewaymanagementapi": "https://docs.aws.amazon.com/cli/latest/reference/apigatewaymanagementapi/index.html",
"aws-cli-apigatewayv2": "https://docs.aws.amazon.com/cli/latest/reference/apigatewayv2/index.html",
"aws-cli-application-autoscaling": "https://docs.aws.amazon.com/cli/latest/reference/application-autoscaling/index.html",
@sergsoares
sergsoares / main.go
Created December 9, 2022 23:39
Golang to ping and encode in JSON response
package main
import (
"fmt"
"os/exec"
"strings"
"strconv"
"net"
)
@sergsoares
sergsoares / main.tf
Created July 14, 2022 19:55
Validation of complex variables in terraform
# terraform.vars
rules = [
{
api_groups = [""]
resources = ["pods","services","deployments","jobs"]
verbs = ["*"]
},
{
api_groups = [""]
resources = ["namespaces"]
@sergsoares
sergsoares / manifest.yml
Created July 14, 2022 18:23
Create a Cluster Role but only use RoleBinding to give access for only 2 specific namespaces (otherwise all namespaces like ClusterRoleBinding)
apiVersion: v1
kind: ServiceAccount
metadata:
name: myapp
namespace: mynamespace
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
namespace: mynamespace
@sergsoares
sergsoares / main.tf
Created July 13, 2022 15:35
Generate dynamically policies based on input and attach for already created roles and users
locals {
policies_arns = {
for item in aws_iam_policy.policy :
item.name => item.arn
}
users_attachment = distinct(
flatten([
for item in var.policies : [
for user in item.users_to_attach : {