Skip to content

Instantly share code, notes, and snippets.

View mlabouardy's full-sized avatar
☁️
Subscribe to my newsletter ➡️ https://devopsbulletin.com

LABOUARDY Mohamed mlabouardy

☁️
Subscribe to my newsletter ➡️ https://devopsbulletin.com
View GitHub Profile
func getDailyCost(dependency Dependency) (map[time.Time]float64, error) {
currentTime := time.Now().Local()
start := currentTime.AddDate(0, 0, -7).Format("2006-01-02")
end := currentTime.Format("2006-01-02")
layoutISO := "2006-01-02"
datapoints := make(map[time.Time]float64, 0)
filter := costexplorer.Expression{}
@mlabouardy
mlabouardy / ovh.conf
Created June 17, 2019 20:24
OVH config file
[default]
; general configuration: default endpoint
endpoint=ovh-eu
[ovh-eu]
; configuration specific to 'ovh-eu' endpoint
application_key=my_app_key
application_secret=my_application_secret
consumer_key=my_consumer_key
@mlabouardy
mlabouardy / deploy.sh
Created June 16, 2019 09:37
Create a resource deployment on K8s
kubectl apply -f deployment.yml
@mlabouardy
mlabouardy / kubeconfig.sh
Created June 16, 2019 09:35
Generate Kubeconfig for GKE
gcloud container clusters get-credentials CLUSTER_NAME --region REGION
@mlabouardy
mlabouardy / login.sh
Created June 16, 2019 09:34
Create Docker config secret for a private docker registry
docker login REGISTRY_URL -u USER -p PASSWORD
kubectl create secret generic nexus \
--from-file=.dockerconfigjson=/home/$USER/.docker/config.json \
--type=kubernetes.io/dockerconfigjson
@mlabouardy
mlabouardy / service.yml
Created June 16, 2019 08:54
Expose a Load Balancer on GCP with K8S
apiVersion: v1
kind: Service
metadata:
name: app
spec:
ports:
- port: 80
targetPort: 3000
selector:
app: app
@mlabouardy
mlabouardy / deployment.yml
Created June 16, 2019 08:53
Kubernetes deployment
apiVersion: apps/v1
kind: Deployment
metadata:
name: app
spec:
replicas: 1
selector:
matchLabels:
app: app
template:
@mlabouardy
mlabouardy / cloudbuild.yaml
Created June 16, 2019 08:51
Continuous deployment with Google Cloud Build on GCP
- id: 'configure kubectl'
name: 'gcr.io/cloud-builders/gcloud'
env:
- 'CLOUDSDK_COMPUTE_ZONE=${_CLOUDSDK_COMPUTE_ZONE}'
- 'CLOUDSDK_CONTAINER_CLUSTER=${_CLOUDSDK_CONTAINER_CLUSTER}'
- 'KUBECONFIG=/kube/config'
entrypoint: 'sh'
args:
- '-c'
- |
@mlabouardy
mlabouardy / k8s.tf
Created June 14, 2019 19:24
Create Google Kubernetes Engine with Terraform
resource "google_container_cluster" "cluster" {
name = "${var.environment}"
location = "${var.zone}"
remove_default_node_pool = true
initial_node_count = "${var.k8s_nodes}"
master_auth {
username = ""
@mlabouardy
mlabouardy / cloudbuild.yaml
Created June 14, 2019 19:23
Continuous Integration for Docker image with Google Cloud Build
steps:
- id: 'run quality test'
name: "golangci/golangci-lint"
args: ["golangci-lint","run"]
- id: 'run unit test'
name: 'gcr.io/cloud-builders/go'
args: ['test', 'app']
env: ['GOPATH=.']