mirror of
https://github.com/Telecominfraproject/wlan-cloud-analytics.git
synced 2026-01-27 02:22:21 +00:00
[WIFI-7439] Add: CI/CD related files
Signed-off-by: Dmitry Dunaev <dmitry@opsfleet.com>
This commit is contained in:
81
.github/workflows/ci.yml
vendored
Normal file
81
.github/workflows/ci.yml
vendored
Normal file
@@ -0,0 +1,81 @@
|
||||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
paths-ignore:
|
||||
- 'openapi/**'
|
||||
- '**.md'
|
||||
branches:
|
||||
- main
|
||||
- 'release/*'
|
||||
tags:
|
||||
- 'v*'
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
|
||||
jobs:
|
||||
docker:
|
||||
runs-on: ubuntu-20.04
|
||||
env:
|
||||
DOCKER_REGISTRY_URL: tip-tip-wlan-cloud-ucentral.jfrog.io
|
||||
DOCKER_REGISTRY_USERNAME: ucentral
|
||||
steps:
|
||||
- name: Checkout actions repo
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
repository: Telecominfraproject/.github
|
||||
path: github
|
||||
|
||||
- name: Build and push Docker image
|
||||
uses: ./github/composite-actions/docker-image-build
|
||||
with:
|
||||
image_name: owanalytics
|
||||
registry: tip-tip-wlan-cloud-ucentral.jfrog.io
|
||||
registry_user: ucentral
|
||||
registry_password: ${{ secrets.DOCKER_REGISTRY_PASSWORD }}
|
||||
|
||||
# TODO uncomment this when this service is ready for deployment to reduce Slack noise
|
||||
# - name: Notify on failure via Slack
|
||||
# if: failure() && github.ref == 'refs/heads/main'
|
||||
# uses: rtCamp/action-slack-notify@v2
|
||||
# env:
|
||||
# SLACK_USERNAME: GitHub Actions failure notifier
|
||||
# SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
|
||||
# SLACK_COLOR: "${{ job.status }}"
|
||||
# SLACK_ICON: https://raw.githubusercontent.com/quintessence/slack-icons/master/images/github-logo-slack-icon.png
|
||||
|
||||
# TODO uncomment this when this service is added into docker-compose and helm deployment scripts in wlan-testing
|
||||
# trigger-testing:
|
||||
# if: startsWith(github.ref, 'refs/pull/')
|
||||
# runs-on: ubuntu-latest
|
||||
# needs: docker
|
||||
# steps:
|
||||
# - name: Get base branch name and set as output
|
||||
# id: get_base_branch
|
||||
# run: |
|
||||
# echo ::set-output name=branch::$(echo ${GITHUB_BASE_REF##*/})
|
||||
# echo ::set-output name=owgw_branch::$(echo ${GITHUB_BASE_REF##*/} | sed 's/main/master/g')
|
||||
#
|
||||
# - name: Checkout actions repo
|
||||
# uses: actions/checkout@v2
|
||||
# with:
|
||||
# repository: Telecominfraproject/.github
|
||||
# path: github
|
||||
#
|
||||
# - name: Trigger testing of OpenWifi Docker Compose deployment and wait for result
|
||||
# uses: ./github/composite-actions/trigger-workflow-and-wait
|
||||
# env:
|
||||
# BASE_BRANCH: ${{ steps.get_base_branch.outputs.branch }}
|
||||
# OWGW_BASE_BRANCH: ${{ steps.get_base_branch.outputs.owgw_branch }}
|
||||
# with:
|
||||
# owner: Telecominfraproject
|
||||
# repo: wlan-testing
|
||||
# workflow: ow_docker-compose.yml
|
||||
# token: ${{ secrets.WLAN_TESTING_PAT }}
|
||||
# ref: master
|
||||
# inputs: '{"microservice": "all", "deployment_version": "${{ env.BASE_BRANCH }}", "owgw_version": "${{ env.OWGW_BASE_BRANCH }}", "owgwui_version": "${{ env.BASE_BRANCH }}", "owsec_version": "${{ env.BASE_BRANCH }}", "owfms_version": "${{ env.BASE_BRANCH }}", "owprov_version": "${{ env.BASE_BRANCH }}", "owprovui_version": "${{ env.BASE_BRANCH }}", "owanalytics_version": "${{ github.sha }}"}'
|
||||
19
.github/workflows/cleanup.yml
vendored
Normal file
19
.github/workflows/cleanup.yml
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
name: Clean up PR Docker images
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
types: [ closed ]
|
||||
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
|
||||
jobs:
|
||||
cleanup:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- run: |
|
||||
export PR_BRANCH_TAG=$(echo ${GITHUB_HEAD_REF#refs/heads/} | tr '/' '-')
|
||||
curl -uucentral:${{ secrets.DOCKER_REGISTRY_PASSWORD }} -X DELETE "https://tip.jfrog.io/artifactory/tip-wlan-cloud-ucentral/owanalytics/$PR_BRANCH_TAG"
|
||||
24
.github/workflows/enforce-jira-issue-key.yml
vendored
Normal file
24
.github/workflows/enforce-jira-issue-key.yml
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
name: Ensure Jira issue is linked
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
types: [opened, edited, reopened, synchronize]
|
||||
branches:
|
||||
- 'release/*'
|
||||
|
||||
jobs:
|
||||
check_for_issue_key:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout actions repo
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
repository: Telecominfraproject/.github
|
||||
path: github
|
||||
|
||||
- name: Run JIRA check
|
||||
uses: ./github/composite-actions/enforce-jira-issue-key
|
||||
with:
|
||||
jira_base_url: ${{ secrets.TIP_JIRA_URL }}
|
||||
jira_user_email: ${{ secrets.TIP_JIRA_USER_EMAIL }}
|
||||
jira_api_token: ${{ secrets.TIP_JIRA_API_TOKEN }}
|
||||
5
.gitignore
vendored
5
.gitignore
vendored
@@ -30,3 +30,8 @@
|
||||
*.exe
|
||||
*.out
|
||||
*.app
|
||||
|
||||
test_scripts/curl/token.json
|
||||
.vscode/c_cpp_properties.json
|
||||
test_scripts/curl/result.json
|
||||
*.swp
|
||||
|
||||
@@ -127,7 +127,7 @@ COPY --from=aws-sdk-cpp-build /aws-sdk-cpp/cmake-build/aws-cpp-sdk-core/libaws-c
|
||||
COPY --from=aws-sdk-cpp-build /aws-sdk-cpp/cmake-build/aws-cpp-sdk-s3/libaws-cpp-sdk-s3.so /usr/local/lib
|
||||
COPY --from=aws-sdk-cpp-build /aws-sdk-cpp/cmake-build/aws-cpp-sdk-sns/libaws-cpp-sdk-sns.so /usr/local/lib
|
||||
|
||||
EXPOSE 16005 17005 16105
|
||||
EXPOSE 16009 17009 16109
|
||||
|
||||
ENTRYPOINT ["/docker-entrypoint.sh"]
|
||||
CMD ["/openwifi/owanalytics"]
|
||||
|
||||
1
helm/.gitignore
vendored
Normal file
1
helm/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
*.swp
|
||||
22
helm/.helmignore
Normal file
22
helm/.helmignore
Normal file
@@ -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/
|
||||
18
helm/Chart.yaml
Normal file
18
helm/Chart.yaml
Normal file
@@ -0,0 +1,18 @@
|
||||
apiVersion: v2
|
||||
appVersion: "1.0"
|
||||
description: A Helm chart for Kubernetes
|
||||
name: owanalytics
|
||||
version: 0.1.0
|
||||
dependencies:
|
||||
- name: postgresql
|
||||
repository: https://charts.bitnami.com/bitnami
|
||||
version: 10.9.2
|
||||
condition: postgresql.enabled
|
||||
- name: mysql
|
||||
repository: https://charts.bitnami.com/bitnami
|
||||
version: 8.8.3
|
||||
condition: mysql.enabled
|
||||
- name: mariadb
|
||||
repository: https://charts.bitnami.com/bitnami
|
||||
version: 9.4.2
|
||||
condition: mariadb.enabled
|
||||
94
helm/README.md
Normal file
94
helm/README.md
Normal file
@@ -0,0 +1,94 @@
|
||||
# owanalytics
|
||||
|
||||
This Helm chart helps to deploy OpenWIFI Analytics service (further on refered as __Analytics__) to the Kubernetes clusters. It is mainly used in [assembly chart](https://github.com/Telecominfraproject/wlan-cloud-ucentral-deploy/tree/main/chart) as Analytics service requires other services as dependencies that are considered in that Helm chart. This chart is purposed to define deployment logic close to the application code itself and define default values that could be overriden during deployment.
|
||||
|
||||
|
||||
## TL;DR;
|
||||
|
||||
```bash
|
||||
$ helm install .
|
||||
```
|
||||
|
||||
## Introduction
|
||||
|
||||
This chart bootstraps the Analytics on a [Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager.
|
||||
|
||||
## Installing the Chart
|
||||
|
||||
Currently this chart is not assembled in charts archives, so [helm-git](https://github.com/aslafy-z/helm-git) is required for remote the installation
|
||||
|
||||
To install the chart with the release name `my-release`:
|
||||
|
||||
```bash
|
||||
$ helm install --name my-release git+https://github.com/Telecominfraproject/wlan-cloud-owanalytics@helm/owanalytics-0.1.0.tgz?ref=main
|
||||
```
|
||||
|
||||
The command deploys the Analytics on the Kubernetes cluster in the default configuration. The [configuration](#configuration) section lists the parameters that can be configured during installation.
|
||||
|
||||
> **Tip**: List all releases using `helm list`
|
||||
|
||||
## Uninstalling the Chart
|
||||
|
||||
To uninstall/delete the `my-release` deployment:
|
||||
|
||||
```bash
|
||||
$ helm delete my-release
|
||||
```
|
||||
|
||||
The command removes all the Kubernetes components associated with the chart and deletes the release.
|
||||
|
||||
## Configuration
|
||||
|
||||
The following table lists the configurable parameters of the chart and their default values. If Default value is not listed in the table, please refer to the [Values](values.yaml) files for details.
|
||||
|
||||
| Parameter | Type | Description | Default |
|
||||
|-----------|------|-------------|---------|
|
||||
| replicaCount | number | Amount of replicas to be deployed | `1` |
|
||||
| strategyType | string | Application deployment strategy | `'Recreate'` |
|
||||
| nameOverride | string | Override to be used for application deployment | |
|
||||
| fullnameOverride | string | Override to be used for application deployment (has priority over nameOverride) | |
|
||||
| images.owanalytics.repository | string | Docker image repository | |
|
||||
| images.owanalytics.tag | string | Docker image tag | `'master'` |
|
||||
| images.owanalytics.pullPolicy | string | Docker image pull policy | `'Always'` |
|
||||
| services.owanalytics.type | string | OpenWIFI Analytics service type | `'LoadBalancer'` |
|
||||
| services.owanalytics.ports.restapi.servicePort | number | REST API endpoint port to be exposed on service | `16009` |
|
||||
| services.owanalytics.ports.restapi.targetPort | number | REST API endpoint port to be targeted by service | `16009` |
|
||||
| services.owanalytics.ports.restapi.protocol | string | REST API endpoint protocol | `'TCP'` |
|
||||
| services.owanalytics.ports.restapiinternal.servicePort | string | Internal REST API endpoint port to be exposed on service | `17009` |
|
||||
| services.owanalytics.ports.restapiinternal.targetPort | number | Internal REST API endpoint port to be targeted by service | `17009` |
|
||||
| services.owanalytics.ports.restapiinternal.protocol | string | Internal REST API endpoint protocol | `'TCP'` |
|
||||
| checks.owanalytics.liveness.httpGet.path | string | Liveness check path to be used | `'/'` |
|
||||
| checks.owanalytics.liveness.httpGet.port | number | Liveness check port to be used (should be pointint to ALB endpoint) | `16109` |
|
||||
| checks.owanalytics.readiness.httpGet.path | string | Readiness check path to be used | `'/'` |
|
||||
| checks.owanalytics.readiness.httpGet.port | number | Readiness check port to be used (should be pointint to ALB endpoint) | `16109` |
|
||||
| ingresses.restapi.enabled | boolean | Defines if REST API endpoint should be exposed via Ingress controller | `False` |
|
||||
| ingresses.restapi.hosts | array | List of hosts for exposed REST API | |
|
||||
| ingresses.restapi.paths | array | List of paths to be exposed for REST API | |
|
||||
| volumes.owanalytics | array | Defines list of volumes to be attached to the Analytics | |
|
||||
| persistence.enabled | boolean | Defines if the Analytics requires Persistent Volume (required for permanent files storage and SQLite DB if enabled) | `True` |
|
||||
| persistence.accessModes | array | Defines PV access modes | |
|
||||
| persistence.size | string | Defines PV size | `'10Gi'` |
|
||||
| public_env_variables | hash | Defines list of environment variables to be passed to the Analytics | |
|
||||
| configProperties | hash | Configuration properties that should be passed to the application in `owanalytics.properties`. May be passed by key in set (i.e. `configProperties."rtty\.token"`) | |
|
||||
| certs | hash | Defines files (keys and certificates) that should be passed to the Analytics (PEM format is adviced to be used) (see `volumes.owanalytics` on where it is mounted) | |
|
||||
|
||||
|
||||
Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example,
|
||||
|
||||
```bash
|
||||
$ helm install --name my-release \
|
||||
--set replicaCount=1 \
|
||||
.
|
||||
```
|
||||
|
||||
The above command sets that only 1 instance of your app should be running
|
||||
|
||||
Alternatively, a YAML file that specifies the values for the parameters can be provided while installing the chart. For example,
|
||||
|
||||
```bash
|
||||
$ helm install --name my-release -f values.yaml .
|
||||
```
|
||||
|
||||
> **Tip**: You can use the default [values.yaml](values.yaml) as a base for customization.
|
||||
|
||||
|
||||
5
helm/templates/_config.tpl
Normal file
5
helm/templates/_config.tpl
Normal file
@@ -0,0 +1,5 @@
|
||||
{{- define "owanalytics.config" -}}
|
||||
{{- range $key, $value := .Values.configProperties }}
|
||||
{{ $key }} = {{ $value }}
|
||||
{{- end }}
|
||||
{{- end -}}
|
||||
42
helm/templates/_helpers.tpl
Normal file
42
helm/templates/_helpers.tpl
Normal file
@@ -0,0 +1,42 @@
|
||||
{{/* vim: set filetype=mustache: */}}
|
||||
{{/*
|
||||
Expand the name of the chart.
|
||||
*/}}
|
||||
{{- define "owanalytics.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 "owanalytics.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 "owanalytics.chart" -}}
|
||||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- define "owanalytics.ingress.apiVersion" -}}
|
||||
{{- if .Capabilities.APIVersions.Has "networking.k8s.io/v1" -}}
|
||||
{{- print "networking.k8s.io/v1" -}}
|
||||
{{- else if .Capabilities.APIVersions.Has "networking.k8s.io/v1beta1" -}}
|
||||
{{- print "networking.k8s.io/v1beta1" -}}
|
||||
{{- else -}}
|
||||
{{- print "extensions/v1beta1" -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
131
helm/templates/deployment.yaml
Normal file
131
helm/templates/deployment.yaml
Normal file
@@ -0,0 +1,131 @@
|
||||
{{- $root := . -}}
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ include "owanalytics.fullname" . }}
|
||||
labels:
|
||||
app.kubernetes.io/name: {{ include "owanalytics.name" . }}
|
||||
helm.sh/chart: {{ include "owanalytics.chart" . }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||
spec:
|
||||
replicas: {{ .Values.replicaCount }}
|
||||
strategy:
|
||||
type: {{ .Values.strategyType }}
|
||||
revisionHistoryLimit: {{ .Values.revisionHistoryLimit }}
|
||||
selector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/name: {{ include "owanalytics.name" . }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
{{- with .Values.services.owanalytics.labels }}
|
||||
{{- toYaml . | nindent 6 }}
|
||||
{{- end }}
|
||||
template:
|
||||
metadata:
|
||||
annotations:
|
||||
checksum/config: {{ include "owanalytics.config" . | sha256sum }}
|
||||
{{- with .Values.podAnnotations }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
app.kubernetes.io/name: {{ include "owanalytics.name" . }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
{{- with .Values.services.owanalytics.labels }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
|
||||
initContainers:
|
||||
- name: wait-kafka
|
||||
image: "{{ .Values.images.dockerize.repository }}:{{ .Values.images.dockerize.tag }}"
|
||||
imagePullPolicy: {{ .Values.images.dockerize.pullPolicy }}
|
||||
args:
|
||||
- -wait
|
||||
- tcp://{{ index .Values.configProperties "openwifi.kafka.brokerlist" }}
|
||||
- -timeout
|
||||
- 600s
|
||||
|
||||
containers:
|
||||
|
||||
- name: owanalytics
|
||||
image: "{{ .Values.images.owanalytics.repository }}:{{ .Values.images.owanalytics.tag }}"
|
||||
imagePullPolicy: {{ .Values.images.owanalytics.pullPolicy }}
|
||||
|
||||
env:
|
||||
- name: KUBERNETES_DEPLOYED
|
||||
value: "{{ now }}"
|
||||
{{- range $key, $value := .Values.public_env_variables }}
|
||||
- name: {{ $key }}
|
||||
value: {{ $value | quote }}
|
||||
{{- end }}
|
||||
{{- range $key, $value := .Values.secret_env_variables }}
|
||||
- name: {{ $key }}
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ include "owanalytics.fullname" $root }}-env
|
||||
key: {{ $key }}
|
||||
{{- end }}
|
||||
|
||||
ports:
|
||||
{{- range $port, $portValue := .Values.services.owanalytics.ports }}
|
||||
- name: {{ $port }}
|
||||
containerPort: {{ $portValue.targetPort }}
|
||||
protocol: {{ $portValue.protocol }}
|
||||
{{- end }}
|
||||
|
||||
volumeMounts:
|
||||
{{- range .Values.volumes.owanalytics }}
|
||||
- name: {{ .name }}
|
||||
mountPath: {{ .mountPath }}
|
||||
{{- if .subPath }}
|
||||
subPath: {{ .subPath }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- if .Values.checks.owanalytics.liveness }}
|
||||
livenessProbe:
|
||||
{{- toYaml .Values.checks.owanalytics.liveness | nindent 12 }}
|
||||
{{- end }}
|
||||
{{- if .Values.checks.owanalytics.readiness }}
|
||||
readinessProbe:
|
||||
{{- toYaml .Values.checks.owanalytics.readiness | nindent 12 }}
|
||||
{{- end }}
|
||||
|
||||
{{- with .Values.resources }}
|
||||
resources:
|
||||
{{- toYaml . | nindent 12 }}
|
||||
{{- end }}
|
||||
|
||||
securityContext:
|
||||
fsGroup: 101
|
||||
|
||||
imagePullSecrets:
|
||||
{{- range $image, $imageValue := .Values.images }}
|
||||
{{- if $imageValue.regcred }}
|
||||
- name: {{ include "owanalytics.fullname" $root }}-{{ $image }}-regcred
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
volumes:
|
||||
{{- range $container, $containerVolumes := .Values.volumes }}
|
||||
{{- range $containerVolumes }}
|
||||
- name: {{ .name }}
|
||||
{{- tpl .volumeDefinition $root | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- with .Values.nodeSelector }}
|
||||
nodeSelector:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
|
||||
{{- with .Values.affinity }}
|
||||
affinity:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
|
||||
{{- with .Values.tolerations }}
|
||||
tolerations:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
61
helm/templates/ingress.yaml
Normal file
61
helm/templates/ingress.yaml
Normal file
@@ -0,0 +1,61 @@
|
||||
{{- $root := . -}}
|
||||
{{- range $ingress, $ingressValue := .Values.ingresses }}
|
||||
{{- if $ingressValue.enabled }}
|
||||
---
|
||||
apiVersion: {{ include "owanalytics.ingress.apiVersion" $root }}
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: {{ include "owanalytics.fullname" $root }}-{{ $ingress }}
|
||||
labels:
|
||||
app.kubernetes.io/name: {{ include "owanalytics.name" $root }}
|
||||
helm.sh/chart: {{ include "owanalytics.chart" $root }}
|
||||
app.kubernetes.io/instance: {{ $root.Release.Name }}
|
||||
app.kubernetes.io/managed-by: {{ $root.Release.Service }}
|
||||
{{- with $ingressValue.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
|
||||
spec:
|
||||
|
||||
{{- if $ingressValue.tls }}
|
||||
tls:
|
||||
{{- range $ingressValue.tls }}
|
||||
- hosts:
|
||||
{{- range .hosts }}
|
||||
- {{ . | quote }}
|
||||
{{- end }}
|
||||
secretName: {{ tpl .secretName $root }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
rules:
|
||||
{{- range $ingressValue.hosts }}
|
||||
- host: {{ . | quote }}
|
||||
http:
|
||||
paths:
|
||||
{{- range $ingressValue.paths }}
|
||||
- path: {{ .path }}
|
||||
{{- if $root.Capabilities.APIVersions.Has "networking.k8s.io/v1" }}
|
||||
pathType: {{ .pathType | default "ImplementationSpecific" }}
|
||||
{{- end }}
|
||||
backend:
|
||||
{{- if $root.Capabilities.APIVersions.Has "networking.k8s.io/v1" }}
|
||||
service:
|
||||
name: {{ include "owanalytics.fullname" $root }}-{{ .serviceName }}
|
||||
port:
|
||||
{{- if kindIs "string" .servicePort }}
|
||||
name: {{ .servicePort }}
|
||||
{{- else }}
|
||||
number: {{ .servicePort }}
|
||||
{{- end }}
|
||||
{{- else }}
|
||||
serviceName: {{ include "owanalytics.fullname" $root }}-{{ .serviceName }}
|
||||
servicePort: {{ .servicePort }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- end }}
|
||||
|
||||
{{- end }}
|
||||
27
helm/templates/pvc.yaml
Normal file
27
helm/templates/pvc.yaml
Normal file
@@ -0,0 +1,27 @@
|
||||
{{- if .Values.persistence.enabled }}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: {{ template "owanalytics.fullname" . }}-pvc
|
||||
labels:
|
||||
app.kubernetes.io/name: {{ include "owanalytics.name" . }}
|
||||
helm.sh/chart: {{ include "owanalytics.chart" . }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||
{{- with .Values.persistence.annotations }}
|
||||
annotations:
|
||||
{{ toYaml . | indent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
accessModes:
|
||||
{{- range .Values.persistence.accessModes }}
|
||||
- {{ . | quote }}
|
||||
{{- end }}
|
||||
resources:
|
||||
requests:
|
||||
storage: {{ .Values.persistence.size | quote }}
|
||||
{{- if .Values.persistence.storageClassName }}
|
||||
storageClassName: {{ .Values.persistence.storageClassName }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
15
helm/templates/secret-certs.yaml
Normal file
15
helm/templates/secret-certs.yaml
Normal file
@@ -0,0 +1,15 @@
|
||||
---
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
labels:
|
||||
app.kuberentes.io/name: {{ include "owanalytics.name" . }}
|
||||
helm.sh/chart: {{ include "owanalytics.chart" . }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||
name: {{ include "owanalytics.fullname" . }}-certs
|
||||
kind: Secret
|
||||
type: Opaque
|
||||
data:
|
||||
{{- range $key, $value := .Values.certs }}
|
||||
{{ $key }}: {{ $value | b64enc | quote }}
|
||||
{{- end }}
|
||||
13
helm/templates/secret-config.yaml
Normal file
13
helm/templates/secret-config.yaml
Normal file
@@ -0,0 +1,13 @@
|
||||
---
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
labels:
|
||||
app.kuberentes.io/name: {{ include "owanalytics.name" . }}
|
||||
helm.sh/chart: {{ include "owanalytics.chart" . }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||
name: {{ include "owanalytics.fullname" . }}-config
|
||||
kind: Secret
|
||||
type: Opaque
|
||||
data:
|
||||
owanalytics.properties: {{ include "owanalytics.config" . | b64enc }}
|
||||
17
helm/templates/secret-env.yaml
Normal file
17
helm/templates/secret-env.yaml
Normal file
@@ -0,0 +1,17 @@
|
||||
---
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
labels:
|
||||
app.kuberentes.io/name: {{ include "owanalytics.name" . }}
|
||||
helm.sh/chart: {{ include "owanalytics.chart" . }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||
name: {{ include "owanalytics.fullname" . }}-env
|
||||
kind: Secret
|
||||
type: Opaque
|
||||
data:
|
||||
# Secret env variables
|
||||
{{- range $key, $value := .Values.secret_env_variables }}
|
||||
{{ $key }}: {{ $value | b64enc | quote }}
|
||||
{{- end }}
|
||||
|
||||
21
helm/templates/secret-regcred.yaml
Normal file
21
helm/templates/secret-regcred.yaml
Normal file
@@ -0,0 +1,21 @@
|
||||
{{- define "imagePullSecret" }}
|
||||
{{- printf "{\"auths\": {\"%s\": {\"auth\": \"%s\"}}}" .registry (printf "%s:%s" .username .password | b64enc) | b64enc }}
|
||||
{{- end }}
|
||||
{{- $root := . -}}
|
||||
{{- range $image, $imageValue := .Values.images }}
|
||||
{{- if $imageValue.regcred }}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
type: kubernetes.io/dockerconfigjson
|
||||
metadata:
|
||||
labels:
|
||||
app.kuberentes.io/name: {{ include "owanalytics.name" $root }}
|
||||
helm.sh/chart: {{ include "owanalytics.chart" $root }}
|
||||
app.kubernetes.io/instance: {{ $root.Release.Name }}
|
||||
app.kubernetes.io/managed-by: {{ $root.Release.Service }}
|
||||
name: {{ include "owanalytics.fullname" $root }}-{{ $image }}-regcred
|
||||
data:
|
||||
.dockerconfigjson: {{ template "imagePullSecret" $imageValue.regcred }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
48
helm/templates/service.yaml
Normal file
48
helm/templates/service.yaml
Normal file
@@ -0,0 +1,48 @@
|
||||
{{- $root := . -}}
|
||||
{{- range $service, $serviceValue := .Values.services }}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ include "owanalytics.fullname" $root }}-{{ $service }}
|
||||
{{- with $serviceValue.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
app.kubernetes.io/name: {{ include "owanalytics.name" $root }}
|
||||
helm.sh/chart: {{ include "owanalytics.chart" $root }}
|
||||
app.kubernetes.io/instance: {{ $root.Release.Name }}
|
||||
app.kubernetes.io/managed-by: {{ $root.Release.Service }}
|
||||
|
||||
{{- with $serviceValue.labels }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
|
||||
{{- if $serviceValue.serviceMonitor }}
|
||||
|
||||
{{- range $selector, $selectorValue := $serviceValue.serviceMonitor.serviceSelector }}
|
||||
{{ $selector }}: {{ tpl $selectorValue $root }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
spec:
|
||||
type: {{ $serviceValue.type }}
|
||||
ports:
|
||||
|
||||
{{- range $service_service, $service_value := $serviceValue.ports }}
|
||||
- name: {{ $service_service }}
|
||||
targetPort: {{ $service_value.targetPort }}
|
||||
protocol: {{ $service_value.protocol }}
|
||||
port: {{ $service_value.servicePort }}
|
||||
{{- if and (eq "NodePort" $serviceValue.type) $service_value.nodePort }}
|
||||
nodePort: {{ $service_value.nodePort }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
selector:
|
||||
app.kubernetes.io/name: {{ include "owanalytics.name" $root }}
|
||||
app.kubernetes.io/instance: {{ $root.Release.Name }}
|
||||
{{- with $serviceValue.labels }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
|
||||
{{- end }}
|
||||
265
helm/values.yaml
Normal file
265
helm/values.yaml
Normal file
@@ -0,0 +1,265 @@
|
||||
# System
|
||||
replicaCount: 1
|
||||
strategyType: Recreate
|
||||
revisionHistoryLimit: 2
|
||||
|
||||
nameOverride: ""
|
||||
fullnameOverride: ""
|
||||
|
||||
images:
|
||||
owanalytics:
|
||||
repository: tip-tip-wlan-cloud-ucentral.jfrog.io/owanalytics
|
||||
tag: main
|
||||
pullPolicy: Always
|
||||
# regcred:
|
||||
# registry: tip-tip-wlan-cloud-ucentral.jfrog.io
|
||||
# username: username
|
||||
# password: password
|
||||
dockerize:
|
||||
repository: tip-tip-wlan-cloud-ucentral.jfrog.io/dockerize
|
||||
tag: 0.16.0
|
||||
pullPolicy: IfNotPresent
|
||||
|
||||
services:
|
||||
owanalytics:
|
||||
type: ClusterIP
|
||||
ports:
|
||||
restapi:
|
||||
servicePort: 16009
|
||||
targetPort: 16009
|
||||
protocol: TCP
|
||||
restapiinternal:
|
||||
servicePort: 17009
|
||||
targetPort: 17009
|
||||
protocol: TCP
|
||||
|
||||
checks:
|
||||
owanalytics:
|
||||
liveness:
|
||||
httpGet:
|
||||
path: /
|
||||
port: 16109
|
||||
readiness:
|
||||
exec:
|
||||
command:
|
||||
- /readiness_check
|
||||
|
||||
ingresses:
|
||||
restapi:
|
||||
enabled: false
|
||||
annotations: {}
|
||||
# kubernetes.io/ingress.class: nginx
|
||||
# kubernetes.io/tls-acme: "true"
|
||||
hosts:
|
||||
- restapi.chart-example.local
|
||||
paths:
|
||||
- path: /
|
||||
pathType: ImplementationSpecific
|
||||
serviceName: owanalytics
|
||||
servicePort: restapi
|
||||
|
||||
volumes:
|
||||
owanalytics:
|
||||
- name: config
|
||||
mountPath: /owanalytics-data/owanalytics.properties
|
||||
subPath: owanalytics.properties
|
||||
# Template below will be rendered in template
|
||||
volumeDefinition: |
|
||||
secret:
|
||||
secretName: {{ include "owanalytics.fullname" . }}-config
|
||||
- name: certs
|
||||
mountPath: /owanalytics-data/certs
|
||||
volumeDefinition: |
|
||||
secret:
|
||||
secretName: {{ include "owanalytics.fullname" . }}-certs
|
||||
# Change this if you want to use another volume type
|
||||
- name: persist
|
||||
mountPath: /owanalytics-data/persist
|
||||
volumeDefinition: |
|
||||
persistentVolumeClaim:
|
||||
claimName: {{ template "owanalytics.fullname" . }}-pvc
|
||||
|
||||
resources: {}
|
||||
# We usually recommend not to specify default resources and to leave this as a conscious
|
||||
# choice for the user. This also increases chances charts run on environments with little
|
||||
# resources, such as Minikube. If you do want to specify resources, uncomment the following
|
||||
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
|
||||
# requests:
|
||||
# cpu: 100m
|
||||
# memory: 128Mi
|
||||
# limits:
|
||||
# cpu: 100m
|
||||
# memory: 128Mi
|
||||
|
||||
nodeSelector: {}
|
||||
|
||||
tolerations: []
|
||||
|
||||
affinity: {}
|
||||
|
||||
podAnnotations: {}
|
||||
|
||||
persistence:
|
||||
enabled: true
|
||||
# storageClassName: "-"
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
size: 10Gi
|
||||
annotations: {}
|
||||
|
||||
# Application
|
||||
public_env_variables:
|
||||
OWANALYTICS_ROOT: /owanalytics-data
|
||||
OWANALYTICS_CONFIG: /owanalytics-data
|
||||
# Environment variables required for the readiness checks using script
|
||||
FLAGS: "-s --connect-timeout 3"
|
||||
# NOTE in order for readiness check to use system info you need to set READINESS_METHOD to "systeminfo" and set OWSEC to the OWSEC's REST API endpoint
|
||||
#READINESS_METHOD: systeminfo
|
||||
#OWSEC: gw-qa01.cicd.lab.wlan.tip.build:16001
|
||||
|
||||
secret_env_variables:
|
||||
# NOTE in order for readiness check to use system info method you need to override these values to the real OWSEC credentials
|
||||
OWSEC_USERNAME: tip@ucentral.com
|
||||
OWSEC_PASSWORD: openwifi
|
||||
|
||||
configProperties:
|
||||
# -> Public part
|
||||
# REST API
|
||||
openwifi.restapi.host.0.backlog: 100
|
||||
openwifi.restapi.host.0.security: relaxed
|
||||
openwifi.restapi.host.0.rootca: $OWANALYTICS_ROOT/certs/restapi-ca.pem
|
||||
openwifi.restapi.host.0.address: "*"
|
||||
openwifi.restapi.host.0.port: 16009
|
||||
openwifi.restapi.host.0.cert: $OWANALYTICS_ROOT/certs/restapi-cert.pem
|
||||
openwifi.restapi.host.0.key: $OWANALYTICS_ROOT/certs/restapi-key.pem
|
||||
openwifi.internal.restapi.host.0.backlog: 100
|
||||
openwifi.internal.restapi.host.0.security: relaxed
|
||||
openwifi.internal.restapi.host.0.rootca: $OWANALYTICS_ROOT/certs/restapi-ca.pem
|
||||
openwifi.internal.restapi.host.0.address: "*"
|
||||
openwifi.internal.restapi.host.0.port: 17009
|
||||
openwifi.internal.restapi.host.0.cert: $OWANALYTICS_ROOT/certs/restapi-cert.pem
|
||||
openwifi.internal.restapi.host.0.key: $OWANALYTICS_ROOT/certs/restapi-key.pem
|
||||
# ALB
|
||||
alb.enable: "true"
|
||||
alb.port: 16109
|
||||
# Kafka
|
||||
openwifi.kafka.enable: "false"
|
||||
openwifi.kafka.group.id: analytics
|
||||
openwifi.kafka.client.id: analytics1
|
||||
openwifi.kafka.brokerlist: localhost:9092
|
||||
openwifi.kafka.auto.commit: false
|
||||
openwifi.kafka.queue.buffering.max.ms: 50
|
||||
openwifi.kafka.ssl.ca.location: ""
|
||||
openwifi.kafka.ssl.certificate.location: ""
|
||||
openwifi.kafka.ssl.key.location: ""
|
||||
openwifi.kafka.ssl.key.password: ""
|
||||
# Storage
|
||||
storage.type: sqlite # (sqlite|postgresql|mysql|odbc)
|
||||
## SQLite
|
||||
storage.type.sqlite.db: analytics.db
|
||||
storage.type.sqlite.idletime: 120
|
||||
storage.type.sqlite.maxsessions: 128
|
||||
## PostgreSQL
|
||||
storage.type.postgresql.maxsessions: 64
|
||||
storage.type.postgresql.idletime: 60
|
||||
storage.type.postgresql.host: localhost
|
||||
storage.type.postgresql.database: owanalytics
|
||||
storage.type.postgresql.port: 5432
|
||||
storage.type.postgresql.connectiontimeout: 60
|
||||
## MySQL
|
||||
storage.type.mysql.maxsessions: 64
|
||||
storage.type.mysql.idletime: 60
|
||||
storage.type.mysql.host: localhost
|
||||
storage.type.mysql.database: owanalytics
|
||||
storage.type.mysql.port: 3306
|
||||
storage.type.mysql.connectiontimeout: 60
|
||||
# System
|
||||
openwifi.service.key: $OWANALYTICS_ROOT/certs/restapi-key.pem
|
||||
openwifi.system.data: $OWANALYTICS_ROOT/persist
|
||||
openwifi.system.debug: "true"
|
||||
openwifi.system.uri.private: https://localhost:17009
|
||||
openwifi.system.uri.public: https://localhost:16009
|
||||
openwifi.system.uri.ui: https://localhost
|
||||
openwifi.system.commandchannel: /tmp/app_owanalytics
|
||||
# Logging
|
||||
logging.type: console
|
||||
logging.path: $OWANALYTICS_ROOT/logs
|
||||
logging.level: debug
|
||||
|
||||
# -> Secret part
|
||||
# REST API
|
||||
openwifi.restapi.host.0.key.password: mypassword
|
||||
openwifi.internal.restapi.host.0.key.password: mypassword
|
||||
# Storage
|
||||
## PostgreSQL
|
||||
storage.type.postgresql.username: stephb
|
||||
storage.type.postgresql.password: snoopy99
|
||||
## MySQL
|
||||
storage.type.mysql.username: stephb
|
||||
storage.type.mysql.password: snoopy99
|
||||
|
||||
certs:
|
||||
# restapi-ca.pem: ""
|
||||
# restapi-cert.pem: ""
|
||||
# restapi-key.pem: ""
|
||||
|
||||
# PostgreSQL (https://github.com/bitnami/charts/tree/master/bitnami/postgresql)
|
||||
postgresql:
|
||||
enabled: false
|
||||
|
||||
image:
|
||||
registry: docker.io
|
||||
repository: bitnami/postgresql
|
||||
tag: 11.13.0-debian-10-r0
|
||||
|
||||
postgresqlPostgresPassword: ""
|
||||
postgresqlUsername: postgres
|
||||
postgresqlPassword: ""
|
||||
postgresqlDatabase: ""
|
||||
|
||||
persistence:
|
||||
enabled: true
|
||||
storageClass: ""
|
||||
size: 8Gi
|
||||
|
||||
# MySQL (https://github.com/bitnami/charts/tree/master/bitnami/mysql)
|
||||
mysql:
|
||||
enabled: false
|
||||
|
||||
image:
|
||||
registry: docker.io
|
||||
repository: bitnami/mysql
|
||||
tag: 8.0.26-debian-10-r10
|
||||
|
||||
auth:
|
||||
rootPassword: ""
|
||||
database: my_database
|
||||
username: ""
|
||||
password: ""
|
||||
|
||||
primary:
|
||||
persistence:
|
||||
enabled: true
|
||||
storageClass: ""
|
||||
size: 8Gi
|
||||
|
||||
# MariaDB (https://github.com/bitnami/charts/tree/master/bitnami/mariadb)
|
||||
mariadb:
|
||||
enabled: false
|
||||
|
||||
image:
|
||||
registry: docker.io
|
||||
repository: bitnami/mariadb
|
||||
tag: 10.5.12-debian-10-r0
|
||||
|
||||
auth:
|
||||
rootPassword: ""
|
||||
database: my_database
|
||||
username: ""
|
||||
password: ""
|
||||
|
||||
primary:
|
||||
persistence:
|
||||
enabled: true
|
||||
storageClass: ""
|
||||
size: 8Gi
|
||||
@@ -37,7 +37,7 @@ openwifi.system.data = ${SYSTEM_DATA}
|
||||
openwifi.system.debug = false
|
||||
openwifi.system.uri.private = ${SYSTEM_URI_PRIVATE}
|
||||
openwifi.system.uri.public = ${SYSTEM_URI_PUBLIC}
|
||||
openwifi.system.commandchannel = /tmp/app.ow.analytics
|
||||
openwifi.system.commandchannel = /tmp/app.owanalytics
|
||||
openwifi.system.uri.ui = ${SYSTEM_URI_UI}
|
||||
|
||||
#############################
|
||||
|
||||
@@ -109,7 +109,7 @@ fi
|
||||
}
|
||||
|
||||
setanalytics() {
|
||||
if [ -z ${OWPROV_OVERRIDE+x} ]; then
|
||||
if [ -z ${OWANALYTICS_OVERRIDE+x} ]; then
|
||||
curl ${FLAGS} -X GET "https://${OWSEC}/api/v1/systemEndpoints" \
|
||||
-H "accept: application/json" \
|
||||
-H "Authorization: Bearer ${token}" > ${result_file}
|
||||
|
||||
@@ -6,8 +6,8 @@ set -e
|
||||
host="$1"
|
||||
shift
|
||||
|
||||
export PGUSER=$(grep 'storage.type.postgresql.username' $OWANALYTICS_CONFIG/owprov.properties | awk -F '= ' '{print $2}')
|
||||
export PGPASSWORD=$(grep 'storage.type.postgresql.password' $OWANALYTICS_CONFIG/owprov.properties | awk -F '= ' '{print $2}')
|
||||
export PGUSER=$(grep 'storage.type.postgresql.username' $OWANALYTICS_CONFIG/owanalytics.properties | awk -F '= ' '{print $2}')
|
||||
export PGPASSWORD=$(grep 'storage.type.postgresql.password' $OWANALYTICS_CONFIG/owanalytics.properties | awk -F '= ' '{print $2}')
|
||||
|
||||
until psql -h "$host" -c '\q'; do
|
||||
>&2 echo "Postgres is unavailable - sleeping"
|
||||
|
||||
Reference in New Issue
Block a user