### Install go-colorable Source: https://github.com/cloudfoundry/bosh-alicloud-cpi-release/blob/master/src/bosh-alicloud-cpi/vendor/github.com/onsi/ginkgo/reporters/stenographer/support/go-colorable/README.md Use the go get command to add the package to your project. ```bash $ go get github.com/mattn/go-colorable ``` -------------------------------- ### Install go.yaml.in/yaml/v3 Source: https://github.com/cloudfoundry/bosh-alicloud-cpi-release/blob/master/src/bosh-alicloud-cpi/vendor/go.yaml.in/yaml/v3/README.md Use 'go get' to install the v3 of the yaml package. ```bash go get go.yaml.in/yaml/v3 ``` -------------------------------- ### Install go-isatty package Source: https://github.com/cloudfoundry/bosh-alicloud-cpi-release/blob/master/src/bosh-alicloud-cpi/vendor/github.com/onsi/ginkgo/reporters/stenographer/support/go-isatty/README.md Install the go-isatty package using the go get command. Ensure you have a Go environment set up. ```bash $ go get github.com/mattn/go-isatty ``` -------------------------------- ### Install go-ini/ini Package Source: https://github.com/cloudfoundry/bosh-alicloud-cpi-release/blob/master/src/bosh-alicloud-cpi/vendor/gopkg.in/ini.v1/README.md Use 'go get' to install the go-ini/ini package. Add the '-u' flag for future updates. ```sh go get gopkg.in/ini.v1 ``` -------------------------------- ### Install doublestar Source: https://github.com/cloudfoundry/bosh-alicloud-cpi-release/blob/master/src/bosh-alicloud-cpi/vendor/github.com/bmatcuk/doublestar/README.md Use the go get command to install the package. ```bash go get github.com/bmatcuk/doublestar ``` -------------------------------- ### Install json-iterator/go Source: https://github.com/cloudfoundry/bosh-alicloud-cpi-release/blob/master/src/bosh-alicloud-cpi/vendor/github.com/json-iterator/go/README.md Use the go get command to add the library to your project. ```bash go get github.com/json-iterator/go ``` -------------------------------- ### Install golang.org/x/sys Source: https://github.com/cloudfoundry/bosh-alicloud-cpi-release/blob/master/src/bosh-alicloud-cpi/vendor/github.com/fsnotify/fsnotify/README.md Ensure you have the latest version of golang.org/x/sys installed by running this command. ```console go get -u golang.org/x/sys/... ``` -------------------------------- ### Install fsnotify from GitHub Source: https://github.com/cloudfoundry/bosh-alicloud-cpi-release/blob/master/src/bosh-alicloud-cpi/vendor/github.com/fsnotify/fsnotify/CONTRIBUTING.md Use 'go get' to install the fsnotify package from GitHub. This ensures you are using the original import path for smooth integration. ```bash go get -u github.com/fsnotify/fsnotify ``` -------------------------------- ### Clone BOSH deployment repository Source: https://github.com/cloudfoundry/bosh-alicloud-cpi-release/blob/master/README.md Initial setup commands to prepare the deployment environment. ```bash $ git clone https://github.com/aliyun/bosh-deployment.git $ cd bosh-deployment ``` -------------------------------- ### Install and Import mxj Source: https://github.com/cloudfoundry/bosh-alicloud-cpi-release/blob/master/src/bosh-alicloud-cpi/vendor/github.com/clbanning/mxj/v2/readme.md Use go.mod to install the package and import it into your Go project. ```bash go get github.com/clbanning/mxj/v2@v2.3.2 ``` ```go import "github.com/clbanning/mxj/v2" ``` -------------------------------- ### Setup Ginkgo Development Environment Source: https://github.com/cloudfoundry/bosh-alicloud-cpi-release/blob/master/src/bosh-alicloud-cpi/vendor/github.com/onsi/ginkgo/CONTRIBUTING.md Commands to fetch the repository, configure remotes, and verify the project state. ```bash go get github.com/onsi/ginkgo go get github.com/onsi/gomega/... cd $GOPATH/src/github.com/onsi/ginkgo git remote add fork git@github.com:/ginkgo.git ginkgo -r -p # ensure tests are green go vet ./... # ensure linter is happy ``` -------------------------------- ### Install Ginkgo CLI Source: https://github.com/cloudfoundry/bosh-alicloud-cpi-release/blob/master/src/bosh-alicloud-cpi/vendor/github.com/onsi/ginkgo/README.md Installs the Ginkgo command line interface globally. Ensure your $GOBIN is in your $PATH. ```bash go get -u github.com/onsi/ginkgo/ginkgo ``` -------------------------------- ### Install UUID package Source: https://github.com/cloudfoundry/bosh-alicloud-cpi-release/blob/master/src/bosh-alicloud-cpi/vendor/github.com/google/uuid/README.md Use the go get command to add the package to your project dependencies. ```sh go get github.com/google/uuid ``` -------------------------------- ### Basic fsnotify Watcher Usage Source: https://github.com/cloudfoundry/bosh-alicloud-cpi-release/blob/master/src/bosh-alicloud-cpi/vendor/github.com/fsnotify/fsnotify/README.md This example demonstrates how to create a new watcher, add a file to monitor, and process events and errors in separate goroutines. Ensure the target directory exists. ```go package main import ( "log" "github.com/fsnotify/fsnotify" ) func main() { watcher, err := fsnotify.NewWatcher() if err != nil { log.Fatal(err) } defer watcher.Close() done := make(chan bool) go func() { for { select { case event, ok := <-watcher.Events: if !ok { return } log.Println("event:", event) if event.Op&fsnotify.Write == fsnotify.Write { log.Println("modified file:", event.Name) } case err, ok := <-watcher.Errors: if !ok { return } log.Println("error:", err) } } }() err = watcher.Add("/tmp/foo") if err != nil { log.Fatal(err) } <-done } ``` -------------------------------- ### Run BOSH Alicloud CPI Integration Tests Source: https://github.com/cloudfoundry/bosh-alicloud-cpi-release/blob/master/README.md After preparing your environment and exporting the necessary variables, navigate to the source code directory and run these commands to install dependencies and execute the integration tests using Ginkgo. ```bash $ make testdeps $ ginkgo -r src/bosh-alicloud-cpi/integration ``` -------------------------------- ### Install nxadm/tail library Source: https://github.com/cloudfoundry/bosh-alicloud-cpi-release/blob/master/src/bosh-alicloud-cpi/vendor/github.com/nxadm/tail/README.md Use this command to add the nxadm/tail library to your Go project dependencies. ```Go go get github.com/nxadm/tail/... ``` -------------------------------- ### Create Root Span Source: https://github.com/cloudfoundry/bosh-alicloud-cpi-release/blob/master/src/bosh-alicloud-cpi/vendor/github.com/opentracing/opentracing-go/README.md Starts a new trace without any parent or causal reference. ```go func xyz() { ... sp := opentracing.StartSpan("operation_name") defer sp.Finish() ... } ``` -------------------------------- ### Install BOSH with jumpbox user Source: https://github.com/cloudfoundry/bosh-alicloud-cpi-release/blob/master/README.md Commands to deploy BOSH with jumpbox access and retrieve the SSH key. ```bash $ bosh create-env bosh-deployment/bosh.yml \ --state=state.json \ --vars-store=creds.yml \ -o bosh-deployment/alicloud/cpi.yml \ -o bosh-deployment/jumpbox-user.yml \ -v director_name=my-bosh \ -v internal_cidr=192.168.0.0/24 \ -v internal_gw=192.168.0.1 \ -v internal_ip=192.168.0.7 \ -v vswitch_id=... \ -v security_group_id=... \ -v access_key_id=... \ -v access_key_secret=... \ -v region=cn-beijing \ -v zone=cn-beijing-e -v key_pair_name=... \ -v private_key=bosh.pem ``` ```bash $ bosh int creds.yml --path /jumpbox_ssh/private_key > jumpbox.key $ chmod 600 jumpbox.key $ ssh jumpbox@ -i jumpbox.key ``` -------------------------------- ### Reference BOSH release in manifest Source: https://github.com/cloudfoundry/bosh-alicloud-cpi-release/blob/master/README.md Example configuration for the releases section of a deployment manifest. ```yaml - name: bosh-alicloud-cpi version: 18 url: http://bosh-((region)).oss-((region)).aliyuncs.com/bosh-alicloud-cpi-release-r18.tgz sha1: 2e36b60f99e51fe2dd4e7ea021bf3ecce883487c ``` -------------------------------- ### Create Span from Context Source: https://github.com/cloudfoundry/bosh-alicloud-cpi-release/blob/master/src/bosh-alicloud-cpi/vendor/github.com/opentracing/opentracing-go/README.md Starts a new span that automatically propagates from an existing context. ```go func xyz(ctx context.Context, ...) { ... span, ctx := opentracing.StartSpanFromContext(ctx, "operation_name") defer span.Finish() span.LogFields( log.String("event", "soft error"), log.String("type", "cache timeout"), log.Int("waited.millis", 1500)) ... } ``` -------------------------------- ### Install BOSH with external IP Source: https://github.com/cloudfoundry/bosh-alicloud-cpi-release/blob/master/README.md Command to deploy BOSH using an external Elastic IP configuration. ```bash bosh create-env bosh-deployment/bosh.yml \ --state=state.json \ --vars-store=creds.yml \ -o bosh-deployment/alicloud/cpi.yml \ -o bosh-deployment/external-ip-not-recommended.yml \ -o bosh-deployment/jumpbox-user.yml \ -o bosh-deployment/misc/powerdns.yml \ -v director_name=my-bosh \ -v internal_cidr=192.168.0.0/24 \ -v internal_gw=192.168.0.1 \ -v internal_ip=192.168.0.7 \ -v vswitch_id=... \ -v security_group_id=... \ -v access_key_id=... \ -v access_key_secret=... \ -v region=cn-beijing \ -v zone=cn-beijing-e \ -v key_pair_name=... \ -v private_key=bosh.pem \ -v external_ip=... \ -v dns_recursor_ip=8.8.8.8 ``` -------------------------------- ### Run BOSH Alibaba Cloud CPI Unit Tests Source: https://context7.com/cloudfoundry/bosh-alicloud-cpi-release/llms.txt Execute unit tests for the BOSH Alibaba Cloud CPI. This involves setting up the environment, installing dependencies, and running the ginkgo test suite, skipping integration tests. ```bash # Set up environment source .envrc # Run unit tests make testdeps ginkgo -r -skipPackage integration src/bosh-alicloud-cpi ``` -------------------------------- ### Example Cloud Config Manifest Source: https://github.com/cloudfoundry/bosh-alicloud-cpi-release/blob/master/docs/bosh/alicloud-cpi.md A comprehensive cloud-config manifest for Alibaba Cloud, defining availability zones, VM types with ephemeral disk sizes, disk types, VM extensions, and network configurations. ```yaml azs: - name: z1 cloud_properties: availability_zone: cn-beijing-a - name: z2 cloud_properties: availability_zone: cn-beijing-d - name: z3 cloud_properties: availability_zone: cn-beijing-e vm_types: - name: minimal cloud_properties: instance_type: ecs.mn4.small ephemeral_disk: {size: "51_200"} - name: small cloud_properties: instance_type: ecs.sn2.medium ephemeral_disk: {size: "51_200"} - name: default cloud_properties: instance_type: ecs.sn2.medium ephemeral_disk: {size: "51_200"} - name: small-highmem cloud_properties: instance_type: ecs.sn2ne.xlarge ephemeral_disk: {size: "51_200"} - name: compiler cloud_properties: instance_type: ecs.sn1.large ephemeral_disk: {size: "51_200"} disk_types: - name: 5GB disk_size: 20_480 - name: 10GB disk_size: 20_480 - name: 100GB disk_size: 102_400 vm_extensions: - name: 5GB_ephemeral_disk cloud_properties: ephemeral_disk: {size: "20_480"} - name: 10GB_ephemeral_disk cloud_properties: ephemeral_disk: {size: "20_480"} - name: 50GB_ephemeral_disk cloud_properties: ephemeral_disk: {size: "50_120"} - name: 100GB_ephemeral_disk cloud_properties: ephemeral_disk: {size: "102_400"} - name: 500GB_ephemeral_disk cloud_properties: ephemeral_disk: {size: "512_000"} - name: 1TB_ephemeral_disk cloud_properties: ephemeral_disk: {size: "1024_000"} - name: cf-router-network-properties cloud_properties: slbs: ["lb-2zegrgbsmjvxx1r1v26pn"] - name: cf-tcp-router-network-properties - name: diego-ssh-proxy-network-properties networks: - name: default type: manual subnets: - range: 192.168.10.0/24 gateway: 192.168.10.1 az: z1 dns: [8.8.8.8] cloud_properties: vswitch_id: vsw-2zeamad3a8cscoicqb5c5 security_group_ids: - sg-2zei0mcphxbdxj49qtmz - sg-2ze2pjrn2cu3rlui8klq - range: 192.168.16.0/24 gateway: 192.168.16.1 az: z2 dns: [8.8.8.8] cloud_properties: vswitch_id: vsw-2zerkt1jluc2xdxygeu5t security_group_ids: - sg-2zei0mcphxbdxj49qtmz - sg-2ze2pjrn2cu3rlui8klq - range: 192.168.11.0/24 gateway: 192.168.11.1 az: z3 dns: [8.8.8.8] cloud_properties: vswitch_id: vsw-2zedja4ggcyrahgz0s7cc security_group_ids: [sg-2zei0mcphxbdxj49qtmz] - name: vip type: vip compilation: workers: 5 reuse_compilation_vms: true az: z1 vm_type: compiler network: default ``` -------------------------------- ### Set CF Domain Source: https://github.com/cloudfoundry/bosh-alicloud-cpi-release/blob/master/docs/cf/install-cf.md Define the domain name for the Cloud Foundry installation. ```bash export CF_DOMAIN=... ``` -------------------------------- ### Configure Availability Zone Source: https://github.com/cloudfoundry/bosh-alicloud-cpi-release/blob/master/docs/bosh/alicloud-cpi.md Specify the availability zone for creating instances. Example: `cn-beijing-a`. ```yaml azs: - name: z1 cloud_properties: availability_zone: cn-beijing-a ``` -------------------------------- ### Create Child Span Source: https://github.com/cloudfoundry/bosh-alicloud-cpi-release/blob/master/src/bosh-alicloud-cpi/vendor/github.com/opentracing/opentracing-go/README.md Starts a span that is a child of an existing parent span. ```go func xyz(parentSpan opentracing.Span, ...) { ... sp := opentracing.StartSpan( "operation_name", opentracing.ChildOf(parentSpan.Context())) defer sp.Finish() ... } ``` -------------------------------- ### Create BOSH environment Source: https://github.com/cloudfoundry/bosh-alicloud-cpi-release/blob/master/README.md Command to initialize the BOSH director on Alibaba Cloud with required parameters. ```bash bosh create-env bosh-deployment/bosh.yml --state=state.json \ --vars-store=creds.yml \ -o bosh-deployment/alicloud/cpi.yml \ -v director_name=my-bosh \ -v internal_cidr=192.168.0.0/24 \ -v internal_gw=192.168.0.1 \ -v internal_ip=192.168.0.2 \ -v vswitch_id=... \ -v security_group_id=... \ -v access_key_id=... \ -v access_key_secret=... \ -v region=cn-beijing \ -v zone=cn-beijing-a \ -v key_pair_name=... \ -v private_key=bosh.pem ``` -------------------------------- ### Bootstrap Ginkgo Test Suite Source: https://github.com/cloudfoundry/bosh-alicloud-cpi-release/blob/master/src/bosh-alicloud-cpi/vendor/github.com/onsi/ginkgo/README.md Commands to set up a new Ginkgo test suite and generate a sample test file. After editing the file, tests can be run using 'go test', 'ginkgo', or 'ginkgo bootstrap'. ```bash cd path/to/package/you/want/to/test ginkgo bootstrap # set up a new ginkgo suite ginkgo generate # will create a sample test file. edit this file and add your tests then... go test # to run your tests ginkgo # also runs your tests ``` -------------------------------- ### Create BOSH Environment Source: https://github.com/cloudfoundry/bosh-alicloud-cpi-release/blob/master/docs/cf/install-cf.md Deploy the BOSH director using the specified Alibaba Cloud configuration parameters. ```bash bosh create-env bosh-deployment/bosh.yml --state=state.json \ --vars-store=creds.yml \ -o bosh-deployment/alicloud/cpi.yml \ -o bosh-deployment/jumpbox-user.yml \ -o bosh-deployment/misc/powerdns.yml \ -v dns_recursor_ip=8.8.8.8 \ -v director_name=my-bosh \ -v internal_cidr=192.168.0.0/24 \ -v internal_gw=192.168.0.1 \ -v internal_ip=$BOSH_ENVIRONMENT \ -v vswitch_id=... \ -v security_group_id=... \ -v access_key_id=... \ -v access_key_secret=... \ -v region=... \ -v zone=... \ -v key_pair_name=... \ -v private_key=bosh.pem ``` -------------------------------- ### Run project unit tests Source: https://github.com/cloudfoundry/bosh-alicloud-cpi-release/blob/master/README.md Commands to prepare dependencies and run Ginkgo unit tests. ```bash $ source .envrc $ make testdeps $ ginkgo -r -skipPackage integration src/bosh-alicloud-cpi ``` -------------------------------- ### Create and follow a log file in Go Source: https://github.com/cloudfoundry/bosh-alicloud-cpi-release/blob/master/src/bosh-alicloud-cpi/vendor/github.com/nxadm/tail/README.md Use this to continuously monitor a log file for new entries. Ensure the file path is correct and the application has read permissions. The ReOpen option is useful for log rotation. ```Go // Create a tail t, err := tail.TailFile( "/var/log/nginx.log", tail.Config{Follow: true, ReOpen: true}) if err != nil { panic(err) } // Print the text of each received line for line := range t.Lines { fmt.Println(line.Text) } ``` -------------------------------- ### Deploy BOSH Director Source: https://github.com/cloudfoundry/bosh-alicloud-cpi-release/blob/master/docs/cf/install-cf-china.md Execute the BOSH create-env command with the necessary Alibaba Cloud CPI and configuration files. ```bash bosh create-env bosh-deployment/bosh.yml --state=state.json \ --vars-store=creds.yml \ -o bosh-deployment/alicloud/cpi.yml \ -o bosh-deployment/alicloud/releases-in-china.yml \ -o bosh-deployment/jumpbox-user.yml \ -o bosh-deployment/misc/powerdns.yml \ -v dns_recursor_ip=8.8.8.8 \ -v director_name=my-bosh \ -v internal_cidr=192.168.0.0/24 \ -v internal_gw=192.168.0.1 \ -v internal_ip=$BOSH_ENVIRONMENT \ -v vswitch_id=... \ -v security_group_id=... \ -v access_key_id=... \ -v access_key_secret=... \ -v region=... \ -v zone=... \ -v key_pair_name=... \ -v private_key=bosh.pem ``` -------------------------------- ### Deploy Cloud Foundry Source: https://github.com/cloudfoundry/bosh-alicloud-cpi-release/blob/master/docs/cf/install-cf.md Execute the deployment of Cloud Foundry using the BOSH CLI. ```bash bosh -e my-bosh -d cf deploy cf-deployment/cf-deployment.yml \ --vars-store cf-vars.yml \ -o cf-deployment/iaas-support/alicloud/stemcells.yml \ -v region=... \ -v system_domain=$CF_DOMAIN ``` -------------------------------- ### Snapshot Disk Method Source: https://context7.com/cloudfoundry/bosh-alicloud-cpi-release/llms.txt Creates a snapshot of a persistent disk for backup purposes and returns the snapshot CID. ```go // CPI method signature func (a SnapshotDiskMethod) SnapshotDisk(diskCID apiv1.DiskCID, meta apiv1.DiskMeta) (apiv1.SnapshotCID, error) // Returns the snapshot CID which can be used for restore operations ``` -------------------------------- ### Get Leaf Nodes and Values Source: https://github.com/cloudfoundry/bosh-alicloud-cpi-release/blob/master/src/bosh-alicloud-cpi/vendor/github.com/clbanning/mxj/v2/readme.md LeafNodes and LeafValues retrieve all terminal nodes and their corresponding values from a map, irrespective of path depth. ```go leafnodes := mv.LeafNodes() ``` ```go leafvalues := mv.LeafValues() ``` -------------------------------- ### Get and Set interface{} Source: https://github.com/cloudfoundry/bosh-alicloud-cpi-release/blob/master/src/bosh-alicloud-cpi/vendor/github.com/modern-go/reflect2/README.md Performs type-checked get/set operations on interface{} values. Always use a pointer to the type when performing these operations. ```go valType := reflect2.TypeOf(1) i := 1 j := 10 valType.Set(&i, &j) // i will be 10 ``` -------------------------------- ### Attach Disk Method Signatures Source: https://context7.com/cloudfoundry/bosh-alicloud-cpi-release/llms.txt Go method signatures for attaching persistent disks to VM instances. ```go // CPI method signatures func (a AttachDiskMethod) AttachDisk(vmCID apiv1.VMCID, diskCID apiv1.DiskCID) error func (a AttachDiskMethod) AttachDiskV2(vmCID apiv1.VMCID, diskCID apiv1.DiskCID) (apiv1.DiskHint, error) // Disk path formats returned: // - For NVMe-supported instance types: /dev/disk/by-id/nvme-Alibaba_Cloud_Elastic_Block_Storage_ // - For standard instance types: /dev/disk/by-id/virtio- // - Legacy path format: /dev/vd[b-z] ``` -------------------------------- ### Get and Set unsafe.Pointer Source: https://github.com/cloudfoundry/bosh-alicloud-cpi-release/blob/master/src/bosh-alicloud-cpi/vendor/github.com/modern-go/reflect2/README.md Performs get/set operations using unsafe.Pointer without type checking. Always use a pointer to the type when performing these operations. ```go valType := reflect2.TypeOf(1) i := 1 j := 10 valType.UnsafeSet(unsafe.Pointer(&i), unsafe.Pointer(&j)) // i will be 10 ``` -------------------------------- ### Clone BOSH Deployment Repository Source: https://github.com/cloudfoundry/bosh-alicloud-cpi-release/blob/master/docs/cf/install-cf.md Retrieve the BOSH deployment configuration for Alibaba Cloud. ```bash $ git clone https://github.com/aliyun/bosh-deployment.git $ cd bosh-deployment $ git checkout alicloud ``` -------------------------------- ### Abstract the OS interface Source: https://github.com/cloudfoundry/bosh-alicloud-cpi-release/blob/master/src/bosh-alicloud-cpi/vendor/github.com/bmatcuk/doublestar/README.md Define a custom OS interface to override standard library filesystem operations. ```go type OS interface { Lstat(name string) (os.FileInfo, error) Open(name string) (*os.File, error) PathSeparator() rune Stat(name string) (os.FileInfo, error) } ``` -------------------------------- ### Import doublestar Source: https://github.com/cloudfoundry/bosh-alicloud-cpi-release/blob/master/src/bosh-alicloud-cpi/vendor/github.com/bmatcuk/doublestar/README.md Include the package in your Go source files. ```go import "github.com/bmatcuk/doublestar" ``` -------------------------------- ### Define Pipeline Variables Source: https://github.com/cloudfoundry/bosh-alicloud-cpi-release/blob/master/ci/README.md Create a YAML file containing Alicloud credentials, network configuration, and GitHub/GitLab authentication details. ```yaml alicloud_access_key__primary: YOUR_ALICLOUD_ACCESS_KEY alicloud_secret_key__primary: YOUR_ALICLOUD_SECRET_KEY alicloud_region__primary: REGION # cn-beijing alicloud__cpi_stemcell_id: CPI_STEMCELL_ID # m-2ze1cneefoj075diqyeh alicloud__cpi_internal_ip: CPI_INTERNAL_IP # 172.16.0.2 alicloud__cpi_internal_gw: CPI_INTERNAL_GATEWAY # 172.16.0.1 github_user_email: YOUR_GITHUB_ACCOUNT_EMAIL github_user_name: YOUR_GITHUB_ACCOUNT_NAME github_user_id: YOUR_GITHUB_ACCOUNT_ID github_user_password: YOUR_GITHUB_ACCOUNT_PASSWORD gitlab_bosh-alicloud-cpi-release_private-key: | -----BEGIN RSA PRIVATE KEY----- YOUR_LOCAL_PRIVATE_KEY -----END RSA PRIVATE KEY----- alicloud_director_vars_file: | -----BEGIN RSA PRIVATE KEY----- YOUR_BOSH_DIRECTOR_PRIVATE_KEY -----END RSA PRIVATE KEY----- ``` -------------------------------- ### Build the BOSH release Source: https://github.com/cloudfoundry/bosh-alicloud-cpi-release/blob/master/README.md Commands to clone the repository, add blobs, and create the BOSH release tarball. ```bash $ git clone https://github.com/aliyun/bosh-alicloud-cpi-release.git $ cd bosh-alicloud-cpi-release $ mkdir blobs $ bosh add-blob ~/Downloads/go1.20.10.linux-amd64.tar.gz go1.20.10.linux-amd64.tar.gz $ source .envrc $ make $ bosh create-release --force --tarball=../bosh-alicloud-cpi.tgz ``` -------------------------------- ### Run BOSH Alibaba Cloud CPI Integration Tests Source: https://context7.com/cloudfoundry/bosh-alicloud-cpi-release/llms.txt Execute integration tests for the BOSH Alibaba Cloud CPI. This requires setting up environment variables with Alibaba Cloud credentials and network configuration before running the ginkgo integration test suite. ```bash # Run integration tests (requires Alibaba Cloud credentials) export CPI_REGION=cn-beijing export CPI_ZONE=cn-beijing-e export CPI_ACCESS_KEY_ID=your-access-key export CPI_ACCESS_KEY_SECRET=your-secret export CPI_SECURITY_GROUP_ID=sg-xxxxx export CPI_VSWITCH_ID=vsw-xxxxx export CPI_STEMCELL_ID=m-xxxxx export CPI_INTERNAL_CIDR=192.168.0.0/24 export CPI_INTERNAL_NETMASK=255.255.255.0 export CPI_INTERNAL_IP=192.168.0.2 export CPI_INTERNAL_GW=192.168.0.1 export CPI_EXTERNAL_IP=47.47.47.47 export CPI_SLB_ID=lb-xxxxx ginkgo -r src/bosh-alicloud-cpi/integration ``` -------------------------------- ### Create a Feature Branch Source: https://github.com/cloudfoundry/bosh-alicloud-cpi-release/blob/master/src/bosh-alicloud-cpi/vendor/github.com/onsi/ginkgo/CONTRIBUTING.md Command to initialize a new branch for development. ```bash git checkout -b my-feature ``` -------------------------------- ### Clone cf-deployment Repository Source: https://github.com/cloudfoundry/bosh-alicloud-cpi-release/blob/master/docs/cf/install-cf-china.md Clone the cf-deployment repository to obtain the necessary configuration files for deployment. ```bash git clone https://github.com/cloudfoundry/cf-deployment.git ``` -------------------------------- ### Login to BOSH Director Source: https://github.com/cloudfoundry/bosh-alicloud-cpi-release/blob/master/docs/cf/install-cf.md Configure the BOSH CLI environment and authenticate with the director. ```bash bosh int ./creds.yml --path /director_ssl/ca > ca-cert bosh alias-env my-bosh -e $BOSH_ENVIRONMENT --ca-cert ca-cert export BOSH_CLIENT=admin export BOSH_CLIENT_SECRET=`bosh int ./creds.yml --path /admin_password` export BOSH_CA_CERT=`bosh int ./creds.yml --path /director_ssl/ca` bosh -e my-bosh login ``` -------------------------------- ### Clone CF Deployment Repository Source: https://github.com/cloudfoundry/bosh-alicloud-cpi-release/blob/master/docs/cf/install-cf.md Retrieve the Cloud Foundry deployment configuration. ```bash $ git clone https://github.com/cloudfoundry/cf-deployment.git ``` -------------------------------- ### Run tests on Linux via Vagrant Source: https://github.com/cloudfoundry/bosh-alicloud-cpi-release/blob/master/src/bosh-alicloud-cpi/vendor/github.com/fsnotify/fsnotify/CONTRIBUTING.md Execute the test suite on a Linux environment using Vagrant. This command connects to the Linux box and runs the tests within the project directory. ```bash vagrant ssh linux -c 'cd fsnotify/fsnotify; go test' ``` -------------------------------- ### Define system call entry points in assembly Source: https://github.com/cloudfoundry/bosh-alicloud-cpi-release/blob/master/src/bosh-alicloud-cpi/vendor/golang.org/x/sys/unix/README.md These functions are implemented in asm_${GOOS}_${GOARCH}.s to handle system call dispatching. Syscall and Syscall6 are standard, while RawSyscall is intended for low-level use without scheduler interaction. ```go func Syscall(trap, a1, a2, a3 uintptr) (r1, r2, err uintptr) func Syscall6(trap, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2, err uintptr) func RawSyscall(trap, a1, a2, a3 uintptr) (r1, r2, err uintptr) ``` -------------------------------- ### Upload CF Release Source: https://github.com/cloudfoundry/bosh-alicloud-cpi-release/blob/master/docs/cf/install-cf.md Upload the Cloud Foundry release version. ```bash bosh upload-release https://bosh.io/d/github.com/cloudfoundry/cf-release?v=278 --sha1 7e05e98a9333b187807501ab4252e52058859a2c ``` -------------------------------- ### Info Method Source: https://context7.com/cloudfoundry/bosh-alicloud-cpi-release/llms.txt Returns CPI information, including supported stemcell formats. ```go // CPI method signature func (a InfoMethod) Info() (apiv1.Info, error) // Returns: // { // "stemcell_formats": ["general-tar", "alicloud-tar", "alicloud-raw"] // } ``` -------------------------------- ### Deploy BOSH Director on Alibaba Cloud Source: https://context7.com/cloudfoundry/bosh-alicloud-cpi-release/llms.txt Use the create-env command with bosh-deployment to deploy BOSH Director on Alibaba Cloud. Ensure you have cloned the bosh-deployment repository and have your Alibaba Cloud credentials and network details ready. ```bash # Clone the bosh-deployment repository git clone https://github.com/aliyun/bosh-deployment.git cd bosh-deployment # Deploy BOSH Director bosh create-env bosh-deployment/bosh.yml \ --state=state.json \ --vars-store=creds.yml \ -o bosh-deployment/alicloud/cpi.yml \ -o bosh-deployment/jumpbox-user.yml \ -v director_name=my-bosh \ -v internal_cidr=192.168.0.0/24 \ -v internal_gw=192.168.0.1 \ -v internal_ip=192.168.0.2 \ -v vswitch_id=vsw-xxxxxxxxx \ -v security_group_id=sg-xxxxxxxxx \ -v access_key_id=YOUR_ACCESS_KEY_ID \ -v access_key_secret=YOUR_ACCESS_KEY_SECRET \ -v region=cn-beijing \ -v zone=cn-beijing-a \ -v key_pair_name=bosh \ -v private_key=bosh.pem ``` -------------------------------- ### Go Module Tools Package for Ginkgo Source: https://github.com/cloudfoundry/bosh-alicloud-cpi-release/blob/master/src/bosh-alicloud-cpi/vendor/github.com/onsi/ginkgo/README.md Sets up Ginkgo as a development dependency using a tools.go file. This ensures reproducible versions for development and automated pipelines. ```go // +build tools package tools import ( _ "github.com/onsi/ginkgo/ginkgo" ) // This file imports packages that are used when running go generate, or used // during the development process but not otherwise depended on by built code. ``` -------------------------------- ### Commit and release commands Source: https://github.com/cloudfoundry/bosh-alicloud-cpi-release/blob/master/src/bosh-alicloud-cpi/vendor/github.com/onsi/ginkgo/RELEASING.md Commands to commit the version change, push to the repository, and create a GitHub release. ```bash git commit -m "vM.m.p" git push gh release create "vM.m.p" git fetch --tags origin master ``` -------------------------------- ### create_vm Source: https://context7.com/cloudfoundry/bosh-alicloud-cpi-release/llms.txt Creates a new ECS instance with specified properties including instance type, availability zone, networking, disks, and optional spot pricing. Supports integration with Server Load Balancers (SLB) and Network Load Balancers (NLB). ```APIDOC ## create_vm Creates a new ECS instance with specified properties including instance type, availability zone, networking, disks, and optional spot pricing. Supports integration with Server Load Balancers (SLB) and Network Load Balancers (NLB). ### Cloud Config Example (vm_types section) ```yaml vm_types: - name: default cloud_properties: availability_zone: cn-beijing-a instance_type: ecs.sn2.medium instance_name: my-bosh-vm key_pair_name: bosh-keypair charge_type: PostPaid # or PrePaid for reserved instances # Spot instance configuration spot_strategy: SpotWithPriceLimit # NoSpot, SpotWithPriceLimit, SpotAsPriceGo spot_price_limit: 0.5 # Disk configuration system_disk: size: 61440 # in MB category: cloud_ssd # cloud_efficiency, cloud_ssd ephemeral_disk: size: 51200 category: cloud_efficiency # Load balancer integration slbs: ["lb-2zegrgbsmjvxx1r1v26pn"] slb_weight: 100 slb_server_group: ["rsp-abc123"] slb_server_group_weight: 100 slb_server_group_port: 8080 # NLB server groups nlb_server_groups: - server_group_id: "sgp-xxx" port: 80 weight: 100 # Security groups (can also be specified in networks) security_group_ids: ["sg-2zei0mcphxbdxj49qtmz"] # IAM role ram_role_name: my-ecs-role # Tags tags: environment: production team: platform ``` ``` -------------------------------- ### CPI Configuration Source: https://context7.com/cloudfoundry/bosh-alicloud-cpi-release/llms.txt Configuration file for the BOSH Alibaba Cloud CPI, specifying cloud and registry properties. ```APIDOC ## CPI Configuration The CPI is configured via a JSON configuration file that specifies Alibaba Cloud credentials and registry settings. ```json { "cloud": { "plugin": "alicloud", "properties": { "alicloud": { "region": "cn-beijing", "availability_zone": "cn-beijing-a", "access_key_id": "YOUR_ACCESS_KEY_ID", "access_key_secret": "YOUR_ACCESS_KEY_SECRET", "security_token": "", "encrypted": true, "kms_key_id": "your-kms-key-id" }, "registry": { "user": "admin", "password": "admin-password", "protocol": "http", "host": "127.0.0.1", "port": 25777 }, "agent": { "ntp": ["0.pool.ntp.org", "1.pool.ntp.org"], "mbus": "nats://nats:nats-password@10.0.0.6:4222" } } } } ``` ``` -------------------------------- ### Configure Logrus with Colorable Output Source: https://github.com/cloudfoundry/bosh-alicloud-cpi-release/blob/master/src/bosh-alicloud-cpi/vendor/github.com/onsi/ginkgo/reporters/stenographer/support/go-colorable/README.md Use NewColorableStdout to enable ANSI color support for logrus output on Windows. ```go logrus.SetFormatter(&logrus.TextFormatter{ForceColors: true}) logrus.SetOutput(colorable.NewColorableStdout()) logrus.Info("succeeded") logrus.Warn("not correct") logrus.Error("something error") logrus.Fatal("panic") ``` -------------------------------- ### Glob files Source: https://github.com/cloudfoundry/bosh-alicloud-cpi-release/blob/master/src/bosh-alicloud-cpi/vendor/github.com/bmatcuk/doublestar/README.md Find files and directories matching a pattern. ```go func Glob(pattern string) ([]string, error) ``` -------------------------------- ### Login to Cloud Foundry Source: https://github.com/cloudfoundry/bosh-alicloud-cpi-release/blob/master/docs/cf/install-cf.md Authenticate with the deployed Cloud Foundry instance using the CF CLI. ```bash cf login -a http://api.$CF_DOMAIN --skip-ssl-validation -u admin -p `bosh int ./cf-vars.yml --path /cf_admin_password` ``` -------------------------------- ### Configure Manual Network Source: https://github.com/cloudfoundry/bosh-alicloud-cpi-release/blob/master/docs/bosh/alicloud-cpi.md Define a manual network with vSwitch ID and security group IDs. Ensure the vSwitch and security group exist in your Alicloud account. ```yaml networks: - name: default type: manual subnets: - range: 10.10.0.0/24 gateway: 10.10.0.1 ip: 10.0.0.3 cloud_properties: vswitch_id: vsw-2zemyfytfclbcmgfkzokx security_group_ids: ["sg-2zei0mcphxbdxj49qtmz"] ``` -------------------------------- ### Set VM Metadata Method Source: https://context7.com/cloudfoundry/bosh-alicloud-cpi-release/llms.txt Sets metadata on a VM instance, which is converted into ECS tags for tracking. ```go // CPI method signature func (a SetVMMetadataMethod) SetVMMetadata(vmCID apiv1.VMCID, meta apiv1.VMMeta) error // BOSH passes metadata including: // - name: instance name (normalized to Alibaba Cloud requirements) // - deployment: BOSH deployment name // - director: BOSH director name // - job: job name // - index: instance index // - instance_group: instance group name // All metadata is converted to ECS tags ``` -------------------------------- ### Update Cloud Config Source: https://github.com/cloudfoundry/bosh-alicloud-cpi-release/blob/master/docs/cf/install-cf.md Apply the Alibaba Cloud specific cloud configuration to the BOSH director. ```bash bosh -e my-bosh update-cloud-config cf-deployment/iaas-support/alicloud/cloud-config.yml ``` -------------------------------- ### Upload Stemcell Source: https://github.com/cloudfoundry/bosh-alicloud-cpi-release/blob/master/docs/cf/install-cf.md Upload the required Ubuntu stemcell for Alibaba Cloud. ```bash bosh -e my-bosh upload-stemcell http://bosh.oss-cn-hangzhou.aliyuncs.com/light-bosh-stemcell-1016-alicloud-kvm-ubuntu-trusty-go_agent.tgz ``` -------------------------------- ### Configure BOSH Alibaba Cloud CPI Source: https://context7.com/cloudfoundry/bosh-alicloud-cpi-release/llms.txt JSON configuration file defining Alibaba Cloud credentials, registry settings, and agent communication parameters. ```json { "cloud": { "plugin": "alicloud", "properties": { "alicloud": { "region": "cn-beijing", "availability_zone": "cn-beijing-a", "access_key_id": "YOUR_ACCESS_KEY_ID", "access_key_secret": "YOUR_ACCESS_KEY_SECRET", "security_token": "", "encrypted": true, "kms_key_id": "your-kms-key-id" }, "registry": { "user": "admin", "password": "admin-password", "protocol": "http", "host": "127.0.0.1", "port": 25777 }, "agent": { "ntp": ["0.pool.ntp.org", "1.pool.ntp.org"], "mbus": "nats://nats:nats-password@10.0.0.6:4222" } } } } ``` -------------------------------- ### Authenticate with BOSH Director Source: https://github.com/cloudfoundry/bosh-alicloud-cpi-release/blob/master/docs/cf/install-cf-china.md Extract credentials from the state file and configure the BOSH CLI for authentication. ```bash bosh int ./creds.yml --path /director_ssl/ca > ca-cert bosh alias-env my-bosh -e BOSH_ENVIRONMENT --ca-cert ca-cert export BOSH_CLIENT=admin export BOSH_CLIENT_SECRET=`bosh int ./creds.yml --path /admin_password` export BOSH_CA_CERT=`bosh int ./creds.yml --path /director_ssl/ca` bosh -e my-bosh login ``` -------------------------------- ### Define a BDD test structure with Ginkgo Source: https://github.com/cloudfoundry/bosh-alicloud-cpi-release/blob/master/src/bosh-alicloud-cpi/vendor/github.com/onsi/ginkgo/README.md Uses Describe, Context, and When blocks to organize test cases, with Expect assertions for validation. ```go Describe("the strings package", func() { Context("strings.Contains()", func() { When("the string contains the substring in the middle", func() { It("returns `true`", func() { Expect(strings.Contains("Ginkgo is awesome", "is")).To(BeTrue()) }) }) }) }) ``` -------------------------------- ### Resize Disk Method Source: https://context7.com/cloudfoundry/bosh-alicloud-cpi-release/llms.txt Resizes an existing persistent disk to a larger size, where the size parameter is in MB. ```go // CPI method signature func (a HasDiskMethod) ResizeDisk(diskCID apiv1.DiskCID, size int) error // size parameter is in MB // The CPI converts to GB for the Alibaba Cloud API ``` -------------------------------- ### Basic Map Conversion Source: https://github.com/cloudfoundry/bosh-alicloud-cpi-release/blob/master/src/bosh-alicloud-cpi/vendor/github.com/clbanning/mxj/v2/readme.md Demonstrates a basic conversion of a value to a Map. ```go mv := Map(v) ``` -------------------------------- ### Snapshot Disk Source: https://context7.com/cloudfoundry/bosh-alicloud-cpi-release/llms.txt Creates a snapshot of a persistent disk for backup purposes. ```APIDOC ## Snapshot Disk ### Description Creates a snapshot of a persistent disk for backup purposes. ### Parameters #### Path Parameters - **diskCID** (apiv1.DiskCID) - Required - The ID of the disk to snapshot. - **meta** (apiv1.DiskMeta) - Required - Metadata for the snapshot. ### Response - **SnapshotCID** (apiv1.SnapshotCID) - The ID of the created snapshot. ``` -------------------------------- ### Configure Resource Pool with System Disk Source: https://github.com/cloudfoundry/bosh-alicloud-cpi-release/blob/master/docs/bosh/alicloud-cpi.md Define a resource pool specifying instance type, availability zone, and system disk configuration. The `instance_charge_type` can be `PrePaid` or `PostPaid`. ```yaml resource_pools: - name: default network: default stemcell: name: bosh-stemcell-alicloud-kvm-ubuntu-trusty-go_agent version: 1016 cloud_properties: availability_zone: cn-beijing-a instance_type: ecs.n1.small instance_charge_type: PostPaid slbs: ["lb-2zegrgbsmjvxx1r1v26pn"] system_disk: {"size": "61_440", "category": "cloud_efficiency"} ``` -------------------------------- ### Unmarshal and Marshal YAML Data in Go Source: https://github.com/cloudfoundry/bosh-alicloud-cpi-release/blob/master/src/bosh-alicloud-cpi/vendor/go.yaml.in/yaml/v3/README.md Demonstrates unmarshalling YAML into a struct and a map, and then marshalling them back to YAML. Ensure struct fields are public for correct unmarshalling. ```go package main import ( "fmt" "log" "go.yaml.in/yaml/v3" ) var data = ` a: Easy! b: c: 2 d: [3, 4] ` // Note: struct fields must be public in order for unmarshal to // correctly populate the data. type T struct { A string B struct { RenamedC int `yaml:"c"` D []int `yaml:",flow"` } } func main() { t := T{} err := yaml.Unmarshal([]byte(data), &t) if err != nil { log.Fatalf("error: %v", err) } fmt.Printf("--- t:\n%v\n\n", t) d, err := yaml.Marshal(&t) if err != nil { log.Fatalf("error: %v", err) } fmt.Printf("--- t dump:\n%s\n\n", string(d)) m := make(map[interface{}]interface{}) err = yaml.Unmarshal([]byte(data), &m) if err != nil { log.Fatalf("error: %v", err) } fmt.Printf("--- m:\n%v\n\n", m) d, err = yaml.Marshal(&m) if err != nil { log.Fatalf("error: %v", err) } fmt.Printf("--- m dump:\n%s\n\n", string(d)) } ``` -------------------------------- ### Match path patterns Source: https://github.com/cloudfoundry/bosh-alicloud-cpi-release/blob/master/src/bosh-alicloud-cpi/vendor/github.com/bmatcuk/doublestar/README.md Functions for matching file names against patterns, with variants for standard path separators and system-specific separators. ```go func Match(pattern, name string) (bool, error) ``` ```go func PathMatch(pattern, name string) (bool, error) ``` -------------------------------- ### Initialize Global Tracer Source: https://github.com/cloudfoundry/bosh-alicloud-cpi-release/blob/master/src/bosh-alicloud-cpi/vendor/github.com/opentracing/opentracing-go/README.md Sets the global tracer instance early in the application lifecycle. ```go import "github.com/opentracing/opentracing-go" import ".../some_tracing_impl" func main() { opentracing.SetGlobalTracer( // tracing impl specific: some_tracing_impl.New(...), ) ... } ``` -------------------------------- ### Upload BOSH release to director Source: https://github.com/cloudfoundry/bosh-alicloud-cpi-release/blob/master/README.md Command to upload the release directly to the BOSH director. ```bash bosh upload-release --sha1 2e36b60f99e51fe2dd4e7ea021bf3ecce883487c \ http://bosh-((region)).oss-((region)).aliyuncs.com/bosh-alicloud-cpi-release-r18.tgz ``` -------------------------------- ### Has VM Method Source: https://context7.com/cloudfoundry/bosh-alicloud-cpi-release/llms.txt Checks if a VM instance exists and returns a boolean status. ```go // CPI method signature func (a HasVMMethod) HasVM(cid apiv1.VMCID) (bool, error) // Returns true if instance exists, false if not found ``` -------------------------------- ### Unpause BOSH Alicloud CPI Pipeline Source: https://github.com/cloudfoundry/bosh-alicloud-cpi-release/blob/master/ci/README.md Enable the pipeline in Concourse after it has been set. ```bash fly -t alicloud unpause-pipeline -p bosh-alicloud-cpi ``` -------------------------------- ### Set BOSH Alicloud CPI Pipeline Source: https://github.com/cloudfoundry/bosh-alicloud-cpi-release/blob/master/ci/README.md Deploy the pipeline configuration to the targeted Concourse environment using the defined variable file. ```bash fly -t alicloud set-pipeline -p bosh-alicloud-cpi -c pipeline-develop.yml --load-vars-from vars-pipeline-develop.yml ``` -------------------------------- ### Configure Dynamic Network Source: https://github.com/cloudfoundry/bosh-alicloud-cpi-release/blob/master/docs/bosh/alicloud-cpi.md Set up a dynamic network using vSwitch ID and security group IDs. The CPI will assign an IP address automatically. ```yaml networks: - name: default type: dynamic cloud_properties: vswitch_id: vsw-2zemyfytfclbcmgfkzokx security_group_ids: ["sg-2zei0mcphxbdxj49qtmz"] ``` -------------------------------- ### Export Alibaba Cloud CPI Environment Variables Source: https://github.com/cloudfoundry/bosh-alicloud-cpi-release/blob/master/README.md Set these environment variables to configure your Alibaba Cloud environment for integration testing. Ensure you have created a SLB (Load Balancer) and obtained its ID. ```bash export CPI_REGION=cn-beijing export CPI_ZONE=cn-beijing-e export CPI_ACCESS_KEY_ID=... export CPI_ACCESS_KEY_SECRET=... export CPI_SECURITY_GROUP_ID=... export CPI_VSWITCH_ID=... export CPI_STEMCELL_ID=... export CPI_INTERNAL_CIDR=192.168.0.0/24/ export CPI_INTERNAL_NETMASK=255.255.255.0 export CPI_INTERNAL_IP=192.168.0.2 export CPI_INTERNAL_GW=192.168.0.1 export CPI_EXTERNAL_IP=47.47.47.47 export CPI_SLB_ID=... ``` -------------------------------- ### Define VM Types for Alibaba Cloud Source: https://context7.com/cloudfoundry/bosh-alicloud-cpi-release/llms.txt Cloud Config snippet for defining VM types, including instance specifications, disk configurations, and load balancer integration. ```yaml # Cloud Config - vm_types section vm_types: - name: default cloud_properties: availability_zone: cn-beijing-a instance_type: ecs.sn2.medium instance_name: my-bosh-vm key_pair_name: bosh-keypair charge_type: PostPaid # or PrePaid for reserved instances # Spot instance configuration spot_strategy: SpotWithPriceLimit # NoSpot, SpotWithPriceLimit, SpotAsPriceGo spot_price_limit: 0.5 # Disk configuration system_disk: size: 61440 # in MB category: cloud_ssd # cloud_efficiency, cloud_ssd ephemeral_disk: size: 51200 category: cloud_efficiency # Load balancer integration slbs: ["lb-2zegrgbsmjvxx1r1v26pn"] slb_weight: 100 slb_server_group: ["rsp-abc123"] slb_server_group_weight: 100 slb_server_group_port: 8080 # NLB server groups nlb_server_groups: - server_group_id: "sgp-xxx" port: 80 weight: 100 # Security groups (can also be specified in networks) security_group_ids: ["sg-2zei0mcphxbdxj49qtmz"] # IAM role ram_role_name: my-ecs-role # Tags tags: environment: production team: platform ``` -------------------------------- ### Reboot VM Method Source: https://context7.com/cloudfoundry/bosh-alicloud-cpi-release/llms.txt Reboots an ECS instance and waits for it to return to the Running status. ```go // CPI method signature func (a RebootVMMethod) RebootVM(cid apiv1.VMCID) error // Uses force reboot and waits for status transition: // Running -> Stopping -> Starting -> Running ``` -------------------------------- ### SSH into BOSH Jumpbox Source: https://github.com/cloudfoundry/bosh-alicloud-cpi-release/blob/master/docs/cf/install-cf.md Access the jumpbox VM using the generated private key. ```bash bosh int creds.yml --path /jumpbox_ssh/private_key > jumpbox.key chmod 600 jumpbox.key ssh jumpbox@$BOSH_ENVIRONMENT -i jumpbox.key ``` -------------------------------- ### Replace encoding/json Marshal with jsoniter Source: https://github.com/cloudfoundry/bosh-alicloud-cpi-release/blob/master/src/bosh-alicloud-cpi/vendor/github.com/json-iterator/go/README.md Use ConfigCompatibleWithStandardLibrary to maintain compatibility when replacing standard library marshaling. ```go import "encoding/json" json.Marshal(&data) ``` ```go import jsoniter "github.com/json-iterator/go" var json = jsoniter.ConfigCompatibleWithStandardLibrary json.Marshal(&data) ``` -------------------------------- ### Configure VIP Network Source: https://github.com/cloudfoundry/bosh-alicloud-cpi-release/blob/master/docs/bosh/alicloud-cpi.md Define a VIP network with a static IP address. ```yaml networks: - name: default type: vip ip: 47.47.47.47 ``` -------------------------------- ### Set BOSH Environment Variable Source: https://github.com/cloudfoundry/bosh-alicloud-cpi-release/blob/master/docs/cf/install-cf.md Define the BOSH environment IP address. ```bash export BOSH_ENVIRONMENT=... ```