Skip to content

Instantly share code, notes, and snippets.

stages:
- build
- test
- deploy
variables:
# disable Docker TLS validation
DOCKER_TLS_CERTDIR: ""
# localhost address is shared by both the job container and the dind container (as they share the same Pod)
# So this configuration make the dind service as our Docker daemon when running Docker commands
@esys
esys / application.yaml
Last active April 8, 2021 19:07
ArgoCD application with plugin
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: testapp
namespace: argocd
spec:
project: default
source:
repoURL: git@gitlab.com:my/repo/charts.git
targetRevision: master
@esys
esys / values.yaml
Last active October 12, 2020 16:51
ArgoCD plugin for Helm secrets
server:
config:
configManagementPlugins: |
- name: helmSecrets
init:
command: ["gpg"]
args: ["--import", "/home/argocd/gpg/gpg.asc"] # is mounted as a kube secret
generate:
command: ["/bin/sh", "-c"]
args: ["helm secrets template $HELM_OPTS $RELEASE_NAME ."]
@esys
esys / testapp.yaml
Created October 12, 2020 16:42
ArgoCD CRD application
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: testapp
namespace: argocd
spec:
project: default
source:
repoURL: git@gitlab.com:my/repo/charts.git
targetRevision: master
@esys
esys / Dockerfile
Last active April 9, 2021 08:31
argocd with sops and helm secrets
FROM argoproj/argocd:v1.8.7
ARG SOPS_VERSION="v3.6.1"
ARG HELM_SECRETS_VERSION="2.0.2"
ARG HELM_GCS_VERSION="0.3.7"
ARG SOPS_PGP_FP="141B69EE206943BA9A64E691A00C9B1A7DCB6D07"
ENV SOPS_PGP_FP=${SOPS_PGP_FP}
USER root
const ng = cluster.addNodegroup("nodegroup", {
instanceType: new ec2.InstanceType("t3.medium"),
minSize: 1,
maxSize: 3,
});
const vpc = new ec2.Vpc(this, "eks-vpc");
const cluster = new eks.Cluster(this, "Cluster", {
vpc: vpc,
defaultCapacity: 0, // we want to manage capacity ourselves
version: eks.KubernetesVersion.V1_17,
});
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-scale
spec:
replicas: 1
selector:
matchLabels:
app: nginx
template:
enableAutoscaling(cluster: eks.Cluster, ng: eks.Nodegroup, version: string = "v1.17.3") {
const autoscalerStmt = new iam.PolicyStatement();
autoscalerStmt.addResources("*");
autoscalerStmt.addActions(
"autoscaling:DescribeAutoScalingGroups",
"autoscaling:DescribeAutoScalingInstances",
"autoscaling:DescribeLaunchConfigurations",
"autoscaling:DescribeTags",
"autoscaling:SetDesiredCapacity",
"autoscaling:TerminateInstanceInAutoScalingGroup",
@esys
esys / autoscaler-eks.ts
Last active January 30, 2023 10:40
eks cdk install cluster autoscaler
import * as cdk from "@aws-cdk/core";
import * as eks from "@aws-cdk/aws-eks";
import * as ec2 from "@aws-cdk/aws-ec2";
import * as iam from "@aws-cdk/aws-iam";
import { CfnJson } from "@aws-cdk/core";
export class MyCluster extends cdk.Construct {
constructor(scope: cdk.Construct, id: string) {
super(scope, id);