Skip to content

Instantly share code, notes, and snippets.

View trietsch's full-sized avatar
💻

Robin Trietsch trietsch

💻
View GitHub Profile
@trietsch
trietsch / gitlab_group_cluster.tf
Last active December 11, 2022 01:04
Gitlab (Group) Kubernetes Cluster with minimal RBAC (NO cluster-admin!)
/*
Gitlab offers the option to configure Kubernetes clusters (either on group level or project level) to be able to view pods
logs, and more all from the web UI. However, they advise to configure cluster-admin as a Cluster Role for the Serviceaccount
that you use to set up access from Gitlab to your cluster.
IMO, these permissions are too wide, as I'm not using Gitlab to manage deployments, that is done through Terraform in my case.
This should have been documented somewhere in the Gitlab documentation, especially since Gitlab acknowledges that many users
find the permissions too wide: https://about.gitlab.com/blog/2021/02/22/gitlab-kubernetes-agent-on-gitlab-com/
The Terraform code below includes all RBAC permissions required to view your clusters in Gitlab, as well as view the
deployment, including the number of pods. Furthermore, it allows for log viewing in Gitlab as well. Permissions are mainly
@trietsch
trietsch / s3-parallel
Last active November 10, 2019 16:02
Parallelize s3 copy / move actions by using screens and forked processes (usage: ./s3-parallel <from> <to> <files_to_copy_per_screen>
#!/bin/bash
action=${1:?Please specify whether to mv or cp.}
from=${2:?Specify the full s3 path to move or copy from.}
to=${3:?Specify the full s3 path to move or copy to.}
number_of_screens=${4:-10}
case $action in
mv)
echo "Going to MOVE data from '$from' to '$to'."