Skip to content

Instantly share code, notes, and snippets.

View hayderimran7's full-sized avatar

Imran Hayder hayderimran7

View GitHub Profile
@hayderimran7
hayderimran7 / EKS_RDS_VPC_Peering_script.sh
Last active January 8, 2024 04:59
VPC Peering Between EKS and RDS postgres
#!/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 March 12, 2020 18:42
aws cross account access to EKS

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 March 9, 2020 05:52
Traffic Routing in canary deployments using nginx-ingress

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 `

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 January 29, 2019 19:41 — forked from paulchubatyy/pipeline.groovy
Jenkins pipeline to read the repository list for Github Organization and create multibranch pipeline projects for them
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.
// 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 {
// Job DSL to create a github organization folder with submodules etc configured
organizationFolder('myorg') {
description("org")
configure {
it / navigators / "org.jenkinsci.plugins.github__branch__source.GitHubSCMNavigator" << {
repoOwner("someowner")
credentialsId("github-user")
}
}
configure {
@hayderimran7
hayderimran7 / FizzBuzz.py
Created June 14, 2018 18:06 — forked from jaysonrowe/FizzBuzz.py
FizzBuzz Python Solution
def fizzbuzz(n):
if n % 3 == 0 and n % 5 == 0:
return 'FizzBuzz'
elif n % 3 == 0:
return 'Fizz'
elif n % 5 == 0:
return 'Buzz'
else:
return str(n)
@hayderimran7
hayderimran7 / min-char-rnn.py
Created June 2, 2018 04:15 — forked from karpathy/min-char-rnn.py
Minimal character-level language model with a Vanilla Recurrent Neural Network, in Python/numpy
"""
Minimal character-level Vanilla RNN model. Written by Andrej Karpathy (@karpathy)
BSD License
"""
import numpy as np
# data I/O
data = open('input.txt', 'r').read() # should be simple plain text file
chars = list(set(data))
data_size, vocab_size = len(data), len(chars)
'''
run it as:
python -c 'import get_vault_auth_aws;print(get_vault_auth_aws.return_token("https://vault.address.com"))'
'''
from __future__ import unicode_literals
import hmac
import json