Skip to content

Instantly share code, notes, and snippets.

@amitlt
amitlt / Jenkinsfile
Created April 1, 2019 08:15
Jenkinsfile Parameter Multiple Extended Choice Example shared library step
node {
timeout(time: 5, unit: "MINUTES") {
INPUT_PARAMS = input(
message: 'Please provide the parameter input:',
ok: 'Next',
parameters: [
booleanParam(defaultValue: true, name: 'Create Jira Tickets?', description: ''),
booleanParam(defaultValue: true, name: 'Encrypted?', description: 'Use for secrets/passwords/certificates/etc'),
multipleChoice(name: 'Environments', choices: ["prod", "eu", "test", "mgmt"], description: 'Environments to create parameter in'),
string(name: 'Path', description: 'SSM Parameter Path'),
@amitlt
amitlt / pre-commit
Created June 25, 2019 08:37
Helm chart semver pre-commit script
#!/usr/bin/env bash
set -euo pipefail
export PATH=$PATH:/usr/local/bin
function error {
echo -e "
[x] Encountered error on pre-commit script: ${BASH_SOURCE[0]}
Message: $1
@amitlt
amitlt / ingress.yaml
Created January 15, 2020 09:52
Kubernetes nginx ingress ssl redirect behind SSL termination LB
annotations:
# Since the SSL term happens at the LB level, nginx will always receive HTTP traffic, which will always cause 'force-ssl-redirect' to loop and the browser to get a 'too many redirects' error.
# What we need to check in order to remedy this is which protocol the LB receives traffic in, HTTP or HTTPS, we do this by checking the header 'X-Forwarded-Proto', if it's HTTP, we redirect the client to the current URL ($host$request_uri), but with an added 'https://' prefix
nginx.ingress.kubernetes.io/configuration-snippet: |
if ($http_x_forwarded_proto = 'http'){
return 301 https://$host$request_uri;
}
kind: ConfigMap
apiVersion: v1
metadata:
name: mousetrap-config
data:
config.yml: |
general:
port: 3000
scanTimeout: 3600
markStaleAfter: 4000
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
name: mousetrap
name: mousetrap
namespace: default
spec:
replicas: 1
selector: