From 9df8a9088ee55e32c2fb1f337b77c7bb9a3ced9f Mon Sep 17 00:00:00 2001 From: Srivahni Date: Tue, 3 Sep 2019 15:44:22 -0700 Subject: [PATCH] Helm chart for visualization-operator Issue-ID: ONAPARC-393 Signed-off-by: Srivahni Change-Id: If841ce54d5d6da4576484084330f401ea537da86 --- .../charts/visualization-operator/.helmignore | 22 +++++++ .../charts/visualization-operator/Chart.yaml | 5 ++ .../visualization-operator/templates/NOTES.txt | 2 + .../visualization-operator/templates/_helpers.tpl | 32 ++++++++++ .../onap_v1alpha1_grafanadatasource_crd.yaml | 72 ++++++++++++++++++++++ .../visualization-operator/templates/operator.yaml | 39 ++++++++++++ .../visualization-operator/templates/role.yaml | 68 ++++++++++++++++++++ .../templates/role_binding.yaml | 20 ++++++ .../templates/service_account.yaml | 12 ++++ .../charts/visualization-operator/values.yaml | 34 ++++++++++ 10 files changed, 306 insertions(+) create mode 100644 vnfs/DAaaS/deploy/operator/charts/visualization-operator/.helmignore create mode 100644 vnfs/DAaaS/deploy/operator/charts/visualization-operator/Chart.yaml create mode 100644 vnfs/DAaaS/deploy/operator/charts/visualization-operator/templates/NOTES.txt create mode 100644 vnfs/DAaaS/deploy/operator/charts/visualization-operator/templates/_helpers.tpl create mode 100644 vnfs/DAaaS/deploy/operator/charts/visualization-operator/templates/onap_v1alpha1_grafanadatasource_crd.yaml create mode 100644 vnfs/DAaaS/deploy/operator/charts/visualization-operator/templates/operator.yaml create mode 100644 vnfs/DAaaS/deploy/operator/charts/visualization-operator/templates/role.yaml create mode 100644 vnfs/DAaaS/deploy/operator/charts/visualization-operator/templates/role_binding.yaml create mode 100644 vnfs/DAaaS/deploy/operator/charts/visualization-operator/templates/service_account.yaml create mode 100644 vnfs/DAaaS/deploy/operator/charts/visualization-operator/values.yaml diff --git a/vnfs/DAaaS/deploy/operator/charts/visualization-operator/.helmignore b/vnfs/DAaaS/deploy/operator/charts/visualization-operator/.helmignore new file mode 100644 index 00000000..50af0317 --- /dev/null +++ b/vnfs/DAaaS/deploy/operator/charts/visualization-operator/.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/vnfs/DAaaS/deploy/operator/charts/visualization-operator/Chart.yaml b/vnfs/DAaaS/deploy/operator/charts/visualization-operator/Chart.yaml new file mode 100644 index 00000000..74485ffd --- /dev/null +++ b/vnfs/DAaaS/deploy/operator/charts/visualization-operator/Chart.yaml @@ -0,0 +1,5 @@ +apiVersion: v1 +appVersion: "1.0" +description: A Helm chart for Visualization-operator +name: visualization-operator +version: 0.1.0 diff --git a/vnfs/DAaaS/deploy/operator/charts/visualization-operator/templates/NOTES.txt b/vnfs/DAaaS/deploy/operator/charts/visualization-operator/templates/NOTES.txt new file mode 100644 index 00000000..6cdc2fcf --- /dev/null +++ b/vnfs/DAaaS/deploy/operator/charts/visualization-operator/templates/NOTES.txt @@ -0,0 +1,2 @@ +1. Get the application URL by running these commands: +Visualization Operator deployment. diff --git a/vnfs/DAaaS/deploy/operator/charts/visualization-operator/templates/_helpers.tpl b/vnfs/DAaaS/deploy/operator/charts/visualization-operator/templates/_helpers.tpl new file mode 100644 index 00000000..96425b6b --- /dev/null +++ b/vnfs/DAaaS/deploy/operator/charts/visualization-operator/templates/_helpers.tpl @@ -0,0 +1,32 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "visualization-operator.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 "visualization-operator.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 "visualization-operator.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} +{{- end -}} diff --git a/vnfs/DAaaS/deploy/operator/charts/visualization-operator/templates/onap_v1alpha1_grafanadatasource_crd.yaml b/vnfs/DAaaS/deploy/operator/charts/visualization-operator/templates/onap_v1alpha1_grafanadatasource_crd.yaml new file mode 100644 index 00000000..f7daa406 --- /dev/null +++ b/vnfs/DAaaS/deploy/operator/charts/visualization-operator/templates/onap_v1alpha1_grafanadatasource_crd.yaml @@ -0,0 +1,72 @@ +{{- if .Values.enabled }} +apiVersion: apiextensions.k8s.io/v1beta1 +kind: CustomResourceDefinition +metadata: + name: grafanadatasources.onap.org + labels: + app: {{ template "visualization-operator.name" . }} + chart: {{ template "visualization-operator.chart" . }} + component: grafanadatasources.onap.org-crd + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +spec: + group: onap.org + names: + kind: GrafanaDataSource + listKind: GrafanaDataSourceList + plural: grafanadatasources + singular: grafanadatasource + scope: Namespaced + subresources: + status: {} + validation: + openAPIV3Schema: + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + properties: + datasources: + items: + properties: + access: + type: string + isDefault: + type: boolean + name: + type: string + type: + type: string + url: + type: string + required: + - name + - type + type: object + type: array + grafana: + additionalProperties: + type: string + type: object + required: + - datasources + - grafana + type: object + status: + type: object + version: v1alpha1 + versions: + - name: v1alpha1 + served: true + storage: true +{{- end }} \ No newline at end of file diff --git a/vnfs/DAaaS/deploy/operator/charts/visualization-operator/templates/operator.yaml b/vnfs/DAaaS/deploy/operator/charts/visualization-operator/templates/operator.yaml new file mode 100644 index 00000000..ed32b763 --- /dev/null +++ b/vnfs/DAaaS/deploy/operator/charts/visualization-operator/templates/operator.yaml @@ -0,0 +1,39 @@ +{{- if .Values.enabled }} +apiVersion: apps/v1 +kind: Deployment +metadata: + name: visualization-operator + labels: + app: {{ template "visualization-operator.name" . }} + chart: {{ template "visualization-operator.chart" . }} + component: deployment + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +spec: + replicas: 1 + selector: + matchLabels: + name: visualization-operator + template: + metadata: + labels: + name: visualization-operator + spec: + serviceAccountName: visualization-operator + containers: + - name: visualization-operator + # Replace this with the built image name + image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + command: + - visualization-operator + imagePullPolicy: {{ .Values.image.pullPolicy }} + env: + - name: WATCH_NAMESPACE + value: {{ default "" .Values.watch.namespace | quote }} + - name: POD_NAME + valueFrom: + fieldRef: + fieldPath: metadata.name + - name: OPERATOR_NAME + value: "visualization-operator" +{{- end }} \ No newline at end of file diff --git a/vnfs/DAaaS/deploy/operator/charts/visualization-operator/templates/role.yaml b/vnfs/DAaaS/deploy/operator/charts/visualization-operator/templates/role.yaml new file mode 100644 index 00000000..11a7a900 --- /dev/null +++ b/vnfs/DAaaS/deploy/operator/charts/visualization-operator/templates/role.yaml @@ -0,0 +1,68 @@ +{{- if .Values.enabled }} +apiVersion: rbac.authorization.k8s.io/v1 +kind: Role +metadata: + creationTimestamp: null + name: visualization-operator + labels: + app: {{ template "visualization-operator.name" . }} + chart: {{ template "visualization-operator.chart" . }} + component: role + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +rules: +- apiGroups: + - "" + resources: + - pods + - services + - endpoints + - persistentvolumeclaims + - events + - configmaps + - secrets + verbs: + - '*' +- apiGroups: + - apps + resources: + - deployments + - daemonsets + - replicasets + - statefulsets + verbs: + - '*' +- apiGroups: + - monitoring.coreos.com + resources: + - servicemonitors + verbs: + - get + - create +- apiGroups: + - apps + resourceNames: + - visualization-operator + resources: + - deployments/finalizers + verbs: + - update +- apiGroups: + - "" + resources: + - pods + verbs: + - get +- apiGroups: + - apps + resources: + - replicasets + verbs: + - get +- apiGroups: + - onap.org + resources: + - '*' + verbs: + - '*' +{{- end }} \ No newline at end of file diff --git a/vnfs/DAaaS/deploy/operator/charts/visualization-operator/templates/role_binding.yaml b/vnfs/DAaaS/deploy/operator/charts/visualization-operator/templates/role_binding.yaml new file mode 100644 index 00000000..0b9319e4 --- /dev/null +++ b/vnfs/DAaaS/deploy/operator/charts/visualization-operator/templates/role_binding.yaml @@ -0,0 +1,20 @@ +{{- if .Values.enabled }} +kind: RoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: visualization-operator + labels: + app: {{ template "visualization-operator.name" . }} + chart: {{ template "visualization-operator.chart" . }} + component: rolebinding + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +subjects: +- kind: ServiceAccount + name: visualization-operator + namespace: {{ .Release.Namespace }} +roleRef: + kind: Role + name: visualization-operator + apiGroup: rbac.authorization.k8s.io +{{- end }} \ No newline at end of file diff --git a/vnfs/DAaaS/deploy/operator/charts/visualization-operator/templates/service_account.yaml b/vnfs/DAaaS/deploy/operator/charts/visualization-operator/templates/service_account.yaml new file mode 100644 index 00000000..58b550ea --- /dev/null +++ b/vnfs/DAaaS/deploy/operator/charts/visualization-operator/templates/service_account.yaml @@ -0,0 +1,12 @@ +{{- if .Values.enabled }} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: visualization-operator + labels: + app: {{ template "visualization-operator.name" . }} + chart: {{ template "visualization-operator.chart" . }} + component: service-account + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +{{- end }} \ No newline at end of file diff --git a/vnfs/DAaaS/deploy/operator/charts/visualization-operator/values.yaml b/vnfs/DAaaS/deploy/operator/charts/visualization-operator/values.yaml new file mode 100644 index 00000000..a3fb709b --- /dev/null +++ b/vnfs/DAaaS/deploy/operator/charts/visualization-operator/values.yaml @@ -0,0 +1,34 @@ +# Default values for visualization-operator. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +enabled: true + +image: + repository: dcr.cluster.local:32644/visualization-operator + tag: latest + pullPolicy: IfNotPresent + +watch: + nameSpace: "" + +nameOverride: "" +fullnameOverride: "" + +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:'. + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi + +nodeSelector: {} + +tolerations: [] + +affinity: {} -- 2.16.6