Skip to content

Instantly share code, notes, and snippets.

View darkn3rd's full-sized avatar
🏠
Working from home

Joaquin Menchaca darkn3rd

🏠
Working from home
View GitHub Profile
@darkn3rd
darkn3rd / delete_k8s.sh
Created October 12, 2022 07:23
GKE/CCSM: cleanup kubernetes resources
source env.sh
# delete pydgraph-client
helmfile --file ./examples/dgraph/helmfile.yaml delete
kubectl delete namespace pydgraph-client
# delete dgraph
helmfile --file ./examples/dgraph/helmfile.yaml delete
kubectl delete pvc --selector app=dgraph --namespace "dgraph"
kubectl delete namespace dgraph
@darkn3rd
darkn3rd / publish_to_docker.sh
Last active October 13, 2022 07:25
GKE/CCSM: Publishing pydgrpah-client images to DockerHub
pushd ./examples/pydgraph-client
###################
# STEP 1: Environment variables
#######################################
source env.sh
export DOCKER_REGISTRY="<your-docker-hub-account-goes-here>"
###################
# STEP 2: Build local image
@darkn3rd
darkn3rd / publish_to_gcr.sh
Last active October 12, 2022 07:15
GKE/CCSM: Publishing pydgrpah-client images to GCR
pushd ./examples/pydgraph-client
###################
# STEP 1: Environment variables
#######################################
source env.sh
export GCR_PROJECT_ID="my-gcr-project" # CHANGE ME
export DOCKER_REGISTRY="gcr.io/$GCR_PROJECT_ID"
export ClOUD_BILLING_ACCOUNT="<my-cloud-billing-account>" # CHANGEME
@darkn3rd
darkn3rd / pydgraph_client.yaml
Last active October 12, 2022 06:19
GKE/CCSM: pydgraph-cleint
repositories:
# https://artifacthub.io/packages/helm/main/raw
- name: bedag
url: https://bedag.github.io/helm-charts/
releases:
- name: pydgraph-client
chart: bedag/raw
namespace: pydgraph-client
version: 1.1.0
@darkn3rd
darkn3rd / helmfile.yaml
Last active October 12, 2022 06:21
GKE/CCSM: Dgraph
repositories:
# https://artifacthub.io/packages/helm/dgraph/dgraph/0.0.19
- name: dgraph
url: https://charts.dgraph.io
# https://artifacthub.io/packages/helm/main/raw
- name: bedag
url: https://bedag.github.io/helm-charts/
releases:
# Dgraph additional resources required to support Consul
@darkn3rd
darkn3rd / helmfile.yaml
Created October 10, 2022 05:49
GKE: GKE Consul Connect Service Mesh
repositories:
# https://artifacthub.io/packages/helm/hashicorp/consul
- name: hashicorp
url: https://helm.releases.hashicorp.com
releases:
- name: consul
namespace: consul
chart: hashicorp/consul
version: 0.49.0
@darkn3rd
darkn3rd / provision_gke_with_least_priv.sh
Created October 8, 2022 23:12
GKE: GKE with least priv with e2-standard-2
source env.sh
#######################
# GSA with least priv for GKE
##########################################
ROLES=(
roles/logging.logWriter
roles/monitoring.metricWriter
roles/monitoring.viewer
roles/stackdriver.resourceMetadata.writer
@darkn3rd
darkn3rd / cleanup_cloud_resources.sh
Created September 19, 2022 10:12
GKE NSM2: Delete Google Cloud Resources
gcloud container clusters delete $GKE_CLUSTER_NAME \
--project $GKE_PROJECT_ID \
--region $GKE_REGION
gcloud iam service-accounts delete $GKE_SA_EMAIL --project $GKE_PROJECT_ID
gcloud iam service-accounts delete $DNS_SA_EMAIL --project $DNS_PROJECT_ID
@darkn3rd
darkn3rd / cleanup_k8s_resources.sh
Created September 19, 2022 10:09
GKE NSM2: Delete Kubernetes Resources
# Ratel Resources
kubectl delete deploy/dgraph-ratel --namespace "ratel"
kubectl delete svc/dgraph-ratel --namespace "ratel"
# VirtualServers
helm delete dgraph-virtualservers --namespace "dgraph"
helm delete ratel-virtualserver --namespace "ratel"
# Kubernetes Addons
helm delete "external-dns" --namespace "kube-addons"
@darkn3rd
darkn3rd / vs.yaml
Created September 18, 2022 07:38
GKE NSM2: Dgraph VirtualServer and Policy
repositories:
# https://artifacthub.io/packages/helm/itscontained/raw
- name: itscontained
url: https://charts.itscontained.io
releases:
- name: dgraph-virtualservers
chart: itscontained/raw
namespace: dgraph
version: 0.2.5