hanahmily commented on a change in pull request #12:
URL: https://github.com/apache/skywalking-swck/pull/12#discussion_r529906245



##########
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:
       >How to map to ServiceInstance and EndpointName by a string name? 
   
   How about adding a link to swctl relevant sections in its README? 
    * linear: https://github.com/apache/skywalking-cli#metrics-linear
    * multi-lines : https://github.com/apache/skywalking-cli#metrics-linear, 
but I use a string `label` instead of a natural number `num` to support meter 
system.
   
   > Including how about the relation metrics, such as ServiceRelation.
   
   have no plan to implement it. HPA cares about the node metrics instead of 
the relation ones. Do you have any scenarios for it? feel free to let me know. 




----------------------------------------------------------------
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]


Reply via email to