wu-sheng commented on a change in pull request #12: URL: https://github.com/apache/skywalking-swck/pull/12#discussion_r530142800
########## File path: doc/custom-metrics-adapter.md ########## @@ -0,0 +1,77 @@ +# Custom metrics Adapter + +This adapter contains an implementation of [external metrics](https://github.com/kubernetes/community/blob/master/contributors/design-proposals/instrumentation/external-metrics-api.md) + API. It is therefore suitable for use with the autoscaling/v2 Horizontal Pod Autoscaler in Kubernetes 1.6+. + + +## Use kustomize to customise your deployment + +1. Clone the source code: + +```sh +git clone [email protected]:apache/skywalking-swck.git +``` + +2. Edit file `config/adapter/adapter/kustomization.yaml` file to change your preferences. If you prefer to your private + docker image, a quick path to override `ADAPTER_IMG` environment variable : `export ADAPTER_IMG=<private registry>/adapter:<tag>` + +3. Use `make` to generate the final manifests and deploy: + +```sh +make adapter-deploy +``` + +## Configuration + +The adapter takes the standard Kubernetes generic API server arguments (including those for authentication and authorization). +By default, it will attempt to using Kubernetes in-cluster config to connect to the cluster. + +It takes the following addition arguments specific to configuring how the adapter talks to SkyWalking OAP cluster: + + * `--oap-addr` The address of OAP cluster. + * `--metric-filter-regex` A regular expression to filter metrics retrieved from OAP cluster. + * `--refresh-interval` This is the interval at which to update the cache of available metrics from OAP cluster. + +## HPA Configuration + +External metrics allow you to autoscale your cluster based on any metric available in OAP cluster. + Just provide a metric block with a `name` and `selector`, and use the `External` metric type. + +```yaml +- type: External + external: + metric: + name: <metric_name> + metricSelector: + matchLabels: + <label_key>: <label_value> + ... + target: + .... +``` + + * metric_name: The name of metric generated by OAL or other subsystem. + * label: available `label_key`s are `service` and `label`. + + The options of label keys are: + * `service` varies in different scopes. If the scope is `Service`, `ServiceInstance` and `Endpoint`, the `service` represents + `serviceName`, `serviceInstanceName` and `endpointName` respectively. Review comment: Then, we need a deeper discussion about what do you plan to distribute. In the current release on the download page, http://skywalking.apache.org/downloads/, there is only a source release, so we always expect users to compile codes by themselves. How would this adaptor be? ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected]
