Skip to content

Instantly share code, notes, and snippets.

@harsh4870
harsh4870 / jwt-user-asseration.js
Created August 9, 2022 18:21
JWT assertion Node JS
var jwt = require('jsonwebtoken');
const fs = require('fs');
var request = require("request");
var querystring = require('querystring');
var privateKey = fs.readFileSync('./private_key.pem');
#idcs or keycloak URL
var url = "https://example.com/oauth2/v1/token"
var headers = {
'Authorization': 'Basic <BASE-64 ENCODED client ID & Secret>',
@harsh4870
harsh4870 / nginx-oci-mesh.yaml
Last active July 17, 2022 13:46
Nginx with Oracle service mesh integration
apiVersion: v1
kind: Service
metadata:
name: nginx
labels:
app: nginx
spec:
ports:
- name: http
port: 80
@harsh4870
harsh4870 / daemonset-configmap-mount.yaml
Created June 10, 2022 06:54
Daemonset configmap hostpath mounting
kind: ServiceAccount
metadata:
name: daemonset-access
namespace: default
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
name: cron-namespace-admin-rbac
subjects:
@harsh4870
harsh4870 / http-echo-istio-deployment.yaml
Created April 19, 2022 09:13
Kubernetes print request, body & header details into logs going into service
apiVersion: apps/v1
kind: Deployment
metadata:
name: istio-echoserver
spec:
replicas: 1
selector:
matchLabels:
app: istio-echoserver
template:
@harsh4870
harsh4870 / mongodb-docker-compose.yaml
Created March 1, 2022 20:16
MongoDb docker compose
version: '3.7'
services:
mongodb_container:
image: mongo:latest
environment:
- MONGO_INITDB_ROOT_USERNAME=root
- MONGO_INITDB_ROOT_PASSWORD=password
- MONGO_INITDB_DATABASE=test
ports:
- 27017:27017
@harsh4870
harsh4870 / elasticsearch.yaml
Created February 22, 2022 12:29
Elasticsearch Kubernetes YAML stateful set for Dev and testing purpose not for Prod
apiVersion: apps/v1
kind: StatefulSet
metadata:
labels:
app : elasticsearch
component: elasticsearch
release: elasticsearch
name: elasticsearch
spec:
podManagementPolicy: Parallel
@harsh4870
harsh4870 / dnssec.yml
Created February 10, 2022 14:56
cloud custodian array or list parse
filters:
- and:
- type: value
key: dnssecConfig.defaultKeySpecs[].algorithm
value: rsasha256
value_type: swap
op: in
- type: value
key: dnssecConfig.defaultKeySpecs[].keyType
op: in
@harsh4870
harsh4870 / logging-enabled.yml
Last active February 10, 2022 14:39
Cloud custodian GCP policy medium blog
policies:
- name: check-all-bucket-logging
description: |
Check all bucket logging enabled
resource: gcp.bucket
filters:
- type: value
key: logging
value: absent
actions:
sudo curl -L -o /usr/local/bin/aws-vault https://github.com/99designs/aws-vault/releases/download/v4.2.0/aws-vault-linux-amd64
sudo chmod 755 /usr/local/bin/aws-vault
apiVersion: cert-manager.io/v1
kind: Issuer
metadata:
name: letsencrypt-prod
spec:
acme:
email: [email protected]
server: https://acme-v02.api.letsencrypt.org/directory
privateKeySecretRef:
name: letsencrypt-prod