Skip to content

Commit 15e109a

Browse files
authored
Networking metrics (#278)
* operator endpoint in istio * progress * WORKING * fix namespace * cleanup * Replace argo with operator DAG manager * Rename pod check intervals * Update operator_local * Skip external dataset check if no environment * Cap desired replicas at max replicas * Update api workload succeeded check * Use Update() instead of Patch() in k8s * Remove killdev make command * fix api * minor fixes * progress * https progress * https * generate random password * remove istio READMEs and examples * clean up * format * update lint * remove vendoring of istio, download at build time * add back space * add back eks commands * remove helm uninstall lines * clean up * clean up * clean up * address comments * unexport update * unexport update * remove ls, add back uninstall * progress * address comments * remove newlines * fix api port * address comments * clean up install/uninstall * add license * add missing istio images * add to cortex * wait for istio propagation * progress * progress * progress * progress * remove * track requests * track response time * report errors * lint * remove error * undo leftover changes * remove dev/cortex.sh * remove json indirect dep * track requests * fix ordering * clean up metrics * remove api ID * remove workloadType * record response time from ingress * remove istio.yaml * clean up * address comments and fix secrets bug * address comments * nulls -> null
1 parent 86b7541 commit 15e109a

File tree

3 files changed

+69
-2
lines changed

3 files changed

+69
-2
lines changed

manager/install_cortex.sh

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,19 @@ function setup_istio() {
9595
echo -n "."
9696
sleep 5
9797
done
98-
9998
echo -n "."
100-
envsubst < manifests/istio.yaml | helm template istio-manifests/istio --values - --name istio --namespace istio-system | kubectl apply -f - >/dev/null
99+
helm template istio-manifests/istio-cni --name istio-cni --namespace kube-system | kubectl apply -f - >/dev/null
100+
envsubst < manifests/istio-values.yaml | helm template istio-manifests/istio --values - --name istio --namespace istio-system | kubectl apply -f - >/dev/null
101+
envsubst < manifests/istio-metrics.yaml | kubectl apply -f - >/dev/null
102+
kubectl -n=istio-system create secret generic 'aws-credentials' \
103+
--from-literal='AWS_ACCESS_KEY_ID'=$AWS_ACCESS_KEY_ID \
104+
--from-literal='AWS_SECRET_ACCESS_KEY'=$AWS_SECRET_ACCESS_KEY \
105+
-o yaml --dry-run | kubectl apply -f - >/dev/null
106+
istio_patch="[
107+
{\"op\": \"add\", \"path\": \"/spec/template/spec/containers/0/env/-\", \"value\": {\"name\": \"AWS_ACCESS_KEY_ID\", \"valueFrom\": {\"secretKeyRef\": {\"name\": \"aws-credentials\", \"key\": \"AWS_ACCESS_KEY_ID\"}}}},\
108+
{\"op\": \"add\", \"path\": \"/spec/template/spec/containers/0/env/-\", \"value\": {\"name\": \"AWS_SECRET_ACCESS_KEY\", \"valueFrom\": {\"secretKeyRef\": {\"name\": \"aws-credentials\", \"key\": \"AWS_SECRET_ACCESS_KEY\"}}}},\
109+
]"
110+
kubectl patch deployment istio-telemetry -n istio-system --type='json' -p="$istio_patch"
101111
}
102112

103113
function validate_cortex() {

manager/manifests/istio-metrics.yaml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# Copyright 2019 Cortex Labs, Inc.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
apiVersion: config.istio.io/v1alpha2
16+
kind: instance
17+
metadata:
18+
name: response-time
19+
namespace: $CORTEX_NAMESPACE
20+
spec:
21+
compiledTemplate: metric
22+
params:
23+
value: response.duration
24+
dimensions:
25+
REQUEST_PATH: request.url_path | "unknown"
26+
---
27+
apiVersion: config.istio.io/v1alpha2
28+
kind: handler
29+
metadata:
30+
name: cortex-request-handler
31+
namespace: $CORTEX_NAMESPACE
32+
spec:
33+
compiledAdapter: cloudwatch
34+
params:
35+
namespace: $CORTEX_NAMESPACE
36+
logGroupName: $CORTEX_LOG_GROUP
37+
logStreamName: $CORTEX_LOG_GROUP
38+
metricInfo:
39+
response-time.instance.cortex:
40+
unit: Milliseconds
41+
logs: {}
42+
---
43+
apiVersion: config.istio.io/v1alpha2
44+
kind: rule
45+
metadata:
46+
name: cortex-api-requests
47+
namespace: $CORTEX_NAMESPACE
48+
spec:
49+
match: source.workload.name == "apis-ingressgateway"
50+
actions:
51+
- handler: cortex-request-handler
52+
instances:
53+
- response-time
54+
---

manager/manifests/istio.yaml renamed to manager/manifests/istio-values.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,9 @@ mixer:
9696

9797
telemetry:
9898
enabled: true
99+
env:
100+
AWS_REGION: $CORTEX_REGION
101+
LOG_GROUP_NAME: $CORTEX_LOG_GROUP
99102

100103
pilot:
101104
image: $CORTEX_IMAGE_ISTIO_PILOT

0 commit comments

Comments
 (0)