### Install gorilla/mux Source: https://github.com/vmware/load-balancer-and-ingress-services-for-kubernetes/blob/master/ako-crd-operator/vendor/github.com/gorilla/mux/README.md Use the go get command to install the package into your Go environment. ```sh go get -u github.com/gorilla/mux ``` -------------------------------- ### Install the structs package Source: https://github.com/vmware/load-balancer-and-ingress-services-for-kubernetes/blob/master/vendor/github.com/fatih/structs/README.md Use the go get command to add the package to your project. ```bash go get github.com/fatih/structs ``` -------------------------------- ### Full Example of a Mux-based Server in Go Source: https://github.com/vmware/load-balancer-and-ingress-services-for-kubernetes/blob/master/ako-crd-operator/vendor/github.com/gorilla/mux/README.md A complete, runnable example of a basic HTTP server using the Mux router in Go. It demonstrates how to define routes and handlers, and how to start the server. This serves as a foundational example for building web applications with Mux. ```go package main import ( "net/http" "log" "github.com/gorilla/mux" ) func YourHandler(w http.ResponseWriter, r *http.Request) { w.Write([]byte("Gorilla!\n")) } func main() { r := mux.NewRouter() // Routes consist of a path and a handler function. r.HandleFunc("/", YourHandler) // Bind to a port and pass our router in log.Fatal(http.ListenAndServe(":8000", r)) } ``` -------------------------------- ### Install go-yaml/v2 Source: https://github.com/vmware/load-balancer-and-ingress-services-for-kubernetes/blob/master/ako-crd-operator/vendor/sigs.k8s.io/yaml/goyaml.v2/README.md Install the go-yaml/v2 library using the go get command. This is the import path for the package. ```bash go get gopkg.in/yaml.v2 ``` -------------------------------- ### Example Operation Match Source: https://github.com/vmware/load-balancer-and-ingress-services-for-kubernetes/blob/master/vendor/istio.io/api/security/v1beta1/authorization_policy.pb.html This example shows how to configure operation matching. It matches requests to hosts ending with '.example.com', with methods 'GET' or 'HEAD', and paths that do not start with '/admin'. ```yaml hosts: ["*.example.com"] methods: ["GET", "HEAD"] notPaths: ["/admin*"] ``` -------------------------------- ### Install and Run Local Go Doc Site Source: https://github.com/vmware/load-balancer-and-ingress-services-for-kubernetes/blob/master/ako-operator/vendor/go.opentelemetry.io/otel/CONTRIBUTING.md Installs and runs a local Go Doc site. Ensure you have Go installed and configured. ```sh go install golang.org/x/pkgsite/cmd/pkgsite@latest pkgsite ``` -------------------------------- ### Install Cobra Library Source: https://github.com/vmware/load-balancer-and-ingress-services-for-kubernetes/blob/master/ako-operator/vendor/github.com/spf13/cobra/README.md Install the latest version of the Cobra library using go get. ```bash go get -u github.com/spf13/cobra@latest ``` -------------------------------- ### Install json-iterator/go Source: https://github.com/vmware/load-balancer-and-ingress-services-for-kubernetes/blob/master/ako-crd-operator/vendor/github.com/json-iterator/go/README.md Install the json-iterator/go library using the go get command. ```bash go get github.com/json-iterator/go ``` -------------------------------- ### Minimal L7Rule Example Source: https://github.com/vmware/load-balancer-and-ingress-services-for-kubernetes/blob/master/docs/crds/l7rule.md A minimal configuration example requiring only essential fields. ```yaml apiVersion: ako.vmware.com/v1alpha2 kind: L7Rule metadata: name: minimal-l7-rule namespace: default spec: minPoolsUp: 1 performanceLimits: maxConcurrentConnections: 500 ``` -------------------------------- ### Log reconciliation start with standard library Source: https://github.com/vmware/load-balancer-and-ingress-services-for-kubernetes/blob/master/ako-crd-operator/vendor/sigs.k8s.io/controller-runtime/TMP-LOGGING.md Example of logging using the Go standard library logger. ```go log.Printf("starting reconciliation for pod %s/%s", podNamespace, podName) ``` -------------------------------- ### Install yaml package Source: https://github.com/vmware/load-balancer-and-ingress-services-for-kubernetes/blob/master/ako-crd-operator/vendor/gopkg.in/yaml.v3/README.md Use 'go get' to install the yaml package for use in your Go projects. ```bash go get gopkg.in/yaml.v3 ``` -------------------------------- ### Example test case Source: https://github.com/vmware/load-balancer-and-ingress-services-for-kubernetes/blob/master/ako-crd-operator/vendor/github.com/fsnotify/fsnotify/CONTRIBUTING.md A practical example of creating a file and verifying the resulting event output. ```text # Create a new empty file with some data. watch / echo data >/file Output: create /file write /file ``` -------------------------------- ### Run fsnotify command line example Source: https://github.com/vmware/load-balancer-and-ingress-services-for-kubernetes/blob/master/ako-crd-operator/vendor/github.com/fsnotify/fsnotify/README.md Executes the example utility provided within the library repository. ```bash % go run ./cmd/fsnotify ``` -------------------------------- ### Install and Import Kubernetes YAML Package Source: https://github.com/vmware/load-balancer-and-ingress-services-for-kubernetes/blob/master/ako-operator/vendor/sigs.k8s.io/yaml/README.md Install the package using go get and import it into your Go project. ```bash $ go get sigs.k8s.io/yaml ``` ```go import "sigs.k8s.io/yaml" ``` -------------------------------- ### Log reconciliation start with structured logging Source: https://github.com/vmware/load-balancer-and-ingress-services-for-kubernetes/blob/master/ako-crd-operator/vendor/sigs.k8s.io/controller-runtime/TMP-LOGGING.md Example of logging using controller-runtime's structured logging approach. ```go logger.Info("starting reconciliation", "pod", req.NamespacedName) ``` ```go func (r *Reconciler) Reconcile(req reconcile.Request) (reconcile.Response, error) { logger := logger.WithValues("pod", req.NamespacedName) // do some stuff logger.Info("starting reconciliation") } ``` -------------------------------- ### Kubernetes VirtualService Example Source: https://github.com/vmware/load-balancer-and-ingress-services-for-kubernetes/blob/master/ako-crd-operator/vendor/istio.io/api/networking/v1alpha3/virtual_service.pb.html This example demonstrates routing traffic to different subsets of the 'reviews' service based on URI prefixes. It highlights how Istio interprets short service names based on the rule's namespace and recommends using fully qualified domain names. ```yaml apiVersion: networking.istio.io/v1 kind: VirtualService metadata: name: reviews-route namespace: foo spec: hosts: - reviews # interpreted as reviews.foo.svc.cluster.local http: - match: - uri: prefix: "/wpcatalog" - uri: prefix: "/consumercatalog" rewrite: uri: "/newcatalog" route: - destination: host: reviews # interpreted as reviews.foo.svc.cluster.local subset: v2 - route: - destination: host: reviews # interpreted as reviews.foo.svc.cluster.local ``` -------------------------------- ### Basic L7Rule Example Source: https://github.com/vmware/load-balancer-and-ingress-services-for-kubernetes/blob/master/docs/crds/l7rule.md A minimal configuration example for setting basic L7Rule properties. ```yaml apiVersion: ako.vmware.com/v1alpha2 kind: L7Rule metadata: name: basic-l7-rule namespace: default spec: allowInvalidClientCert: false closeClientConnOnConfigUpdate: true ignPoolNetReach: false removeListeningPortOnVsDown: true sslSessCacheAvgSize: 2048 minPoolsUp: 1 performanceLimits: maxConcurrentConnections: 1000 maxThroughput: 2000 ``` -------------------------------- ### Install via URL Source: https://github.com/vmware/load-balancer-and-ingress-services-for-kubernetes/blob/master/ako-crd-operator/README.md Installs the project directly from a remote YAML bundle URL. ```sh kubectl apply -f https://raw.githubusercontent.com//ako-crd-operator//dist/install.yaml ``` -------------------------------- ### WorkloadEntry Example 1: VM with Sidecar Source: https://github.com/vmware/load-balancer-and-ingress-services-for-kubernetes/blob/master/ako-crd-operator/vendor/istio.io/api/networking/v1alpha3/workload_entry.pb.html Example of a WorkloadEntry for a VM with a sidecar installed, bootstrapped with a specific service account. This entry is associated with a ServiceEntry for the 'details.bookinfo.com' service. ```APIDOC ## POST /apis/networking.istio.io/v1alpha3/namespaces/{namespace}/workloadentries ### Description Creates a new WorkloadEntry resource. ### Method POST ### Endpoint `/apis/networking.istio.io/v1alpha3/namespaces/{namespace}/workloadentries` ### Request Body ```yaml apiVersion: networking.istio.io/v1 kind: WorkloadEntry metadata: name: details-svc spec: serviceAccount: details-legacy address: 2.2.2.2 labels: app: details-legacy instance-id: vm1 ``` ### Associated ServiceEntry Example ```yaml apiVersion: networking.istio.io/v1 kind: ServiceEntry metadata: name: details-svc spec: hosts: - details.bookinfo.com location: MESH_INTERNAL ports: - number: 80 name: http protocol: HTTP targetPort: 8080 resolution: STATIC workloadSelector: labels: app: details-legacy ``` ``` -------------------------------- ### Install Ginkgo Locally Source: https://github.com/vmware/load-balancer-and-ingress-services-for-kubernetes/blob/master/ako-operator/vendor/github.com/onsi/ginkgo/v2/CONTRIBUTING.md Installs the Ginkgo CLI locally. Ensure this is done before running tests. ```bash go install "./..." ``` -------------------------------- ### Define a RESTful WebService Source: https://github.com/vmware/load-balancer-and-ingress-services-for-kubernetes/blob/master/ako-crd-operator/vendor/github.com/emicklei/go-restful/v3/README.md Example of defining a WebService with a path, supported content types, and a GET route for retrieving a user. This snippet demonstrates setting up routes and handling path parameters. ```go ws := new(restful.WebService) ws. Path("/users"). Consumes(restful.MIME_XML, restful.MIME_JSON). Produces(restful.MIME_JSON, restful.MIME_XML) ws.Route(ws.GET("/{user-id}").To(u.findUser). Doc("get a user"). Param(ws.PathParameter("user-id", "identifier of the user").DataType("string")), Writes(User{})) ... func (u UserResource) findUser(request *restful.Request, response *restful.Response) { id := request.PathParameter("user-id") ... } ``` -------------------------------- ### Install dependencies Source: https://github.com/vmware/load-balancer-and-ingress-services-for-kubernetes/blob/master/ako-operator/vendor/go.uber.org/automaxprocs/CONTRIBUTING.md Command to install required test dependencies. ```bash make dependencies ``` -------------------------------- ### Delegate VirtualService Example Source: https://github.com/vmware/load-balancer-and-ingress-services-for-kubernetes/blob/master/vendor/istio.io/api/networking/v1alpha3/virtual_service.pb.html Example demonstrating the use of delegate VirtualServices for routing traffic to different services based on URI prefixes. ```APIDOC ## Delegate VirtualService Example This example shows how routing rules can forward traffic to `/productpage` by a delegate VirtualService named `productpage`, and to `/reviews` by a delegate VirtualService named `reviews`. ### VirtualService: bookinfo ```yaml apiVersion: networking.istio.io/v1 kind: VirtualService metadata: name: bookinfo spec: hosts: - "bookinfo.com" gateways: - mygateway http: - match: - uri: prefix: "/productpage" delegate: name: productpage namespace: nsA - match: - uri: prefix: "/reviews" delegate: name: reviews namespace: nsB ``` ### VirtualService: productpage (Delegate) ```yaml apiVersion: networking.istio.io/v1 kind: VirtualService metadata: name: productpage namespace: nsA spec: http: - match: - uri: prefix: "/productpage/v1/" route: - destination: host: productpage-v1.nsA.svc.cluster.local - route: - destination: host: productpage.nsA.svc.cluster.local ``` ### VirtualService: reviews (Delegate) ```yaml apiVersion: networking.istio.io/v1 kind: VirtualService metadata: name: reviews namespace: nsB spec: http: - route: - destination: host: reviews.nsB.svc.cluster.local ``` ### Delegate Parameters #### Path Parameters - **name** (string) - Required - Name specifies the name of the delegate VirtualService. ``` -------------------------------- ### Example output of YAML processing Source: https://github.com/vmware/load-balancer-and-ingress-services-for-kubernetes/blob/master/ako-operator/vendor/gopkg.in/yaml.v3/README.md The expected console output after running the provided Go example. ```text --- t: {Easy! {2 [3 4]}} --- t dump: a: Easy! b: c: 2 d: [3, 4] --- m: map[a:Easy! b:map[c:2 d:[3 4]]] --- m dump: a: Easy! b: c: 2 d: - 3 - 4 ``` -------------------------------- ### Install Zap Source: https://github.com/vmware/load-balancer-and-ingress-services-for-kubernetes/blob/master/ako-operator/vendor/go.uber.org/zap/README.md Command to install the Zap package using Go modules. ```bash go get -u go.uber.org/zap ``` -------------------------------- ### Complete RouteBackendExtension Configuration Example Source: https://github.com/vmware/load-balancer-and-ingress-services-for-kubernetes/blob/master/docs/crds/routebackendextension.md This example demonstrates a comprehensive configuration for RouteBackendExtension, covering load balancing algorithms, session persistence, health monitoring, and secure backend TLS settings. Ensure all referenced objects are in the same namespace. ```yaml apiVersion: ako.vmware.com/v1alpha1 kind: RouteBackendExtension metadata: name: complete-backend-config namespace: production spec: # Load balancing with consistent hashing lbAlgorithm: LB_ALGORITHM_CONSISTENT_HASH lbAlgorithmHash: LB_ALGORITHM_CONSISTENT_HASH_SOURCE_IP_ADDRESS # Session persistence persistenceProfile: System-Persistence-Client-IP # Health monitoring healthMonitor: - kind: "AVIREF" name: "production-health-monitor" # Secure backend communication backendTLS: pkiProfile: kind: "CRD" name: "production-pki-profile" hostCheckEnabled: true domainName: - "backend.production.com" ``` -------------------------------- ### Install jsonpatch library Source: https://github.com/vmware/load-balancer-and-ingress-services-for-kubernetes/blob/master/ako-crd-operator/vendor/gopkg.in/evanphx/json-patch.v4/README.md Commands to install the latest or specific stable versions of the library using Go modules. ```bash go get -u github.com/evanphx/json-patch/v5 ``` ```bash go get -u gopkg.in/evanphx/json-patch.v5 ``` ```bash go get -u gopkg.in/evanphx/json-patch.v4 ``` -------------------------------- ### Example ServiceEntry for VM and Kubernetes Integration Source: https://github.com/vmware/load-balancer-and-ingress-services-for-kubernetes/blob/master/ako-crd-operator/vendor/istio.io/api/networking/v1alpha3/service_entry.pb.html This example demonstrates a ServiceEntry that spans both VMs and Kubernetes services, using a workload selector for Kubernetes pods and specifying VM details. ```APIDOC ## POST /api/v1/namespaces/{namespace}/serviceentries ### Description Creates a new ServiceEntry resource within a specified namespace. ### Method POST ### Endpoint `/api/v1/namespaces/{namespace}/serviceentries` ### Parameters #### Path Parameters - **namespace** (string) - Required - The namespace in which to create the ServiceEntry. #### Request Body ```yaml apiVersion: networking.istio.io/v1 kind: ServiceEntry metadata: name: details-svc spec: hosts: - details.bookinfo.com location: MESH_INTERNAL ports: - number: 80 name: http protocol: HTTP resolution: STATIC workloadSelector: labels: app: details ``` ### Request Example ```json { "apiVersion": "networking.istio.io/v1", "kind": "ServiceEntry", "metadata": { "name": "details-svc" }, "spec": { "hosts": [ "details.bookinfo.com" ], "location": "MESH_INTERNAL", "ports": [ { "number": 80, "name": "http", "protocol": "HTTP" } ], "resolution": "STATIC", "workloadSelector": { "labels": { "app": "details" } } } } ``` ### Response #### Success Response (201 Created) - **message** (string) - Confirmation message indicating successful creation. #### Response Example ```json { "message": "ServiceEntry details-svc created successfully." } ``` ``` -------------------------------- ### Define WebService and Route Source: https://github.com/vmware/load-balancer-and-ingress-services-for-kubernetes/blob/master/ako-operator/vendor/github.com/emicklei/go-restful/v3/README.md Example of initializing a WebService, configuring paths, and defining a route with a handler function. ```go ws := new(restful.WebService) ws. Path("/users"). Consumes(restful.MIME_XML, restful.MIME_JSON). Produces(restful.MIME_JSON, restful.MIME_XML) ws.Route(ws.GET("/{user-id}").To(u.findUser). Doc("get a user"). Param(ws.PathParameter("user-id", "identifier of the user").DataType("string")). Writes(User{})) ... func (u UserResource) findUser(request *restful.Request, response *restful.Response) { id := request.PathParameter("user-id") ... } ``` -------------------------------- ### Rejected L4Rule Object Example Source: https://github.com/vmware/load-balancer-and-ingress-services-for-kubernetes/blob/master/docs/crds/l4rule.md Example output from `kubectl get l4rule` showing an L4Rule that has been rejected. ```bash $ kubectl get l4rule NAME STATUS AGE my-l4-rule-alt Rejected 2d23h ``` -------------------------------- ### Build installer bundle Source: https://github.com/vmware/load-balancer-and-ingress-services-for-kubernetes/blob/master/ako-crd-operator/README.md Generates an install.yaml file in the dist directory containing all necessary resources. ```sh make build-installer IMG=/ako-crd-operator:tag ``` -------------------------------- ### Run merge patch example Source: https://github.com/vmware/load-balancer-and-ingress-services-for-kubernetes/blob/master/ako-crd-operator/vendor/gopkg.in/evanphx/json-patch.v4/README.md Execution output for the merge patch demonstration. ```bash $ go run main.go patch document: {"height":null,"name":"Jane"} updated alternative doc: {"age":28,"name":"Jane"} ``` -------------------------------- ### Download the project using go get Source: https://github.com/vmware/load-balancer-and-ingress-services-for-kubernetes/blob/master/ako-operator/vendor/go.opentelemetry.io/otel/CONTRIBUTING.md Download the project source using the Go toolchain. ```go go get -d go.opentelemetry.io/otel ``` -------------------------------- ### Install Stable JSON Patch Library v4 (Go) Source: https://github.com/vmware/load-balancer-and-ingress-services-for-kubernetes/blob/master/vendor/gopkg.in/evanphx/json-patch.v4/README.md Use this command to get the stable v4 of the jsonpatch library. ```bash go get -u gopkg.in/evanphx/json-patch.v4 ``` -------------------------------- ### Dog and Bird Instantiation Source: https://github.com/vmware/load-balancer-and-ingress-services-for-kubernetes/blob/master/ako-operator/vendor/go.opentelemetry.io/otel/CONTRIBUTING.md Shows how to instantiate Dog and Bird types using their respective specific options. ```go func NewDog(name string, o ...DogOption) Dog {…} func NewBird(name string, o ...BirdOption) Bird {…} ``` -------------------------------- ### Serve Static Files Source: https://github.com/vmware/load-balancer-and-ingress-services-for-kubernetes/blob/master/ako-crd-operator/vendor/github.com/gorilla/mux/README.md Use PathPrefix and http.FileServer to serve static assets from a directory. ```go func main() { var dir string flag.StringVar(&dir, "dir", ".", "the directory to serve files from. Defaults to the current dir") flag.Parse() r := mux.NewRouter() // This will serve files under http://localhost:8000/static/ r.PathPrefix("/static/").Handler(http.StripPrefix("/static/", http.FileServer(http.Dir(dir)))) srv := &http.Server{ Handler: r, Addr: "127.0.0.1:8000", // Good practice: enforce timeouts for servers you create! WriteTimeout: 15 * time.Second, ReadTimeout: 15 * time.Second, } log.Fatal(srv.ListenAndServe()) } ``` -------------------------------- ### Install Stable JSON Patch Library v5 (Go) Source: https://github.com/vmware/load-balancer-and-ingress-services-for-kubernetes/blob/master/vendor/gopkg.in/evanphx/json-patch.v4/README.md Use this command to get the stable v5 of the jsonpatch library. ```bash go get -u gopkg.in/evanphx/json-patch.v5 ``` -------------------------------- ### Install Latest JSON Patch Library (Go) Source: https://github.com/vmware/load-balancer-and-ingress-services-for-kubernetes/blob/master/vendor/gopkg.in/evanphx/json-patch.v4/README.md Use this command to get the latest version of the jsonpatch library for your Go project. ```bash go get -u github.com/evanphx/json-patch/v5 ``` -------------------------------- ### Register Basic Routes Source: https://github.com/vmware/load-balancer-and-ingress-services-for-kubernetes/blob/master/ako-crd-operator/vendor/github.com/gorilla/mux/README.md Initialize a new router and map URL paths to handler functions. ```go func main() { r := mux.NewRouter() r.HandleFunc("/", HomeHandler) r.HandleFunc("/products", ProductsHandler) r.HandleFunc("/articles", ArticlesHandler) http.Handle("/", r) } ``` -------------------------------- ### Convert float32 to float16 and vice versa Source: https://github.com/vmware/load-balancer-and-ingress-services-for-kubernetes/blob/master/ako-crd-operator/vendor/github.com/x448/float16/README.md Demonstrates converting between float32 and float16 types using the library's functions. Ensure the library is installed with `go get github.com/x448/float16`. ```Go // Convert float32 to float16 pi := float32(math.Pi) pi16 := float16.Fromfloat32(pi) // Convert float16 to float32 pi32 := pi16.Float32() ``` -------------------------------- ### Install the UUID package Source: https://github.com/vmware/load-balancer-and-ingress-services-for-kubernetes/blob/master/ako-crd-operator/vendor/github.com/google/uuid/README.md Use this command to fetch the package into your Go project. ```sh go get github.com/google/uuid ``` -------------------------------- ### Install AKO via Helm Source: https://context7.com/vmware/load-balancer-and-ingress-services-for-kubernetes/llms.txt Commands to create the namespace, pull the chart, and deploy AKO with required controller and network settings. ```bash # Create namespace kubectl create ns avi-system # Pull and extract AKO helm chart helm pull oci://projects.packages.broadcom.com/ako/helm-charts/ako --version 2.2.1 --untar cd ako helm dependency build # Install AKO (Primary instance) helm install ako-release . \ --set ControllerSettings.controllerHost=10.10.10.100 \ --set ControllerSettings.cloudName=Default-Cloud \ --set avicredentials.username=admin \ --set avicredentials.password=Avi123 \ --set AKOSettings.clusterName=my-cluster \ --set NetworkSettings.vipNetworkList[0].networkName=vip-network \ --set NetworkSettings.vipNetworkList[0].cidr=10.20.0.0/24 \ --set AKOSettings.primaryInstance=true \ --namespace=avi-system # Verify installation helm list -n avi-system kubectl get pods -n avi-system ``` -------------------------------- ### Build All Files (Old System) Source: https://github.com/vmware/load-balancer-and-ingress-services-for-kubernetes/blob/master/ako-operator/vendor/golang.org/x/sys/unix/README.md Use this script to generate Go files for your current OS and architecture under the old build system. Ensure GOOS and GOARCH are set correctly. ```bash mkall.sh ``` -------------------------------- ### Install CRDs Source: https://github.com/vmware/load-balancer-and-ingress-services-for-kubernetes/blob/master/ako-crd-operator/README.md Installs the project's Custom Resource Definitions into the cluster. ```sh make install ``` -------------------------------- ### Fix OpenAPI Examples Source: https://github.com/vmware/load-balancer-and-ingress-services-for-kubernetes/blob/master/vendor/github.com/emicklei/go-restful/v3/CHANGES.md Fixes issues with OpenAPI examples. This was addressed in v3.1.0. ```go fix openapi examples (#425) ``` -------------------------------- ### Normal Event Examples Source: https://github.com/vmware/load-balancer-and-ingress-services-for-kubernetes/blob/master/docs/troubleshooting/events.md Examples of successful workflow events generated by AKO. ```text 20m Normal ValidatedUserInput pod/ako-0 User input validation completed. ``` ```text 20m Normal StatusSync pod/ako-0 Status syncing completed ``` ```text 33s Normal Synced ingress/ingress1 Added virtualservice clusterName--Shared-L7-1 for bar.avi.com ``` -------------------------------- ### Warning Event Example Source: https://github.com/vmware/load-balancer-and-ingress-services-for-kubernetes/blob/master/docs/troubleshooting/events.md Example of a warning event indicating a deviation from the normal workflow. ```text 23s Warning AKOShutdown pod/ako-0 Invalid user input [No user input detected for vipNetworkList] ``` -------------------------------- ### Install AKO via Helm Source: https://github.com/vmware/load-balancer-and-ingress-services-for-kubernetes/blob/master/docs/openshift/openshift_helm.md Deploys AKO with required controller and credential parameters. ```bash helm install --generate-name . --set ControllerSettings.controllerHost= --set avicredentials.username= --set avicredentials.password= --set AKOSettings.primaryInstance=true --namespace=avi-system ``` -------------------------------- ### Install Secondary AKO instance Source: https://github.com/vmware/load-balancer-and-ingress-services-for-kubernetes/blob/master/docs/install/helm.md Installs a secondary instance of AKO. For secondary installations, `ako-crd-operator.enabled` must be set to `false` as only one instance of the operator can run in the cluster. Specify a different namespace for the secondary instance. ```bash helm install --generate-name . --version 2.2.1 --set ControllerSettings.controllerHost= --set avicredentials.username= --set avicredentials.password= --set AKOSettings.primaryInstance=false --namespace=avi-secondary-system --set ako-crd-operator.enabled=false ``` -------------------------------- ### Convert Format Strings to Structured Logs Source: https://github.com/vmware/load-balancer-and-ingress-services-for-kubernetes/blob/master/ako-crd-operator/vendor/github.com/go-logr/logr/README.md Examples demonstrating the migration from klog format strings to structured logr logger calls. ```go klog.V(4).Infof("Client is returning errors: code %v, error %v", responseCode, err) ``` ```go logger.Error(err, "client returned an error", "code", responseCode) ``` ```go klog.V(4).Infof("Got a Retry-After %ds response for attempt %d to %v", seconds, retries, url) ``` ```go logger.V(4).Info("got a retry-after response when requesting url", "attempt", retries, "after seconds", seconds, "url", url) ``` -------------------------------- ### Fixed Static Example Source: https://github.com/vmware/load-balancer-and-ingress-services-for-kubernetes/blob/master/vendor/github.com/emicklei/go-restful/v3/CHANGES.md Corrects an issue with the static example provided. This fix was contributed in v2.10.0. ```go fixed static example (thanks Arthur ) ``` -------------------------------- ### Advanced L7Rule with All Profiles Source: https://github.com/vmware/load-balancer-and-ingress-services-for-kubernetes/blob/master/docs/crds/l7rule.md An advanced configuration example utilizing all available profile references and policy settings. ```yaml apiVersion: ako.vmware.com/v1alpha2 kind: L7Rule metadata: name: advanced-l7-rule namespace: production spec: # Basic settings allowInvalidClientCert: true closeClientConnOnConfigUpdate: false ignPoolNetReach: true removeListeningPortOnVsDown: false sslSessCacheAvgSize: 4096 minPoolsUp: 2 # Performance limits performanceLimits: maxConcurrentConnections: 5000 maxThroughput: 10000 # Policy references botPolicyRef: "production-bot-policy" securityPolicyRef: "ddos-protection-policy" trafficCloneProfileRef: "traffic-mirror-profile" hostNameXlate: "internal-service.company.com" # Profile references analyticsProfile: kind: AviRef name: "web-analytics-profile" applicationProfile: kind: AviRef name: "http-application-profile" wafPolicy: kind: AviRef name: "owasp-waf-policy" icapProfile: kind: AviRef name: "antivirus-scan-profile" errorPageProfile: kind: AviRef name: "custom-error-pages" # Analytics policy analyticsPolicy: fullClientLogs: enabled: true throttle: MEDIUM duration: 3600 logAllHeaders: true # HTTP policy httpPolicy: overwrite: true policySets: - "rate-limiting-policy" - "header-rewrite-policy" - "redirect-policy" ``` -------------------------------- ### Update Example for Swagger12 and OpenAPI Source: https://github.com/vmware/load-balancer-and-ingress-services-for-kubernetes/blob/master/vendor/github.com/emicklei/go-restful/v3/CHANGES.md Updates the example to be compatible with Swagger12 and OpenAPI. This was done in v2.6.0. ```go Update example for Swagger12 and OpenAPI ``` -------------------------------- ### Preview Documentation Changes Source: https://github.com/vmware/load-balancer-and-ingress-services-for-kubernetes/blob/master/ako-operator/vendor/github.com/onsi/ginkgo/v2/CONTRIBUTING.md Builds and serves the Ginkgo documentation locally using Jekyll. This allows you to preview your documentation updates before committing. ```bash bundle && bundle exec jekyll serve ``` -------------------------------- ### Initialize Zapr with logr Source: https://github.com/vmware/load-balancer-and-ingress-services-for-kubernetes/blob/master/ako-crd-operator/vendor/github.com/go-logr/zapr/README.md Standard setup for using Zapr as a logr implementation. ```go package main import ( "fmt" "go.uber.org/zap" "github.com/go-logr/logr" "github.com/go-logr/zapr" ) func main() { var log logr.Logger zapLog, err := zap.NewDevelopment() if err != nil { panic(fmt.Sprintf("who watches the watchmen (%v)?", err)) } log = zapr.NewLogger(zapLog) log.Info("Logr in action!", "the answer", 42) } ``` -------------------------------- ### Install Cobra CLI Generator Source: https://github.com/vmware/load-balancer-and-ingress-services-for-kubernetes/blob/master/ako-operator/vendor/github.com/spf13/cobra/README.md Install the cobra-cli command-line program for generating Cobra applications and command files. ```bash go install github.com/spf13/cobra-cli@latest ``` -------------------------------- ### Run Pre-Release Tasks Source: https://github.com/vmware/load-balancer-and-ingress-services-for-kubernetes/blob/master/ako-operator/vendor/go.opentelemetry.io/otel/RELEASING.md Commands to initiate the pre-release process and verify changes. ```sh make prerelease MODSET= ``` ```sh git diff ...prerelease__ ``` ```go git merge prerelease__ ``` -------------------------------- ### Log reconciliation start using structured logging Source: https://github.com/vmware/load-balancer-and-ingress-services-for-kubernetes/blob/master/ako-operator/vendor/sigs.k8s.io/controller-runtime/TMP-LOGGING.md Basic usage of structured logging in controller-runtime. ```go logger.Info("starting reconciliation", "pod", req.NamespacedName) ``` -------------------------------- ### PKIProfile Object Naming Example Source: https://github.com/vmware/load-balancer-and-ingress-services-for-kubernetes/blob/master/docs/naming-conventions/ako-crd-operator.md Example of a generated PKIProfile object name based on the specified CRD parameters. ```text CRD: PKIProfile "my-ca-bundle" in namespace "app-ns" with cluster name "cluster1" Avi Object: ako-crd-operator-cluster1--ec7217373c9ae28cf92d3452997e1a3b252053e9 ``` -------------------------------- ### ApplicationProfile Object Naming Example Source: https://github.com/vmware/load-balancer-and-ingress-services-for-kubernetes/blob/master/docs/naming-conventions/ako-crd-operator.md Example of a generated ApplicationProfile object name based on the specified CRD parameters. ```text CRD: ApplicationProfile "custom-http-profile" in namespace "app-ns" with cluster name "cluster1" Avi Object: ako-crd-operator-cluster1--25473353622c80679af5cfcc3cdee7c7e0007303 ``` -------------------------------- ### Initialize procfs and retrieve CPU statistics Source: https://github.com/vmware/load-balancer-and-ingress-services-for-kubernetes/blob/master/ako-crd-operator/vendor/github.com/prometheus/procfs/README.md Initializes the proc filesystem at the specified path and reads system statistics. ```go fs, err := procfs.NewFS("/proc") stats, err := fs.Stat() ``` -------------------------------- ### HealthMonitor Object Naming Example Source: https://github.com/vmware/load-balancer-and-ingress-services-for-kubernetes/blob/master/docs/naming-conventions/ako-crd-operator.md Example of a generated HealthMonitor object name based on the specified CRD parameters. ```text CRD: HealthMonitor "my-health-check" in namespace "app-ns" with cluster name "cluster1" Avi Object: ako-crd-operator-cluster1--0f10bce27de8131f458c31b46ea91e27358b3b22 ```