Skip to content

Instantly share code, notes, and snippets.

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

Glen Yu Neutrollized

🏠
Working from home
View GitHub Profile
@Neutrollized
Neutrollized / cloudbuild.yaml
Last active February 6, 2023 18:46
Medium: Deploying HashiCorp Vault on Cloud Run using Cloud Build
---
steps:
- id: 'Lint Dockerfile'
name: 'ghcr.io/hadolint/hadolint'
entrypoint: '/bin/hadolint'
args: ['cloud-run/Dockerfile']
- id: 'Build container image'
name: 'gcr.io/cloud-builders/docker'
args: ['build', '-t', '${_GAR_REGION}-docker.pkg.dev/${PROJECT_ID}/${_GAR_REPO_NAME}/vault-server:${COMMIT_SHA}', '-f', 'cloud-run/Dockerfile', '.']
- id: 'Image efficiency scan'
@Neutrollized
Neutrollized / tf_benchmark.py
Created July 24, 2022 16:01
Medium: Installing TensorFlow on Apple M1 Pro using pyenv
#! /usr/bin/env python3
import tensorflow as tf
import tensorflow_datasets as tfds
(ds_train, ds_test), ds_info = tfds.load(
'mnist',
split=['train', 'test'],
shuffle_files=True,
@Neutrollized
Neutrollized / vault-auth.sh
Last active June 10, 2022 18:49
Medium: Securing your workflow using Vault Agent with GCP Auth Method on HashiCorp Vault
#!/bin/bash
export VAULT_ADDR='http://127.0.0.1:8100'
TOKEN_FILE_DIR='/path/to/dir'
TOKEN_FILENAME='vault-token-via-agent'
AUTOAUTH_TOKEN=$(find ${TOKEN_FILE_DIR} -type f -name ${TOKEN_FILENAME} -exec cat {} +)
ROLE_ID=$(VAULT_TOKEN=${AUTOAUTH_TOKEN} vault read -field=role_id auth/medium/role/jenkins/role-id)
@Neutrollized
Neutrollized / vault-agent.hcl
Last active February 13, 2024 02:20
Medium: Securing your workflow using Vault Agent with GCP Auth Method on HashiCorp Vault
vault {
address = "https://10.234.56.78:8200"
retry {
num_retries = 3
}
}
auto_auth {
method "gcp" {
mount_path = "auth/my-project-123"
@Neutrollized
Neutrollized / bindings.hcl
Created June 10, 2022 18:45
Medium: Securing your GCP workflow using Secrets Engines on HashiCorp Vault
resource "//cloudresourcemanager.googleapis.com/projects/my-project-123" {
roles = [
"roles/compute.instanceAdmin.v1",
"roles/compute.networkAdmin",
"roles/compute.securityAdmin",
"roles/iam.serviceAccountUser",
]
}
@Neutrollized
Neutrollized / store_route.yaml
Last active June 4, 2022 00:57
Medium: Getting started with GKE Gateway controller
---
kind: HTTPRoute
apiVersion: gateway.networking.k8s.io/v1alpha2
metadata:
name: store
namespace: store-ns
spec:
parentRefs:
- kind: Gateway
name: external-http
@Neutrollized
Neutrollized / store.yaml
Last active June 4, 2022 00:41
Medium: Getting started with GKE Gateway controller
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: store-v1
namespace: store-ns
spec:
replicas: 2
selector:
matchLabels:
@Neutrollized
Neutrollized / gateway.yaml
Last active June 4, 2022 00:57
Medium: Getting started with GKE Gateway controller
---
kind: Gateway
apiVersion: gateway.networking.k8s.io/v1alpha2
metadata:
name: external-http
namespace: infra-ns
spec:
gatewayClassName: gke-l7-gxlb
listeners:
- name: http
@Neutrollized
Neutrollized / gke_ingress.yaml
Created June 3, 2022 15:40
Medium: NGINX Ingress or GKE Ingress
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: gxlb-ingress
namespace: default
annotations:
kubernetes.io/ingress.class: "gce"
kubernetes.io/ingress.allow-http: "true"
spec:
@Neutrollized
Neutrollized / nginx_ingress_rewrite.yaml
Created June 3, 2022 15:38
Medium: NGINX Ingress or GKE Ingress
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: nginx-ingress-rewrite
annotations:
kubernetes.io/ingress.class: "nginx"
nginx.ingress.kubernetes.io/ssl-redirect: "false"
nginx.ingress.kubernetes.io/rewrite-target: /$2
spec: