Browse Source

Add storj application

M. Rehan 3 năm trước cách đây
mục cha
commit
b20cf68cfc

+ 6 - 0
test/storj/1.0.0/Chart.lock

@@ -0,0 +1,6 @@
+dependencies:
+- name: common
+  repository: file://../../../library/common/2207.0.0
+  version: 2207.0.0
+digest: sha256:f17f3d458ca0210a52e39da0dce35034e900b36f2040d4b19bed46a7aae91506
+generated: "2022-08-02T17:37:09.365219548+05:00"

+ 16 - 0
test/storj/1.0.0/Chart.yaml

@@ -0,0 +1,16 @@
+apiVersion: v2
+appVersion: 1.17.5
+icon: https://assets-global.website-files.com/602eda09fc78afc76e9706b6/60917835a05862243e7de9af_logo.svg
+description: Share you storage on internet and earn.
+name: storj
+version: 1.0.0
+dependencies:
+- name: common
+  repository: file://../../../library/common/2207.0.0
+  version: 2207.0.0
+home: https://www.storj.io/
+keywords:
+- storage
+- dapps
+- networking
+- financial

+ 3 - 0
test/storj/1.0.0/README.md

@@ -0,0 +1,3 @@
+# storj
+
+[storj](https://www.storj.io/) share you extra storage and earn money

+ 3 - 0
test/storj/1.0.0/app-readme.md

@@ -0,0 +1,3 @@
+# storj
+
+[storj](https://www.storj.io/) share you extra storage and earn money

BIN
test/storj/1.0.0/charts/common-2207.0.0.tgz


+ 5 - 0
test/storj/1.0.0/ix_values.yaml

@@ -0,0 +1,5 @@
+image:
+  pullPolicy: IfNotPresent
+  repository: storjlabs/storagenode
+  tag: 6a69f0345-v1.57.5-go1.17.5
+identityCreationMountPath: "/root/.local/share/storj/identity/storagenode"

+ 273 - 0
test/storj/1.0.0/questions.yaml

@@ -0,0 +1,273 @@
+groups:
+  - name: "Configuration"
+    description: "Storj application configuration"
+  - name: "Storage"
+    description: "Configure storage for storj"
+  - name: "Networking"
+    description: "Networking Configuration for storj"
+  - name: "Advanced DNS Settings"
+    description: "Configure DNS settings"
+  - name: "Resource Limits"
+    description: "Set CPU/memory limits for Kubernetes Pod"
+
+portals:
+  web_portal:
+    protocols:
+      - "http"
+    host:
+      - "$node_ip"
+    ports:
+      - "$variable-webPort"
+    path: "/"
+
+questions:
+  - variable: webPort
+    label: "Web Port for Storj"
+    group: Networking
+    schema:
+      type: int
+      min: 9000
+      max: 65535
+      default: 20909
+      required: true
+  - variable: nodePort
+    label: "Node Port for Storj"
+    group: Networking
+    schema:
+      type: int
+      min: 9000
+      max: 65535
+      default: 20988
+      required: true
+
+  - variable: dnsConfig
+    label: "DNS Configuration"
+    group: "Advanced DNS Settings"
+    schema:
+      type: dict
+      attrs:
+        - variable: options
+          label: "DNS Options"
+          schema:
+            type: list
+            items:
+              - variable: optionsEntry
+                label: "Option Entry Configuration"
+                schema:
+                  type: dict
+                  attrs:
+                    - variable: name
+                      label: "Option Name"
+                      schema:
+                        type: string
+                        required: true
+                    - variable: value
+                      label: "Option Value"
+                      schema:
+                        type: string
+                        required: true
+
+  - variable: wallet
+    label: "Configure Wallet for Storj"
+    group: "Configuration"
+    schema:
+      type: string
+      required: true
+
+  - variable: authToken
+    label: "Configure Auth token for Storj Node"
+    group: "Configuration"
+    schema:
+      type: string
+      required: true
+
+  - variable: email
+    label: "Configure Email for Storj"
+    group: "Configuration"
+    schema:
+      type: string
+      required: true
+
+  - variable: domainAddress
+    label: "Add Your Storage Domain for Storj"
+    group: "Configuration"
+    schema:
+      type: string
+      required: true
+
+  - variable: storageSize
+    label: "Configure Storage Size You Want To Share in GB's"
+    group: Storage
+    schema:
+      type: int
+      min: 500
+      default: 500
+
+  - variable: runAsUser
+    label: "Owner User ID"
+    group: "Configuration"
+    schema:
+      immutable: true
+      type: int
+      default: 568
+      min: 1
+      max: 65535
+
+  - variable: runAsGroup
+    label: "Owner Group ID"
+    group: "Configuration"
+    schema:
+      immutable: true
+      type: int
+      default: 568
+      min: 1
+      max: 65535
+
+
+  - variable: environmentVariables
+    label: "Storj Extra Environment Variables"
+    group: "Configuration"
+    schema:
+      type: list
+      default: []
+      items:
+        - variable: environmentVariable
+          label: "Environment Variable"
+          schema:
+            type: dict
+            attrs:
+              - variable: name
+                label: "Name"
+                schema:
+                  type: string
+              - variable: value
+                label: "Value"
+                schema:
+                  type: string
+
+  - variable: appVolumeMounts
+    label: "Storj Configuration"
+    group: "Storage"
+    schema:
+      type: dict
+      attrs:
+        - variable: data
+          label: "Configuration Data Volume to Share on Storj"
+          schema:
+            type: dict
+            attrs:
+              - variable: datasetName
+                label: "Configuration Volume Dataset Name"
+                schema:
+                  type: string
+                  hidden: true
+                  $ref:
+                    - "normalize/ixVolume"
+                  show_if: [["hostPathEnabled", "=", false]]
+                  default: "ix_data"
+                  editable: false
+              - variable: mountPath
+                label: "Configuration Mount Path"
+                description: "Path Where the Volume Will be Mounted Inside the Pod"
+                schema:
+                  type: path
+                  hidden: true
+                  editable: false
+                  default: "/app/config"
+              - variable: hostPathEnabled
+                label: "Enable Custom Host Path for Storj Configuration Volume"
+                schema:
+                  type: boolean
+                  default: false
+                  show_subquestions_if: true
+                  subquestions:
+                    - variable: hostPath
+                      label: "Host Path for Storj Configuration Volume"
+                      schema:
+                        type: hostpath
+                        required: true
+        - variable: identity
+          label: "Configure Identity Volume for Storage Node"
+          schema:
+            type: dict
+            attrs:
+              - variable: datasetName
+                label: "Configure Storj Identity Volume to Allocate"
+                schema:
+                  type: string
+                  hidden: true
+                  $ref:
+                    - "normalize/ixVolume"
+                  show_if: [["hostPathEnabled", "=", false]]
+                  default: "ix_identity"
+                  editable: false
+              - variable: mountPath
+                label: "Configure Storj Identity Volume to Allocate"
+                description: "Path where the volume will be mounted inside the pod"
+                schema:
+                  type: path
+                  hidden: true
+                  editable: false
+                  default: "/app/identity"
+              - variable: hostPathEnabled
+                label: "Enable Custom Host Path for Storj Identity Volume"
+                schema:
+                  type: boolean
+                  default: false
+                  show_subquestions_if: true
+                  subquestions:
+                    - variable: hostPath
+                      label: "Host Path for Storj identity Volume"
+                      schema:
+                        type: hostpath
+                        required: true
+
+  - variable: extraAppVolumeMounts
+    label: "Extra Host Path Volumes"
+    group: "Storage"
+    schema:
+      type: list
+      items:
+        - variable: extraAppVolume
+          label: "Host Path Volume"
+          description: "Add an extra host path volume for storj"
+          schema:
+            type: dict
+            attrs:
+              - variable: mountPath
+                label: "Mount Path in Pod"
+                description: "Path where the volume will be mounted inside the pod."
+                schema:
+                  type: path
+                  required: true
+              - variable: hostPath
+                label: "Host Path"
+                description: "Host path"
+                schema:
+                  type: hostpath
+                  required: true
+
+  - variable: enableResourceLimits
+    label: "Enable Pod resource limits"
+    group: "Resource Limits"
+    schema:
+      type: boolean
+      default: false
+  - variable: cpuLimit
+    label: "CPU Limresource limitsit"
+    description: "CPU resource limit allow  plain integer values with suffix m(milli) e.g 1000m, 100."
+    group: "Resource Limits"
+    schema:
+      type: string
+      show_if: [["enableResourceLimits", "=", true]]
+      valid_chars: "^\\d+(?:\\.\\d+(?!.*m$)|m?$)"
+      default: "4000m"
+  - variable: memLimit
+    label: "Memory Limit"
+    group: "Resource Limits"
+    description: "Memory limits is specified by number of bytes. Followed by quantity suffix like E,P,T,G,M,k and Ei,Pi,Ti,Mi,Gi,Ki can also be used. e.g 129e6, 129M,  128974848000m, 123Mi"
+    schema:
+      type: string
+      show_if: [["enableResourceLimits", "=", true]]
+      valid_chars: "^([+-]?[0-9.]+)([eEinumkKMGTP]*[-+]?[0-9]*)$"
+      default: "8Gi"

+ 6 - 0
test/storj/1.0.0/templates/_helpers.tpl

@@ -0,0 +1,6 @@
+{{/*
+Retrieve cert path
+*/}}
+{{- define "certPath" -}}
+{{ printf }}
+{{- end -}}

+ 97 - 0
test/storj/1.0.0/templates/deployment.yaml

@@ -0,0 +1,97 @@
+{{ include "common.storage.hostPathValidate" .Values }}
+apiVersion: {{ template "common.capabilities.deployment.apiVersion" . }}
+kind: Deployment
+metadata:
+  name: {{ template "common.names.fullname" . }}
+  labels:
+    app: {{ template "common.names.name" . }}
+    chart: {{ template "common.names.chart" . }}
+    release: {{ .Release.Name }}
+    heritage: {{ .Release.Service }}
+  annotations:
+    rollme: {{ randAlphaNum 5 | quote }}
+spec:
+  replicas: {{ (default 1 .Values.replicas) }}
+  strategy:
+    type: "Recreate"
+  selector:
+    matchLabels:
+      app: {{ template "common.names.name" . }}
+      release: {{ .Release.Name }}
+  template:
+    metadata:
+      name: {{ template "common.names.fullname" . }}
+      labels:
+        app: {{ template "common.names.name" . }}
+        release: {{ .Release.Name }}
+        {{- include "common.labels.selectorLabels" . | nindent 8 }}
+      annotations: {{ include "common.annotations" . | nindent 8 }}
+    spec:
+      initContainers:
+      - name: generate-identity
+        image: "alpine/curl:latest"
+        securityContext:
+          runAsUser: 0
+          runAsGroup: 0
+        command:
+          - ./init_script/init_config.sh
+        env:
+          {{ $envListIdentity := (default list) }}
+          {{ $envListIdentity = mustAppend $envListIdentity (dict "name" "DEFAULT_CERT_PATH" "value" (printf "%s/ca.cert" .Values.identityCreationMountPath)) }}
+          {{ $envListIdentity = mustAppend $envListIdentity (dict "name" "DEFAULT_IDENTITY_CERT_PATH" "value" (printf "%s/identity.cert" .Values.identityCreationMountPath)) }}
+          {{ $envListIdentity = mustAppend $envListIdentity (dict "name" "AUTH_KEY" "valueFromSecret" true "secretName" "storj-credentials" "secretKey" "authToken") }}
+          {{ include "common.containers.environmentVariables" (dict "environmentVariables" $envListIdentity) | nindent 12 }}
+        volumeMounts:
+          - name: initial-scripts
+            mountPath: /init_script/
+          - name: identity
+            mountPath: {{ .Values.identityCreationMountPath }}
+      - name: setup
+        {{ include "common.containers.imageConfig" .Values.image | nindent 8 }}
+        command:
+          - /bin/sh
+          - -c
+          - 'test ! -f {{ .Values.appVolumeMounts.data.mountPath }}/config.yaml && export SETUP="true"; /entrypoint;'
+          {{ include "common.storage.allContainerVolumeMounts" .Values | nindent 8 }}
+        securityContext:
+          runAsUser: {{ .Values.runAsUser }}
+          runAsGroup: {{ .Values.runAsGroup }}
+      containers:
+        - name: {{ .Chart.Name }}
+          {{ include "common.containers.imageConfig" .Values.image | nindent 10 }}
+          {{ include "common.resources.limitation" . | nindent 10 }}
+          volumeMounts: {{ include "common.storage.configureAppVolumeMountsInContainer" .Values | nindent 12 }}
+          {{ range $index, $hostPathConfiguration := .Values.extraAppVolumeMounts }}
+            - name: extrappvolume-{{ $index }}
+              mountPath: {{ $hostPathConfiguration.mountPath }}
+          {{ end }}
+          securityContext:
+            runAsUser: {{ .Values.runAsUser }}
+            runAsGroup: {{ .Values.runAsGroup }}
+          ports:
+            - name: web
+              containerPort: 14002
+            - name: tcp
+              containerPort: 28967
+              protocol: TCP
+            - name: udp
+              containerPort: 28967
+              protocol: UDP
+          env:
+            {{ $envList := (default list .Values.environmentVariables) }}
+            {{ $envList = mustAppend $envList (dict "name" "WALLET" "valueFromSecret" true "secretName" "storj-credentials" "secretKey" "wallet") }}
+            {{ $envList = mustAppend $envList (dict "name" "ADDRESS" "value" (printf "%s:%d" (.Values.domainAddress) (.Values.nodePort | int))) }}
+            {{ $envList = mustAppend $envList (dict "name" "EMAIL" "value" (printf "%s" (.Values.email))) }}
+            {{ $envList = mustAppend $envList (dict "name" "STORAGE" "value" (printf "%dGB" (.Values.storageSize | int))) }}
+            {{ include "common.containers.environmentVariables" (dict "environmentVariables" $envList) | nindent 12 }}
+{{ include "common.networking.dnsConfiguration" .Values | nindent 6 }}
+      volumes: {{ include "common.storage.configureAppVolumes" .Values | nindent 8 }}
+      {{ range $index, $hostPathConfiguration := .Values.extraAppVolumeMounts }}
+        - name: extrappvolume-{{ $index }}
+          hostPath:
+            path: {{ $hostPathConfiguration.hostPath }}
+      {{ end }}
+        - name: initial-scripts
+          configMap:
+            defaultMode: 0755
+            name: "initial-scripts"

+ 18 - 0
test/storj/1.0.0/templates/initial_scripts.yaml

@@ -0,0 +1,18 @@
+apiVersion: v1
+kind: ConfigMap
+metadata:
+  name: "initial-scripts"
+  annotations:
+    rollme: {{ randAlphaNum 5 | quote }}
+
+data:
+  init_config.sh: |-
+    #!/bin/sh
+    if ! [ -f ${DEFAULT_CERT_PATH} ] && ! [ -f ${DEFAULT_IDENTITY_CERT_PATH} ]; then
+      curl -L https://github.com/storj/storj/releases/latest/download/identity_linux_amd64.zip -o identity_linux_amd64.zip
+      unzip -o identity_linux_amd64.zip
+      chmod +x identity
+      ./identity create storagenode
+      ./identity authorize storagenode ${AUTH_KEY}
+      chown -R {{ .Values.runAsUser }}:{{ .Values.runAsGroup }} {{ .Values.identityCreationMountPath }}
+    fi

+ 28 - 0
test/storj/1.0.0/templates/pre-install-job.yaml

@@ -0,0 +1,28 @@
+apiVersion: batch/v1
+kind: Job
+metadata:
+  name: "{{ template "common.names.fullname" . }}-preinstall-job"
+  labels:
+    app.kubernetes.io/managed-by: {{ .Release.Service | quote }}
+    app.kubernetes.io/instance: {{ .Release.Name | quote }}
+    app.kubernetes.io/version: {{ .Chart.AppVersion }}
+    helm.sh/chart: {{ template "common.names.chart" . }}
+  annotations:
+    "helm.sh/hook": pre-install
+    "helm.sh/hook-delete-policy": hook-succeeded
+spec:
+  template:
+    metadata:
+      name: "{{ template "common.names.fullname" . }}-preinstall-hook"
+      labels:
+        app.kubernetes.io/managed-by: {{ .Release.Service | quote }}
+        app.kubernetes.io/instance: {{ .Release.Name | quote }}
+        helm.sh/chart: {{ template "common.names.chart" . }}
+    spec:
+      restartPolicy: Never
+      containers:
+      - name: pre-install-job
+        image: "alpine:latest"
+        command: ["chown", "-R", "{{ .Values.runAsUser }}:{{ .Values.runAsGroup }}", "{{ .Values.appVolumeMounts.data.mountPath }}", "{{ .Values.appVolumeMounts.identity.mountPath }}"]
+        volumeMounts: {{ include "common.storage.configureAppVolumeMountsInContainer" .Values | nindent 12 }}
+      volumes: {{ include "common.storage.configureAppVolumes" .Values | nindent 8 }}

+ 11 - 0
test/storj/1.0.0/templates/service.yaml

@@ -0,0 +1,11 @@
+{{ $selectors := list }}
+{{ $selectors = mustAppend $selectors (dict "key" "app" "value" (include "common.names.name" .) ) }}
+{{ $selectors = mustAppend $selectors (dict "key" "release" "value" .Release.Name ) }}
+{{ $ports := list }}
+{{ $ports = mustAppend $ports (dict "name" "web" "port" .Values.webPort "nodePort" .Values.webPort "targetPort" 14002) }}
+{{ $ports = mustAppend $ports (dict "name" "tcp" "port" .Values.nodePort "nodePort" .Values.nodePort "targetPort" 28967) }}
+{{ $ports = mustAppend $ports (dict "name" "udp" "port" .Values.nodePort "nodePort" .Values.nodePort "targetPort" 28967 "protocol" "UDP") }}
+{{ $params := . }}
+{{ $_ := set $params "commonService" (dict "type" "NodePort" "ports" $ports ) }}
+{{ $_1 := set .Values "extraSelectorLabels" $selectors }}
+{{ include "common.classes.service" $params }}

+ 9 - 0
test/storj/1.0.0/templates/storj-secrets.yaml

@@ -0,0 +1,9 @@
+apiVersion: v1
+kind: Secret
+metadata:
+  name: storj-credentials
+  labels: {{ include "common.labels" . | nindent 4 }}
+type: Opaque
+data:
+  authToken: {{ .Values.authToken | b64enc | quote }}
+  wallet: {{ .Values.wallet | b64enc | quote }}

+ 26 - 0
test/storj/1.0.0/test_values.yaml

@@ -0,0 +1,26 @@
+image:
+  pullPolicy: IfNotPresent
+  repository: storjlabs/storagenode
+  tag: 6a69f0345-v1.57.5-go1.17.5
+environmentVariables: []
+extraAppVolumeMounts: []
+webPort: 30000
+nodePort: 30002
+storageSize: 500
+wallet: "0xXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
+email: "user@example.com"
+dnsConfig:
+  options: []
+emptyDirVolumes: true
+appVolumeMounts:
+  data:
+    emptyDir: true
+    mountPath: /app/config
+  identity:
+    emptyDir: true
+    mountPath: /app/identity
+authToken: "user:sasjkadkjhakdlaskdlkajsd"
+identityCreationMountPath: "/root/.local/share/storj/identity/storagenode"
+domainAddress: "localhost"
+runAsUser: 568
+runAsGroup: 568

+ 6 - 0
test/storj/item.yaml

@@ -0,0 +1,6 @@
+icon_url: https://assets-global.website-files.com/602eda09fc78afc76e9706b6/60917835a05862243e7de9af_logo.svg
+categories:
+- storage
+- dapps
+- networking
+- finantial