Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PAK-4249] modify for rosa #101

Merged
merged 5 commits into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 8 additions & 7 deletions charts/smartmet-server/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,18 @@ apiVersion: v2
description: Helm chart for smartmet server
home: "file"
keywords:
- fmi
- smartmet
- fmi
- smartmet
- smartmet-server
# dependencies:
# - name: redis
# repository: https://charts.bitnami.com/bitnami
# version: 18.19.2
# condition: redis.enabled
# condition: config.redis.enabled
maintainers:
- email: admin@weatherproof.fi
name: fmi-build-bot
url: https://github.com/fmi-build-bot
- email: admin@weatherproof.fi
name: fmi-build-bot
url: https://github.com/fmi-build-bot
name: smartmet-server
type: application
version: 0.1.2
version: 0.1.6
42 changes: 23 additions & 19 deletions charts/smartmet-server/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,25 +15,29 @@ spec:
labels:
app: {{ .Release.Name }}
spec:
#TODO proper sa template
serviceAccountName: ptrace-sa-v1
{{- if .Values.serviceAccount.enabled }}
serviceAccountName: {{ default "smartmet-server-serviceaccount" .Values.serviceAccount.name }}
{{- end }}
securityContext:
runAsNonRoot: true
runAsGroup: 0
# TODO proper pullsecret
{{- if .Values.image.pullSecret }}
imagePullSecrets:
- name: fmi-openshift-pull-secret
- name: {{ .Values.image.pullSecret }}
{{- end }}
#TODO only if using internal redis
initContainers:
{{- if .Values.config.redis.enabled }}
- name: wait-for-redis
image: busybox
command: ['/bin/sh', '-c']
args:
- |
until echo quit | telnet {{ default "redis-master.smartmet-server-development" .Values.filesys2smartmet.config.redis.address }} {{ default 6379 .Values.filesys2smartmet.config.redis.port }} ; do
until echo quit | telnet {{ default (printf "redis-master.%s" .Release.Name) .Values.config.redis.address }} {{ default 6379 .Values.config.redis.port }} ; do
echo 'waiting for database...'
sleep 2
done
{{- end }}
containers:
- name: {{ .Release.Name }}
securityContext:
Expand All @@ -45,11 +49,11 @@ spec:
- SYS_PTRACE
resources:
requests:
memory: 2Gi
cpu: 0.2
memory: {{ default "8Gi" .Values.resources.requests.memory }}
cpu: {{ default "1" .Values.resources.requests.cpu }}
limits:
memory: 8Gi
cpu: 1
memory: {{ default "16Gi" .Values.resources.limits.memory }}
cpu: {{ default "2" .Values.resources.limits.cpu }}
image: {{ .Values.image.repository }}:{{ .Values.image.tag }}
{{- if .Values.image.pullPolicy }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
Expand All @@ -71,52 +75,52 @@ spec:
- name: FMINAMES_USER
valueFrom:
secretKeyRef:
name: smartmet-server-sealedsecrets
name: {{ .Values.secrets.name }}
key: FMINAMES_USER
- name: FMINAMES_PASSWORD
valueFrom:
secretKeyRef:
name: smartmet-server-sealedsecrets
name: {{ .Values.secrets.name }}
key: FMINAMES_PW
- name: FMINAMES_HOST
valueFrom:
secretKeyRef:
name: smartmet-server-sealedsecrets
name: {{ .Values.secrets.name }}
key: FMINAMES_HOST
- name: FMINAMES_PORT
valueFrom:
secretKeyRef:
name: smartmet-server-sealedsecrets
name: {{ .Values.secrets.name }}
key: FMINAMES_PORT
- name: FMINAMES_DATABASE
valueFrom:
secretKeyRef:
name: smartmet-server-sealedsecrets
name: {{ .Values.secrets.name }}
key: FMINAMES_DATABASE
- name: GIS_USER
valueFrom:
secretKeyRef:
name: smartmet-server-sealedsecrets
name: {{ .Values.secrets.name }}
key: GIS_USER
- name: GIS_PASSWORD
valueFrom:
secretKeyRef:
name: smartmet-server-sealedsecrets
name: {{ .Values.secrets.name }}
key: GIS_PW
- name: GIS_HOST
valueFrom:
secretKeyRef:
name: smartmet-server-sealedsecrets
name: {{ .Values.secrets.name }}
key: GIS_HOST
- name: GIS_PORT
valueFrom:
secretKeyRef:
name: smartmet-server-sealedsecrets
name: {{ .Values.secrets.name }}
key: GIS_PORT
- name: GIS_DATABASE
valueFrom:
secretKeyRef:
name: smartmet-server-sealedsecrets
name: {{ .Values.secrets.name }}
key: GIS_DATABASE
volumeMounts:
- name: smartmet-main-configuration
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- if .Values.filesys2smartmet.enabled }}
apiVersion: apps/v1
kind: Deployment
metadata:
Expand All @@ -15,25 +16,28 @@ spec:
labels:
app: {{ .Release.Name }}
spec:
#TODO SA definition template
serviceAccountName: ptrace-sa-v1
{{- if .Values.serviceAccount.enabled }}
serviceAccountName: {{ default "smartmet-server-serviceaccount" .Values.serviceAccount.name }}
{{- end }}
securityContext:
runAsNonRoot: true
runAsGroup: 0
#TODO Pull secret templating
{{- if .Values.image.pullSecret }}
imagePullSecrets:
- name: fmi-openshift-pull-secret
#TODO only if using internal redis
- name: {{ .Values.image.pullSecret }}
{{- end }}
initContainers:
{{- if .Values.config.redis.enabled }}
- name: wait-for-redis
image: busybox
command: ['/bin/sh', '-c']
args:
- |
until echo quit | telnet {{ default "redis-master.{{ .Release.Name }}" .Values.filesys2smartmet.config.redis.address }} {{ default 6379 .Values.filesys2smartmet.config.redis.port }} ; do
until echo quit | telnet {{ default (printf "redis-master.%s" .Release.Name) .Values.config.redis.address }} {{ default 6379 .Values.config.redis.port }} ; do
echo 'waiting for database...'
sleep 2
done
{{- end }}
containers:
- name: filesys2smartmet
securityContext:
Expand All @@ -43,23 +47,23 @@ spec:
- SYS_PTRACE
resources:
requests:
memory: 2Gi
cpu: 0.2
memory: {{ default "8Gi" .Values.resources.requests.memory }}
cpu: {{ default "1" .Values.resources.requests.cpu }}
limits:
memory: 8Gi
cpu: 1
memory: {{ default "16Gi" .Values.resources.limits.memory }}
cpu: {{ default "2" .Values.resources.limits.cpu }}
image: {{ .Values.filesys2smartmet.image.repository }}:{{ .Values.filesys2smartmet.image.tag }}
{{- if .Values.filesys2smartmet.image.pullPolicy }}
imagePullPolicy: {{ .Values.filesys2smartmet.image.pullPolicy }}
{{- end }}
command: ["/usr/bin/fmi/filesys2smartmet", "/config/filesys2smartmet.conf", "{{ default 60 .Values.filesys2smartmet.config.loopInterval}}" ]
env:
- name: REDIS_CONTENT_SERVER_ADDRESS
value: "{{ default "redis-master.{{ .Release.Name }}" .Values.filesys2smartmet.config.redis.address }}"
value: "{{ default "redis-master.{{ .Release.Name }}" .Values.config.redis.address }}"
- name: REDIS_CONTENT_SERVER_PORT
value: "{{ default 6379 .Values.filesys2smartmet.config.redis.port }}"
value: "{{ default 6379 .Values.config.redis.port }}"
- name: REDIS_CONTENT_SERVER_TABLE_PREFIX
value: "{{ default "smartmet." .Values.filesys2smartmet.config.redis.tablePrefix }}"
value: "{{ default "smartmet." .Values.config.redis.tablePrefix }}"
volumeMounts:
- name: filesys2smartmet-config
mountPath: "/config/filesys2smartmet.conf"
Expand All @@ -70,17 +74,16 @@ spec:
- name: filesys2smartmet-producerdef-config
mountPath: "/config/libraries/grid-tools/producerDef.csv"
subPath: "producerDef.csv"
{{- if and .Values.pvc.name .Values.pvc.mountPath }}
{{- if and .Values.pvc.name .Values.pvc.mountPath }}
- name: {{ .Values.pvc.name }}
mountPath: {{ .Values.pvc.mountPath }}
{{- end }}

