Skip to content

Commit

Permalink
first
Browse files Browse the repository at this point in the history
  • Loading branch information
William Mortl authored and William Mortl committed May 14, 2020
1 parent 1b42eb5 commit 8849163
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 7 deletions.
2 changes: 1 addition & 1 deletion docs/deploy.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
export GO111MODULE=on
```

3. Build the image and push it to docker hub.
3. Log into Docker Hub and then Build the image and push it to Docker Hub.

```shell
docker login
Expand Down
53 changes: 47 additions & 6 deletions docs/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@
export GO111MODULE=on
```

3. Install test certificates using `make generate-test-certs`.
3. Make sure all environment variables have been set.

4. Install test certificates using `make generate-test-certs`.

4. Install the CRDs defined in the config/crd/bases folder using the command
5. Install the CRDs defined in the config/crd/bases folder using the command
`make install`
You will see output as below.

Expand All @@ -26,7 +28,46 @@
customresourcedefinition.apiextensions.k8s.io/azuresqlservers.azure.microsoft.com configured
```

5. Run the operator locally using
6. Copy the generated certificates to the correct location by first attempting to run the operator locally using
```make run```
This will cause the operator to run (briefly) and will display an error (as well the correct location to copy generated certificates to). You will see something similar to this in the terminal window indicating that the controller started running and then subsequently failed:

```
go fmt ./...
go vet ./...
go run ./main.go

...

2020-05-13T17:04:26.587-0700 INFO controller-runtime.builder skip registering a validating webhook, admission.Validator interface is not implemented {"GVK": "azure.microsoft.com/v1alpha1, Kind=AzureSqlFirewallRule"}
2020-05-13T17:04:26.587-0700 INFO controller-runtime.builder conversion webhook enabled {"object": {"metadata":{"creationTimestamp":null},"spec":{"server":""},"status":{}}}
2020-05-13T17:04:26.587-0700 INFO controller-runtime.builder skip registering a mutating webhook, admission.Defaulter interface is not implemented {"GVK": "azure.microsoft.com/v1alpha1, Kind=AzureSqlFailoverGroup"}
2020-05-13T17:04:26.587-0700 INFO controller-runtime.builder skip registering a validating webhook, admission.Validator interface is not implemented {"GVK": "azure.microsoft.com/v1alpha1, Kind=AzureSqlFailoverGroup"}
2020-05-13T17:04:26.587-0700 INFO controller-runtime.builder conversion webhook enabled {"object": {"metadata":{"creationTimestamp":null},"spec":{"location":"","server":"","failoverpolicy":"","failovergraceperiod":0,"secondaryserver":"","secondaryserverresourcegroup":"","databaselist":null},"status":{}}}
2020-05-13T17:04:26.587-0700 INFO controller-runtime.builder skip registering a mutating webhook, admission.Defaulter interface is not implemented {"GVK": "azure.microsoft.com/v1alpha1, Kind=BlobContainer"}
2020-05-13T17:04:26.587-0700 INFO controller-runtime.builder skip registering a validating webhook, admission.Validator interface is not implemented {"GVK": "azure.microsoft.com/v1alpha1, Kind=BlobContainer"}
2020-05-13T17:04:26.587-0700 INFO controller-runtime.builder conversion webhook enabled {"object": {"metadata":{"creationTimestamp":null},"spec":{"location":""},"status":{}}}
2020-05-13T17:04:26.587-0700 INFO setup starting manager
2020-05-13T17:04:26.587-0700 INFO controller-runtime.webhook.webhooks starting webhook server
2020-05-13T17:04:26.587-0700 INFO controller-runtime.manager starting metrics server {"path": "/metrics"}
2020-05-13T17:04:26.588-0700 DEBUG controller-runtime.manager non-leader-election runnable finished {"runnable type": "*webhook.Server"}
2020-05-13T17:04:26.588-0700 INFO controller-runtime.controller Starting EventSource {"controller": "keyvault", "source": "kind source: /, Kind="}
2020-05-13T17:04:26.588-0700 ERROR setup problem running manager {"error": "open /var/folders/1_/d50yhxgd357cfl0yjdclppfc0000gn/T/k8s-webhook-server/serving-certs/tls.crt: no such file or directory"}
github.com/go-logr/zapr.(*zapLogger).Error
/Users/username/Code/go/pkg/mod/github.com/go-logr/zapr@v0.1.0/zapr.go:128
main.main
/Users/username/Code/go/src/github.com/WilliamMortlMicrosoft/azure-service-operator/main.go:781
runtime.main
/usr/local/Cellar/go/1.14.2_1/libexec/src/runtime/proc.go:203
exit status 1
make: *** [run] Error 1`
```

Look for the listed directory given in the *problem running manager* log entry, above that directory is: "/var/folders/1_/d50yhxgd357cfl0yjdclppfc0000gn/T/". Next, run the following command `cp -r /tmp/k8s-webhook-server /var/folders/1_/d50yhxgd357cfl0yjdclppfc0000gn/T/`.

Please note, copying the generated certificates into the this folder only needs to be done the first time (or when the local Kubernetes cluster is cleared). You do not need to do this step every time.

7. Run the operator locally using
```make run```
This will cause the operator to run and "watch" for events on this terminal. You will need to open a new terminal to trigger the creation of a custom resource.

Expand Down Expand Up @@ -66,15 +107,15 @@
2019-09-24T12:18:10.626-0600 INFO controller-runtime.controller Starting workers {"controller": "eventhubnamespace", "worker count": 1}
```
6. Open a new terminal window. Trigger the creation of a custom resource using kubectl and the sample YAML file provided.
8. Open a new terminal window. Trigger the creation of a custom resource using kubectl and the sample YAML file provided.
For instance, you would use the following command to create a SQL server:
```shell
kubectl apply -f config/samples/azure_v1alpha1_azuresqlserver.yaml
azuresqlserver.azure.microsoft.com/sqlserver-sample created
```

7. You should see logs on the other terminal from the operator when this custom resource is being created.
9. You should see logs on the other terminal from the operator when this custom resource is being created.

```
2019-09-24T12:27:12.450-0600 DEBUG controller-runtime.manager.events Normal {"object": {"kind":"AzureSqlServer","namespace":"default","name":"sqlserver-sample1","uid":"ed3774af-def8-11e9-90c4-025000000001","apiVersion":"azure.microsoft.com/v1alpha1","resourceVersion":"194427"}, "reason": "Updated", "message": "finalizer azuresqlserver.finalizers.azure.com added"}
Expand All @@ -93,7 +134,7 @@
2019-09-24T12:28:20.331-0600 DEBUG controller-runtime.manager.events Normal {"object": {"kind":"AzureSqlServer","namespace":"default","name":"sqlserver-sample1","uid":"ed3774af-def8-11e9-90c4-025000000001","apiVersion":"azure.microsoft.com/v1alpha1","resourceVersion":"194518"}, "reason": "Provisioned", "message": "sqlserver sqlserver-sample1 provisioned "}
```
8. Once the operator is running locally, in order to view debugging (Prometheus-based) metrics for the Azure operator, open a web browser and navigate to the [Metrics Endpoint](http://127.0.0.1:8080/metrics).
10. Once the operator is running locally, in order to view debugging (Prometheus-based) metrics for the Azure operator, open a web browser and navigate to the [Metrics Endpoint](http://127.0.0.1:8080/metrics).
If you are using the Kubernetes cluster that comes with "Docker Desktop" and would like to view the Prometheus metrics, you can redirect port 8080 to the local machine using the following command:
Expand Down

0 comments on commit 8849163

Please sign in to comment.