Skip to content

Instantly share code, notes, and snippets.

View MarkWarneke's full-sized avatar
🐒
lounging

Mark Warneke MarkWarneke

🐒
lounging
View GitHub Profile
# container-azm-ms-agentconfig.yaml
# FOLLOWING: https://docs.microsoft.com/en-us/azure/azure-monitor/insights/container-insights-agent-config
# ORIGINAL: https://raw.githubusercontent.com/microsoft/Docker-Provider/ci_prod/kubernetes/container-azm-ms-agentconfig.yaml
kind: ConfigMap
apiVersion: v1
metadata:
name: container-azm-ms-agentconfig
namespace: kube-system
data:
@MarkWarneke
MarkWarneke / _include_faq.html
Last active January 6, 2021 14:48
Generate Google Search Central Advanced SEO mark up FAQs with structured data using Jekyll Liquid https://developers.google.com/search/docs/data-types/faqpage
---
faqitems:
- question: This is a question1
answer: >-
This is my answer, and if you want [mailto](mailto:me@mymail.com)
- question: This is a question2
answer: >-
This is an answer with list elements:
- Element One.

Keybase proof

I hereby claim:

  • I am markwarneke on github.
  • I am markwarneke (https://keybase.io/markwarneke) on keybase.
  • I have a public key ASBpqyqPjT5rTKbbLuPFf3WkSqUChgYIUzhgSuB6ArxiIQo

To claim this, I am signing this object:

@MarkWarneke
MarkWarneke / Terraform_Update_Pull_Request.yaml
Last active December 22, 2020 11:47
Update Pull Request adds a comment to the pull request with the results of the format, init and plan steps. In addition, it displays the plan output (steps.plan.outputs.stdout). This allows your team to review the results of the plan directly in the PR. Based on https://learn.hashicorp.com/tutorials/terraform/github-actions
- uses: hashicorp/setup-terraform@v1
- name: Update Pull Request
uses: actions/github-script@0.9.0
if: github.event_name == 'pull_request'
env:
PLAN: "${{ steps.plan.outputs.stdout }}"
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const output = `
@MarkWarneke
MarkWarneke / generic_test.go
Last active January 13, 2021 08:07
Reusable generic Terratest for all Azure based Terraform modules. https://markwarneke.me/2020-10-14-Generic-Terraform-Module-Test-Using-Terratest/
package test
import (
"fmt"
"log"
"math/rand"
"os"
"strings"
"testing"
"github.com/gruntwork-io/terratest/modules/terraform"
)
@MarkWarneke
MarkWarneke / cdk-typescript-azurerm-k8s-main.ts
Last active July 24, 2020 10:34
Cloud Development Kit (CDK) TypeScript implementation to deploy Azure Kubernetes Service (AKS)
import { Construct } from 'constructs';
import { App, TerraformStack, TerraformOutput } from 'cdktf';
import { AzurermProvider, KubernetesCluster, KubernetesClusterConfig, KubernetesClusterDefaultNodePool, KubernetesClusterServicePrincipal, ResourceGroup, ResourceGroupConfig } from './.gen/providers/azurerm'
class K8SStack extends TerraformStack {
constructor(scope: Construct, name: string) {
super(scope, name);
const provider = new AzurermProvider(this, 'AzureRm', {
features: [{}]
@MarkWarneke
MarkWarneke / status-git.sh
Created July 19, 2020 11:03
A quick and dirty folder based script to get the status and local branches of all repositories in the current folder
#!/bin/bash
BASEDIR=$(sh -c pwd)
for foldername in */; do \
cd $foldername && \
branch=$(git rev-parse --abbrev-ref HEAD) && \
lbranches=$(git branch)
echo "======= Status for $foldername --- branch: $branch =======" && \
git status
echo "------- local branches --------" && \
echo "$lbranches"
@MarkWarneke
MarkWarneke / refresh-git.sh
Created July 19, 2020 11:02
A quick and dirty folder based script to pull & prune all repositories in the current folder
#!/bin/bash
BASEDIR=$(sh -c pwd)
for foldername in */; do \
cd $foldername && \
branch=$(git rev-parse --abbrev-ref HEAD) && \
echo "======= Pulling $foldername --- branch: $branch =======" && \
git pull && \
git remote prune origin
cd $BASEDIR
done
@MarkWarneke
MarkWarneke / Test-AzTemplate.adls.spec.ps1
Created July 8, 2020 07:49
Testing the presence of the template, validate that adls file can be read and convert it from a JSON string to a PowerShell object. https://markwarneke.me/2019-08-21-static-code-analysis-for-infrastructure-as-code/
# azuredeploy.adls.Tests.ps1
param (
$Path = (Join-Path $PSScriptRoot "azuredeploy.json")
)
# Test for template presence
$null = Test-Path $Path -ErrorAction Stop
# Test if arm template content is readable
$text = Get-Content $Path -Raw -ErrorAction Stop
@MarkWarneke
MarkWarneke / Test-AzTemplate.spec.ps1
Created July 8, 2020 07:47
We want to ensure we have consistency and best practices checked when testing our ARM templates. The output should be human readable and easy to understand. See https://markwarneke.me/2019-08-21-static-code-analysis-for-infrastructure-as-code/
#azuredeploy.Tests.ps1
param (
$Path = (Join-Path $PSScriptRoot "azuredeploy.json")
)
Describe "[$Path] should be valid" -Tag Unit {
# Test for template presence
$null = Test-Path $Path -ErrorAction Stop