Skip to content

Instantly share code, notes, and snippets.

View krish143434's full-sized avatar
πŸ‘¨β€πŸ’»

Sai Krishna reddy Karri krish143434

πŸ‘¨β€πŸ’»
  • Hyderabad
View GitHub Profile
DemoHandler
---
def lambda_handler(event, context):
print(event)
return "hello, world!!"
DemoAuthorizer
---
# Get ExternalIPs of all nodes
kubectl get nodes -o jsonpath='{.items[*].status.addresses[?(@.type=="ExternalIP")].address}'
# List Names of Pods that belong to Particular RC
# "jq" command useful for transformations that are too complex for jsonpath, it can be found at https://stedolan.github.io/jq/
sel=${$(kubectl get rc my-rc --output=json | jq -j '.spec.selector | to_entries | .[] | "\(.key)=\(.value),"')%?}
echo $(kubectl get pods --selector=$sel --output=jsonpath={.items..metadata.name})
# Check which nodes are ready
JSONPATH='{range .items[*]}{@.metadata.name}:{range @.status.conditions[*]}{@.type}={@.status};{end}{end}' \
&& kubectl get nodes -o jsonpath="$JSONPATH" | grep "Ready=True"
# List all Secrets currently in use by a pod
@krish143434
krish143434 / jenkins-add-ssh-keypair-with-password-credential.groovy
Created August 19, 2020 12:10 — forked from ivan-pinatti/jenkins-add-ssh-keypair-with-password-credential.groovy
Jenkins - Add SSH keypair with password credential via groovy script - #jenkins #groovy #ssh #credential
#!groovy
// imports
import com.cloudbees.jenkins.plugins.sshcredentials.impl.*
import com.cloudbees.plugins.credentials.*
import com.cloudbees.plugins.credentials.common.*
import com.cloudbees.plugins.credentials.domains.Domain
import com.cloudbees.plugins.credentials.impl.*
import hudson.util.Secret
import java.nio.file.Files
@krish143434
krish143434 / jenkins-add-username-with-password-credential.groovy
Created August 19, 2020 12:09 — forked from ivan-pinatti/jenkins-add-username-with-password-credential.groovy
Jenkins - Add Username with password credential via groovy script - #jenkins #groovy #username #password #credential #usernameWithPassword
#!groovy
// imports
import com.cloudbees.plugins.credentials.*
import com.cloudbees.plugins.credentials.domains.Domain
import com.cloudbees.plugins.credentials.impl.*
import hudson.util.Secret
import jenkins.model.Jenkins
// parameters
@krish143434
krish143434 / git-tag-delete-local-and-remote.sh
Created May 21, 2020 11:55 — forked from mobilemind/git-tag-delete-local-and-remote.sh
how to delete a git tag locally and remote
# delete local tag '12345'
git tag -d 12345
# delete remote tag '12345' (eg, GitHub version too)
git push origin :refs/tags/12345
# alternative approach
git push --delete origin tagName
git tag -d tagName
@krish143434
krish143434 / bitbucket_api
Created May 18, 2020 18:31
How to Tag a Release on BitBucket
#other way is to use bitbucket api call
#create a personal access token from bitbucket app passwords and use it here, and give the name of the tag and target hash
curl -X POST -u username:Passwd -H "Content-Type: application/json" -v --trace - -d '{"name":"nameoftag","target":{"hash":"gitcommitid_whichyouwanttotag"}}' \
https://api.bitbucket.org/2.0/repositories/yourname/yourreponame/refs/tags
@krish143434
krish143434 / kubectl-delete_all
Created March 26, 2020 10:41 — forked from superbrothers/kubectl-delete_all
Kubernetes: Delete all objects in the namespace
kubectl delete "$(kubectl api-resources --namespaced=true --verbs=delete -o name | tr "\n" "," | sed -e 's/,$//')" --all
@krish143434
krish143434 / apply-ecr-lifecycle-policy.sh
Last active July 20, 2020 13:09 — forked from shcallaway/apply-ecr-lifecycle-policy.sh
Apply the same lifecycle policy to all AWS ECR repositories
#!/bin/bash
aws ecr describe-repositories | jq '.repositories[].repositoryName' | xargs -I {} aws ecr put-lifecycle-policy --repository-name {} --lifecycle-policy-text "file://policy.json"
/////////////////////////
#the other way is to store it in some varible and pass it in the cmd line
#here am giving major lifecycle policies like
# 1) removing untagged images
# 2) storing only images with specific tag prefix
@krish143434
krish143434 / find ecr image tag.sh
Created February 21, 2020 20:03
Following script will check ecr and get the Imagetag in json format, please have jason parser installed in your OS, if not availabile.
#!/usr/bin/env bash
# Example:
# ./find-ecr-image.sh foo/bar mytag
if [ $# -lt 2 ]; then
echo "Usage: $( basename $0 ) <repository-name> <image-tag>"
exit 1
fi
IMAGE_META="$( aws ecr describe-images --repository-name=$1 --image-ids=imageTag=$2 2> /dev/null )"
@krish143434
krish143434 / README.md
Last active February 7, 2020 07:09 — forked from dnozay/_Jenkins+Script+Console.md
jenkins groovy scripts collection.