Skip to content

Instantly share code, notes, and snippets.

View 80-jenkins.sh
#################################
# Running Jenkins In Kubernetes #
# Tutorial And Review #
# https://youtu.be/2Kc3fUJANAc #
#################################
# Referenced videos:
# - GitHub CLI - How to manage repositories more efficiently: https://youtu.be/BII6ZY2Rnlc
# - Kaniko - Building Container Images In Kubernetes Without Docker: https://youtu.be/EgwVQN6GNJg
# - Kustomize - How to Simplify Kubernetes Configuration Management: https://youtu.be/Twtbg6LFnAg
@hayderimran7
hayderimran7 / FB-PE-InterviewTips.md
Created Dec 17, 2020 — forked from ameenkhan07/FB-PE-InterviewTips.md
Facebook Production Engineering Interview
View FB-PE-InterviewTips.md

What to Expect and Tips

• 45-minute systems interview, focus on responding to real world problems with an unhealthy service, such as a web server or database. The interview will start off at a high level troubleshooting a likely scenario, dig deeper to find the cause and some possible solutions for it. The goal is to probe your knowledge of systems at scale and under load, so keep in mind the challenges of the Facebook environment.
• Focus on things such as tooling, memory management and unix process lifecycle.

Systems

More specifically, linux troubleshooting and debugging. Understanding things like memory, io, cpu, shell, memory etc. would be pretty helpful. Knowing how to actually write a unix shell would also be a good idea. What tools might you use to debug something? On another note, this interview will likely push your boundaries of what you know (and how to implement it).

Design/Architecture 

Interview is all about taking an ambiguous question of how you might build a system and letting

@hayderimran7
hayderimran7 / deploy.md
Last active Dec 1, 2020
Automatically deploy GoDaddy External Secrets Controller for SSM/Secrets Manager in K8s with IAM role for service account
View deploy.md
#!/bin/bash -xe
## SET BASIC VARIABLES
EKS_CLUSTER="dev-cluster"
IAM_ROLE_NAME=eksctl-$EKS_CLUSTER-iamserviceaccount-role
EXTERNAL_SECRETS_POLICY="kube-external-secrets"
#### CREATE POLICY TO ACCESS SSM/Secrets Manager
cat << EOF > policy.json
{
@hayderimran7
hayderimran7 / iam_role_jq_jmesqmatching.md
Last active Apr 14, 2020
get IAM Role matching a name using jq and aws cli
View iam_role_jq_jmesqmatching.md

Intro

To use aws cli, its common to invoke built-in features like --filters and --query however they aren't avaiable for all the commands.

for my use case i wanted to get a role matching a name, i.e. regex pattern . that was very easy using jq

one-liner to get Role ARN of a role macthing name

if i want to get a role matching name eksctl-dev-cluster-addon-iamserviceaccount then to get ARN of that role is simply doing

@hayderimran7
hayderimran7 / EKS_RDS_VPC_Peering_script.sh
Last active Apr 2, 2021
VPC Peering Between EKS and RDS postgres
View EKS_RDS_VPC_Peering_script.sh
#!/bin/bash -xe
## Create a VPC Peering connection between EKS and RDS Postgres
echo """ run this script as:
./eks-rds-peering.sh
+ read -p 'Enter name of EKS Cluster: ' EKS_CLUSTER
Enter name of EKS Cluster: xolv-dev-cluster
+ EKS_VPC=eksctl-xolv-dev-cluster-cluster/VPC
+ EKS_PUBLIC_ROUTING_TABLE=eksctl-xolv-dev-cluster-cluster/PublicRouteTable
+ read -p 'Enter name of RDS: ' RDS_DB_NAME
Enter name of RDS: sfstackuat
@hayderimran7
hayderimran7 / aws_cross_accout_access_to_eks.md
Last active Mar 12, 2020
aws cross account access to EKS
View aws_cross_accout_access_to_eks.md

introduction

When you want your users in IAM to access EKS cluster in another account, its very simple to do via cross account role. This assumes you have already created the role in account B to users in account A.

steps to access EKS in second account

  1. first make sure you have a IAM role cross-account-role created in Account B and having added trusted relationship for users in that you would like to from account A to access it.
  2. Once thats done , make sure you have access to the EKS cluster in account B(this needs to be done in order to edit the permissions of EKS).
  3. now edit the aws-auth configmap of that EKS cluster as:
@hayderimran7
hayderimran7 / Traffic Routing in canary deployments using nginx-ingress.md
Created Mar 9, 2020
Traffic Routing in canary deployments using nginx-ingress
View Traffic Routing in canary deployments using nginx-ingress.md

Canary deployments in gitlab AutoDevops using nginx-ingress

Gitlab AutoDevops is a great feature in Gitlab which allows us to Build,Test,Deploy our apps seamlessly to Kubernetes. This tutorial will not walk over steps to configure kubernetes integration in Gitlab as its already well documented here.

AutoDevops Helm Chart setup for canary-deployments

This chart is the modified form of official auto-deploy-app that is intended to achieve traffic routing in canary deployment using nginx-ingress. Assuming you have already configured your Gitlab project with AutoDevops, next is to use the modified chart that I created here -> https://gitlab.com/hayderimran7/auto-deploy-canary-chart AutoDevops is completely customizable, so in order to use this chart instead of official chart, all you need to do is copy the files and move under `

View Azure load balancer backend pool update python script.md

this python script can be used to automate updating AZ load balancer backend pool with the vms you like. this is knda custom as the dcos_vm and maint_vm are what this script is used to switch between .

#!/usr/bin/env python3
import argparse
import configparser
import logging.config
import os
import sys
@hayderimran7
hayderimran7 / pipeline.groovy
Created Jan 29, 2019 — forked from paulchubatyy/pipeline.groovy
Jenkins pipeline to read the repository list for Github Organization and create multibranch pipeline projects for them
View pipeline.groovy
import org.kohsuke.github.*
/*
* This pipeline uses the Jenkins Job DSL plugin to create the multi-branch pipelines
* for your Github Organization repositories.
*
* @see https://wiki.jenkins-ci.org/display/JENKINS/Job+DSL+Plugin
*
* It does not consumes 5k requests in 6 minutes, but actually queries the Github API
* for the repositories in organization and creates the Multi-Branch Pipelines in Jenkins.
View jenkins_pipeline_nested_conditions_when.groovy
// This example shows how to use nested conditions for `when` in jenkinsfile for declarative pipeline syntax
def skip_docker = true
pipeline {
agent any
{
stages {
stage('some stage') {
when {
allOf {