Update ubuntu docker file and add autoscaling templates
Related-PROD: PROD-36128
Change-Id: Ic983e236e4342d50a5df7075a5a47eaeb866ac16
diff --git a/autoscale/environment.yaml b/autoscale/environment.yaml
new file mode 100644
index 0000000..19907c4
--- /dev/null
+++ b/autoscale/environment.yaml
@@ -0,0 +1,2 @@
+resource_registry:
+ "OS::Nova::Server::Ubuntu": "server.yaml"
diff --git a/autoscale/server.yaml b/autoscale/server.yaml
new file mode 100644
index 0000000..1c5aa96
--- /dev/null
+++ b/autoscale/server.yaml
@@ -0,0 +1,29 @@
+heat_template_version: 2014-10-16
+description: A simple Ubuntu server booted from volume.
+
+parameters:
+ metadata:
+ type: json
+
+resources:
+ server:
+ type: OS::Nova::Server
+ properties:
+ block_device_mapping:
+ - device_name: vda
+ delete_on_termination: true
+ volume_id: { get_resource: volume }
+ flavor: cvp.medium
+ networks:
+ - network: cvp.net.1
+ metadata: {get_param: metadata}
+ user_data_format: RAW
+ user_data: |
+ #!/bin/sh
+ while [ 1 ] ; do echo $((13**99)) 1>/dev/null 2>&1; done
+
+ volume:
+ type: OS::Cinder::Volume
+ properties:
+ image: 'cvp.ubuntu.1604'
+ size: 20
diff --git a/autoscale/simple.yaml b/autoscale/simple.yaml
new file mode 100644
index 0000000..fe95eed
--- /dev/null
+++ b/autoscale/simple.yaml
@@ -0,0 +1,48 @@
+heat_template_version: 2016-10-14
+description: A simple auto scaling group.
+
+resources:
+ group:
+ type: OS::Heat::AutoScalingGroup
+ properties:
+ cooldown: 60
+ desired_capacity: 2
+ max_size: 5
+ min_size: 1
+ resource:
+ type: OS::Nova::Server::Ubuntu
+ properties:
+ metadata: {"metering.server_group": {get_param: "OS::stack_id"}}
+
+ scaleup_policy:
+ type: OS::Heat::ScalingPolicy
+ properties:
+ adjustment_type: change_in_capacity
+ auto_scaling_group_id: { get_resource: group }
+ cooldown: 60
+ scaling_adjustment: 1
+
+ cpu_alarm_high:
+ type: OS::Aodh::GnocchiAggregationByResourcesAlarm
+ properties:
+ description: Scale up if CPU time spent >10000 ns
+ metric: cpu
+ aggregation_method: mean
+ granularity: 60
+ evaluation_periods: 1
+ threshold: 10000
+ resource_type: instance
+ comparison_operator: gt
+ alarm_actions:
+ - str_replace:
+ template: trust+url
+ params:
+ url: {get_attr: [scaleup_policy, signal_url]}
+ query:
+ list_join:
+ - ''
+ - - {'=': {server_group: {get_param: "OS::stack_id"}}}
+
+outputs:
+ scaleup_policy_signal_url:
+ value: {get_attr: {scaleup_policy, signal_url}}
diff --git a/k8s/docker-ubuntu-2004 b/k8s/docker-ubuntu-2004
index 998ae15..5a1200d 100644
--- a/k8s/docker-ubuntu-2004
+++ b/k8s/docker-ubuntu-2004
@@ -12,12 +12,15 @@
make && \
make install && \
cd /opt && \
- rm -rf /opt/fio && \
- export TZ="America/Chicago" && \
+ rm -rf /opt/fio
+
+RUN export TZ="America/Chicago" && \
ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone && \
- apt-get install -y python3-pip python3-venv vim git iperf3 mtr htop iputils-ping traceroute tcpdump wget iproute2 curl screen && \
- pip3 install --no-cache-dir python-openstackclient python-neutronclient python-heatclient pyghmi python-octaviaclient tempestparser && \
- git clone https://gerrit.mcp.mirantis.com/mcp/cvp-configuration /opt/res-files && \
+ apt-get install -y python3-pip python3-venv vim git iperf3 mtr htop iputils-ping traceroute tcpdump wget iproute2 curl screen
+
+RUN pip3 install --no-cache-dir python-openstackclient python-neutronclient python-heatclient pyghmi python-octaviaclient tempestparser python-ironicclient aodhclient gnocchiclient
+
+RUN git clone https://gerrit.mcp.mirantis.com/mcp/cvp-configuration /opt/res-files && \
git clone http://gerrit.mcp.mirantis.com/mcp/cfg-checker /opt/cfg-checker && \
cd /opt/cfg-checker && \
python3 -m venv .checkervenv && \
@@ -29,16 +32,20 @@
cp /opt/res-files/scripts/prepare.sh ./ && \
cp /opt/res-files/scripts/cmp_check.sh ./ && \
cp /opt/res-files/cleanup.sh ./ && \
- cd /opt/si-tests/ && \
- python3 -m venv .venv && \
- . .venv/bin/activate && \
- pip3 install --no-cache-dir -r si_tests/requirements.txt && \
- deactivate && \
- cd /opt && \
- rm -rf /var/lib/apt/lists/* && \
rm -rf /opt/res-files/.git && \
rm -rf /opt/cfg-checker/.git
+RUN cd /opt/si-tests/ && \
+ python3 -m venv .sivenv && \
+ . .sivenv/bin/activate && \
+ pip3 install --no-cache-dir -r si_tests/requirements.txt && \
+ deactivate && \
+ cd /opt
+
+RUN mkdir /opt/packages/ && \
+ cd /opt/packages && \
+ apt-get download $(apt-cache depends --recurse --no-recommends --no-suggests --no-conflicts --no-breaks --no-replaces --no-enhances iperf3 | grep "^\w" | sort -u) || true
+
RUN curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" && \
install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl && \
rm kubectl