Add basic heat support
Change-Id: Iabab0770fd03fa11845ac175b13886cdfa8a42d8
This commit is contained in:
parent
97501c4460
commit
f2bf41d3e7
3
Makefile
3
Makefile
@ -1,6 +1,9 @@
|
|||||||
images:
|
images:
|
||||||
docker build images/horizon -t vexxhost/horizon:latest
|
docker build images/horizon -t vexxhost/horizon:latest
|
||||||
docker build images/ceilometer --target ceilometer-agent-notification -t vexxhost/ceilometer-agent-notification:latest
|
docker build images/ceilometer --target ceilometer-agent-notification -t vexxhost/ceilometer-agent-notification:latest
|
||||||
|
docker build images/heat --target heat-api -t vexxhost/heat-api:latest
|
||||||
|
docker build images/heat --target heat-api-cfn -t vexxhost/heat-api-cfn:latest
|
||||||
|
docker build images/heat --target heat-engine -t vexxhost/heat-engine:latest
|
||||||
docker build images/mcrouter -t vexxhost/mcrouter:latest
|
docker build images/mcrouter -t vexxhost/mcrouter:latest
|
||||||
docker build images/mcrouter-exporter -t vexxhost/mcrouter-exporter:latest
|
docker build images/mcrouter-exporter -t vexxhost/mcrouter-exporter:latest
|
||||||
docker build images/memcached -t vexxhost/memcached:latest
|
docker build images/memcached -t vexxhost/memcached:latest
|
||||||
|
24
chart/crds/orchestration.openstack.org_heats.yaml
Normal file
24
chart/crds/orchestration.openstack.org_heats.yaml
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
---
|
||||||
|
apiVersion: apiextensions.k8s.io/v1beta1
|
||||||
|
kind: CustomResourceDefinition
|
||||||
|
metadata:
|
||||||
|
name: heats.orchestration.openstack.org
|
||||||
|
spec:
|
||||||
|
group: orchestration.openstack.org
|
||||||
|
names:
|
||||||
|
kind: Heat
|
||||||
|
listKind: HeatList
|
||||||
|
plural: heats
|
||||||
|
singular: heat
|
||||||
|
scope: Namespaced
|
||||||
|
version: v1alpha1
|
||||||
|
versions:
|
||||||
|
- name: v1alpha1
|
||||||
|
served: true
|
||||||
|
storage: true
|
||||||
|
status:
|
||||||
|
acceptedNames:
|
||||||
|
kind: ""
|
||||||
|
plural: ""
|
||||||
|
conditions: []
|
||||||
|
storedVersions: []
|
@ -131,6 +131,26 @@ rules:
|
|||||||
- get
|
- get
|
||||||
- patch
|
- patch
|
||||||
- update
|
- update
|
||||||
|
- apiGroups:
|
||||||
|
- orchestration.openstack.org
|
||||||
|
resources:
|
||||||
|
- heats
|
||||||
|
verbs:
|
||||||
|
- create
|
||||||
|
- delete
|
||||||
|
- get
|
||||||
|
- list
|
||||||
|
- patch
|
||||||
|
- update
|
||||||
|
- watch
|
||||||
|
- apiGroups:
|
||||||
|
- orchestration.openstack.org
|
||||||
|
resources:
|
||||||
|
- heats/status
|
||||||
|
verbs:
|
||||||
|
- get
|
||||||
|
- patch
|
||||||
|
- update
|
||||||
- apiGroups:
|
- apiGroups:
|
||||||
- dashboard.openstack.org
|
- dashboard.openstack.org
|
||||||
resources:
|
resources:
|
||||||
|
@ -29,6 +29,8 @@ spec:
|
|||||||
args:
|
args:
|
||||||
- run
|
- run
|
||||||
- -m
|
- -m
|
||||||
|
- openstack_operator.heat
|
||||||
|
- -m
|
||||||
- openstack_operator.horizon
|
- openstack_operator.horizon
|
||||||
- -m
|
- -m
|
||||||
- openstack_operator.keystone
|
- openstack_operator.keystone
|
||||||
|
7
config/samples/orchestration_v1alpha1_heat.yaml
Normal file
7
config/samples/orchestration_v1alpha1_heat.yaml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
apiVersion: orchestration.openstack.org/v1alpha1
|
||||||
|
kind: Heat
|
||||||
|
metadata:
|
||||||
|
name: sample
|
||||||
|
spec:
|
||||||
|
configDir: /etc/heat
|
@ -51,8 +51,7 @@ for image in images:
|
|||||||
continue
|
continue
|
||||||
if len(line.value) >= 3 and line.value[1].lower() != 'as':
|
if len(line.value) >= 3 and line.value[1].lower() != 'as':
|
||||||
continue
|
continue
|
||||||
if line.value[0] != image:
|
if len(line.value) >= 3 and image in line.value[2]:
|
||||||
continue
|
|
||||||
targets.append(line.value[2])
|
targets.append(line.value[2])
|
||||||
|
|
||||||
# Update images if we have more than 1 target
|
# Update images if we have more than 1 target
|
||||||
|
37
images/heat/Dockerfile
Normal file
37
images/heat/Dockerfile
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
# Copyright (c) 2020 VEXXHOST, Inc.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||||
|
# implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
FROM docker.io/opendevorg/python-builder as builder
|
||||||
|
COPY bindep.txt /tmp/src/bindep.txt
|
||||||
|
RUN assemble openstack-heat==13.0.1 python-memcached
|
||||||
|
|
||||||
|
FROM docker.io/opendevorg/uwsgi-base AS heat-api-base
|
||||||
|
COPY --from=builder /output/ /output
|
||||||
|
RUN /output/install-from-bindep
|
||||||
|
RUN ln -s /usr/local/etc/heat /etc/heat
|
||||||
|
|
||||||
|
FROM heat-api-base AS heat-api
|
||||||
|
EXPOSE 8004
|
||||||
|
ENV UWSGI_HTTP_SOCKET=:8004 UWSGI_WSGI_FILE=/usr/local/bin/heat-wsgi-api
|
||||||
|
|
||||||
|
FROM heat-api-base AS heat-api-cfn
|
||||||
|
EXPOSE 8000
|
||||||
|
ENV UWSGI_HTTP_SOCKET=:8000 UWSGI_WSGI_FILE=/usr/local/bin/heat-wsgi-api-cfn
|
||||||
|
|
||||||
|
FROM docker.io/opendevorg/python-base AS heat-engine
|
||||||
|
COPY --from=builder /output/ /output
|
||||||
|
RUN /output/install-from-bindep
|
||||||
|
RUN ln -s /usr/local/etc/heat /etc/heat
|
||||||
|
CMD ["/usr/local/bin/heat-engine"]
|
2
images/heat/bindep.txt
Normal file
2
images/heat/bindep.txt
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
gcc [compile]
|
||||||
|
libc-dev [compile]
|
43
openstack_operator/heat.py
Normal file
43
openstack_operator/heat.py
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
# Copyright 2020 VEXXHOST, Inc.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
"""Heat Operator
|
||||||
|
|
||||||
|
This module maintains the operator for Heat, it takes care of creating
|
||||||
|
the appropriate deployments, an instance of Memcache, RabbitMQ and a database
|
||||||
|
server for the installation.
|
||||||
|
"""
|
||||||
|
|
||||||
|
import kopf
|
||||||
|
|
||||||
|
from openstack_operator import utils
|
||||||
|
|
||||||
|
|
||||||
|
@kopf.on.resume('orchestration.openstack.org', 'v1alpha1', 'heats')
|
||||||
|
@kopf.on.create('orchestration.openstack.org', 'v1alpha1', 'heats')
|
||||||
|
def create_or_resume(name, spec, **_):
|
||||||
|
"""Create and re-sync any Heat instances
|
||||||
|
|
||||||
|
This function is called when a new resource is created but also when we
|
||||||
|
start the service up for the first time.
|
||||||
|
"""
|
||||||
|
|
||||||
|
for component in ("api", "api-cfn"):
|
||||||
|
utils.create_or_update('heat/deployment.yml.j2',
|
||||||
|
name=name, spec=spec, component=component)
|
||||||
|
utils.create_or_update('heat/service.yml.j2',
|
||||||
|
name=name, component=component)
|
||||||
|
|
||||||
|
utils.create_or_update('heat/deployment.yml.j2',
|
||||||
|
name=name, spec=spec, component='engine')
|
80
openstack_operator/templates/heat/deployment.yml.j2
Normal file
80
openstack_operator/templates/heat/deployment.yml.j2
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
---
|
||||||
|
# Copyright 2020 VEXXHOST, Inc.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
{% if component is defined %}
|
||||||
|
{% set component = component %}
|
||||||
|
{% else %}
|
||||||
|
{% set component = "api" %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: heat-{{ name }}-{{ component }}
|
||||||
|
labels:
|
||||||
|
{{ labels("heat", name, component) | indent(4) }}
|
||||||
|
spec:
|
||||||
|
replicas: 3
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
{{ labels("heat", name, component) | indent(6) }}
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
{{ labels("heat", name, component) | indent(8) }}
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: heat-{{ component }}
|
||||||
|
image: vexxhost/heat-{{ component }}:latest
|
||||||
|
imagePullPolicy: Always
|
||||||
|
{% if 'api' in component %}
|
||||||
|
ports:
|
||||||
|
- name: heat-{{ component }}
|
||||||
|
containerPort: {% if component == 'api' %}8004{% else %}8000{% endif%}
|
||||||
|
livenessProbe:
|
||||||
|
tcpSocket:
|
||||||
|
port: heat-{{ component }}
|
||||||
|
readinessProbe:
|
||||||
|
tcpSocket:
|
||||||
|
port: heat-{{ component }}
|
||||||
|
{% endif %}
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
cpu: 1000m
|
||||||
|
ephemeral-storage: 50M
|
||||||
|
memory: 512M
|
||||||
|
requests:
|
||||||
|
cpu: 50m
|
||||||
|
ephemeral-storage: 50M
|
||||||
|
memory: 64M
|
||||||
|
securityContext:
|
||||||
|
runAsUser: 65534
|
||||||
|
runAsGroup: 65534
|
||||||
|
volumeMounts:
|
||||||
|
- mountPath: /etc/heat
|
||||||
|
name: config
|
||||||
|
volumes:
|
||||||
|
- name: config
|
||||||
|
hostPath:
|
||||||
|
path: {{ spec['configDir'] }}
|
||||||
|
type: Directory
|
||||||
|
{% if 'nodeSelector' in spec %}
|
||||||
|
nodeSelector:
|
||||||
|
{{ spec.nodeSelector | to_yaml | indent(8) }}
|
||||||
|
{% endif %}
|
||||||
|
{% if 'tolerations' in spec %}
|
||||||
|
tolerations:
|
||||||
|
{{ spec.tolerations | to_yaml | indent(8) }}
|
||||||
|
{% endif %}
|
27
openstack_operator/templates/heat/service.yml.j2
Normal file
27
openstack_operator/templates/heat/service.yml.j2
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
---
|
||||||
|
# Copyright 2020 VEXXHOST, Inc.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: heat-{{ name }}-{{ component }}
|
||||||
|
spec:
|
||||||
|
serviceType: ClusterIP
|
||||||
|
ports:
|
||||||
|
- name: heat-{{ component }}
|
||||||
|
port: 80
|
||||||
|
targetPort: heat-{{ component }}
|
||||||
|
selector:
|
||||||
|
{{ labels("heat", name, component) | indent(4) }}
|
27
openstack_operator/tests/unit/test_heat.py
Normal file
27
openstack_operator/tests/unit/test_heat.py
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
# Copyright 2020 VEXXHOST, Inc.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
"""Tests for Heat Operator
|
||||||
|
|
||||||
|
This module contains all the tests for the Heat operator.
|
||||||
|
"""
|
||||||
|
|
||||||
|
from openstack_operator.tests.unit import base
|
||||||
|
|
||||||
|
|
||||||
|
class HeatAPIDeploymentTestCase(base.DeploymentTestCase):
|
||||||
|
"""Basic tests for the Deployment."""
|
||||||
|
|
||||||
|
SAMPLE_FILE = 'orchestration_v1alpha1_heat.yaml'
|
||||||
|
TEMPLATE_FILE = 'heat/deployment.yml.j2'
|
@ -4,6 +4,9 @@
|
|||||||
provides: openstack-operator:image:ceilometer
|
provides: openstack-operator:image:ceilometer
|
||||||
vars: &id001
|
vars: &id001
|
||||||
docker_images:
|
docker_images:
|
||||||
|
- context: images/ceilometer
|
||||||
|
repository: vexxhost/ceilometer
|
||||||
|
target: ceilometer
|
||||||
- context: images/ceilometer
|
- context: images/ceilometer
|
||||||
repository: vexxhost/ceilometer-agent-notification
|
repository: vexxhost/ceilometer-agent-notification
|
||||||
target: ceilometer-agent-notification
|
target: ceilometer-agent-notification
|
||||||
|
@ -20,41 +20,45 @@
|
|||||||
jobs:
|
jobs:
|
||||||
- openstack-operator:functional:
|
- openstack-operator:functional:
|
||||||
dependencies:
|
dependencies:
|
||||||
- name: openstack-operator:images:build:ceilometer
|
- name: openstack-operator:images:build:mcrouter-exporter
|
||||||
soft: true
|
|
||||||
- name: openstack-operator:images:build:rabbitmq
|
|
||||||
soft: true
|
|
||||||
- name: openstack-operator:images:build:keystone
|
|
||||||
soft: true
|
soft: true
|
||||||
- name: openstack-operator:images:build:horizon
|
- name: openstack-operator:images:build:horizon
|
||||||
soft: true
|
soft: true
|
||||||
|
- name: openstack-operator:images:build:rabbitmq
|
||||||
|
soft: true
|
||||||
|
- name: openstack-operator:images:build:ceilometer
|
||||||
|
soft: true
|
||||||
|
- name: openstack-operator:images:build:memcached-exporter
|
||||||
|
soft: true
|
||||||
- name: openstack-operator:images:build:memcached
|
- name: openstack-operator:images:build:memcached
|
||||||
soft: true
|
soft: true
|
||||||
|
- name: openstack-operator:images:build:keystone
|
||||||
|
soft: true
|
||||||
- name: openstack-operator:images:build:mcrouter
|
- name: openstack-operator:images:build:mcrouter
|
||||||
soft: true
|
soft: true
|
||||||
- openstack-operator:images:build:openstack-operator
|
- openstack-operator:images:build:openstack-operator
|
||||||
- name: openstack-operator:images:build:mcrouter-exporter
|
- name: openstack-operator:images:build:heat
|
||||||
soft: true
|
|
||||||
- name: openstack-operator:images:build:memcached-exporter
|
|
||||||
soft: true
|
soft: true
|
||||||
gate:
|
gate:
|
||||||
jobs:
|
jobs:
|
||||||
- openstack-operator:functional:
|
- openstack-operator:functional:
|
||||||
dependencies:
|
dependencies:
|
||||||
- name: openstack-operator:images:upload:ceilometer
|
- name: openstack-operator:images:upload:mcrouter-exporter
|
||||||
soft: true
|
|
||||||
- name: openstack-operator:images:upload:rabbitmq
|
|
||||||
soft: true
|
|
||||||
- name: openstack-operator:images:upload:keystone
|
|
||||||
soft: true
|
soft: true
|
||||||
- name: openstack-operator:images:upload:horizon
|
- name: openstack-operator:images:upload:horizon
|
||||||
soft: true
|
soft: true
|
||||||
|
- name: openstack-operator:images:upload:rabbitmq
|
||||||
|
soft: true
|
||||||
|
- name: openstack-operator:images:upload:ceilometer
|
||||||
|
soft: true
|
||||||
|
- name: openstack-operator:images:upload:memcached-exporter
|
||||||
|
soft: true
|
||||||
- name: openstack-operator:images:upload:memcached
|
- name: openstack-operator:images:upload:memcached
|
||||||
soft: true
|
soft: true
|
||||||
|
- name: openstack-operator:images:upload:keystone
|
||||||
|
soft: true
|
||||||
- name: openstack-operator:images:upload:mcrouter
|
- name: openstack-operator:images:upload:mcrouter
|
||||||
soft: true
|
soft: true
|
||||||
- openstack-operator:images:upload:openstack-operator
|
- openstack-operator:images:upload:openstack-operator
|
||||||
- name: openstack-operator:images:upload:mcrouter-exporter
|
- name: openstack-operator:images:upload:heat
|
||||||
soft: true
|
|
||||||
- name: openstack-operator:images:upload:memcached-exporter
|
|
||||||
soft: true
|
soft: true
|
||||||
|
45
zuul.d/heat-jobs.yaml
Normal file
45
zuul.d/heat-jobs.yaml
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
- job:
|
||||||
|
name: openstack-operator:images:build:heat
|
||||||
|
parent: vexxhost-build-docker-image
|
||||||
|
provides: openstack-operator:image:heat
|
||||||
|
vars: &id001
|
||||||
|
docker_images:
|
||||||
|
- context: images/heat
|
||||||
|
repository: vexxhost/heat-api-base
|
||||||
|
target: heat-api-base
|
||||||
|
- context: images/heat
|
||||||
|
repository: vexxhost/heat-api
|
||||||
|
target: heat-api
|
||||||
|
- context: images/heat
|
||||||
|
repository: vexxhost/heat-api-cfn
|
||||||
|
target: heat-api-cfn
|
||||||
|
- context: images/heat
|
||||||
|
repository: vexxhost/heat-engine
|
||||||
|
target: heat-engine
|
||||||
|
dependencies:
|
||||||
|
- openstack-operator:images:build:openstack-operator
|
||||||
|
files: &id002
|
||||||
|
- ^images/heat/.*
|
||||||
|
- job:
|
||||||
|
name: openstack-operator:images:upload:heat
|
||||||
|
parent: vexxhost-upload-docker-image
|
||||||
|
provides: openstack-operator:image:heat
|
||||||
|
vars: *id001
|
||||||
|
dependencies:
|
||||||
|
- openstack-operator:images:upload:openstack-operator
|
||||||
|
files: *id002
|
||||||
|
- job:
|
||||||
|
name: openstack-operator:images:promote:heat
|
||||||
|
parent: vexxhost-promote-docker-image
|
||||||
|
vars: *id001
|
||||||
|
files: *id002
|
||||||
|
- project:
|
||||||
|
check:
|
||||||
|
jobs:
|
||||||
|
- openstack-operator:images:build:heat
|
||||||
|
gate:
|
||||||
|
jobs:
|
||||||
|
- openstack-operator:images:upload:heat
|
||||||
|
promote:
|
||||||
|
jobs:
|
||||||
|
- openstack-operator:images:promote:heat
|
Loading…
Reference in New Issue
Block a user