Skip to content

Instantly share code, notes, and snippets.

View owensengoku's full-sized avatar
🎯
Focusing

owensengoku owensengoku

🎯
Focusing
View GitHub Profile
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: test-network-policy
namespace: default #You can specify the namespace by your requirement
spec:
podSelector: {} # Means select all
policyTypes:
- Egress
egress:
@owensengoku
owensengoku / set-firewall-rule-with-service-tag-ips.sh
Created August 9, 2021 03:00
Set firewall rule with Service Tag IP
#!bin/bash
cidrs=( $(az network list-service-tags -l "westus2" --query "values[?id=='Storage.WestUS2']" | jq -r '.[0].properties.addressPrefixes | .[]' ) )
for i in "${cidrs[@]}"
do
if [[ $i =~ .*:.* ]]
then
echo "IPv6"
@owensengoku
owensengoku / SqlTableCreator.cs
Created August 12, 2020 13:33 — forked from riyadparvez/SqlTableCreator.cs
Create Sql table based on given DataTable schema
// Copyright (c) 2012-2013, Riyad Parvez
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
//
// 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
//
// 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
#!bin/bash
for ID in $(az account list -o tsv --query '[*].id')
do
echo $ID
az advisor recommendation list --query "[?impact=='High']" -o table --subscription $ID
done
@owensengoku
owensengoku / setup-azure-ingress-application-gateway-lets-encrypt.ps1
Created June 14, 2020 10:54
Azure kubernetes service (AKS) + Azure application gateway + Letsencrypt ingress setup (production setup) (AGIC) automatic ssl certificate generation.
# prereq:
# 1. aks cluster
# 2. azure gateway V2 (rules setup not important, will be overwritten)
# 3. both of the above in the same Virtual network in azure. (different subnets).
$subscriptionId = '<azure-subscription-guid>';
$resourceGroup = '<resource-group-name>';
$rbac = $true; # on k8s cluster
$aksName = '<azure-kubernetes-cluster-name>';
Import-Module AzureRm -Force
$TENANTID = '<REPLACE WITH YOUR AAD TENANT ID'
$SUBSCRIPTION_ID = '<REPLACE WITH YOUR SUBSCRIPTION ID>'
$SETTINGS_NAME = '<REPLACE WITH RANDOM NAME FOR DIAGNOSTIC SETTINGS NAME>'
$LA_RESOURCEGROUP_NAME = '<REPLACE WITH YOUR LOG ANALYTICS RESOURCE GROUP>'
$LA_WORKSPACE_NAME = '<REPLACE WITH YOUR LOG ANALYTICS WORKSPACE NAME>'
$LA_WORKSPACE_ID ='/subscriptions/{0}/resourcegroups/{1}/providers/microsoft.operationalinsights/workspaces/{2}' -f $SUBSCRIPTION_ID, $LA_RESOURCEGROUP_NAME, $LA_WORKSPACE_NAME
kind: Cluster
apiVersion: kind.sigs.k8s.io/v1alpha3
nodes:
- role: control-plane
extraMounts:
- containerPath: /workdir/src/github.com/owensengoku/kind-run-test
hostPath: /Users/developer/kind-run-test
@owensengoku
owensengoku / Demo Dockerfile
Created October 7, 2019 04:37
Demo Dockerfile
FROM kindest/node:v1.13.4
RUN apt-get update \
&& apt-get install -y dnsutils iputils-ping \
&& apt-get install -y make gcc musl-dev golang-go libzmqpp-dev
ENV GOPATH /go
RUN go version
@owensengoku
owensengoku / helm-service-account.yaml
Created April 6, 2019 11:22
helm-service-account.yaml
apiVersion: v1
kind: ServiceAccount
metadata:
name: tiller
namespace: kube-system
---
apiVersion: v1
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
@owensengoku
owensengoku / kind-config.yaml
Created March 31, 2019 12:52
kind config.yaml for mounting volume
kind: Cluster
apiVersion: kind.sigs.k8s.io/v1alpha3
nodes:
- role: control-plane
extraMounts:
- containerPath: /tmp-in-kind
hostPath: /tmp
readOnly: false
selinuxRelabel: false
propagation: None