From 5404b24913f114fe6328d1ec20c7bb79d91a7a92 Mon Sep 17 00:00:00 2001 From: Dileep Ranganathan Date: Sat, 10 Aug 2019 17:30:33 -0700 Subject: [PATCH] Helm charts for Collectd Operator Helm charts for Collectd Operator Issue-ID: ONAPARC-461 Signed-off-by: Dileep Ranganathan Change-Id: Icd1fc169f9e005030a0d2b48cf9dd76434bf6ba3 Signed-off-by: Dileep Ranganathan --- .../operator/charts/collectd-operator/.helmignore | 22 +++++++ .../operator/charts/collectd-operator/Chart.yaml | 5 ++ .../charts/collectd-operator/templates/NOTES.txt | 3 + .../collectd-operator/templates/_helpers.tpl | 32 +++++++++ .../onap_v1alpha1_collectdglobal_crd.yaml | 75 ++++++++++++++++++++++ .../onap_v1alpha1_collectdplugin_crd.yaml | 72 +++++++++++++++++++++ .../collectd-operator/templates/operator.yaml | 41 ++++++++++++ .../charts/collectd-operator/templates/role.yaml | 57 ++++++++++++++++ .../collectd-operator/templates/role_binding.yaml | 20 ++++++ .../templates/service_account.yaml | 12 ++++ .../operator/charts/collectd-operator/values.yaml | 27 ++++++++ 11 files changed, 366 insertions(+) create mode 100644 vnfs/DAaaS/deploy/operator/charts/collectd-operator/.helmignore create mode 100644 vnfs/DAaaS/deploy/operator/charts/collectd-operator/Chart.yaml create mode 100644 vnfs/DAaaS/deploy/operator/charts/collectd-operator/templates/NOTES.txt create mode 100644 vnfs/DAaaS/deploy/operator/charts/collectd-operator/templates/_helpers.tpl create mode 100644 vnfs/DAaaS/deploy/operator/charts/collectd-operator/templates/onap_v1alpha1_collectdglobal_crd.yaml create mode 100644 vnfs/DAaaS/deploy/operator/charts/collectd-operator/templates/onap_v1alpha1_collectdplugin_crd.yaml create mode 100644 vnfs/DAaaS/deploy/operator/charts/collectd-operator/templates/operator.yaml create mode 100644 vnfs/DAaaS/deploy/operator/charts/collectd-operator/templates/role.yaml create mode 100644 vnfs/DAaaS/deploy/operator/charts/collectd-operator/templates/role_binding.yaml create mode 100644 vnfs/DAaaS/deploy/operator/charts/collectd-operator/templates/service_account.yaml create mode 100644 vnfs/DAaaS/deploy/operator/charts/collectd-operator/values.yaml diff --git a/vnfs/DAaaS/deploy/operator/charts/collectd-operator/.helmignore b/vnfs/DAaaS/deploy/operator/charts/collectd-operator/.helmignore new file mode 100644 index 00000000..50af0317 --- /dev/null +++ b/vnfs/DAaaS/deploy/operator/charts/collectd-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/collectd-operator/Chart.yaml b/vnfs/DAaaS/deploy/operator/charts/collectd-operator/Chart.yaml new file mode 100644 index 00000000..12278df4 --- /dev/null +++ b/vnfs/DAaaS/deploy/operator/charts/collectd-operator/Chart.yaml @@ -0,0 +1,5 @@ +apiVersion: v1 +appVersion: "1.0" +description: A Helm chart for Kubernetes +name: collectd-operator +version: 0.1.0 diff --git a/vnfs/DAaaS/deploy/operator/charts/collectd-operator/templates/NOTES.txt b/vnfs/DAaaS/deploy/operator/charts/collectd-operator/templates/NOTES.txt new file mode 100644 index 00000000..8b5acf3a --- /dev/null +++ b/vnfs/DAaaS/deploy/operator/charts/collectd-operator/templates/NOTES.txt @@ -0,0 +1,3 @@ +1. Get the application URL by running these commands: +Collectd Operator deployment. + diff --git a/vnfs/DAaaS/deploy/operator/charts/collectd-operator/templates/_helpers.tpl b/vnfs/DAaaS/deploy/operator/charts/collectd-operator/templates/_helpers.tpl new file mode 100644 index 00000000..88991c87 --- /dev/null +++ b/vnfs/DAaaS/deploy/operator/charts/collectd-operator/templates/_helpers.tpl @@ -0,0 +1,32 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "collectd-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 "collectd-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 "collectd-operator.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} +{{- end -}} diff --git a/vnfs/DAaaS/deploy/operator/charts/collectd-operator/templates/onap_v1alpha1_collectdglobal_crd.yaml b/vnfs/DAaaS/deploy/operator/charts/collectd-operator/templates/onap_v1alpha1_collectdglobal_crd.yaml new file mode 100644 index 00000000..89d38a70 --- /dev/null +++ b/vnfs/DAaaS/deploy/operator/charts/collectd-operator/templates/onap_v1alpha1_collectdglobal_crd.yaml @@ -0,0 +1,75 @@ +{{- if .Values.enabled }} +apiVersion: apiextensions.k8s.io/v1beta1 +kind: CustomResourceDefinition +metadata: + name: collectdglobals.onap.org + labels: + app: {{ template "collectd-operator.name" . }} + chart: {{ template "collectd-operator.chart" . }} + component: collectdglobals.onap.org-crd + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} + annotations: + "helm.sh/hook": crd-install + "helm.sh/hook-delete-policy": "before-hook-creation" +spec: + group: onap.org + names: + kind: CollectdGlobal + listKind: CollectdGlobalList + plural: collectdglobals + singular: collectdglobal + 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: + configMap: + type: string + globalOptions: + description: 'INSERT ADDITIONAL SPEC FIELDS - desired state of cluster + Important: Run "operator-sdk generate k8s" to regenerate code after + modifying this file Add custom validation using kubebuilder tags: + https://book.kubebuilder.io/beyond_basics/generating_crd.html' + type: string + required: + - globalOptions + type: object + status: + properties: + collectdAgents: + description: 'INSERT ADDITIONAL STATUS FIELD - define observed state + of cluster Important: Run "operator-sdk generate k8s" to regenerate + code after modifying this file Add custom validation using kubebuilder + tags: https://book.kubebuilder.io/beyond_basics/generating_crd.html + CollectdAgents are the collectd pods in the Daemonset Status can be + one of "", Created, Deleting, Applied, Deprecated' + items: + type: string + type: array + status: + type: string + required: + - 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/collectd-operator/templates/onap_v1alpha1_collectdplugin_crd.yaml b/vnfs/DAaaS/deploy/operator/charts/collectd-operator/templates/onap_v1alpha1_collectdplugin_crd.yaml new file mode 100644 index 00000000..fccd7cd8 --- /dev/null +++ b/vnfs/DAaaS/deploy/operator/charts/collectd-operator/templates/onap_v1alpha1_collectdplugin_crd.yaml @@ -0,0 +1,72 @@ +{{- if .Values.enabled }} +apiVersion: apiextensions.k8s.io/v1beta1 +kind: CustomResourceDefinition +metadata: + name: collectdplugins.onap.org + labels: + app: {{ template "collectd-operator.name" . }} + chart: {{ template "collectd-operator.chart" . }} + component: collectdplugins.onap.org-crd + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} + annotations: + "helm.sh/hook": crd-install + "helm.sh/hook-delete-policy": "before-hook-creation" +spec: + group: onap.org + names: + kind: CollectdPlugin + listKind: CollectdPluginList + plural: collectdplugins + singular: collectdplugin + 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: + pluginConf: + type: string + pluginName: + description: 'INSERT ADDITIONAL SPEC FIELDS - desired state of cluster + Important: Run "operator-sdk generate k8s" to regenerate code after + modifying this file Add custom validation using kubebuilder tags: + https://book.kubebuilder.io/beyond_basics/generating_crd.html' + type: string + required: + - pluginName + - pluginConf + type: object + status: + properties: + collectdAgents: + description: CollectdAgents are the collectd pods in the Daemonset Status + can be one of "", Created, Deleting, Applied, Deprecated + items: + type: string + type: array + status: + type: string + required: + - 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/collectd-operator/templates/operator.yaml b/vnfs/DAaaS/deploy/operator/charts/collectd-operator/templates/operator.yaml new file mode 100644 index 00000000..c62dde2b --- /dev/null +++ b/vnfs/DAaaS/deploy/operator/charts/collectd-operator/templates/operator.yaml @@ -0,0 +1,41 @@ +{{- if .Values.enabled }} +apiVersion: apps/v1 +kind: Deployment +metadata: + name: collectd-operator + labels: + app: {{ template "collectd-operator.name" . }} + chart: {{ template "collectd-operator.chart" . }} + component: deployment + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +spec: + replicas: 1 + selector: + matchLabels: + name: collectd-operator + template: + metadata: + labels: + name: collectd-operator + spec: + serviceAccountName: collectd-operator + containers: + - name: collectd-operator + # Replace this with the built image name + image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + command: + - collectd-operator + env: + - name: WATCH_NAMESPACE + value: {{ default "" .Values.watch.namespace | quote }} + - name: WATCH_LABELS + value: {{ default "app=collectd" .Values.watch.labels | quote }} + - name: POD_NAME + valueFrom: + fieldRef: + fieldPath: metadata.name + - name: OPERATOR_NAME + value: "collectd-operator" +{{- end }} \ No newline at end of file diff --git a/vnfs/DAaaS/deploy/operator/charts/collectd-operator/templates/role.yaml b/vnfs/DAaaS/deploy/operator/charts/collectd-operator/templates/role.yaml new file mode 100644 index 00000000..73de6aad --- /dev/null +++ b/vnfs/DAaaS/deploy/operator/charts/collectd-operator/templates/role.yaml @@ -0,0 +1,57 @@ +{{- if .Values.enabled }} +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + creationTimestamp: null + name: collectd-operator + labels: + app: {{ template "collectd-operator.name" . }} + chart: {{ template "collectd-operator.chart" . }} + component: clusterrole + 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: + - collectd-operator + resources: + - deployments/finalizers + verbs: + - update +- apiGroups: + - onap.org + resources: + - '*' + - collectdglobals + verbs: + - '*' +{{- end }} \ No newline at end of file diff --git a/vnfs/DAaaS/deploy/operator/charts/collectd-operator/templates/role_binding.yaml b/vnfs/DAaaS/deploy/operator/charts/collectd-operator/templates/role_binding.yaml new file mode 100644 index 00000000..024ba2a1 --- /dev/null +++ b/vnfs/DAaaS/deploy/operator/charts/collectd-operator/templates/role_binding.yaml @@ -0,0 +1,20 @@ +{{- if .Values.enabled }} +kind: ClusterRoleBinding +apiVersion: rbac.authorization.k8s.io/v1 +metadata: + name: collectd-operator + labels: + app: {{ template "collectd-operator.name" . }} + chart: {{ template "collectd-operator.chart" . }} + component: clusterrolebinding + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +subjects: +- kind: ServiceAccount + name: collectd-operator + namespace: {{ .Release.Namespace }} +roleRef: + kind: ClusterRole + name: collectd-operator + apiGroup: rbac.authorization.k8s.io +{{- end }} \ No newline at end of file diff --git a/vnfs/DAaaS/deploy/operator/charts/collectd-operator/templates/service_account.yaml b/vnfs/DAaaS/deploy/operator/charts/collectd-operator/templates/service_account.yaml new file mode 100644 index 00000000..d3c17cf8 --- /dev/null +++ b/vnfs/DAaaS/deploy/operator/charts/collectd-operator/templates/service_account.yaml @@ -0,0 +1,12 @@ +{{- if .Values.enabled }} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: collectd-operator + labels: + app: {{ template "collectd-operator.name" . }} + chart: {{ template "collectd-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/collectd-operator/values.yaml b/vnfs/DAaaS/deploy/operator/charts/collectd-operator/values.yaml new file mode 100644 index 00000000..4517befb --- /dev/null +++ b/vnfs/DAaaS/deploy/operator/charts/collectd-operator/values.yaml @@ -0,0 +1,27 @@ +# Default values for collectd-operator. +enabled: true +watch: + nameSpace: "" + labels: "app=collectd" +image: + repository: dcr.cluster.local:32644/collectd-operator + tag: latest + pullPolicy: Always + +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