This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
VOLUME_DIRECTORY="/etc/prometheus/rules/changeme" | |
for arg in "$@" | |
do | |
case $arg in | |
-VD=*|--volume-dir=*) | |
VOLUME_DIRECTORY="${arg#*=}" | |
shift | |
;; | |
esac |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: apps/v1 | |
kind: Deployment | |
metadata: | |
name: test | |
spec: | |
replicas: 1 | |
selector: | |
matchLabels: | |
component: test | |
template: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const privateKey = fs.readFileSync('webhook.key').toString(); | |
const certificate = fs.readFileSync('webhook.crt').toString(); | |
//… | |
const options = {key: privateKey, cert: certificate}; | |
const server = https.createServer(options, app); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RUN openssl genrsa -out rootCA.key 4096 | |
RUN openssl req -x509 -new -nodes -key rootCA.key -sha256 -days 1024 -out rootCA.crt \ | |
-subj "/C=US/ST=New Jersey/L=Princeton /O=Dow Jones/OU=PIB/CN=*.default.svc/emailAddress=scott.rahner@dowjones.com" | |
RUN openssl genrsa -out webhook.key 4096 | |
RUN openssl req -new -key webhook.key -out webhook.csr \ | |
-subj "/C=US/ST=New Jersey/L=Princeton /O=Dow Jones/OU=PIB/CN=webhook-service.default.svc/emailAddress=scott.rahner@dowjones.com" | |
RUN openssl x509 -req -in webhook.csr -CA rootCA.crt -CAkey rootCA.key -CAcreateserial -out webhook.crt -days 1024 -sha256 | |
RUN cat rootCA.crt | base64 | tr -d '\n' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: admissionregistration.k8s.io/v1beta1 | |
kind: MutatingWebhookConfiguration | |
metadata: | |
name: webhook | |
webhooks: | |
- name: webhook-service.default.svc | |
failurePolicy: Fail | |
clientConfig: | |
service: | |
name: webhook-service |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: v1 | |
kind: Service | |
metadata: | |
name: webhook-service | |
spec: | |
ports: | |
- port: 443 | |
targetPort: 8443 | |
selector: | |
component: webhook-server |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: apps/v1 | |
kind: Deployment | |
metadata: | |
name: webhook-server | |
spec: | |
replicas: 1 | |
selector: | |
matchLabels: | |
component: webhook-server | |
template: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM node:8 | |
USER node | |
WORKDIR /home/node | |
COPY index.js . | |
COPY package.json . | |
RUN npm install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const app = express(); | |
app.use(bodyParser.json()); | |
app.post('/mutate', (req, res) => { | |
console.log(req.body) | |
console.log(req.body.request.object) | |
let adminResp = {response:{ | |
allowed: true, | |
patch: Buffer.from("[{ \"op\": \"add\", \"path\": \"/metadata/labels/foo\", \"value\": \"bar\" }]").toString('base64'), | |
patchType: "JSONPatch", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.bottom{ | |
bottom: -225px; | |
animation: waves 999999999s cubic-bezier(0,.25,1,.75) infinite; | |
} | |
.middle{ | |
bottom: -125px; | |
animation: bwaves 450000s linear infinite; | |
} |
NewerOlder