This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# set your CloudFlare key & email | |
export auth_email=$CLOUDFLARE_EMAIL | |
export auth_key=$CLOUDFLARE_TOKEN | |
# list your DNS zones hosted at CloudFlare | |
curl -s -X GET "https://api.cloudflare.com/client/v4/zones/?per_page=100" -H "X-Auth-Email: $auth_email" -H "X-Auth-Key: $auth_key" -H "Content-Type: application/json"| jq -r '.result[] | "\(.id) \(.name)"' | |
# expected output: | |
# a3c9c7d3861e52cf23c835102c258d63 example1.com | |
# f47d1debb65621ca89039b9fbfeb726a example2.com |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
apiVersion: v1 | |
kind: Namespace | |
metadata: | |
name: ns1 | |
--- | |
apiVersion: v1 | |
kind: ServiceAccount | |
metadata: | |
name: ns1-sa |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
get_network_mode() { | |
docker inspect --format='{{.HostConfig.NetworkMode}}' "$1" | |
} | |
created_by_kubelet() { | |
[[ $(docker inspect --format='{{.Name}}' "$1") =~ ^/k8s_ ]] | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
db.getCollectionInfos().forEach(function(coll) { | |
if (coll.type === "collection" ) { | |
db[coll.name].getIndexes().forEach(function(index) { | |
if ("id" !== index.name) { | |
//print( JSON.stringify( index )) | |
var indexKey = index.key // save the key, and transform index into the "options" | |
delete index.v | |
delete index.key | |
index.background = true // optional: force background to be true | |
print("db." + coll.name + ".createIndex(" + JSON.stringify(indexKey) + ", " + JSON.stringify(index) + ")"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// List all indexes in all databases | |
db.getMongo().getDBNames().forEach(function(dbName) { | |
if (dbName != "admin" && dbName != "local" && dbName != "config") { | |
db.getSiblingDB(dbName).getCollectionNames().forEach(function(coll) { | |
db.getSiblingDB(dbName)[coll].getIndexes().forEach(function(index) { | |
if ("id" !== index.name) { | |
print("db.getSiblingDB('" + dbName + "')." + coll + ".ensureIndex(" + tojson(index.key) + ")"); | |
} | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## This creates a working single node Azure Kubernetes Cluster | |
## and with an Azure Container Registry. Note, the ACR is in | |
## the same resource group as the AKS for demo purposes. For | |
## dev you should have ACR in separate resource group. | |
echo "Beginning AKS Setup for Demo" | |
date | |
AKS_RESOURCE_GROUP=aks-rg1 | |
AKS_CLUSTER_NAME=aks-c1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ kubectl run nginx --image=nginx --dry-run -o yaml | |
apiVersion: extensions/v1beta1 | |
kind: Deployment | |
metadata: | |
creationTimestamp: null | |
labels: | |
run: nginx | |
name: nginx | |
spec: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# get namespaces list | |
NAMESPACES=$(kubectl get namespaces --output=jsonpath={.items..metadata.name}) | |
# delete stuck pods in each namespace | |
for NS in $NAMESPACES;do | |
kubectl get pods -n $NS | awk "\$3==\"Terminating\" {print \"kubectl delete -n $NS pod \" \$1 \" --grace-period=0 --force\"}" | xargs -0 bash -c | |
done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
time-format %T | |
date-format %d/%b/%Y | |
log_format "%d:%t +%^" client=%h method=%m request="%r" request_length=%^ status=%s bytes_sent=%b body_bytes_sent=%^ referer=%R user_agent="%^" upstream_addr=%^ upstream_status=%^ request_time=%T upstream_response_time=%^ upstream_connect_time=%^ upstream_header_time=%^ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resource "opentelekomcloud_dns_zone_v2" "dnszone" { | |
name = "${var.dnszone}" | |
email = "info@${var.dnszone}" | |
ttl = 6000 | |
} | |
resource "opentelekomcloud_dns_recordset_v2" "test_a" { | |
zone_id = "${opentelekomcloud_dns_zone_v2.dnszone.id}" | |
name = "${var.dnszone}" | |
ttl = 300 |