Skip to content

Instantly share code, notes, and snippets.

View iamdejan's full-sized avatar
🎯
Focusing

Giovanni Dejan iamdejan

🎯
Focusing
  • 17:38 (UTC +07:00)
View GitHub Profile
@iamdejan
iamdejan / k8s-rollout-demo-github-actions.yaml
Created May 26, 2022 09:51
Github Actions for K8s Rollout Demo
name: Build and Deploy Image
on:
push:
branches:
- "main"
jobs:
Main:
runs-on: ubuntu-20.04
steps:
- name: Checkout repository code
@iamdejan
iamdejan / gke-custer.tf
Created May 26, 2022 06:46
GKE cluster provisioning
# GKE cluster
resource "google_container_cluster" "primary" {
name = "${var.project_id}-gke"
location = var.region
# We can't create a cluster with no node pool defined, but we want to only use
# separately managed node pools. So we create the smallest possible default
# node pool and immediately delete it.
remove_default_node_pool = true
initial_node_count = 1
@iamdejan
iamdejan / gcp-vpc-subnet.tf
Last active May 26, 2022 06:51
VPC and subnet for Google Cloud Provider
# VPC
resource "google_compute_network" "vpc" {
name = "${var.project_id}-vpc"
auto_create_subnetworks = "false"
}
# Subnet
resource "google_compute_subnetwork" "subnet" {
name = "${var.project_id}-subnet"
region = var.region
@iamdejan
iamdejan / kubernetes.tf
Created May 26, 2022 06:37
Kubernetes objects
data "google_client_config" "primary" {
depends_on = [google_container_cluster.primary]
}
provider "kubernetes" {
host = "https://${google_container_cluster.primary.endpoint}"
token = data.google_client_config.primary.access_token
client_certificate = google_container_cluster.primary.master_auth.0.client_certificate
client_key = google_container_cluster.primary.master_auth.0.client_key
cluster_ca_certificate = base64decode(
@iamdejan
iamdejan / Dockerfile
Last active May 20, 2022 15:33
FastAPI Dockerfile
FROM python:3.9.10-slim-bullseye
COPY requirements.txt requirements.txt
RUN pip3 install -r requirements.txt
COPY main.py .
EXPOSE 8000
CMD ["uvicorn", "main:app", "--host", "0.0.0.0"]
@iamdejan
iamdejan / main.py
Last active May 20, 2022 15:40
Simple API v0.1
import time
from fastapi import FastAPI
app: FastAPI = FastAPI()
@app.get("/version")
def get_version() -> str:
time.sleep(15)
return "v0.1"
@iamdejan
iamdejan / Engineering Manager Resources.md
Last active January 5, 2024 16:08
Engineering Manager Resources
@iamdejan
iamdejan / portfolio-website-101.md
Last active June 10, 2022 15:54
Portfolio Website 101

Portfolio Website 101

Static Site Generators

Tutorials

val number = 7
println(number.inv()) // will print -8