Skip to content

Instantly share code, notes, and snippets.

View alaypatel07's full-sized avatar

Alay Patel alaypatel07

  • Raleigh, North Carolina
View GitHub Profile
@alaypatel07
alaypatel07 / etcd-sts.yaml
Last active August 9, 2023 19:40
ETCD statefulset yaml
apiVersion: v1
kind: Service
metadata:
name: "etcd"
annotations:
# Create endpoints also if the related pod isn't ready
service.alpha.kubernetes.io/tolerate-unready-endpoints: "true"
spec:
ports:
- port: 2379
@alaypatel07
alaypatel07 / main.go
Created September 4, 2019 18:20
remove member from data directory
package main
import (
"encoding/binary"
"flag"
"fmt"
"log"
"os"
"path/filepath"
"strings"
@alaypatel07
alaypatel07 / shell
Last active November 15, 2019 00:46
defrag-cluster-etcd.sh
#!/usr/bin/env bash
ETCD_IMAGE=$(oc get configmap -n openshift-machine-config-operator machine-config-operator-images -oyaml | grep etcd | awk '{print $2}')
ETCD_IMAGE=${ETCD_IMAGE::-1}
oc create -f - <<EOF
---
apiVersion: batch/v1beta1
kind: CronJob
oc create namespace openshift-migration
#create service for mongo-db
cat <<EOF | oc create -f -
kind: Service
apiVersion: v1
metadata:
name: mig-operator-noobaa-db
namespace: openshift-migration
labels:
func (r *ReconcileMigToken) Reconcile(request reconcile.Request) (reconcile.Result, error) {
var err error
log.Reset()
token := &migapi.MigToken{}
// prefer a separate function call instead of defer func() {}()
// two advantages:
// 1. defers are hard(er) to debug/reason about than normal calls
// 2. with normal function we can have a matching else condition
htpasswd -c -B -b users.htpasswd bob bob
oc create secret generic htpass-secret --from-file=htpasswd=./users.htpasswd -n openshift-config
oc patch oauth cluster --type='json' -p '[ { "op": "replace", "path": "/spec", "value": {"identityProviders": [{"htpasswd": {"fileData": {"name": "htpass-secret"}}, "mappingMethod": "claim", "name": "bob_httpassd_provider", "type": "HTPasswd"}]}}]'
oc login -u bob -p bob
oc new-project bob-destination
oc login -u kubeadmin -p $KUBEADMIN_PASSWORD
cat <<EOF | oc create -f -
apiVersion: migration.openshift.io/v1alpha1
kind: MigrationTenant
metadata:
export RESOURCE="migrationcontrollers"
export NAMESPACE="openshift-migration"
if [ -z "$1" ]; then
export USER="bob"
else
export USER=$1
fi
if [ -z "$2" ]; then
/*
Copyright 2019 Red Hat Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
@alaypatel07
alaypatel07 / rsync-stunnel-server-setup.yaml
Last active November 29, 2021 18:45
rsync stunnel manual setup with nginx ingress
apiVersion: v1
kind: Pod
metadata:
labels:
app: crane2
name: rsync-server
namespace: default
spec:
containers:
- command:
package main
import (
"fmt"
"k8s.io/test-infra/prow/apis/prowjobs/v1"
"sigs.k8s.io/yaml"
)
func main() {