Skip to content

Commit

Permalink
PILOT-6142: Add FileOps service helm charts (#141)
Browse files Browse the repository at this point in the history
* helm-charts: add fileops service

* docs: build index for helm repo for fileops service

* pr_feed: update values.yaml file

* add httptarget for fileops readiness probe

* add livenessProbe and pr_feed
  • Loading branch information
juyoungkimthedev authored Oct 31, 2024
1 parent 1f5284a commit 9c1ab2c
Show file tree
Hide file tree
Showing 12 changed files with 541 additions and 0 deletions.
Binary file added docs/fileops-service-1.0.0.tgz
Binary file not shown.
11 changes: 11 additions & 0 deletions docs/index.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1897,6 +1897,17 @@ entries:
urls:
- https://pilotdataplatform.github.io/helm-charts/entityinfo-service-0.1.0.tgz
version: 0.1.0
fileops-service:
- apiVersion: v2
appVersion: "252"
created: "2024-10-28T01:05:00.195099-04:00"
description: A Helm chart for Kubernetes
digest: b414b15a1bdd5e74fceaafe8ebb5c93edc2e3c85a10ea17caf7a44e7964c8c1a
name: fileops-service
type: application
urls:
- https://pilotdataplatform.github.io/helm-charts/fileops-service-1.0.0.tgz
version: 1.0.0
fluentd:
- annotations:
category: Analytics
Expand Down
23 changes: 23 additions & 0 deletions fileops-service/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# 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
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
24 changes: 24 additions & 0 deletions fileops-service/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apiVersion: v2
name: fileops-service
description: A Helm chart for Kubernetes

# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application

# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 1.0.0

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "252"
22 changes: 22 additions & 0 deletions fileops-service/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
1. Get the application URL by running these commands:
{{- if .Values.ingress.enabled }}
{{- range $host := .Values.ingress.hosts }}
{{- range .paths }}
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }}
{{- end }}
{{- end }}
{{- else if contains "NodePort" .Values.service.type }}
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "fileops-service.fullname" . }})
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT
{{- else if contains "LoadBalancer" .Values.service.type }}
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
You can watch its status by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "fileops-service.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "fileops-service.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
echo http://$SERVICE_IP:{{ .Values.service.port }}
{{- else if contains "ClusterIP" .Values.service.type }}
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "fileops-service.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}")
echo "Visit http://127.0.0.1:8080 to use your application"
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT
{{- end }}
62 changes: 62 additions & 0 deletions fileops-service/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "fileops-service.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 "fileops-service.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 "fileops-service.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "fileops-service.labels" -}}
helm.sh/chart: {{ include "fileops-service.chart" . }}
{{ include "fileops-service.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "fileops-service.selectorLabels" -}}
app.kubernetes.io/name: {{ include "fileops-service.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "fileops-service.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "fileops-service.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
183 changes: 183 additions & 0 deletions fileops-service/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,183 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "fileops-service.fullname" . }}
labels:
{{- include "fileops-service.labels" . | nindent 4 }}
{{- with .Values.deploymentAnnotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.replicaCount }}
{{- end }}
{{- if .Values.updateStrategy }}
strategy:
{{- toYaml .Values.updateStrategy | nindent 4 }}
{{- end }}
selector:
matchLabels:
{{- include "fileops-service.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "fileops-service.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- if .Values.serviceAccount.create }}
serviceAccountName: {{ .Values.serviceAccount.name }}
{{- end }}
containers:
- name: {{ .Chart.Name }}
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
{{- if .Values.command }}
{{- with .Values.command }}
command:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- end }}
{{- if .Values.args }}
{{- with .Values.args }}
args:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- end }}
ports:
- name: http
containerPort: {{ .Values.container.port }}
env:
- name: port
value: {{ .Values.appConfig.port | quote }}
- name: env
value: {{ .Values.appConfig.env | quote }}
- name: CONFIG_CENTER_ENABLED
value: {{ .Values.appConfig.config_center_enabled | quote }}
- name: CONFIG_CENTER_BASE_URL
value: {{ .Values.appConfig.config_center_base_url | quote }}
# log levels
- name: LOG_LEVEL_DEFAULT
value: {{ .Values.appConfig.LOG_LEVEL_DEFAULT | quote}}
- name: LOG_LEVEL_FILE
value: {{ .Values.appConfig.LOG_LEVEL_FILE | quote}}
- name: LOG_LEVEL_STDOUT
value: {{ .Values.appConfig.LOG_LEVEL_STDOUT | quote}}
- name: LOG_LEVEL_STDERR
value: {{ .Values.appConfig.LOG_LEVEL_STDERR | quote }}
- name: CORE_ZONE_LABEL
value: "Core"
- name: GREEN_ZONE_LABEL
value: "Greenroom"
- name: DOWNLOAD_TOKEN_EXPIRE_AT
value: {{ .Values.appConfig.DOWNLOAD_TOKEN_EXPIRE_AT | quote }}
#if core or greenroom
{{- if contains "core" .Values.appConfig.namespace }}
- name: ROOT_PATH
value: "/core-data"
{{- else }}
- name: ROOT_PATH
value: "/data/core-storage"
{{- end}}
#if tenant id is not set
{{- if not .Values.appConfig.tenant_id }}
- name: APPROVAL_SERVICE
value: "http://approval.utility:8000"
- name: DATAOPS_SERVICE
value: "http://dataops.utility:5063"
- name: DATASET_SERVICE
value: "http://dataset.utility:5081"
- name: PROJECT_SERVICE
value: "http://project.utility:5064"
- name: METADATA_SERVICE
value: "http://metadata.utility:5066"
- name: KAFKA_URL
value: "kafka.utility:9092"
- name: KAFKA_ACTIVITY_TOPIC
value: "metadata.items.activity"
{{- else }}
- name: APPROVAL_SERVICE
value: "http://approval.{{ .Values.appConfig.tenant_id }}-utility:8000"
- name: DATAOPS_SERVICE
value: "http://dataops.{{ .Values.appConfig.tenant_id }}-utility:5063"
- name: DATASET_SERVICE
value: "http://dataset.{{ .Values.appConfig.tenant_id }}-utility:5081"
- name: PROJECT_SERVICE
value: "http://project.{{ .Values.appConfig.tenant_id }}-utility:5064"
- name: METADATA_SERVICE
value: "http://metadata.{{ .Values.appConfig.tenant_id }}-utility:5066"
- name: KAFKA_URL
value: "kafka.datastores:9092"
- name: KAFKA_ACTIVITY_TOPIC
value: "{{ .Values.appConfig.tenant_id}}.metadata.items.activity"
{{- end}}
# redis
- name: REDIS_DB
value: {{ .Values.appConfig.REDIS_DB | quote }}
{{- if not .Values.appConfig.tenant_id }}
- name: REDIS_HOST
value: {{ .Values.appConfig.REDIS_HOST | quote }}
{{- else }}
- name: REDIS_HOST
value: "redis-master.{{ .Values.appConfig.tenant_id }}-redis"
{{- end }}
- name: REDIS_PORT
value: {{ .Values.appConfig.REDIS_PORT | quote }}
# telemetry
- name: OPEN_TELEMETRY_ENABLED
value: {{ .Values.appConfig.OPEN_TELEMETRY_ENABLED | quote }}
- name: OPEN_TELEMETRY_HOST
value: {{ .Values.appConfig.OPEN_TELEMETRY_HOST | quote }}
- name: OPEN_TELEMETRY_PORT
value: {{ .Values.appConfig.OPEN_TELEMETRY_PORT | quote }}

