Skip to content

Instantly share code, notes, and snippets.

View peter-wangxu's full-sized avatar

Peter Wang peter-wangxu

View GitHub Profile
@peter-wangxu
peter-wangxu / cinder.conf.unity
Created October 4, 2017 11:13
cinder volume conf for unity
[DEFAULT]
rootwrap_config = /etc/cinder/rootwrap.conf
api_paste_confg = /etc/cinder/api-paste.ini
iscsi_helper = tgtadm
volume_name_template = volume-%s
volume_group = cinder-volumes
verbose = True
auth_strategy = noauth
state_path = /var/lib/cinder
lock_path = /var/lock/cinder
@peter-wangxu
peter-wangxu / docker-compose.yml
Last active October 4, 2017 11:14
cinder volume docker-compose.yml
version: "2"
services:
rabbitmq:
image: rabbitmq
ports:
- "5672:5672"
hostname: rabbitmq
networks:
cindernet:
ipv4_address: 172.49.49.5
# kubectl apply -f pv.yaml
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: local-storage
provisioner: kubernetes.io/no-provisioner
volumeBindingMode: WaitForFirstConsumer
---
apiVersion: v1
kind: PersistentVolumeClaim
@peter-wangxu
peter-wangxu / gist:c6907729309fb0e4c7899faac62b785e
Last active July 13, 2019 14:54
service-account-to-kubeconfig
# your server name goes here
server=https://<your apiserver address>:6443
# the name of the secret containing the service account token goes here
name=crd-reader-sa-token-rz5xp
# namespace to use, set NAMESPACE_OVERRIDE to use other namespace
namespace=${NAMESPACE_OVERRIDE:=default}
ca=$(kubectl get secret/$name -o jsonpath='{.data.ca\.crt}' -n $namespace)
token=$(kubectl get secret/$name -o jsonpath='{.data.token}' -n $namespace | base64 --decode)
namespace=$(kubectl get secret/$name -o jsonpath='{.data.namespace}' -n $namespace | base64 --decode)
@peter-wangxu
peter-wangxu / config-my-new-mac.sh
Last active July 10, 2022 09:30
config my new mac
# 参考文档:https://medium.com/%E6%95%B8%E6%93%9A%E4%B8%8D%E6%AD%A2-not-only-data/macos-%E7%9A%84-terminal-%E5%A4%A7%E6%94%B9%E9%80%A0-iterms-oh-my-zsh-%E5%85%A8%E6%94%BB%E7%95%A5-77d5aae87b10
# 安装brew
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew install zsh
brew install git
brew install iterm2
brew install maven
brew install golang
# 安装oh-my-zsh
@peter-wangxu
peter-wangxu / client-go-watcher.go
Last active August 17, 2022 08:06
a repeatable client-go watcher with timeout
package main
import (
"flag"
"fmt"
"github.com/golang/glog"
v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/watch"
"strings"
"time"
@peter-wangxu
peter-wangxu / image-push-demo.go
Last active April 15, 2024 01:44
image uploading with go-containerregistry
package main
import (
"compress/gzip"
"context"
"fmt"
"io"
"io/ioutil"
"os"