Skip to content

Instantly share code, notes, and snippets.

@chenweienn
chenweienn / test.222
Created September 7, 2023 10:37
test-for-mcard
AA:file1.zip
BB:file2.tgz
@chenweienn
chenweienn / variables.yml
Last active March 27, 2023 11:08
deploy-concourse-via-bosh
1. prepare var file
$ cat > variables.yml << EOF
---
deployment_name: concourse-v6
azs:
- AZ3
- AZ2
- AZ1
network_name: services
#!/bin/bash
set -e
# set -x
# intall om
echo "+++ installing om"
curl -L -O https://github.com/pivotal-cf/om/releases/download/7.8.2/om-linux-amd64-7.8.2
chmod +x om-linux-amd64-7.8.2
cp om-linux-amd64-7.8.2 /usr/local/bin/om
@chenweienn
chenweienn / new-scs-config-server.sh
Created February 8, 2023 07:55
new-scs-config-server.sh
#!/bin/bash
set -eu
config_server_credentials=$(echo $VCAP_SERVICES | jq -r '.["p.config-server"][0].credentials')
credhub_ref=$(echo ${config_server_credentials} | jq -r '."credhub-ref"')
## client_id, client_secret is not available as plain text when credhub integration is enabled
# client_id=$(echo ${config_server_credentials}|jq -r '.client_id')
# client_secret=$(echo ${config_server_credentials}|jq -r '.client_secret')
# access_token_uri=$(echo ${config_server_credentials}|jq -r '.access_token_uri')
@chenweienn
chenweienn / list-svc.sh
Last active January 13, 2023 09:11
A script to list service instances on TAS foundation.
#!/bin/bash
SCRIPT_NAME=$(basename $0)
usage() {
echo "Usage:"
echo " $SCRIPT_NAME --per-svc|--per-org"
echo ""
echo "Flags:"
echo " --per-svc Print triple (org_name, space_name, service_instance_name) for every service offering."
@chenweienn
chenweienn / ssh-tkg-ova
Last active October 14, 2022 17:44
Setting up SSH user for TKG ova image
This procedure is based on
- slack discussion: https://vmware.slack.com/archives/CSZCCLW0P/p1642695822214400?thread_ts=1642667864.186000&cid=CSZCCLW0P
- https://github.com/kubernetes-sigs/image-builder/blob/master/images/capi/hack/image-govc-cloudinit.sh
- https://cloudinit.readthedocs.io/en/latest/topics/datasources/vmware.html
(1) Authenticate govc CLI.
(2) In vCenter UI, use TKG OVA template to create a VM.
For example, I created test-vm from ova ubuntu-2004-kube-v1.22.9+vmware.1-tkg.1
@chenweienn
chenweienn / CNS-test-app
Last active October 15, 2022 06:09
Test Cloud Native Storage on vSphere.
## Doc:
## https://docs.vmware.com/en/VMware-Tanzu-Kubernetes-Grid-Integrated-Edition/1.14/tkgi/GUID-vsphere-cns.html#create-or-use-cns-block-volumes-8
## https://docs.vmware.com/en/VMware-vSphere-Container-Storage-Plug-in/2.0/vmware-vsphere-csp-getting-started/GUID-B1AAA825-3441-46D3-877C-A6580D2097D1.html
(1) sample storage class pointing to vSAN datastore
cat > storage-class.yml << EOF
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
@chenweienn
chenweienn / nsxt-ingress-test-app
Last active June 22, 2022 03:23
Test NSX native support for k8s ingress.
## This sample app is from NCP (NSX Container Plug-in) project.
## https://gitlab.eng.vmware.com/core-build/nsx-ujo/-/tree/master/doc/source/devref/samples/ingress
## NCP ingress Doc:
## https://docs.vmware.com/en/VMware-NSX-T-Data-Center/3.2/ncp-kubernetes/GUID-E03D6EE5-9C6C-457F-AD81-25CF2056F4D8.html
(1) tea app
cat > tea-svc.yaml << EOF
apiVersion: v1
(1) create test namespace
kubectl create namespace sriov-dpdk-test
(2) Identify two worker nodes with available SR-IOV VFs; schedule a receiver pod and transmitter pod to the two nodes
# ubuntu:jammy packages dpdk 21.11.1
cat > test-pod-receiver.yaml << EOF
# This procedure is to address the issue in the following KB article, before TAS patch is released
# https://community.pivotal.io/s/article/Apps-stop-running-after-a-deploy-when-using-dynamic-ASGs-with-icmp-any-rule
(1) download the bosh release containing fix
$ wget -L https://github.com/cloudfoundry/silk-release/releases/download/3.5.0/silk-3.5.0.tgz
$ wget -L https://github.com/cloudfoundry/cf-networking-release/releases/download/3.5.0/cf-networking-3.5.0.tgz