Skip to content

Commit e4e9514

Browse files
committed
adding kubernetes support
Change-Id: I23adc1eeb608dbb9fa3783561cb4f7950a704fd8 Reviewed-on: http://review.couchbase.org/c/perfrunner/+/144178 Reviewed-by: Bo-Chun Wang <[email protected]> Tested-by: Korrigan Clark <[email protected]>
1 parent 84edb7f commit e4e9514

File tree

106 files changed

+17797
-3955
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

106 files changed

+17797
-3955
lines changed

Makefile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,14 @@ loader:
6969
docker:
7070
docker build -t docker.io/perflab/perfrunner docker
7171

72+
docker-cloud-worker:
73+
pyenv local 3.6.12 && \
74+
virtualenv --quiet --python ${PYTHON} ${ENV}
75+
${ENV}/bin/pip install --upgrade --quiet pip wheel
76+
${ENV}/bin/pip install --quiet --no-warn-script-location -r requirements.txt
77+
${ENV}/bin/python setup.py --quiet install
78+
pwd > ${ENV}/lib/${PYTHON}/site-packages/perfrunner.pth
79+
7280
CONTAINER_PASSWORD := puppet
7381
docker-compose:
7482
docker-compose up -d --build perfrunner

cbagent/collectors/collector.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,11 @@ class Collector:
1616

1717
def __init__(self, settings):
1818
self.session = requests.Session()
19-
19+
self.cloud = settings.cloud
20+
self.cloud_enabled = self.cloud['enabled']
21+
if self.cloud_enabled:
22+
self.session = self.cloud["cloud_rest"]
2023
self.interval = settings.interval
21-
2224
self.cluster = settings.cluster
2325
self.master_node = settings.master_node
2426
self.auth = (settings.rest_username, settings.rest_password)
@@ -39,9 +41,14 @@ def __init__(self, settings):
3941

4042
def get_http(self, path, server=None, port=8091, json=True):
4143
server = server or self.master_node
42-
url = "http://{}:{}{}".format(server, port, path)
4344
try:
44-
r = self.session.get(url=url, auth=self.auth)
45+
if self.cloud_enabled:
46+
server, port = self.session.translate_host_and_port(server, port)
47+
url = "http://{}:{}{}".format(server, port, path)
48+
r = self.session.get(url=url)
49+
else:
50+
url = "http://{}:{}{}".format(server, port, path)
51+
r = self.session.get(url=url, auth=self.auth)
4552
if r.status_code in (200, 201, 202):
4653
return json and r.json() or r.text
4754
else:

cloud/broker/rabbitmq/0.48/cluster-operator.yaml

