diff options
author | Arthur Martella <arthur.martella.1@att.com> | 2019-03-15 11:56:54 -0400 |
---|---|---|
committer | Arthur Martella <arthur.martella.1@att.com> | 2019-03-15 11:56:54 -0400 |
commit | 99c4495bd4eb4b1bb01cc483f5d9ade58843d91a (patch) | |
tree | ceb9ed28f275b9514eca11cc0d9196a0b7c30222 /engine | |
parent | 2f7fe5df5de5014f2d54422eccc8bc2a4e13fd8e (diff) |
Initial upload of F-GPS seed code 1/21
Includes:
Base license for project and engine
Engine dockerfile
Engine sample helm chart
Engine sample config directory
Change-Id: I034927aed57d8f48de44a0aae9be34e46d7db5ac
Issue-ID: OPTFRA-440
Signed-off-by: arthur.martella.1@att.com
Diffstat (limited to 'engine')
-rw-r--r-- | engine/LICENSE.txt | 45 | ||||
-rw-r--r-- | engine/docker/Dockerfile | 23 | ||||
-rwxr-xr-x | engine/kubernetes/org-onap-fgps-dev/.helmignore | 21 | ||||
-rwxr-xr-x | engine/kubernetes/org-onap-fgps-dev/Chart.yaml | 19 | ||||
-rwxr-xr-x | engine/kubernetes/org-onap-fgps-dev/resources/config/solver.json | 72 | ||||
-rwxr-xr-x | engine/kubernetes/org-onap-fgps-dev/templates/configmap.yaml | 21 | ||||
-rwxr-xr-x | engine/kubernetes/org-onap-fgps-dev/templates/deployment.yaml | 76 | ||||
-rwxr-xr-x | engine/kubernetes/org-onap-fgps-dev/templates/service.yaml | 41 | ||||
-rwxr-xr-x | engine/kubernetes/org-onap-fgps-dev/values.yaml | 97 | ||||
-rwxr-xr-x | engine/src/config/planner.json | 69 | ||||
-rwxr-xr-x | engine/src/config/solver.json | 72 | ||||
-rwxr-xr-x | engine/src/config/solver_test.json | 72 | ||||
-rw-r--r-- | engine/src/config/version.json | 9 | ||||
-rwxr-xr-x | engine/src/requirements.txt | 7 |
14 files changed, 644 insertions, 0 deletions
diff --git a/engine/LICENSE.txt b/engine/LICENSE.txt new file mode 100644 index 0000000..f7449f4 --- /dev/null +++ b/engine/LICENSE.txt @@ -0,0 +1,45 @@ + +The following licence applies to all files in this and subdirectories. Licences +are included in individual source files where appropriate, and if it differs +from this text, it supersedes this. Any file that does not have licence text +defaults to being covered by this text; not all files support the addition of +licenses. + +/* +* ============LICENSE_START========================================== +* ONAP - F-GPS Engine +* =================================================================== +* Copyright (c) 2019 AT&T Intellectual Property. All rights reserved. +* =================================================================== +* +* Unless otherwise specified, all software contained herein is licensed +* under the Apache License, Version 2.0 (the "License"); +* you may not use this software 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. +* +* +* +* Unless otherwise specified, all documentation contained herein is licensed +* under the Creative Commons License, Attribution 4.0 Intl. (the "License"); +* you may not use this documentation except in compliance with the License. +* You may obtain a copy of the License at +* +* https://creativecommons.org/licenses/by/4.0/ +* +* Unless required by applicable law or agreed to in writing, documentation +* 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. +* +* ============LICENSE_END============================================ +* +*/ diff --git a/engine/docker/Dockerfile b/engine/docker/Dockerfile new file mode 100644 index 0000000..f8bf14e --- /dev/null +++ b/engine/docker/Dockerfile @@ -0,0 +1,23 @@ +FROM python:2.7.15-alpine + +COPY src/ /opt/engine +WORKDIR /opt/engine + +ARG HTTP_PROXY +ARG HTTPS_PROXY + +ENV HTTP_PROXY ${HTTP_PROXY} +ENV HTTPS_PROXY ${HTTPS_PROXY} + +RUN apk --update add --virtual build-dep gcc musl-dev linux-headers libc-dev \ + && pip install -r requirements.txt \ + && apk del build-dep + +ENV HTTP_PROXY "" +ENV HTTPS_PROXY "" + +RUN addgroup -g 825 -S valetg && adduser -u 825 -S valetu -G valetg && chown -R valetu:valetg /opt/engine +USER valetu:valetg +RUN date > /home/valetu/imagedate.txt + +CMD ["python", "valet/valet_main.py", "/opt/config/solver.json"] diff --git a/engine/kubernetes/org-onap-fgps-dev/.helmignore b/engine/kubernetes/org-onap-fgps-dev/.helmignore new file mode 100755 index 0000000..f0c1319 --- /dev/null +++ b/engine/kubernetes/org-onap-fgps-dev/.helmignore @@ -0,0 +1,21 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*~ +# Various IDEs +.project +.idea/ +*.tmproj diff --git a/engine/kubernetes/org-onap-fgps-dev/Chart.yaml b/engine/kubernetes/org-onap-fgps-dev/Chart.yaml new file mode 100755 index 0000000..2749f1a --- /dev/null +++ b/engine/kubernetes/org-onap-fgps-dev/Chart.yaml @@ -0,0 +1,19 @@ +# Copyright © 2019 AT&T +# +# 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 +appVersion: "1.0" +description: A Helm chart for valet engine Kubernetes +name: valetengine +version: 1.0.0 diff --git a/engine/kubernetes/org-onap-fgps-dev/resources/config/solver.json b/engine/kubernetes/org-onap-fgps-dev/resources/config/solver.json new file mode 100755 index 0000000..62f179e --- /dev/null +++ b/engine/kubernetes/org-onap-fgps-dev/resources/config/solver.json @@ -0,0 +1,72 @@ +{
+ "engine": {
+ "id": "valet01",
+ "timeout": 300,
+ "dha": "false",
+ "ek": "123"
+ },
+ "logging": {
+ "path": "{{.Values.logging.path}}",
+ "name": "{{.Values.logging.name}}",
+ "format": "{{.Values.logging.format}}",
+ "size": 10000000,
+ "level": "{{.Values.logging.level}}",
+ "lk": "234"
+ },
+ "db": {
+ "mode": "music",
+ "keyspace": "{{.Values.db.keyspace}}",
+ "requests_table": "{{.Values.db.requests_table}}",
+ "results_table": "{{.Values.db.results_table}}",
+ "group_rules_table": "{{.Values.db.group_rules_table}}",
+ "groups_table": "{{.Values.db.groups_table}}",
+ "stacks_table": "{{.Values.db.stacks_table}}",
+ "resources_table": "{{.Values.db.resources_table}}",
+ "stack_id_map_table": "{{.Values.db.stack_id_map_table}}",
+ "regions_table": "{{.Values.db.regions_table}}",
+ "dk": "789"
+ },
+ "music": {
+ "hosts": [ "{{.Values.music.host1}}", "{{.Values.music.host2}}", "{{.Values.music.host3}}" ],
+ "port": "8080",
+ "path": "/MUSIC/rest/v2",
+ "timeout": 10,
+ "retries": 3,
+ "replication_factor": 3,
+ "lock_timeout": 300,
+ "userid": "{{.Values.music.userid}}",
+ "password": "{{.Values.music.password}}",
+ "namespace": "{{.Values.music.namespace}}"
+ },
+ "compute": {
+ "mode": "nova",
+ "default_cpu_allocation_ratio": 1.0,
+ "default_ram_allocation_ratio": 1.0,
+ "default_disk_allocation_ratio": 1.0,
+ "batch_sync_interval": 3600
+ },
+ "nova": {
+ "project_name": "{{.Values.nova.project_name}}",
+ "admin_view_username": "{{.Values.nova.admin_view_username}}",
+ "admin_username": "{{.Values.nova.admin_username}}",
+ "admin_view_password": "{{.Values.nova.admin_view_password}}",
+ "admin_password": "{{.Values.nova.admin_password}}"
+ },
+ "topology": {
+ "mode": "{{.Values.topology.mode}}"
+ },
+ "naming": {
+ "rack_codes": [
+ "r"
+ ],
+ "host_codes": [
+ "a",
+ "c",
+ "u",
+ "f",
+ "o",
+ "p",
+ "s"
+ ]
+ }
+}
diff --git a/engine/kubernetes/org-onap-fgps-dev/templates/configmap.yaml b/engine/kubernetes/org-onap-fgps-dev/templates/configmap.yaml new file mode 100755 index 0000000..25c8816 --- /dev/null +++ b/engine/kubernetes/org-onap-fgps-dev/templates/configmap.yaml @@ -0,0 +1,21 @@ +# Copyright © 2019 AT&T +# +# 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: ConfigMap +metadata: + name: engine-configs + namespace: org-onap-fgps-dev +data: +{{ tpl (.Files.Glob "resources/config/*").AsConfig . | indent 2 }} diff --git a/engine/kubernetes/org-onap-fgps-dev/templates/deployment.yaml b/engine/kubernetes/org-onap-fgps-dev/templates/deployment.yaml new file mode 100755 index 0000000..aebeacc --- /dev/null +++ b/engine/kubernetes/org-onap-fgps-dev/templates/deployment.yaml @@ -0,0 +1,76 @@ +# Copyright © 2019 AT&T +# +# 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: extensions/v1beta1 +kind: Deployment +metadata: + name: {{ .Chart.Name }} + namespace: {{ .Values.global.ns }} + labels: + app: {{ .Chart.Name }} + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +spec: + replicas: {{ .Values.replicaCount }} + template: + metadata: + labels: + app: {{ .Chart.Name }} + release: {{ .Release.Name }} + spec: + serviceAccount: "default" + volumes: + - name: engine-volume + configMap: + name: engine-configs + items: + - key: solver.json + path: solver.json + - name: engine-logs + hostPath: + path: /opt/logs/engine + imagePullSecrets: + - name: pullsecret + initContainers: + - name: init-cont + image: ubuntu:16.04 + command: ['bash', '-c', 'useradd --uid 825 valetu && chown -R valetu /engine'] + volumeMounts: + - mountPath: /engine + name: engine-logs + containers: + - env: + - name: properties + value: solver.json + image: "nexus.onap.org:5100/org.onap.fgps/engine:latest" + imagePullPolicy: Always + name: "engine" + volumeMounts: + - name: engine-volume + mountPath: /opt/config/solver.json + subPath: solver.json + - name: engine-logs + mountPath: /engine + ports: + - containerPort: 80 + protocol: TCP + resources: + requests: + memory: "500Mi" + cpu: "250m" + limits: + memory: "1Gi" + cpu: "500m" + restartPolicy: Always diff --git a/engine/kubernetes/org-onap-fgps-dev/templates/service.yaml b/engine/kubernetes/org-onap-fgps-dev/templates/service.yaml new file mode 100755 index 0000000..8b9d1d0 --- /dev/null +++ b/engine/kubernetes/org-onap-fgps-dev/templates/service.yaml @@ -0,0 +1,41 @@ +# Copyright © 2019 AT&T +# +# 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: {{ .Chart.Name }} + namespace: {{ .Values.global.ns }} + labels: + app: {{ .Chart.Name }} + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} + annotations: +spec: + type: {{ .Values.service.type }} + ports: + {{if eq .Values.service.type "NodePort" -}} + - port: {{ .Values.service.externalPort }} + nodePort: {{ .Values.service.nodePort }} + name: {{ .Values.service.portName }} + {{- else -}} + - port: {{ .Values.service.externalPort }} + targetPort: {{ .Values.service.internalPort }} + name: {{ .Values.service.portName }} + {{- end}} + selector: + app: {{ .Chart.Name }} + release: {{ .Release.Name }} + diff --git a/engine/kubernetes/org-onap-fgps-dev/values.yaml b/engine/kubernetes/org-onap-fgps-dev/values.yaml new file mode 100755 index 0000000..223f036 --- /dev/null +++ b/engine/kubernetes/org-onap-fgps-dev/values.yaml @@ -0,0 +1,97 @@ +# Copyright © 2019 AT&T +# +# 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. + +global: + loggingRepository: docker.elastic.co + loggingImage: beats/filebeat:5.5.0 + repositoryCred: + user: repo_user@valet.onap.org + password: repo_password + repository: nexus.onap.org:5100 + commonConfigPrefix: engine + ns: org-onap-fgps-dev + image: + filebeat: docker.elastic.co/beats/filebeat:5.5.0 + repository: nexus.onap.org:5100 + name: org.onap.fgps/engine:latest +pullPolicy: Always +nodePortPrefix: 300 +dataRootDir: /dockerdata-nfs +config: + aai: + serviceName: aai.onap.org + port: 8443 + msb: + serviceName: msb-iag + port: 80 + +service: + type: NodePort + name: engine + externalPort: 80 + internalPort: 80 + nodePort: 30632 + portName: engine +ingress: + enabled: false +replicaCount: 1 +liveness: + initialDelaySeconds: 10 + periodSeconds: 10 + enabled: true +readiness: + initialDelaySeconds: 10 + periodSeconds: 10 + + +logging: + path: "/engine/" + name: debug1.log + format: "%(asctime)s.%(msecs)03d [%(levelname)-5.5s] [%(name)s] - %(message)s" + size: 10000000 + level: debug + lk: '234' +db: + mode: music + keyspace: pn1 + requests_table: requests + results_table: results + group_rules_table: group_rules + groups_table: groups + stacks_table: stacks + resources_table: resources + stack_id_map_table: stack_id_map + regions_table: regions + dk: '789' +music: + host1: music1.onap.org + host2: music2.onap.org + host3: music3.onap.org + port: '8080' + path: "/MUSIC/rest/v2" + timeout: 10 + retries: 3 + replication_factor: 3 + lock_timeout: 300 + userid: musicuser@onap.org + password: encrypted_music_password + namespace: org.onap.dev.music +nova: + project_name: admin + admin_view_username: openstack_username + admin_username: openstack_username + admin_view_password: encrypted_openstack_password + admin_password: encrypted_openstack_password +topology: + mode: naming
\ No newline at end of file diff --git a/engine/src/config/planner.json b/engine/src/config/planner.json new file mode 100755 index 0000000..2e14702 --- /dev/null +++ b/engine/src/config/planner.json @@ -0,0 +1,69 @@ +{ + "engine": { + "id": "valet01", + "timeout": 3600 + }, + "logging": { + "path": "/engine", + "name": "planner.log", + "format": "%(asctime)s.%(msecs)03d [%(levelname)-5.5s] [%(name)s] - %(message)s", + "size": 100000000, + "level": "debug" + }, + "db": { + "mode": "mem_db", + "keyspace": "pn2", + "requests_table": "requests", + "results_table": "results", + "group_rules_table": "group_rules", + "groups_table": "groups", + "stacks_table": "stacks", + "resources_table": "resources", + "stack_id_map_table": "stack_id_map", + "regions_table": "regions" + }, + "music": { + "hosts": [ "music_host_1.onap.org", "music_host_2.onap.org" ], + "port": "8080", + "path": "/MUSIC/rest/v2", + "timeout": 10, + "retries": 3, + "replication_factor": 3, + "lock_timeout": 300, + "userid": "musicuser@onap.org", + "password": "encrypted_music_password", + "namespace": "org.onap.dev.music" + }, + "compute": { + "mode": "planner", + "default_cpu_allocation_ratio": 1.0, + "default_ram_allocation_ratio": 1.0, + "default_disk_allocation_ratio": 1.0, + "batch_sync_interval": 3600 + }, + "nova": { + "project_name": "admin", + "admin_view_username": "openstack_username", + "admin_username": "openstack_username", + "admin_view_password": "encrypted_openstack_password", + "admin_password": "encrypted_openstack_password" + }, + "topology": { + "mode": "naming", + "num_of_hosts_per_rack": 18 + }, + "naming": { + "rack_codes": [ + "r" + ], + "host_codes": [ + "a", + "c", + "u", + "f", + "o", + "p", + "s" + ] + } +} diff --git a/engine/src/config/solver.json b/engine/src/config/solver.json new file mode 100755 index 0000000..fd8ce29 --- /dev/null +++ b/engine/src/config/solver.json @@ -0,0 +1,72 @@ +{ + "engine": { + "id": "valet01", + "timeout": 300, + "dha": "false", + "ek": "123" + }, + "logging": { + "path": "/engine/", + "name": "solver.log", + "format": "%(asctime)s.%(msecs)03d [%(levelname)-5.5s] [%(name)s] - %(message)s", + "size": 10000000, + "level": "debug", + "lk": "234" + }, + "db": { + "mode": "music", + "keyspace": "pn2", + "requests_table": "requests", + "results_table": "results", + "group_rules_table": "group_rules", + "groups_table": "groups", + "stacks_table": "stacks", + "resources_table": "resources", + "stack_id_map_table": "stack_id_map", + "regions_table": "regions", + "dk": "789" + }, + "music": { + "hosts": [ "music_host_1.onap.org", "music_host_2.onap.org" ], + "port": "8080", + "path": "/MUSIC/rest/v2", + "timeout": 10, + "retries": 3, + "replication_factor": 3, + "lock_timeout": 300, + "userid": "musicuser@onap.org", + "password": "encrypted_music_password", + "namespace": "org.onap.dev.music" + }, + "compute": { + "mode": "nova", + "default_cpu_allocation_ratio": 1.0, + "default_ram_allocation_ratio": 1.0, + "default_disk_allocation_ratio": 1.0, + "batch_sync_interval": 3600 + }, + "nova": { + "project_name": "admin", + "admin_view_username": "openstack_username", + "admin_username": "openstack_username", + "admin_view_password": "encrypted_openstack_password", + "admin_password": "encrypted_openstack_password" + }, + "topology": { + "mode": "naming" + }, + "naming": { + "rack_codes": [ + "r" + ], + "host_codes": [ + "a", + "c", + "u", + "f", + "o", + "p", + "s" + ] + } +} diff --git a/engine/src/config/solver_test.json b/engine/src/config/solver_test.json new file mode 100755 index 0000000..a5b00e5 --- /dev/null +++ b/engine/src/config/solver_test.json @@ -0,0 +1,72 @@ +{ + "engine": { + "id": "valet01", + "timeout": 300, + "dha": "true", + "ek": "123" + }, + "logging": { + "path": "/engine", + "name": "solver_test.log", + "format": "%(asctime)s.%(msecs)03d [%(levelname)-5.5s] [%(name)s] - %(message)s", + "size": 10000000, + "level": "debug", + "lk": "234" + }, + "db": { + "mode": "mem_db", + "keyspace": "Valet_IST", + "requests_table": "requests", + "results_table": "results", + "group_rules_table": "group_rules", + "groups_table": "groups", + "stacks_table": "stacks", + "resources_table": "resources", + "stack_id_map_table": "stack_id_map", + "regions_table": "regions", + "dk": "789" + }, + "music": { + "hosts": [ "music_host_1.onap.org", "music_host_2.onap.org" ], + "port": "8080", + "path": "/MUSIC/rest/v2", + "timeout": 10, + "retries": 3, + "replication_factor": 3, + "lock_timeout": 300, + "userid": "musicuser@onap.org", + "password": "encrypted_music_password", + "namespace": "org.onap.dev.music" + }, + "compute": { + "mode": "sim", + "default_cpu_allocation_ratio": 1.0, + "default_ram_allocation_ratio": 1.0, + "default_disk_allocation_ratio": 1.0, + "batch_sync_interval": 3600 + }, + "nova": { + "project_name": "admin", + "admin_view_username": "openstack_username", + "admin_username": "openstack_username", + "admin_view_password": "encrypted_openstack_password", + "admin_password": "encrypted_openstack_password" + }, + "topology": { + "mode": "naming" + }, + "naming": { + "rack_codes": [ + "r" + ], + "host_codes": [ + "a", + "c", + "u", + "f", + "o", + "p", + "s" + ] + } +} diff --git a/engine/src/config/version.json b/engine/src/config/version.json new file mode 100644 index 0000000..baf15cc --- /dev/null +++ b/engine/src/config/version.json @@ -0,0 +1,9 @@ +{ + "version": { + "major": 0, + "minor": 4, + "patch": 22, + "full": "0.4.22", + "type": "C" + } +}
\ No newline at end of file diff --git a/engine/src/requirements.txt b/engine/src/requirements.txt new file mode 100755 index 0000000..f623b01 --- /dev/null +++ b/engine/src/requirements.txt @@ -0,0 +1,7 @@ +six==1.12.0 +Crypto==1.4.1 +requests==2.21.0 +python-novaclient==2.18.0 +python-keystoneclient==3.6.0 +pycrypto==2.6.1 +pytz==2018.9 |