From 5ccb412d9feecdab593638cd7799d9756cc773ff Mon Sep 17 00:00:00 2001 From: "hoejoo.lee" Date: Fri, 14 Apr 2023 02:34:31 -0400 Subject: [PATCH] add inference service helm chart depending on serving version Change-Id: If34fe5b89bb19b3a16921a9a79d5628f16ccccc0 Signed-off-by: hoejoo.lee --- pkg/helm/data/resources/inf-alpha/Chart.yaml | 23 +++++ .../resources/inf-alpha/templates/_helpers.tpl | 76 ++++++++++++++ .../inf-alpha/templates/inferenceservice.yaml | 46 +++++++++ pkg/helm/data/resources/inf-alpha/values.yaml | 45 ++++++++ pkg/helm/data/resources/inf-beta/Chart.yaml | 22 ++++ .../data/resources/inf-beta/templates/_helpers.tpl | 76 ++++++++++++++ .../inf-beta/templates/inferenceservice.yaml | 46 +++++++++ pkg/helm/data/resources/inf-beta/values.yaml | 44 ++++++++ pkg/helm/data/resources/std/Chart.yaml | 23 +++++ pkg/helm/data/resources/std/templates/_helpers.tpl | 77 ++++++++++++++ .../data/resources/std/templates/appconfig.yaml | 24 +++++ pkg/helm/data/resources/std/templates/appenv.yaml | 29 ++++++ .../data/resources/std/templates/deployment.yaml | 113 +++++++++++++++++++++ pkg/helm/data/resources/std/templates/service.yaml | 41 ++++++++ pkg/helm/data/resources/std/values.yaml | 50 +++++++++ 15 files changed, 735 insertions(+) create mode 100755 pkg/helm/data/resources/inf-alpha/Chart.yaml create mode 100755 pkg/helm/data/resources/inf-alpha/templates/_helpers.tpl create mode 100755 pkg/helm/data/resources/inf-alpha/templates/inferenceservice.yaml create mode 100755 pkg/helm/data/resources/inf-alpha/values.yaml create mode 100755 pkg/helm/data/resources/inf-beta/Chart.yaml create mode 100755 pkg/helm/data/resources/inf-beta/templates/_helpers.tpl create mode 100755 pkg/helm/data/resources/inf-beta/templates/inferenceservice.yaml create mode 100755 pkg/helm/data/resources/inf-beta/values.yaml create mode 100755 pkg/helm/data/resources/std/Chart.yaml create mode 100755 pkg/helm/data/resources/std/templates/_helpers.tpl create mode 100755 pkg/helm/data/resources/std/templates/appconfig.yaml create mode 100755 pkg/helm/data/resources/std/templates/appenv.yaml create mode 100755 pkg/helm/data/resources/std/templates/deployment.yaml create mode 100755 pkg/helm/data/resources/std/templates/service.yaml create mode 100755 pkg/helm/data/resources/std/values.yaml diff --git a/pkg/helm/data/resources/inf-alpha/Chart.yaml b/pkg/helm/data/resources/inf-alpha/Chart.yaml new file mode 100755 index 0000000..e7695bb --- /dev/null +++ b/pkg/helm/data/resources/inf-alpha/Chart.yaml @@ -0,0 +1,23 @@ +# ================================================================================== +# +# Copyright (c) 2023 Samsung Electronics Co., Ltd. All Rights Reserved. +# +# 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: Inference Service Helm Chart +name: inference-service +version: 1.0.0 diff --git a/pkg/helm/data/resources/inf-alpha/templates/_helpers.tpl b/pkg/helm/data/resources/inf-alpha/templates/_helpers.tpl new file mode 100755 index 0000000..416396e --- /dev/null +++ b/pkg/helm/data/resources/inf-alpha/templates/_helpers.tpl @@ -0,0 +1,76 @@ +# ================================================================================== +# +# Copyright (c) 2023 Samsung Electronics Co., Ltd. All Rights Reserved. +# +# 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. +# +# ================================================================================== +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "ricxapp.name" -}} + {{- default .Chart.Name .Values.name | 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 "ricxapp.fullname" -}} + {{- $name := ( include "ricxapp.name" . ) -}} + {{- $fullname := ( printf "%s-%s" .Release.Namespace $name ) -}} + {{- default $fullname .Values.fullname | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "ricxapp.chart" -}} + {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "ricxapp.namespace" -}} + {{- default .Release.Namespace .Values.nsPrefix -}} +{{- end -}} + + + +{{- define "ricxapp.servicename" -}} + {{- $name := ( include "ricxapp.fullname" . ) -}} + {{- printf "service-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "ricxapp.configmapname" -}} + {{- $name := ( include "ricxapp.fullname" . ) -}} + {{- printf "configmap-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "ricxapp.deploymentname" -}} + {{- $name := ( include "ricxapp.fullname" . ) -}} + {{- printf "deployment-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + + +{{- define "ricxapp.containername" -}} + {{- $name := ( include "ricxapp.fullname" . ) -}} + {{- printf "container-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + + +{{- define "ricxapp.imagepullsecret" -}} + {{- $reponame := .repo -}} + {{- $postfix := $reponame | replace "." "-" | replace ":" "-" | replace "/" "-" | trunc 63 | trimSuffix "-" -}} + {{- printf "secret-%s" $postfix -}} +{{- end -}} diff --git a/pkg/helm/data/resources/inf-alpha/templates/inferenceservice.yaml b/pkg/helm/data/resources/inf-alpha/templates/inferenceservice.yaml new file mode 100755 index 0000000..51d9a69 --- /dev/null +++ b/pkg/helm/data/resources/inf-alpha/templates/inferenceservice.yaml @@ -0,0 +1,46 @@ +# ================================================================================== +# +# Copyright (c) 2023 Samsung Electronics Co., Ltd. All Rights Reserved. +# +# 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: "serving.kubeflow.org/v1alpha2" +kind: "InferenceService" +metadata: + name: {{ .Values.fullname }} + labels: + controller-tools.k8s.io: "1.0" + app: {{ .Values.fullname }} +spec: + default: + predictor: + serviceAccountName: {{ .Values.ric_serviceaccount_name }} + {{- if .Values.max_replicas }} + maxReplicas: {{ .Values.max_replicas }} + {{- end }} + {{- if .Values.max_replicas }} + minReplicas: {{ .Values.min_replicas }} + {{- end }} + {{- if eq .Values.engine "tensorflow" }} + tensorflow: + ports: + - containerPort: 9000 + name: h2c # Do not change this value + protocol: TCP + {{- end }} + storageUri: {{ .Values.storageUri }} + {{- if .Values.resources }} + resources: + {{- toYaml .Values.resources | nindent 10 }} + {{- end -}} diff --git a/pkg/helm/data/resources/inf-alpha/values.yaml b/pkg/helm/data/resources/inf-alpha/values.yaml new file mode 100755 index 0000000..d199a65 --- /dev/null +++ b/pkg/helm/data/resources/inf-alpha/values.yaml @@ -0,0 +1,45 @@ +# ================================================================================== +# +# Copyright (c) 2023 Samsung Electronics Co., Ltd. All Rights Reserved. +# +# 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. +# +# ================================================================================== + +engine: {} +storageUri: {} + +ric_serviceaccount_name: default + +resources: {} +# example formats +### +# limits: +# cpu: "1" +# memory: "1Gi" +# requests: +# cpu: "0.5" +# memory: "0.5Gi" +### + +max_replicas: {} +min_replicas: {} + +# Image pulling policy +image_pull_policy: Always + +# Instance name. If empty, chart name will be used +name: {} + +# Full instance name. If empty, full name will be constructed from name +fullname: {} diff --git a/pkg/helm/data/resources/inf-beta/Chart.yaml b/pkg/helm/data/resources/inf-beta/Chart.yaml new file mode 100755 index 0000000..5988cad --- /dev/null +++ b/pkg/helm/data/resources/inf-beta/Chart.yaml @@ -0,0 +1,22 @@ +# ================================================================================== +# +# Copyright (c) 2023 Samsung Electronics Co., Ltd. All Rights Reserved. +# +# 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: Inference Service Helm Chart +name: inference-service +version: 1.0.0 diff --git a/pkg/helm/data/resources/inf-beta/templates/_helpers.tpl b/pkg/helm/data/resources/inf-beta/templates/_helpers.tpl new file mode 100755 index 0000000..416396e --- /dev/null +++ b/pkg/helm/data/resources/inf-beta/templates/_helpers.tpl @@ -0,0 +1,76 @@ +# ================================================================================== +# +# Copyright (c) 2023 Samsung Electronics Co., Ltd. All Rights Reserved. +# +# 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. +# +# ================================================================================== +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "ricxapp.name" -}} + {{- default .Chart.Name .Values.name | 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 "ricxapp.fullname" -}} + {{- $name := ( include "ricxapp.name" . ) -}} + {{- $fullname := ( printf "%s-%s" .Release.Namespace $name ) -}} + {{- default $fullname .Values.fullname | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "ricxapp.chart" -}} + {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "ricxapp.namespace" -}} + {{- default .Release.Namespace .Values.nsPrefix -}} +{{- end -}} + + + +{{- define "ricxapp.servicename" -}} + {{- $name := ( include "ricxapp.fullname" . ) -}} + {{- printf "service-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "ricxapp.configmapname" -}} + {{- $name := ( include "ricxapp.fullname" . ) -}} + {{- printf "configmap-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "ricxapp.deploymentname" -}} + {{- $name := ( include "ricxapp.fullname" . ) -}} + {{- printf "deployment-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + + +{{- define "ricxapp.containername" -}} + {{- $name := ( include "ricxapp.fullname" . ) -}} + {{- printf "container-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + + +{{- define "ricxapp.imagepullsecret" -}} + {{- $reponame := .repo -}} + {{- $postfix := $reponame | replace "." "-" | replace ":" "-" | replace "/" "-" | trunc 63 | trimSuffix "-" -}} + {{- printf "secret-%s" $postfix -}} +{{- end -}} diff --git a/pkg/helm/data/resources/inf-beta/templates/inferenceservice.yaml b/pkg/helm/data/resources/inf-beta/templates/inferenceservice.yaml new file mode 100755 index 0000000..828d334 --- /dev/null +++ b/pkg/helm/data/resources/inf-beta/templates/inferenceservice.yaml @@ -0,0 +1,46 @@ +# ================================================================================== +# +# Copyright (c) 2023 Samsung Electronics Co., Ltd. All Rights Reserved. +# +# 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: "serving.kubeflow.org/v1beta1" +kind: "InferenceService" +metadata: + name: {{ .Values.fullname }} + labels: + controller-tools.k8s.io: "1.0" + app: {{ .Values.fullname }} +spec: + predictor: + serviceAccountName: {{ .Values.ric_serviceaccount_name }} + {{- if .Values.max_replicas }} + maxReplicas: {{ .Values.max_replicas }} + {{- end }} + {{- if .Values.max_replicas }} + minReplicas: {{ .Values.min_replicas }} + {{- end }} + {{- if eq .Values.engine "tensorflow" }} + tensorflow: + ports: + - containerPort: 9000 + name: h2c + protocol: TCP + {{- end }} + storageUri: {{ .Values.storageUri }} + {{- if .Values.resources }} + resources: + {{- toYaml .Values.resources | nindent 10 }} + {{- end -}} diff --git a/pkg/helm/data/resources/inf-beta/values.yaml b/pkg/helm/data/resources/inf-beta/values.yaml new file mode 100755 index 0000000..f0f05ba --- /dev/null +++ b/pkg/helm/data/resources/inf-beta/values.yaml @@ -0,0 +1,44 @@ +# ================================================================================== +# +# Copyright (c) 2023 Samsung Electronics Co., Ltd. All Rights Reserved. +# +# 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. +# +# ================================================================================== +engine: {} +storageUri: {} + +ric_serviceaccount_name: default + +resources: {} +# example formats +### +# limits: +# cpu: "1" +# memory: "1Gi" +# requests: +# cpu: "0.5" +# memory: "0.5Gi" +### + +max_replicas: {} +min_replicas: {} + +# Image pulling policy +image_pull_policy: Always + +# Instance name. If empty, chart name will be used +name: {} + +# Full instance name. If empty, full name will be constructed from name +fullname: {} diff --git a/pkg/helm/data/resources/std/Chart.yaml b/pkg/helm/data/resources/std/Chart.yaml new file mode 100755 index 0000000..edd6bd7 --- /dev/null +++ b/pkg/helm/data/resources/std/Chart.yaml @@ -0,0 +1,23 @@ +# ================================================================================== +# +# Copyright (c) 2023 Samsung Electronics Co., Ltd. All Rights Reserved. +# +# 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: Standard Inference Service Helm Chart +name: inference-service-std +version: 0.0.1 diff --git a/pkg/helm/data/resources/std/templates/_helpers.tpl b/pkg/helm/data/resources/std/templates/_helpers.tpl new file mode 100755 index 0000000..be7d436 --- /dev/null +++ b/pkg/helm/data/resources/std/templates/_helpers.tpl @@ -0,0 +1,77 @@ +# ================================================================================== +# +# Copyright (c) 2023 Samsung Electronics Co., Ltd. All Rights Reserved. +# +# 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. +# +# ================================================================================== + +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "ricxapp.name" -}} + {{- default .Chart.Name .Values.name | 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 "ricxapp.fullname" -}} + {{- $name := ( include "ricxapp.name" . ) -}} + {{- $fullname := ( printf "%s-%s" .Release.Namespace $name ) -}} + {{- default $fullname .Values.fullname | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "ricxapp.chart" -}} + {{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "ricxapp.namespace" -}} + {{- default .Release.Namespace .Values.nsPrefix -}} +{{- end -}} + + + +{{- define "ricxapp.servicename" -}} + {{- $name := ( include "ricxapp.fullname" . ) -}} + {{- printf "service-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "ricxapp.configmapname" -}} + {{- $name := ( include "ricxapp.fullname" . ) -}} + {{- printf "configmap-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{- define "ricxapp.deploymentname" -}} + {{- $name := ( include "ricxapp.fullname" . ) -}} + {{- printf "deployment-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + + +{{- define "ricxapp.containername" -}} + {{- $name := ( include "ricxapp.fullname" . ) -}} + {{- printf "container-%s" $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} + + +{{- define "ricxapp.imagepullsecret" -}} + {{- $reponame := .repo -}} + {{- $postfix := $reponame | replace "." "-" | replace ":" "-" | replace "/" "-" | trunc 63 | trimSuffix "-" -}} + {{- printf "secret-%s" $postfix -}} +{{- end -}} \ No newline at end of file diff --git a/pkg/helm/data/resources/std/templates/appconfig.yaml b/pkg/helm/data/resources/std/templates/appconfig.yaml new file mode 100755 index 0000000..145ed28 --- /dev/null +++ b/pkg/helm/data/resources/std/templates/appconfig.yaml @@ -0,0 +1,24 @@ +# ================================================================================== +# +# Copyright (c) 2023 Samsung Electronics Co., Ltd. All Rights Reserved. +# +# 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: {{ include "ricxapp.configmapname" . }}-appconfig +data: diff --git a/pkg/helm/data/resources/std/templates/appenv.yaml b/pkg/helm/data/resources/std/templates/appenv.yaml new file mode 100755 index 0000000..5bff866 --- /dev/null +++ b/pkg/helm/data/resources/std/templates/appenv.yaml @@ -0,0 +1,29 @@ +# ================================================================================== +# +# Copyright (c) 2023 Samsung Electronics Co., Ltd. All Rights Reserved. +# +# 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: {{ include "ricxapp.configmapname" . }}-appenv +data: + {{- if .Values.appenv }} + {{- toYaml .Values.appenv | nindent 2 }} + {{- end }} + RMR_RTG_SVC: "4561" + XAPP_DESCRIPTOR_PATH: {{ .Values.appconfig.path }} + RMR_SRC_ID: {{ include "ricxapp.servicename" . }}-rmr.{{ include "ricxapp.namespace" . }}:4560 \ No newline at end of file diff --git a/pkg/helm/data/resources/std/templates/deployment.yaml b/pkg/helm/data/resources/std/templates/deployment.yaml new file mode 100755 index 0000000..af1ea30 --- /dev/null +++ b/pkg/helm/data/resources/std/templates/deployment.yaml @@ -0,0 +1,113 @@ +# ================================================================================== +# +# Copyright (c) 2023 Samsung Electronics Co., Ltd. All Rights Reserved. +# +# 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: apps/v1 +kind: Deployment +metadata: + name: {{ include "ricxapp.fullname" . }} + labels: + app: {{ include "ricxapp.namespace" . }}-{{ include "ricxapp.name" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +spec: + replicas: {{ .Values.replicaCount }} + selector: + matchLabels: + app: {{ include "ricxapp.namespace" . }}-{{ include "ricxapp.name" . }} + release: {{ .Release.Name }} + template: + metadata: + {{- if .Values.annotations }} + annotations: + {{- range $key, $value := .Values.annotations }} + {{- if kindIs "string" $value }} + {{ $key }}: {{ $value | toPrettyJson }} + {{- else }} + {{ $key }}: | +{{- $value | toPrettyJson | nindent 10 }} + {{- end }} + {{- end -}} + {{ end }} + labels: + app: {{ include "ricxapp.namespace" . }}-{{ include "ricxapp.name" . }} + kubernetes_name: {{ include "ricxapp.namespace" . }}_{{ include "ricxapp.name" . }} + release: {{ .Release.Name }} + spec: + hostname: {{ include "ricxapp.name" . }} + imagePullSecrets: +{{- range .Values.containers }} + - name: {{ .image.registry | replace "." "-" | replace ":" "-" | replace "/" "-" | trunc 63 | trimSuffix "-" }} +{{- end }} + volumes: + - name: config-volume + configMap: + name: {{ include "ricxapp.configmapname" . }}-appconfig + containers: +{{- $containers := .Values.containers }} +{{- $ports := .Values.messaging.ports }} +{{- range $container := $containers }} + {{- $portlist := list }} + {{- range $port := $ports }} + {{- if eq $port.container $container.name }} + {{- $portlist = append $portlist $port }} + {{- end }} + {{- end }} + - name: {{ $container.name }} + image: "{{ $container.image.registry }}/{{ $container.image.name }}:{{ $container.image.tag }}" + {{- if $container.command }} + command: [ + {{- range $command := $container.command -}} + {{- $command | quote -}} + {{- if ne $command (last $container.command) }} + {{- print ", " -}} + {{- end -}} + {{- end -}} + {{- print "]" -}} + {{- end}} + {{- if $container.args }} + args: [ + {{- range $arg := $container.args -}} + {{- $arg | quote -}} + {{- if ne $arg (last $container.args) }} + {{- print ", " -}} + {{- end -}} + {{- end -}} + {{- print "]" -}} + {{- end}} + imagePullPolicy: {{ $.Values.image_pull_policy }} + {{- if $portlist }} + ports: + {{- range $port := $portlist }} + - name: {{ $port.name }} + containerPort: {{ $port.port }} + protocol: TCP + {{- end }} + {{- end }} +{{- end }} + volumeMounts: + - name: config-volume + mountPath: {{ .Values.appconfig.path }} + envFrom: + - configMapRef: + name: {{ include "ricxapp.configmapname" . }}-appenv + - configMapRef: + name: dbaas-appconfig + - configMapRef: + name: alarm-appconfig + restartPolicy: Always diff --git a/pkg/helm/data/resources/std/templates/service.yaml b/pkg/helm/data/resources/std/templates/service.yaml new file mode 100755 index 0000000..2171dd3 --- /dev/null +++ b/pkg/helm/data/resources/std/templates/service.yaml @@ -0,0 +1,41 @@ +# ================================================================================== +# +# Copyright (c) 2023 Samsung Electronics Co., Ltd. All Rights Reserved. +# +# 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: {{ include "ricxapp.servicename" . }}-rmr + namespace: {{ include "ricxapp.namespace" . }} + labels: + app: {{ include "ricxapp.namespace" . }}-{{ include "ricxapp.name" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +spec: + type: ClusterIP + ports: + {{- range .Values.messaging.ports }} + - port: {{ .port }} + targetPort: {{ .name }} + protocol: TCP + name: {{ .name }} + {{- end }} + selector: + app: {{ include "ricxapp.namespace" . }}-{{ include "ricxapp.name" . }} + release: {{ .Release.Name }} diff --git a/pkg/helm/data/resources/std/values.yaml b/pkg/helm/data/resources/std/values.yaml new file mode 100755 index 0000000..f0db9bf --- /dev/null +++ b/pkg/helm/data/resources/std/values.yaml @@ -0,0 +1,50 @@ +# ================================================================================== +# +# Copyright (c) 2023 Samsung Electronics Co., Ltd. All Rights Reserved. +# +# 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. +# +# ================================================================================== + +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + + +# Location of the xApp config files injected from the xApp descriptor +appconfig: + path: /opt/ric/config + +# Number of replica +replicaCount: 1 + +# Image pulling policy +image_pull_policy: IfNotPresent + +# Environment variables that will be injected +appenv: {} + +# Liveness probe definition. If empty, liveness probe will be disabled +livenessProbe: {} + +# Readiness probe definition. If empty, readiness probe will be disabled +readinessProbe: {} + +# Instance name. If empty, chart name will be used +name: {} + +# Full instance name. If empty, full name will be constructed from name +fullname: {} +############### The following are from the xApp descriptor ############### + + + -- 2.16.6