Lines changed: 4127 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
{
2+
"rabbit_version": "3.8.9",
3+
"parameters": [],
4+
"policies": [],
5+
"users": [
6+
{
7+
"name": "guest",
8+
"password_hash": "i6qMFDGjSjiOHQ6KpNilidmpk48=",
9+
"tags": "administrator"
10+
},
11+
{
12+
"name": "couchbase",
13+
"password_hash": "Z6MS4kUSF6v1TxJVI+aREEwzypE=",
14+
"tags": ""
15+
}
16+
],
17+
"vhosts": [
18+
{
19+
"name": "broker"
20+
},
21+
{
22+
"name": "/"
23+
}
24+
],
25+
"permissions": [
26+
{
27+
"user": "couchbase",
28+
"vhost": "broker",
29+
"configure": ".*",
30+
"write": ".*",
31+
"read": ".*"
32+
},
33+
{
34+
"user": "guest",
35+
"vhost": "/",
36+
"configure": ".*",
37+
"write": ".*",
38+
"read": ".*"
39+
}
40+
],
41+
"queues": [],
42+
"bindings": []
43+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
apiVersion: rabbitmq.com/v1beta1
2+
kind: RabbitmqCluster
3+
metadata:
4+
name: rabbitmq
5+
annotations:
6+
sidecar.istio.io/inject: "false"
7+
spec:
8+
service:
9+
type: NodePort
10+
affinity:
11+
nodeAffinity:
12+
requiredDuringSchedulingIgnoredDuringExecution:
13+
nodeSelectorTerms:
14+
- matchExpressions:
15+
- key: NodeRoles
16+
operator: In
17+
values:
18+
- utilities
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"Version": "2012-10-17",
3+
"Statement": [
4+
{
5+
"Effect": "Allow",
6+
"Action": [
7+
"ec2:AttachVolume",
8+
"ec2:CreateSnapshot",
9+
"ec2:CreateTags",
10+
"ec2:CreateVolume",
11+
"ec2:DeleteSnapshot",
12+
"ec2:DeleteTags",
13+
"ec2:DeleteVolume",
14+
"ec2:DescribeInstances",
15+
"ec2:DescribeSnapshots",
16+
"ec2:DescribeTags",
17+
"ec2:DescribeVolumes",
18+
"ec2:DetachVolume"
19+
],
20+
"Resource": "*"
21+
}
22+
]
23+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
kind: StorageClass
2+
apiVersion: storage.k8s.io/v1
3+
metadata:
4+
name: perf-sc
5+
annotations:
6+
storageclass.kubernetes.io/is-default-class: "true"
7+
provisioner: kubernetes.io/aws-ebs
8+
parameters:
9+
type: gp2
10+
fsType: ext4
11+
reclaimPolicy: Delete
12+
volumeBindingMode: WaitForFirstConsumer
13+
allowVolumeExpansion: true
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
AWSTemplateFormatVersion: '2010-09-09'
3+
Description: 'Amazon EKS Cluster Role'
4+
5+
6+
Resources:
7+
8+
eksClusterRole:
9+
Type: AWS::IAM::Role
10+
Properties:
11+
AssumeRolePolicyDocument:
12+
Version: '2012-10-17'
13+
Statement:
14+
- Effect: Allow
15+
Principal:
16+
Service:
17+
- eks.amazonaws.com
18+
Action:
19+
- sts:AssumeRole
20+
ManagedPolicyArns:
21+
- arn:aws:iam::aws:policy/AmazonEKSClusterPolicy
22+
23+
Outputs:
24+
25+
RoleArn:
26+
Description: The role that Amazon EKS will use to create AWS resources for Kubernetes clusters
27+
Value: !GetAtt eksClusterRole.Arn
28+
Export:
29+
Name: !Sub "${AWS::StackName}-RoleArn"
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
AWSTemplateFormatVersion: "2010-09-09"
2+
3+
Description: Amazon EKS - Node Group Role
4+
5+
Mappings:
6+
ServicePrincipals:
7+
aws-cn:
8+
ec2: ec2.amazonaws.com.cn
9+
aws-us-gov:
10+
ec2: ec2.amazonaws.com
11+
aws:
12+
ec2: ec2.amazonaws.com
13+
14+
Resources:
15+
NodeInstanceRole:
16+
Type: "AWS::IAM::Role"
17+
Properties:
18+
AssumeRolePolicyDocument:
19+
Version: "2012-10-17"
20+
Statement:
21+
- Effect: Allow
22+
Principal:
23+
Service:
24+
- !FindInMap [ServicePrincipals, !Ref "AWS::Partition", ec2]
25+
Action:
26+
- "sts:AssumeRole"
27+
ManagedPolicyArns:
28+
- !Sub "arn:${AWS::Partition}:iam::aws:policy/AmazonEKSWorkerNodePolicy"
29+
- !Sub "arn:${AWS::Partition}:iam::aws:policy/AmazonEKS_CNI_Policy"
30+
- !Sub "arn:${AWS::Partition}:iam::aws:policy/AmazonEC2ContainerRegistryReadOnly"
31+
Path: /
32+
33+
Outputs:
34+
NodeInstanceRole:
35+
Description: The node instance role
36+
Value: !GetAtt NodeInstanceRole.Arn
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
[infrastructure]
2+
provider = aws
3+
4+
[clusters]
5+
couchbase1 =
6+
k8s.k8s_cluster_1.k8s_node_group_1.1:kv
7+
k8s.k8s_cluster_1.k8s_node_group_1.2:kv
8+
9+
[clients]
10+
workers1 =
11+
k8s.k8s_cluster_1.k8s_node_group_2.1
12+
13+
[utilities]
14+
brokers1 = k8s.k8s_cluster_1.k8s_node_group_3
15+
operators1 = k8s.k8s_cluster_1.k8s_node_group_3
16+
17+
[k8s]
18+
clusters = k8s_cluster_1
19+
20+
[k8s_cluster_1]
21+
node_groups = k8s_node_group_1,k8s_node_group_2,k8s_node_group_3
22+
version = 1.17
23+
storage_class = gp2
24+
25+
[k8s_node_group_1]
26+
instance_type = c5.24xlarge
27+
instance_capacity = 2
28+
volume_size = 100
29+
30+
[k8s_node_group_2]
31+
instance_type = c5.24xlarge
32+
instance_capacity = 1
33+
volume_size = 100
34+
35+
[k8s_node_group_3]
36+
instance_type = c5.24xlarge
37+
instance_capacity = 1
38+
volume_size = 100
39+
40+
[storage]
41+
data = /data
42+
43+
[credentials]
44+
rest = Administrator:password
45+
ssh = root:couchbase
46+
aws_key_name = korry
47+
48+
[parameters]
49+
OS = CentOS 7
50+
CPU = c5.24xlarge (96 vCPU)
51+
Memory = 192 GB
52+
Disk = EBS 1TB

0 commit comments

Comments
 (0)