blob: 896df6ec2a6c24bbd294275542a0185c58cf1a07 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
#!/usr/bin/env python
# Copyright (c) Authors of Clover
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
import getopt
import sys
from clover.orchestration import kube_client
import clover.servicemesh.route_rules as rr
from clover.tracing.tracing import Tracing
from clover.tools.validate_rr import ValidateWRR
def main(argv):
service_name = None
test_id = None
help_str = 'clover_validate_rr.py -t <test-id> -s <service name>'
try:
opts, args = getopt.getopt(argv,"hs:t:",["service-name", "test-id"])
except getopt.GetoptError:
print help_str
sys.exit(2)
for opt, arg in opts:
if opt == '-h':
print help_str
sys.exit()
elif opt in ("-t", "--test-id"):
test_id = str(arg)
elif opt in ("-s", "--service-name"):
service_name = str(arg)
if not service_name or not test_id:
print help_str
sys.exit(3)
validate_wrr = ValidateWRR(test_id)
istio_pods = ['istio-ingress', 'istio-mixer', 'istio-pilot']
jaeger_pods = ['jaeger-deployment']
if not validate_wrr.check_pods_up(istio_pods + jaeger_pods,
'istio-system'):
sys.exit(4)
ret, errors = validate_wrr.validate(service_name)
for err in errors:
print err
if __name__ == "__main__":
main(sys.argv[1:])
|