diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1d74e21 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.vscode/ diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst new file mode 100644 index 0000000..f2f8e6d --- /dev/null +++ b/CONTRIBUTING.rst @@ -0,0 +1,16 @@ +If you would like to contribute to the development of OpenStack, +you must follow the steps in this page: + + https://docs.openstack.org/infra/manual/developers.html + +Once those steps have been completed, changes to OpenStack +should be submitted for review via the Gerrit tool, following +the workflow documented at: + + https://docs.openstack.org/infra/manual/developers.html#development-workflow + +Pull requests submitted through GitHub will be ignored. + +Bugs should be filed in Launchpad: + + https://bugs.launchpad.net/starlingx diff --git a/HACKING.rst b/HACKING.rst new file mode 100644 index 0000000..73014ef --- /dev/null +++ b/HACKING.rst @@ -0,0 +1,17 @@ +StarlingX SNMP-Armada-App Style Commandments +================================================================ + +- Step 1: Read the OpenStack style commandments + https://docs.openstack.org/hacking/latest/ +- Step 2: Read on + +Snmp-Armada-App Specific Commandments +--------------------------------------------------------- + +None so far + +Running tests +------------- +The approach to running tests is to simply run the command ``tox``. This will +create virtual environments, populate them with dependencies and run all of +the tests that OpenStack CI systems run. diff --git a/centos_build_layer.cfg b/centos_build_layer.cfg new file mode 100644 index 0000000..c581999 --- /dev/null +++ b/centos_build_layer.cfg @@ -0,0 +1 @@ +flock diff --git a/centos_iso_image.inc b/centos_iso_image.inc new file mode 100644 index 0000000..b6438ac --- /dev/null +++ b/centos_iso_image.inc @@ -0,0 +1 @@ +stx-snmp-helm diff --git a/centos_pkg_dirs b/centos_pkg_dirs new file mode 100644 index 0000000..b6438ac --- /dev/null +++ b/centos_pkg_dirs @@ -0,0 +1 @@ +stx-snmp-helm diff --git a/centos_pkg_dirs_containers b/centos_pkg_dirs_containers new file mode 100644 index 0000000..b6438ac --- /dev/null +++ b/centos_pkg_dirs_containers @@ -0,0 +1 @@ +stx-snmp-helm diff --git a/centos_stable_docker_images.inc b/centos_stable_docker_images.inc new file mode 100644 index 0000000..b6438ac --- /dev/null +++ b/centos_stable_docker_images.inc @@ -0,0 +1 @@ +stx-snmp-helm diff --git a/config b/config new file mode 100644 index 0000000..22bdef2 --- /dev/null +++ b/config @@ -0,0 +1,12 @@ +[core] + repositoryformatversion = 0 + filemode = true + bare = false + logallrefupdates = true +[remote "origin"] + url = https://review.opendev.org/starlingx/snmp-armada-app.git + fetch = +refs/heads/*:refs/remotes/origin/* +[branch "master"] + remote = origin + merge = refs/heads/master + rebase = true diff --git a/github_sync.trigger b/github_sync.trigger new file mode 100644 index 0000000..b8a4ee2 --- /dev/null +++ b/github_sync.trigger @@ -0,0 +1,2 @@ +# to trigger the upload job to sync to GitHub +1 diff --git a/stx-snmp-helm/centos/build_srpm.data b/stx-snmp-helm/centos/build_srpm.data new file mode 100644 index 0000000..5f71932 --- /dev/null +++ b/stx-snmp-helm/centos/build_srpm.data @@ -0,0 +1,7 @@ +SRC_DIR="stx-snmp-helm" + +TAR_NAME=helm-charts-snmp-0-1-0 +VERSION=1.0.0 +TAR="$TAR_NAME.tar.gz" + +TIS_PATCH_VER=PKG_GITREVCOUNT diff --git a/stx-snmp-helm/centos/docker/Dockerfile b/stx-snmp-helm/centos/docker/Dockerfile new file mode 100644 index 0000000..e4d0438 --- /dev/null +++ b/stx-snmp-helm/centos/docker/Dockerfile @@ -0,0 +1,6 @@ +FROM centos:8 +RUN yum -y update +RUN yum -y install net-snmp + +EXPOSE 161/udp +CMD [ "/usr/sbin/snmpd", "-f"] diff --git a/stx-snmp-helm/centos/stx-snmp-helm.spec b/stx-snmp-helm/centos/stx-snmp-helm.spec new file mode 100644 index 0000000..f044890 --- /dev/null +++ b/stx-snmp-helm/centos/stx-snmp-helm.spec @@ -0,0 +1,71 @@ +# Application tunables (maps to metadata) +%global app_name snmp +%global helm_repo stx-platform + +%global armada_folder /usr/lib/armada + +# Install location +%global app_folder /usr/local/share/applications/helm + +# Build variables +%global helm_folder /usr/lib/helm +%global toolkit_version 0.1.0 + +Summary: StarlingX SNMP Armada Helm Charts +Name: stx-snmp-helm +Version: 1.0 +Release: %{tis_patch_ver}%{?_tis_dist} +License: Apache-2.0 +Group: base +Packager: Wind River +URL: unknown + +Source0: helm-charts-snmp-0-1-0.tar.gz + +BuildArch: noarch + +BuildRequires: helm + +%description +StarlingX SNMP Helm Charts + +%prep +%setup -n helm-charts-snmp-0-1-0-1.0.0 + +%build + +cd helm-charts +make +cd - + +# Create a chart tarball compliant with sysinv kube-app.py +%define app_staging %{_builddir}/staging +%define app_tarball %{app_name}-%{version}-%{tis_patch_ver}.tgz + +# Setup staging +mkdir -p %{app_staging} +cp files/metadata.yaml %{app_staging} +cp manifests/*.yaml %{app_staging} +mkdir -p %{app_staging}/charts +cp helm-charts/*.tgz %{app_staging}/charts +cd %{app_staging} + +# Populate metadata +sed -i 's/@APP_NAME@/%{app_name}/g' %{app_staging}/metadata.yaml +sed -i 's/@APP_VERSION@/%{version}-%{tis_patch_ver}/g' %{app_staging}/metadata.yaml +sed -i 's/@HELM_REPO@/%{helm_repo}/g' %{app_staging}/metadata.yaml + +# package it up +find . -type f ! -name '*.md5' -print0 | xargs -0 md5sum > checksum.md5 +tar -zcf %{_builddir}/%{app_tarball} -C %{app_staging}/ . + +# Cleanup staging +rm -fr %{app_staging} + +%install +install -d -m 755 %{buildroot}/%{app_folder} +install -p -D -m 755 %{_builddir}/%{app_tarball} %{buildroot}/%{app_folder} + +%files +%defattr(-,root,root,-) +%{app_folder}/* diff --git a/stx-snmp-helm/centos/stx-snmp-helm.stable_docker_image b/stx-snmp-helm/centos/stx-snmp-helm.stable_docker_image new file mode 100644 index 0000000..b93294a4 --- /dev/null +++ b/stx-snmp-helm/centos/stx-snmp-helm.stable_docker_image @@ -0,0 +1,2 @@ +BUILDER=docker +LABEL=stx-snmp diff --git a/stx-snmp-helm/stx-snmp-helm/README b/stx-snmp-helm/stx-snmp-helm/README new file mode 100644 index 0000000..b773ef4 --- /dev/null +++ b/stx-snmp-helm/stx-snmp-helm/README @@ -0,0 +1,5 @@ +This directory contains all StarlingX charts that need to be built for this +application. Some charts are common across applications. These common charts +reside in the stx-config/kubernetes/helm-charts directory. To include these in +this application update the build_srpm.data file and use the COPY_LIST_TO_TAR +mechanism to populate these common charts. diff --git a/stx-snmp-helm/stx-snmp-helm/files/index.yaml b/stx-snmp-helm/stx-snmp-helm/files/index.yaml new file mode 100644 index 0000000..36db709 --- /dev/null +++ b/stx-snmp-helm/stx-snmp-helm/files/index.yaml @@ -0,0 +1,3 @@ +apiVersion: v1 +entries: {} +generated: 2019-01-07T12:33:46.098166523-06:00 diff --git a/stx-snmp-helm/stx-snmp-helm/files/metadata.yaml b/stx-snmp-helm/stx-snmp-helm/files/metadata.yaml new file mode 100644 index 0000000..d2c6295 --- /dev/null +++ b/stx-snmp-helm/stx-snmp-helm/files/metadata.yaml @@ -0,0 +1,5 @@ +maintain_user_overrides: true + +app_name: @APP_NAME@ +app_version: @APP_VERSION@ +helm_repo: @HELM_REPO@ diff --git a/stx-snmp-helm/stx-snmp-helm/files/repositories.yaml b/stx-snmp-helm/stx-snmp-helm/files/repositories.yaml new file mode 100644 index 0000000..fe1299f --- /dev/null +++ b/stx-snmp-helm/stx-snmp-helm/files/repositories.yaml @@ -0,0 +1,11 @@ +apiVersion: v1 +generated: 2019-01-02T15:19:36.215111369-06:00 +repositories: +- caFile: "" + cache: /builddir/.helm/repository/cache/local-index.yaml + certFile: "" + keyFile: "" + name: local + password: "" + url: http://127.0.0.1:8879/charts + username: "" diff --git a/stx-snmp-helm/stx-snmp-helm/helm-charts/Makefile b/stx-snmp-helm/stx-snmp-helm/helm-charts/Makefile new file mode 100644 index 0000000..bf83b0c --- /dev/null +++ b/stx-snmp-helm/stx-snmp-helm/helm-charts/Makefile @@ -0,0 +1,43 @@ +# +# Copyright 2017 The Openstack-Helm Authors. +# +# Copyright (c) 2019 Wind River Systems, Inc. +# +# SPDX-License-Identifier: Apache-2.0 +# +# It's necessary to set this because some environments don't link sh -> bash. +SHELL := /bin/bash +TASK := build + +EXCLUDES := helm-toolkit doc tests tools logs tmp +CHARTS := helm-toolkit $(filter-out $(EXCLUDES), $(patsubst %/.,%,$(wildcard */.))) + +.PHONY: $(EXCLUDES) $(CHARTS) + +all: $(CHARTS) + +$(CHARTS): + @if [ -d $@ ]; then \ + echo; \ + echo "===== Processing [$@] chart ====="; \ + make $(TASK)-$@; \ + fi + +init-%: + if [ -f $*/Makefile ]; then make -C $*; fi + if [ -f $*/requirements.yaml ]; then helm dep up $*; fi + +lint-%: init-% + if [ -d $* ]; then helm lint $*; fi + +build-%: + if [ -d $* ]; then helm package $*; fi + +clean: + @echo "Clean all build artifacts" + rm -f */templates/_partials.tpl */templates/_globals.tpl + rm -f *tgz */charts/*tgz */requirements.lock + rm -rf */charts */tmpcharts + +%: + @: diff --git a/stx-snmp-helm/stx-snmp-helm/helm-charts/snmp/.helmignore b/stx-snmp-helm/stx-snmp-helm/helm-charts/snmp/.helmignore new file mode 100755 index 0000000..50af031 --- /dev/null +++ b/stx-snmp-helm/stx-snmp-helm/helm-charts/snmp/.helmignore @@ -0,0 +1,22 @@ +# 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 +.vscode/ diff --git a/stx-snmp-helm/stx-snmp-helm/helm-charts/snmp/Chart.yaml b/stx-snmp-helm/stx-snmp-helm/helm-charts/snmp/Chart.yaml new file mode 100755 index 0000000..41f835c --- /dev/null +++ b/stx-snmp-helm/stx-snmp-helm/helm-charts/snmp/Chart.yaml @@ -0,0 +1,5 @@ +apiVersion: v1 +appVersion: "1.0" +description: SNMP service +name: snmp +version: 1.0.0 diff --git a/stx-snmp-helm/stx-snmp-helm/helm-charts/snmp/snmpd/snmpd.conf b/stx-snmp-helm/stx-snmp-helm/helm-charts/snmp/snmpd/snmpd.conf new file mode 100755 index 0000000..5a9b3cf --- /dev/null +++ b/stx-snmp-helm/stx-snmp-helm/helm-charts/snmp/snmpd/snmpd.conf @@ -0,0 +1,7 @@ +# incl/excl subtree mask +view all included .1 80 + +agentAddress udp:161 +sysObjectID 1.3.6.1.4.1.731.3 +sysServices 72 + diff --git a/stx-snmp-helm/stx-snmp-helm/helm-charts/snmp/templates/NOTES.txt b/stx-snmp-helm/stx-snmp-helm/helm-charts/snmp/templates/NOTES.txt new file mode 100755 index 0000000..2423aad --- /dev/null +++ b/stx-snmp-helm/stx-snmp-helm/helm-charts/snmp/templates/NOTES.txt @@ -0,0 +1,6 @@ +1. This is SNMP deployment with extended MIB: + This charts starts: + - Create config map for /etc/snmp/snmpd.conf + - Deploy snmpd + - Create service for port for snmp get + - Deploy sub agent for extended MIB diff --git a/stx-snmp-helm/stx-snmp-helm/helm-charts/snmp/templates/_helpers.tpl b/stx-snmp-helm/stx-snmp-helm/helm-charts/snmp/templates/_helpers.tpl new file mode 100755 index 0000000..e9dd216 --- /dev/null +++ b/stx-snmp-helm/stx-snmp-helm/helm-charts/snmp/templates/_helpers.tpl @@ -0,0 +1,33 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "snmp.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this +(by the DNS naming spec). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "snmp.fullname" -}} +{{- if .Values.fullnameOverride -}} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- $name := default .Chart.Name .Values.nameOverride -}} +{{- if contains $name .Release.Name -}} +{{- .Release.Name | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} +{{- end -}} +{{- end -}} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "snmp.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} +{{- end -}} diff --git a/stx-snmp-helm/stx-snmp-helm/helm-charts/snmp/templates/configmap.yaml b/stx-snmp-helm/stx-snmp-helm/helm-charts/snmp/templates/configmap.yaml new file mode 100755 index 0000000..9c33145 --- /dev/null +++ b/stx-snmp-helm/stx-snmp-helm/helm-charts/snmp/templates/configmap.yaml @@ -0,0 +1,7 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ .Values.configmap.name_snmpd }} +data: +{{ (.Files.Glob "snmpd/*").AsConfig | indent 2 }} +--- \ No newline at end of file diff --git a/stx-snmp-helm/stx-snmp-helm/helm-charts/snmp/templates/deployment.yaml b/stx-snmp-helm/stx-snmp-helm/helm-charts/snmp/templates/deployment.yaml new file mode 100755 index 0000000..3b14789 --- /dev/null +++ b/stx-snmp-helm/stx-snmp-helm/helm-charts/snmp/templates/deployment.yaml @@ -0,0 +1,37 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "snmp.fullname" . }} + labels: + app.kubernetes.io/name: {{ include "snmp.name" . }} + helm.sh/chart: {{ include "snmp.chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} +spec: + replicas: {{ .Values.replicaCount }} + selector: + matchLabels: + app.kubernetes.io/name: {{ include "snmp.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + template: + metadata: + labels: + app.kubernetes.io/name: {{ include "snmp.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + spec: + containers: + - name: {{ .Chart.Name }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + ports: + - containerPort: 161 + protocol: UDP + - containerPort: 162 + protocol: UDP + volumeMounts: + - name: snmpd-etc-volume + mountPath: /etc/snmp + volumes: + - name: snmpd-etc-volume + configMap: + name: {{ .Values.configmap.name_snmpd }} diff --git a/stx-snmp-helm/stx-snmp-helm/helm-charts/snmp/templates/service.yaml b/stx-snmp-helm/stx-snmp-helm/helm-charts/snmp/templates/service.yaml new file mode 100755 index 0000000..6213ffe --- /dev/null +++ b/stx-snmp-helm/stx-snmp-helm/helm-charts/snmp/templates/service.yaml @@ -0,0 +1,19 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ .Values.service.name }} + labels: + app.kubernetes.io/name: {{ include "snmp.name" . }} + helm.sh/chart: {{ include "snmp.chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} +spec: + type: {{ .Values.service.type }} + ports: + - name: port-1 + port: 161 + protocol: UDP + targetPort: 161 + selector: + app.kubernetes.io/name: {{ include "snmp.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} diff --git a/stx-snmp-helm/stx-snmp-helm/helm-charts/snmp/values.yaml b/stx-snmp-helm/stx-snmp-helm/helm-charts/snmp/values.yaml new file mode 100755 index 0000000..b1b1fcf --- /dev/null +++ b/stx-snmp-helm/stx-snmp-helm/helm-charts/snmp/values.yaml @@ -0,0 +1,24 @@ +# Default values for snmp. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +replicaCount: 1 + +image: + repository: registry.local:9001/local/snmp + tag: 1.0.0 + pullPolicy: IfNotPresent + +nameOverride: "" +fullnameOverride: "" + +configmap: + name_snmpd: snmpd-etc-config + +deployment: + master_agent_host: localhost + +service: + name: snmpd-service + type: NodePort + diff --git a/stx-snmp-helm/stx-snmp-helm/manifests/snmp_manifest.yaml b/stx-snmp-helm/stx-snmp-helm/manifests/snmp_manifest.yaml new file mode 100644 index 0000000..0828229 --- /dev/null +++ b/stx-snmp-helm/stx-snmp-helm/manifests/snmp_manifest.yaml @@ -0,0 +1,45 @@ +--- +schema: armada/Chart/v1 +metadata: + schema: metadata/Document/v1 + name: snmp +data: + chart_name: snmp + release: snmp + namespace: kube-system + source: + location: http://172.17.0.1:8080/helm_charts/stx-platform/snmp-1.0.0.tgz + subpath: snmp + type: tar + reference: master + wait: + timeout: 1800 + install: + no_hooks: false + upgrade: + no_hooks: false + pre: + delete: + - type: job + labels: + app: snmp + dependencies: [] +--- +schema: armada/ChartGroup/v1 +metadata: + schema: metadata/Document/v1 + name: snmp +data: + description: "StarlingX SNMP" + sequenced: false + chart_group: + - snmp +--- +schema: armada/Manifest/v1 +metadata: + schema: metadata/Document/v1 + name: snmp-manifest +data: + release_prefix: ns + chart_groups: + - snmp