From fdb7efc0a8b05f517356d2f92b2dee6306a3f0fb Mon Sep 17 00:00:00 2001 From: SANDEEP KUMAR JAISAWAL Date: Fri, 8 Dec 2023 14:17:31 +0530 Subject: [PATCH] Installation changes for modelmgmtservice component, review comments Issue-Id: AIMLFW-70 Change-Id: I13b8e9efc01beb73942d67d8219af1ff9249635c Signed-off-by: SANDEEP KUMAR JAISAWAL --- ...le_recipe_local_images_oran_i_release.yaml | 7 ++ .../templates/_modelmgmtservice.tpl | 85 +++++++++++++++++++ helm/modelmgmtservice/Chart.yaml | 23 +++++ helm/modelmgmtservice/requirements.yaml | 21 +++++ .../modelmgmtservice/templates/configmap.yaml | 32 +++++++ .../templates/deployment.yaml | 60 +++++++++++++ helm/modelmgmtservice/templates/service.yaml | 33 +++++++ helm/modelmgmtservice/values.yaml | 24 ++++++ 8 files changed, 285 insertions(+) create mode 100644 aimlfw-common/Common-Template/helm/aimlfw-common/templates/_modelmgmtservice.tpl create mode 100644 helm/modelmgmtservice/Chart.yaml create mode 100644 helm/modelmgmtservice/requirements.yaml create mode 100644 helm/modelmgmtservice/templates/configmap.yaml create mode 100644 helm/modelmgmtservice/templates/deployment.yaml create mode 100644 helm/modelmgmtservice/templates/service.yaml create mode 100644 helm/modelmgmtservice/values.yaml diff --git a/RECIPE_EXAMPLE/example_recipe_local_images_oran_i_release.yaml b/RECIPE_EXAMPLE/example_recipe_local_images_oran_i_release.yaml index f6c3d20..033a203 100644 --- a/RECIPE_EXAMPLE/example_recipe_local_images_oran_i_release.yaml +++ b/RECIPE_EXAMPLE/example_recipe_local_images_oran_i_release.yaml @@ -85,3 +85,10 @@ kserveadapter: ric_dms: ip: port: 8000 + +modelmgmtservice: + image: + repository: modelmgmtservice + pullPolicy: IfNotPresent + # Overrides the image tag whose default is the chart appVersion. + tag: "1.0.0" diff --git a/aimlfw-common/Common-Template/helm/aimlfw-common/templates/_modelmgmtservice.tpl b/aimlfw-common/Common-Template/helm/aimlfw-common/templates/_modelmgmtservice.tpl new file mode 100644 index 0000000..5b31f75 --- /dev/null +++ b/aimlfw-common/Common-Template/helm/aimlfw-common/templates/_modelmgmtservice.tpl @@ -0,0 +1,85 @@ +# ================================================================================== +# +# 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. +# +# ================================================================================== + +{{/* +Expand the name of the chart. +*/}} +{{- define "modelmgmtservice.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 "modelmgmtservice.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 "modelmgmtservice.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "modelmgmtservice.labels" -}} +helm.sh/chart: {{ include "modelmgmtservice.chart" . }} +{{ include "modelmgmtservice.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "modelmgmtservice.selectorLabels" -}} +app.kubernetes.io/name: {{ include "modelmgmtservice.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "modelmgmtservice.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "modelmgmtservice.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} + +{{- define "common.serviceport.modelmgmtservice.http" -}}8082{{- end -}} +{{- define "common.serviceport.modelmgmtservice.targetport" -}}8082{{- end -}} +{{- define "common.servicehost.modelmgmtservice.http" -}}modelmgmtservice.traininghost{{- end -}} +{{- define "common.serviceport.modelmgmtservice.external" -}}32006{{- end -}} \ No newline at end of file diff --git a/helm/modelmgmtservice/Chart.yaml b/helm/modelmgmtservice/Chart.yaml new file mode 100644 index 0000000..bb911ce --- /dev/null +++ b/helm/modelmgmtservice/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 +name: modelmgmtservice +description: Helm chart for modelmgmtservice +type: application +version: 1.0.0 +appVersion: "1.0.0" diff --git a/helm/modelmgmtservice/requirements.yaml b/helm/modelmgmtservice/requirements.yaml new file mode 100644 index 0000000..ca1af17 --- /dev/null +++ b/helm/modelmgmtservice/requirements.yaml @@ -0,0 +1,21 @@ +# ================================================================================== +# +# 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. +# +# ================================================================================== +dependencies: + - name: aimlfw-common + version: 1.0.0 + repository: "@local" diff --git a/helm/modelmgmtservice/templates/configmap.yaml b/helm/modelmgmtservice/templates/configmap.yaml new file mode 100644 index 0000000..57c68c1 --- /dev/null +++ b/helm/modelmgmtservice/templates/configmap.yaml @@ -0,0 +1,32 @@ +# ================================================================================== +# +# 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. +# +# ================================================================================== +kind: ConfigMap +apiVersion: v1 +metadata: + name: modelmgmtservice-configmap + namespace: {{ include "common.namespace.platform" . }} + +data: + # Configuration values can be set as key-value properties + MMES_URL: 0.0.0.0:8082 + S3_URL: http://leofs.kubeflow:8080 + S3_ACCESS_KEY: leofs + S3_REGION: oranaiml + MODEL_FILE_POSTFIX: _model.zip + INFO_FILE_POSTFIX: _info.json + LOG_FILE_NAME: mmes.log diff --git a/helm/modelmgmtservice/templates/deployment.yaml b/helm/modelmgmtservice/templates/deployment.yaml new file mode 100644 index 0000000..d3037e5 --- /dev/null +++ b/helm/modelmgmtservice/templates/deployment.yaml @@ -0,0 +1,60 @@ +# ================================================================================== +# +# 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 "modelmgmtservice.fullname" . }} + namespace: {{ include "common.namespace.platform" . }} + labels: + {{- include "modelmgmtservice.labels" . | nindent 4 }} +spec: + selector: + matchLabels: + {{- include "modelmgmtservice.selectorLabels" . | nindent 6 }} + template: + metadata: + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "modelmgmtservice.selectorLabels" . | nindent 8 }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + containers: + - name: {{ .Chart.Name }} + image: "{{ .Values.modelmgmtservice.image.repository }}:{{ .Values.modelmgmtservice.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.modelmgmtservice.image.pullPolicy }} + ports: + - name: serviceport + containerPort: {{ include "common.serviceport.modelmgmtservice.http" . }} + protocol: TCP + envFrom: + - configMapRef: + name: modelmgmtservice-configmap + env: + - name: S3_SECRET_KEY + valueFrom: + secretKeyRef: + name: leofs-secret + key: password diff --git a/helm/modelmgmtservice/templates/service.yaml b/helm/modelmgmtservice/templates/service.yaml new file mode 100644 index 0000000..902a216 --- /dev/null +++ b/helm/modelmgmtservice/templates/service.yaml @@ -0,0 +1,33 @@ +# ================================================================================== +# +# 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 "modelmgmtservice.fullname" . }} + namespace: {{ include "common.namespace.platform" . }} + labels: {{ include "modelmgmtservice.labels" . | nindent 4 }} +spec: + type: NodePort + ports: + - port: {{ include "common.serviceport.modelmgmtservice.http" . }} + targetPort: + {{ include "common.serviceport.modelmgmtservice.targetport" . }} + nodePort: {{ include "common.serviceport.modelmgmtservice.external" . }} + protocol: TCP + name: serviceport + selector: {{ include "modelmgmtservice.selectorLabels" . | nindent 4 }} diff --git a/helm/modelmgmtservice/values.yaml b/helm/modelmgmtservice/values.yaml new file mode 100644 index 0000000..bb0f588 --- /dev/null +++ b/helm/modelmgmtservice/values.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. +# +# ================================================================================== +# Default values for modelmgmtservice component. + +image: + repository: modelmgmtservice + pullPolicy: IfNotPresent + # Overrides the image tag whose default is the chart appVersion. + tag: "1.0.0"