Skip to content

Instantly share code, notes, and snippets.

@gambtho
gambtho / pid_max_ds.yaml
Last active December 21, 2021 17:35
daemonset aks set pid_max
apiVersion: apps/v1
kind: DaemonSet
metadata:
namespace: kube-system
name: set-pid-max
labels:
k8s-app: set-pid-max
spec:
selector:
matchLabels:
[Unit]
Description=start and stop the minecraft-server
[Service]
WorkingDirectory=/minecraft
#!/bin/bash
# install az cli
# rpm --import https://packages.microsoft.com/keys/microsoft.asc
# sh -c 'echo -e "[azure-cli]
# name=Azure CLI
# baseurl=https://packages.microsoft.com/yumrepos/azure-cli
# enabled=1
# gpgcheck=1
# gpgkey=https://packages.microsoft.com/keys/microsoft.asc" > /etc/yum.repos.d/azure-cli.repo'
@gambtho
gambtho / multistage.yml
Last active August 22, 2019 19:03
simple example of a multi-stage pipeline
name: cust-App-NP-$(Date:yyyyMMdd).$(Rev:.r)
trigger:
batch: true
branches:
include:
- master
variables:
- group: cust_non_prod_shared_terraform_config
@gambtho
gambtho / delete_all_rgs
Created July 25, 2019 15:26
clean-up your azure resources
#!/bin/bash
# NOTE: Be careful as this code in intended to delete ALL Resources in a subscription. Use at your own risk.
# https://stackoverflow.com/a/56139987
# Set The correct Subscription
az account set -s "<Subscription_name / Id>"
# Get All resource groups and loop to delete them
for rg_name in `az group list -o tsv --query [*].name`; do
echo Deleting ${rg_name}
# Azure Pipeline.
# optional
variables:
- group: some_resource_group
name: $(Date:yyyyMMdd).$(Rev:.r)
trigger:
batch: true
# choose which branches to build automatically
@gambtho
gambtho / Azure RBAC creation and save to keyvault
Created April 10, 2019 15:48
Create Azure Service Principal for RBAC and Save data to KeyVault
if [ $(az ad sp list --display-name "${CLIENT_APP_NAME}-rbac" | jq '. | length') -gt 0 ]
then
echo "RBAC client app ${CLIENT_APP_NAME}-rbac already exists"
else
TENANT_ID=$(az account show --query tenantId --out tsv)
SUBSCRIPTION_ID=$(az account show --query id --out tsv)
sp_vars=$(az ad sp create-for-rbac -n "${CLIENT_APP_NAME}-rbac" --role contributor --scopes="/subscriptions/${SUBSCRIPTION_ID}" | jq '[.appId, .password]')
CLIENT_ID=$(echo $sp_vars | jq -r '.[0]')
CLIENT_SECRET=$(echo $sp_vars | jq -r '.[1]')
@gambtho
gambtho / ecs.tf
Created August 3, 2018 16:49
ECS cluster with fargate
locals {
autoscale_resource_id = "service/${aws_ecs_cluster.cluster.name}/${aws_ecs_service.service.name}"
}
resource "aws_ecr_repository" "app_ecr" {
name = "${var.api_name}-${var.environment}"
}
resource "aws_ecs_cluster" "cluster" {
depends_on = ["aws_ecs_task_definition.taskdef"]
@gambtho
gambtho / ecs.tf
Created August 3, 2018 16:49
ECS cluster with fargate
locals {
autoscale_resource_id = "service/${aws_ecs_cluster.cluster.name}/${aws_ecs_service.service.name}"
}
resource "aws_ecr_repository" "app_ecr" {
name = "${var.api_name}-${var.environment}"
}
resource "aws_ecs_cluster" "cluster" {
depends_on = ["aws_ecs_task_definition.taskdef"]
@gambtho
gambtho / lb.tf
Created August 3, 2018 16:47
terraform for ecs lb using cert
resource "aws_lb" "app" {
name = "${var.api_name}-${var.environment}"
internal = false
security_groups = ["${var.lb_security_groups}"]
subnets = ["${var.public_subnets}"]
idle_timeout = "${var.idle_timeout}"
tags = "${var.tags}"
}
resource "aws_alb_target_group" "http" {