{{- if .Values.extraEnv }}
{{- range $key, $value := .Values.extraEnv }}
- name: {{ $key }}
value: {{ $value | quote }}
{{- end }}
{{- end }}
{{- with .Values.extraEnvYaml }}
{{- toYaml . | nindent 10 }}
{{- end }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- if .Values.volumes }}
volumeMounts:
- mountPath: {{ .Values.volumes.mountPath }}
name: {{ .Values.volumes.name }}
{{- end }}
{{- if .Values.readinessProbe }}
readinessProbe:
{{- toYaml .Values.readinessProbe | nindent 12 }}
{{- end }}
{{- if .Values.livenessProbe }}
livenessProbe:
{{- toYaml .Values.livenessProbe | nindent 12 }}
{{- end }}
{{- if .Values.volumes }}
volumes:
- name: {{ .Values.volumes.name }}
persistentVolumeClaim:
claimName: {{ .Values.volumes.claimName }}
{{- 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 changes: 61 additions & 0 deletions fileops-service/templates/ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{{- if .Values.ingress.enabled -}}
{{- $fullName := include "fileops-service.fullname" . -}}
{{- $svcPort := .Values.service.port -}}
{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }}
{{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }}
{{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}}
{{- end }}
{{- end }}
{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1
{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}}
apiVersion: networking.k8s.io/v1beta1
{{- else -}}
apiVersion: extensions/v1beta1
{{- end }}
kind: Ingress
metadata:
name: {{ $fullName }}
labels:
{{- include "fileops-service.labels" . | nindent 4 }}
{{- with .Values.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
{{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }}
ingressClassName: {{ .Values.ingress.className }}
{{- end }}
{{- if .Values.ingress.tls }}
tls:
{{- range .Values.ingress.tls }}
- hosts:
{{- range .hosts }}
- {{ . | quote }}
{{- end }}
secretName: {{ .secretName }}
{{- end }}
{{- end }}
rules:
{{- range .Values.ingress.hosts }}
- host: {{ .host | quote }}
http:
paths:
{{- range .paths }}
- path: {{ .path }}
{{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }}
pathType: {{ .pathType }}
{{- end }}
backend:
{{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }}
service:
name: {{ $fullName }}
port:
number: {{ $svcPort }}
{{- else }}
serviceName: {{ $fullName }}
servicePort: {{ $svcPort }}
{{- end }}
{{- end }}
{{- end }}
{{- end }}
Loading

0 comments on commit 9c1ab2c

Please sign in to comment.