github.com/verrazzano/verrazzano@v1.7.0/platform-operator/README.md (about) 1 [![Go Report Card](https://goreportcard.com/badge/github.com/verrazzano/verrazzano)](https://goreportcard.com/report/github.com/verrazzano/verrazzano) 2 3 # Verrazzano Platform Operator 4 5 Instructions for building and testing the Verrazzano platform operator. 6 7 ## Prerequisites 8 * `kustomize` v3.1.0+ 9 * `kubebuilder` 2.3.1+ 10 * `go` version v1.15.7 11 * Docker 12 * `kubectl` 13 14 ## Build and install Verrazzano 15 16 To build and then install Verrazzano using the Verrazzano platform operator: 17 18 ``` 19 # Create the verrazzano-platform-operator image. For now, the image needs public access. 20 # Replace <docker-repository> and <namespace for image>. 21 $ export DOCKER_REPO=<docker-repository> 22 $ export DOCKER_NAMESPACE=<namespace for image> 23 $ make docker-push 24 25 # Create the verrrazzano-platform-operator deployment YAML file. 26 # Define the VZ_DEV_IMAGE env variable and call the create-test-deploy target 27 # - Replace <verrazzano-image> with the verrazzano-platform-operator image you created with `make docker-push` 28 # - Creates a valid deployment YAML file in build/deploy/operator.yaml 29 $ export VZ_DEV_IMAGE=<verrazzano-image> 30 $ make create-test-deploy 31 32 # Deploy the verrazzano-platform-operator 33 $ kubectl apply -f build/deploy/operator.yaml 34 35 # Verify verrazzano-platform-operator pod is running 36 $ kubectl get pods -n verrazzano-install 37 38 # Initiate a Verrazzano install for nip.io 39 $ kubectl apply -f config/samples/install-default.yaml 40 41 # NOTE: If you chose to deploy a cluster that makes use of OCI DNS perform the following instead of the nip.io 42 # cluster deployment command: 43 44 # Generate a secret named "oci" based on the OCI configuration profile you wish to leverage. You 45 # can specify a profile other than DEFAULT and a different secret name if you wish. See instruction by running 46 # ./scripts/install/create_oci_config_secret.sh 47 $ ./scripts/install/create_oci_config_secret.sh 48 49 # Copy the config/samples/install-oci.yaml file 50 $ cp config/samples/install-oci.yaml /tmp 51 52 # Edit the file and provide the DNS ZONE name, OCID, and compartment OCID, and secret name 53 54 # Monitor the install 55 $ kubectl logs -f $(kubectl get pod -l job-name=verrazzano-install-my-verrazzano -o jsonpath="{.items[0].metadata.name}") 56 57 # Wait for the Verrazzano install to complete 58 $ kubectl wait --timeout=20m --for=condition=InstallComplete verrazzano/my-verrazzano 59 ``` 60 61 To uninstall Verrazzano using the Verrazzano platform operator: 62 63 ``` 64 # Initiate a Verrazzano uninstall 65 $ kubectl delete -f config/samples/install-default.yaml 66 67 # Monitor the uninstall 68 $ kubectl logs -f $(kubectl get pod -l job-name=verrazzano-uninstall-my-verrazzano -o jsonpath="{.items[0].metadata.name}") 69 ``` 70 71 ## Build the Verrazzano platform operator 72 73 - To generate manifests (for example, CRD, RBAC, and such): 74 75 ``` 76 $ make manifests 77 ``` 78 79 - To generate code (for example, `zz_generated.deepcopy.go`): 80 81 ``` 82 $ make generate 83 ``` 84 85 - To do all the source code checks, such as `fmt`, `lint`, and such: 86 87 ``` 88 $ make check 89 ``` 90 91 - To build the operator and generated code: 92 93 ``` 94 $ make go-install 95 ``` 96 97 ## Test the Verrazzano platform operator 98 99 You need a Kubernetes cluster to run against. 100 101 * Install the CRDs into the cluster: 102 ``` 103 $ make install-crds 104 ``` 105 106 * Run the operator. This will run in the foreground, so switch to a new terminal if you want to leave it running. 107 ``` 108 $ make run 109 ``` 110 111 * Create a custom resource. You will notice that messages are logged to the operator 112 when the custom resource is applied. 113 ``` 114 $ kubectl apply -f config/samples/install-default.yaml 115 ``` 116 117 * Delete the custom resource. You will notice that messages are logged to the operator 118 when the custom resource is deleted. 119 ``` 120 $ kubectl delete -f config/samples/install-default.yaml 121 ``` 122 * Uninstall the CRDs from the cluster: 123 ``` 124 $ make uninstall-crds 125 ``` 126 127 ## Build and push Docker images 128 129 * To build the Docker image: 130 ``` 131 $ make docker-build 132 ``` 133 * To build and push the Docker image: 134 ``` 135 $ make docker-push 136 ```