volumes:
{{- if and .Values.pvc.name .Values.pvc.claimName }}
{{- end }}
volumes:
{{- if and .Values.pvc.name .Values.pvc.claimName }}
- name: {{ .Values.pvc.name }}
persistentVolumeClaim:
claimName: {{ .Values.pvc.claimName }}
{{- end }}
{{- end }}
- name: filesys2smartmet-config
configMap:
name: filesys2smartmet-config
Expand All @@ -99,3 +102,4 @@ spec:
items:
- key: producerdef
path: producerDef.csv
{{- end }}
42 changes: 42 additions & 0 deletions charts/smartmet-server/templates/gitsync/wms-gitsync.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{{- if not .Values.config.plugins.wms.disabled }}
# apiVersion: apps/v1
# kind: Deployment
# metadata:
# name: {{ .Release.name }}-wms-layer-git-sync
# spec:
# replicas: 1
# selector:
# matchLabels:
# app: {{ .Release.Name }}
# template:
# metadata:
# labels:
# app: {{ .Release.Name }}
# spec:
# securityContext:
# # Set this to any valid GID, and two things happen:
# # 1) The volume "content-from-git" is group-owned by this GID.
# # 2) This GID is added to each container.
# fsGroup: 0
# volumes:
# - name: wms-layers
# emptyDir: {}
# containers:
# - name: git-sync
# # This container pulls git data and publishes it into volume
# # "content-from-git". In that volume you will find a symlink
# # "current" (see -dest below) which points to a checked-out copy of
# # the master branch (see -branch) of the repo (see -repo).
# # NOTE: git-sync already runs as non-root.
# image: registry.k8s.io/git-sync/git-sync:v4.0.0
# args:
# - --repo={{ .Values.config.plugins.wms.gitSync.repository }}
# - --branch={{ .Values.config.plugins.wms.gitSync.branch }}
# - --depth=1
# - --period={{ .Values.config.plugins.wms.gitSync.period }}s
# - --link=current
# - --root=/wms-layers
# volumeMounts:
# - name: wms-layers
# mountPath: /wms-layers
{{- end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: radon-to-smartmet-config
data:
configuration: |
##################################################################
# smartmet-tools-grid : radon2smartmet
##################################################################

# This is a configuration file for "radon2smartmet" program.
# The program is used for synchronizing content information
# in the Redis database according to the information stored
# into the Radon database.

##################################################################

# Importing global configuration parameters. There should be
# an environment variable SMARTMET_ENV_FILE that points to
# the global configuration file. The idea is that you can easily
# change your environment by editing this file.


# This information is needed for initializing the grid-library.

smartmet.library.grid-files.configFile = "/config/libraries/grid-files/grid-files.conf"



smartmet :
{
tools :
{
grid :
{


radon2smartmet :
{
# The "addFileInfoListWithContent" message can contain max this many records:

maxMessageSize = 10000


content-source :
{
# There might be different content sources that update information
# in the content server. That's why they should have an unique identifier.

source-id = 100


# This file contains a list of producer names which content is updated
# to the content server.

producerFile = "$(RADON_PRODUCERFILE)"

radon :
{
connection-string = "host=$(RADON_HOST) dbname=$(RADON_DATABASE) user=$(RADON_USER) password=$(RADON_PASSWORD)"
}

}


content-storage :
{
# Content storage type (redis/corba/http)

type = "redis"

redis :
{
address = "$(REDIS_CONTENT_SERVER_ADDRESS)"
#address = "127.0.0.1"
port = $(REDIS_CONTENT_SERVER_PORT)
tablePrefix = "$(REDIS_CONTENT_SERVER_TABLE_PREFIX)"
}

corba :
{
ior = "$(CORBA_CONTENT_SERVER_IOR)"
}

http :
{
url = "$(HTTP_CONTENT_SERVER_URL)"
}
}

processing-log :
{
enabled = false
file = "/dev/stdout"
# file = "$(GRID_TOOLS_LOG_DIR)/radon2smartmet_processing.log"
maxSize = 100000000
truncateSize = 20000000
}

debug-log :
{
enabled = true
file = "/dev/stdout"
# file = "$(GRID_TOOLS_LOG_DIR)/radon2smartmet_debug.log"
maxSize = 100000000
truncateSize = 20000000
}

}


}
}
}
Loading
Loading