Skip to content

Instantly share code, notes, and snippets.

from OpenSSL import crypto
import random
def create_cert(ca_cert, ca_subj, ca_key, common_name=None):
client_key = crypto.PKey()
client_key.generate_key(crypto.TYPE_RSA, 4096)
client_cert = crypto.X509()
client_cert.set_version(2)
import random
from OpenSSL import crypto
ca_key = crypto.PKey()
ca_key.generate_key(crypto.TYPE_RSA, 4096)
ca_cert = crypto.X509()
ca_cert.set_version(2)
ca_cert.set_serial_number(random.randint(50000000, 100000000))
import random
from OpenSSL import crypto
ca_key = crypto.PKey()
ca_key.generate_key(crypto.TYPE_RSA, 4096)
ca_cert = crypto.X509()
ca_cert.set_version(2)
ca_cert.set_serial_number(random.randint(50000000, 100000000))
@rohancme
rohancme / grafana-prometheus-values.yaml
Last active June 23, 2021 19:20
Values for the grafana helm chart to talk to an existing prometheus datasource
persistence:
enabled: true
accessModes:
- ReadWriteOnce
size: 5Gi
datasources:
datasources.yaml:
apiVersion: 1
datasources:
@rohancme
rohancme / prometheus-values.yml
Created June 26, 2018 06:26
values.yml for prometheus 2.1 with cAdvisor
serverFiles:
alerts: ""
rules: ""
prometheus.yml: |-
rule_files:
- /etc/config/rules
- /etc/config/alerts
scrape_configs:
- job_name: prometheus
@rohancme
rohancme / Jenkinsfile-windows.groovy
Last active November 3, 2017 02:06
A simple Windows Jenkinsfile for the Kubernetes plugin
podTemplate(label: 'windows-vs2017',
containers: [
containerTemplate(name: 'jnlp', image: '{{REPLACE-WITH-YOUR-CUSTOM-IMAGE}}',
envVars:[
containerEnvVar(key: 'HOME', value:'C:\\users\\containeradministrator'),
containerEnvVar(key: 'JENKINS_HOME', value: 'G:\\')
],
workingDir:'C:\\Jenkins\\')
],
nodeSelector: 'beta.kubernetes.io/os=windows') {
@rohancme
rohancme / Jenkinsfile-ubuntu.groovy
Last active November 3, 2017 02:06
Jenkinsfile for a Linux build with the K8S plugin
podTemplate(label: 'my-build-pod', containers: [
// This is the official jnlp base image with added support for ssh access to git repos
containerTemplate(name: 'jnlp', image: 'larribas/jenkins-jnlp-slave-with-ssh:1.0.0', args: '${computer.jnlpmac} ${computer.name}'),
// This image gives us a container with kubectl installed so we can deploy the image we build
containerTemplate(name: 'kubectl', image: 'lachlanevenson/k8s-kubectl', ttyEnabled: true, command: 'cat'),
// A docker container to build our image
containerTemplate(name: 'docker', image: 'docker', command: 'cat', ttyEnabled: true)]) {
node ('my-build-pod') {
// Store ssh credentials in Jenkins, replace GITHUB_URL with your Github Repo
git branch: "${env.BRANCH_NAME}", credentialsId: "{{JENKINS_CREDENTIALS}}", url: '{{GITHUB_URL}}'
@rohancme
rohancme / jenkins-windows-msbuild-Dockerfile
Last active September 23, 2020 01:29
My base MSBuild image
FROM microsoft/windowsservercore
# Pass in JENKINS_SECRET and JENKINS_JNLP_URL as an environment variables
# Install jre and add to PATH
# Do not recommend pushing the image to a public repository due to Oracle's EULA: http://www.oracle.com/technetwork/java/javase/documentation/index.html
SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue';"]
RUN wget 'http://javadl.oracle.com/webapps/download/AutoDL?BundleId=210185' -Outfile 'C:\jreinstaller.exe' ; \
Start-Process -filepath C:\jreinstaller.exe -passthru -wait -argumentlist "/s,INSTALLDIR=c:\Java\jre1.8.0_91" ; \
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: jenkins-slave-windows
namespace: ci
spec:
template:
metadata:
labels:
name: jenkins-slave-windows
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: jenkins-slave-ubuntu
namespace: ci
spec:
template:
metadata:
labels:
name: jenkins-slave-ubuntu