View github_clone_using_token.sh
export GITHUB_USER=magickatt | |
export GITHUB_TOKEN=secret | |
export GITHUB_REPOSITORY=magickatt/ContainerisingLegacyApplicationsTalk | |
git clone https://${GITHUB_USER}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY} |
View restart_namespace.sh
#!/bin/bash | |
if [ "$#" -ne 1 ] | |
then | |
echo "Usage: restart_namespace \$NAMESPACE" | |
exit 1 | |
fi | |
NAMESPACE=$1 | |
echo "Restarting all deployments in $NAMESPACE..." |
View check_ssl_validity.sh
#!/bin/bash | |
URI=https://www.yahoo.com | |
INTERVAL_IN_SECONDS=0.5 | |
RESULTS_PER_LINE=50 | |
echo "Checking $URI at ${INTERVAL_IN_SECONDS}s intervals..." | |
check_uri () { |
View filebeat.yaml
filebeat.autodiscover: | |
providers: | |
- type: kubernetes | |
hints.enabled: true | |
hints.default_config.enabled: false | |
add_resource_metadata: | |
namespace: | |
enabled: true | |
processors: | |
- add_kubernetes_metadata: |
View function_countdown.sh
#!/bin/bash | |
# Random number between 1 and 10 | |
WAIT=`shuf -i 1-10 -n 1` | |
# Subtract 1 from the random number, check if it is now 0 | |
is_random_number_zero () { | |
let WAIT=WAIT-1 | |
return $([[ "$WAIT" -eq "0" ]]) | |
} |
View cloud_iap_firewall_rule.tf
resource "google_compute_firewall" "allow_nodes_from_cloud_iap" { | |
name = "allow-gke-nodes-ssh-from-cloud-iap" | |
description = "Allow Cloud IAP to communicate with the the GKE nodes." | |
network = var.network | |
allow { | |
protocol = "tcp" | |
ports = ["22"] | |
} |
View example_uid.yaml
apiVersion: v1 | |
kind: Pod | |
metadata: | |
name: example-uid | |
spec: | |
containers: | |
- name: test | |
image: busybox | |
command: ["/bin/sh", "echo", "$EXAMPLE_UID"] | |
env: |
View helm_dots_to_dashes.yaml
apiVersion: networking.gke.io/v1beta2 | |
kind: ManagedCertificate | |
metadata: | |
name: {{ .Values.domain | replace "." "-" }} | |
namespace: kise | |
spec: | |
domains: | |
- {{ .Values.domain }} |
View access_gcr_images_from_other_projects.tf
locals { | |
project_ids = [123456789012, 234567890123, 345678901234] | |
bucket_region = "us" | |
bucket_project = "something-123456" | |
bucket_name = "${local.bucket_region}.artifacts.${local.bucket_project}.appspot.com" | |
} | |
# Allow Cloud Build in every other project access to GCR images hosted in the central project | |
resource "google_storage_bucket_iam_member" "container_registry" { | |
for_each = var.project_ids |
View access_vm_images_from_other_projects.tf
locals { | |
project_ids = [123456789012, 234567890123, 345678901234] | |
} | |
# Allow every other project access to GCE VM images in a central project | |
resource "google_project_iam_member" "image_user" { | |
for_each = local.project_ids | |
project = "tools-275721" | |
role = "roles/compute.imageUser" |
NewerOlder