# !/bin/bash

#sudo apt install nfs-kernel-server
#sudo mkdir /var/nfs/kubedata -p
#sudo chown nobody: /var/nfs/kubedata
#sudo systemctl enable nfs-server.service
#sudo systemctl start nfs-server.service
#sudo vim /etc/exports


#sudo exportfs -rav
#exporting *:/var/nfs/kubedata
#sudo apt install snapd 
#sudo snap install helm --classic
#mkdir ~/downloads && cd ~/downloads
#wget https://github.com/apache/openwhisk-cli/releases/download/latest/OpenWhisk_CLI-latest-linux-amd64.tgz
#tar -xvf OpenWhisk_CLI-latest-linux-amd64.tgz
#sudo mv wsk /usr/local/bin/wsk
#sudo helm repo add nfs-subdir-external-provisioner https://kubernetes-sigs.github.io/nfs-subdir-external-provisioner/
#sudo helm repo update
#sudo helm  install openwhisk-nfs nfs-subdir-external-provisioner/nfs-subdir-external-provisioner \
#    --set nfs.server=10.0.0.185 \
#    --set nfs.path=/var/nfs/kubedata
#kubectl patch storageclass cbs -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"false"}}}'
#kubectl patch storageclass nfs-client -p '{"metadata": {"annotations":{"storageclass.kubernetes.io/is-default-class":"true"}}}'
#sudo kubectl get storageclass

#sudo kubectl label node 10.0.0.185 openwhisk-role=core
#sudo kubectl label node 10.0.0.104 openwhisk-role=invoker
#sudo kubectl label node 10.0.0.25 openwhisk-role=invoker
#sudo kubectl label node 10.0.0.35 openwhisk-role=invoker
#sudo wsk property set --apihost 10.0.0.185:31001
#sudo wsk property set --auth 23bc46b1-71f6-4ed5-8c54-816aa4f8c502:123zO3xZCLrMN6v2BKK1dXYFpXlPkccOFqm12CdAsMgRU4VrNZ9lyGVCGuMDGIwP
#cd ~
#git clone https://github.com/apache/openwhisk-deploy-kube.git
#cd openwhisk-deploy-kube
#sudo helm  install owdev ./helm/openwhisk -n openwhisk --create-namespace -f ~/mycluster.yaml
#sudo apt install -y docker.io
#curl -fsSL https://www.mongodb.org/static/pgp/server-5.0.asc | \
#   sudo gpg -o /usr/share/keyrings/mongodb-server-5.0.gpg \
#   --dearmor
#echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-5.0.gpg ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/5.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-5.0.list
#sudo apt-get update
#sudo apt-get install -y mongodb-org
#sudo systemctl start mongod
#sudo systemctl status mongod
#sudo systemctl enable mongod
#sudo apt install -y redis

#cd /etc/docker/
#sudo mkdir certs.d
#sudo nano /etc/docker/certs.d/openssl-san.cnf
#
#sudo openssl req -x509 -nodes -days 365 -newkey rsa:4096 -keyout /etc/docker/certs.d/registry.key -out /etc/docker/certs.d/registry.crt -config /etc/docker/certs.d/openssl-san.cnf
#sudo openssl req -new -key /etc/docker/certs.d/registry.key -out /etc/docker/certs.d/registry.csr -config /etc/docker/certs.d/openssl-san.cnf
#sudo openssl genpkey -algorithm RSA -out /etc/docker/certs.d/ca.key -pkeyopt rsa_keygen_bits:4096
#sudo openssl req -x509 -new -nodes -key /etc/docker/certs.d/ca.key -sha256 -days 365 -out /etc/docker/certs.d/ca.crt -subj "/C=CN/ST=Shandong/L=Qingdao/O=HEU/OU=SYS/CN=My CA"
#
# echo "subjectAltName = IP:10.0.0.185, DNS:10.0.0.185" | sudo tee /etc/docker/certs.d/tmp.ext > /dev/null
#
#sudo openssl x509 -req -in /etc/docker/certs.d/registry.csr -CA /etc/docker/certs.d/ca.crt -CAkey /etc/docker/certs.d/ca.key -CAcreateserial -out /etc/docker/certs.d/registry.crt -days 365 -sha256 -extfile /etc/docker/certs.d/tmp.ext
# sudo cp /etc/docker/certs.d/ca.crt /usr/local/share/ca-certificates/
# sudo update-ca-certificates
# sudo cp /etc/docker/certs.d/registry.crt /usr/local/share/ca-certificates/
#sudo update-ca-certificates
#
#sudo docker run -d --restart=always -p 5000:5000 --name registry -v /etc/docker/certs.d:/certs -e REGISTRY_HTTP_TLS_CERTIFICATE=/certs/registry.crt -e REGISTRY_HTTP_TLS_KEY=/certs/registry.key registry:2
#sudo mkdir -p /etc/docker/certs.d/10.0.0.185:5000
#sudo cp /etc/docker/certs.d/registry.crt /etc/docker/certs.d/10.0.0.185:5000/ca.crt
#sudo systemctl restart docker
#sudo chmod 644 /etc/docker/certs.d/registry.key
#sudo chmod 644 /etc/docker/certs.d/ca.key

wget https://golang.org/dl/go1.21.0.linux-amd64.tar.gz
sudo tar -C /usr/local -xzf go1.21.0.linux-amd64.tar.gz
export PATH=$PATH:/usr/local/go/bin
source ~/.profile
go version
go install github.com/rakyll/hey@latest
hey --help



