diff --git a/Makefile b/Makefile new file mode 100644 index 0000000000..2cd6b18b89 --- /dev/null +++ b/Makefile @@ -0,0 +1,4 @@ + +validate: + @helm dependency update ./test/machinaris/1.0.11 + @helm template --values ./test/machinaris/1.0.11/ix_values.yaml machinaris ./test/machinaris/1.0.11 --debug \ No newline at end of file diff --git a/library/common/2105.0.0/templates/lib/containers/_image.tpl b/library/common/2105.0.0/templates/lib/containers/_image.tpl index 4a5a368008..2b2b04561d 100644 --- a/library/common/2105.0.0/templates/lib/containers/_image.tpl +++ b/library/common/2105.0.0/templates/lib/containers/_image.tpl @@ -4,6 +4,6 @@ Retrieve image configuration for container {{- define "common.containers.imageConfig" -}} {{- $values := . -}} {{- include "common.schema.validateKeys" (dict "values" $values "checkKeys" (list "repository" "tag" "pullPolicy")) -}} -image: "{{ $values.repository }}:{{ $values.tag }}" +image: "{{ $values.repository }}{{- if hasKey $values "postfix" -}}-{{ $values.postfix }}{{- end -}}:{{ $values.tag }}" imagePullPolicy: {{ $values.pullPolicy }} {{- end -}} diff --git a/library/common/2105.0.0/templates/lib/containers/_port.tpl b/library/common/2105.0.0/templates/lib/containers/_port.tpl new file mode 100644 index 0000000000..7833994311 --- /dev/null +++ b/library/common/2105.0.0/templates/lib/containers/_port.tpl @@ -0,0 +1,12 @@ +{{/* +Retrieve ports configuration for container +*/}} +{{- define "common.containers.configurePorts" -}} +ports: +{{- range $index, $port := .ports -}} +{{- include "common.schema.validateKeys" (dict "values" $port "checkKeys" (list "protocol" "containerPort")) }} +- protocol: {{ $port.protocol }} + containerPort: {{ $port.containerPort }} + {{- if hasKey $port "name" }}name: {{ $port.name }}{{ end -}} +{{- end }} +{{ end -}} diff --git a/library/common/2105.0.0/templates/lib/storage/_appStorage.tpl b/library/common/2105.0.0/templates/lib/storage/_appStorage.tpl index 0651870eb1..7e83dddf0e 100644 --- a/library/common/2105.0.0/templates/lib/storage/_appStorage.tpl +++ b/library/common/2105.0.0/templates/lib/storage/_appStorage.tpl @@ -29,23 +29,23 @@ Define hostPath for appVolumes {{- $values := . -}} {{- if $values.appVolumeMounts -}} {{- range $name, $av := $values.appVolumeMounts -}} -{{ if (default true $av.enabled) }} +{{ if (default true $av.enabled) -}} - name: {{ $name }} - {{ if or $av.emptyDir $.emptyDirVolumes }} + {{- if or $av.emptyDir $.emptyDirVolumes }} emptyDir: {} {{- else -}} hostPath: - {{ if $av.hostPathEnabled }} + {{- if $av.hostPathEnabled }} path: {{ required "hostPath not set" $av.hostPath }} {{ else }} {{- include "common.schema.validateKeys" (dict "values" $values "checkKeys" (list "ixVolumes")) -}} {{- include "common.schema.validateKeys" (dict "values" $av "checkKeys" (list "datasetName")) -}} {{- $volDict := dict "datasetName" $av.datasetName "ixVolumes" $values.ixVolumes -}} path: {{ include "common.storage.retrieveHostPathFromiXVolume" $volDict }} - {{ end }} - {{ end }} + {{ end -}} + {{- end -}} {{ end }} -{{- end -}} +{{ end -}} {{- end -}} {{- end -}} diff --git a/test/machinaris/1.0.11/Chart.yaml b/test/machinaris/1.0.11/Chart.yaml index 2dd13f5a7f..ae80f76f96 100644 --- a/test/machinaris/1.0.11/Chart.yaml +++ b/test/machinaris/1.0.11/Chart.yaml @@ -1,5 +1,5 @@ apiVersion: v1 -appVersion: v0.6.1 +appVersion: v0.6.4 dependencies: - name: common repository: file://../../../library/common/2112.0.0 diff --git a/test/machinaris/1.0.11/charts/common-2105.0.0.tgz b/test/machinaris/1.0.11/charts/common-2105.0.0.tgz new file mode 100644 index 0000000000..a1defeb195 Binary files /dev/null and b/test/machinaris/1.0.11/charts/common-2105.0.0.tgz differ diff --git a/test/machinaris/1.0.11/ix_values.yaml b/test/machinaris/1.0.11/ix_values.yaml index 7ec908a19e..8023edc16f 100644 --- a/test/machinaris/1.0.11/ix_values.yaml +++ b/test/machinaris/1.0.11/ix_values.yaml @@ -1,5 +1,88 @@ image: pullPolicy: IfNotPresent repository: ghcr.io/guydavis/machinaris - tag: v0.6.1 + tag: v0.6.4 +appVolumeMounts: + config: + emptyDir: true + mountPath: /data + plots: + emptyDir: true + mountPath: /plots +coins: + - name: cactus + apiPort: 8936 + ports: + - protocol: TCP + containerPort: 8936 + - protocol: TCP + containerPort: 11444 + - protocol: TCP + containerPort: 11447 + - name: chives + apiPort: 8931 + ports: + - protocol: TCP + containerPort: 8931 + - protocol: TCP + containerPort: 9699 + - protocol: TCP + containerPort: 9647 + - name: flax + apiPort: 8928 + ports: + - protocol: TCP + containerPort: 8928 + - protocol: TCP + containerPort: 6888 + - protocol: TCP + containerPort: 6885 + - name: flora + apiPort: 8936 + ports: + - protocol: TCP + containerPort: 8932 + - protocol: TCP + containerPort: 18644 + - protocol: TCP + containerPort: 18647 + - name: hddcoin + apiPort: 8936 + ports: + - protocol: TCP + containerPort: 8930 + - protocol: TCP + containerPort: 28444 + - protocol: TCP + containerPort: 28447 + - name: nchain + apiPort: 8936 + ports: + - protocol: TCP + containerPort: 8929 + - protocol: TCP + containerPort: 58445 + - protocol: TCP + containerPort: 38447 + - name: stacoin + apiPort: 8936 + ports: + - protocol: TCP + containerPort: 8934 + - protocol: TCP + containerPort: 1999 + - protocol: TCP + containerPort: 1692 + - name: stor + apiPort: 8936 + ports: + - protocol: TCP + containerPort: 8935 + - protocol: TCP + containerPort: 8668 + - protocol: TCP + containerPort: 8337 +machinaris_ui_port: 31003 +timezone: America/Edmonton updateStrategy: Recreate +nodeIP: 127.0.0.1 diff --git a/test/machinaris/1.0.11/templates/coins-deployment.yaml b/test/machinaris/1.0.11/templates/coins-deployment.yaml new file mode 100644 index 0000000000..3af155ba09 --- /dev/null +++ b/test/machinaris/1.0.11/templates/coins-deployment.yaml @@ -0,0 +1,51 @@ +{{- $ref := . }} +{{- range $coin := $ref.Values.coins }} +{{ $_ := set $ref "common" (dict "nameSuffix" $coin.name) }} +apiVersion: {{ template "common.capabilities.deployment.apiVersion" $ref }} +kind: Deployment +metadata: + name: {{ template "common.names.fullname" $ref }} + labels: {{ include "common.labels" $ref | nindent 4 }} +spec: + strategy: + type: {{ $ref.Values.updateStrategy }} + selector: + matchLabels: {{ include "common.labels.selectorLabels" $ref | nindent 6 }} + template: + metadata: + name: {{ template "common.names.fullname" $ref }} + labels: {{ include "common.labels.selectorLabels" $ref | nindent 8 }} + spec: + containers: + - name: {{ $ref.Chart.Name }} + {{ if $ref.Values.enableResourceLimits }} + resources: + limits: + cpu: {{ $ref.Values.cpuLimit }} + memory: {{ $ref.Values.memLimit }} + {{ end }} + tty: true + {{ include "common.containers.imageConfig" (dict "repository" $ref.Values.image.repository "tag" $ref.Values.image.tag "pullPolicy" $ref.Values.image.pullPolicy "postfix" $ref.common.nameSuffix) | nindent 10 }} + {{ include "common.containers.configurePorts" $coin | nindent 10 }} + volumeMounts: {{ include "common.storage.configureAppVolumeMountsInContainer" $ref.Values | nindent 12 }} + {{ range $index, $hostPathConfiguration := $ref.Values.extraAppVolumeMounts }} + - name: extrappvolume-{{ $index }} + mountPath: {{ $hostPathConfiguration.mountPath }} + {{ end }} + {{ $envList := (default list $ref.Values.environmentVariables) }} + {{ $envList = mustAppend $envList (dict "name" "TZ" "value" $ref.Values.timezone) }} + {{ $envList = mustAppend $envList (dict "name" "worker_address" "value" $ref.Values.nodeIP) }} + {{ $envList = mustAppend $envList (dict "name" "controller_host" "value" $ref.Values.nodeIP) }} + {{ $envList = mustAppend $envList (dict "name" "worker_api_port" "value" $coin.apiPort) }} + {{ $envList = mustAppend $envList (dict "name" "blockchains" "value" $coin.name) }} + {{ $envList = mustAppend $envList (dict "name" "plots_dir" "value" $ref.Values.appVolumeMounts.plots.mountPath) }} + {{ $envList = mustAppend $envList (dict "name" "mode" "value" "fullnode") }} + {{ include "common.containers.allEnvironmentVariables" (dict "environmentVariables" $envList) | nindent 10 }} + volumes: {{ include "common.storage.configureAppVolumes" $ref.Values | nindent 8 }} + {{ range $index, $hostPathConfiguration := $ref.Values.extraAppVolumeMounts }} + - name: extrappvolume-{{ $coin.name }}-{{ $index }} + hostPath: + path: {{ $hostPathConfiguration.hostPath }} + {{ end }} +--- +{{- end }} diff --git a/test/machinaris/1.0.11/templates/service.yaml b/test/machinaris/1.0.11/templates/service.yaml index bc10f57869..5b5eec5aad 100644 --- a/test/machinaris/1.0.11/templates/service.yaml +++ b/test/machinaris/1.0.11/templates/service.yaml @@ -4,3 +4,4 @@ {{ $params := . }} {{ $_ := set $params "commonService" (dict "ports" $ports "type" "NodePort" ) }} {{ include "common.classes.service" $params }} +{{ }} diff --git a/test/machinaris/1.0.11/test_values.yaml b/test/machinaris/1.0.11/test_values.yaml index d3554a85a9..f628b08e7b 100644 --- a/test/machinaris/1.0.11/test_values.yaml +++ b/test/machinaris/1.0.11/test_values.yaml @@ -8,7 +8,7 @@ appVolumeMounts: image: pullPolicy: IfNotPresent repository: ghcr.io/guydavis/machinaris - tag: v0.6.1 + tag: v0.6.4 machinaris_ui_port: 31003 timezone: America/Edmonton updateStrategy: Recreate