diff --git a/charts/karpor/Chart.yaml b/charts/karpor/Chart.yaml index 8c671ed..1fd8949 100644 --- a/charts/karpor/Chart.yaml +++ b/charts/karpor/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v2 name: karpor -version: 0.7.5 +version: 0.7.6 type: application appVersion: 0.6.3 description: A modern kubernetes visualization tool (Karpor). diff --git a/charts/karpor/README.md b/charts/karpor/README.md index 31d4ff2..8625497 100644 --- a/charts/karpor/README.md +++ b/charts/karpor/README.md @@ -57,6 +57,11 @@ The following table lists the configurable parameters of the chart and their def | namespace | string | `"karpor"` | Which namespace to be deployed. | | namespaceEnabled | bool | `true` | Whether to generate namespace. | | registryProxy | string | `""` | Image registry proxy will be the prefix as all component image. | +| search.engine | string | `"elasticsearch"` | Engine for storage,may elasticsearch or meilisearch | +| search.external.addresses | list | `["192.168.0.1:3456"]` | Address for search engine | +| search.external.enabled | bool | `false` | If external is set to be true. and fill the connection information in "external" section | +| search.external.password | string | `""` | password for search engine | +| search.external.username | string | `""` | Username for search engine | ### Global Parameters @@ -117,6 +122,19 @@ The ElasticSearch Component to store the synchronized resources and user data. | elasticsearch.replicas | int | `1` | The number of ElasticSearch pods to run. | | elasticsearch.resources | object | `{"limits":{"cpu":"2","ephemeral-storage":"10Gi","memory":"4Gi"},"requests":{"cpu":"2","ephemeral-storage":"10Gi","memory":"4Gi"}}` | Resource limits and requests for the karpor elasticsearch pods. | +The MeiliSearch Component to store the synchronized resources and user data. + +| Key | Type | Default | Description | +|-----|------|---------|-------------| +| meilisearch.image.repo | string | `"getmeili/meilisearch"` | Repository for meilisearch image. | +| meilisearch.image.tag | string | `"v1.13"` | Specific tag for meilisearch image. | +| meilisearch.key | string | `"danger!changeIt"` | Default master key | +| meilisearch.name | string | `"meilisearch"` | Component name for meilisearch. | +| meilisearch.noAnalytics | bool | `true` | | +| meilisearch.port | int | `7700` | Port for meilisearch. | +| meilisearch.replicas | int | `1` | The number of meilisearch pods to run. | +| meilisearch.resources | object | `{"limits":{"cpu":"2","ephemeral-storage":"10Gi","memory":"4Gi"},"requests":{"cpu":"2","ephemeral-storage":"10Gi","memory":"4Gi"}}` | Resource limits and requests for the karpor meilisearch pods. | + ### ETCD The ETCD Component is the storage of Karpor Server as `apiserver`. diff --git a/charts/karpor/README.md.gotmpl b/charts/karpor/README.md.gotmpl index 87e00f9..02f9641 100644 --- a/charts/karpor/README.md.gotmpl +++ b/charts/karpor/README.md.gotmpl @@ -48,7 +48,7 @@ The following table lists the configurable parameters of the chart and their def | Key | Type | Default | Description | |-----|------|---------|-------------| {{- range .Values }} - {{- if not (or (hasPrefix "global" .Key) (hasPrefix "server" .Key) (hasPrefix "syncer" .Key) (hasPrefix "elasticsearch" .Key) (hasPrefix "etcd" .Key) (hasPrefix "job" .Key) ) }} + {{- if not (or (hasPrefix "global" .Key) (hasPrefix "server" .Key) (hasPrefix "syncer" .Key) (hasPrefix "elasticsearch" .Key) (hasPrefix "meilisearch" .Key) (hasPrefix "etcd" .Key) (hasPrefix "job" .Key) ) }} | {{ .Key }} | {{ .Type }} | {{ if .Default }}{{ .Default }}{{ else }}{{ .AutoDefault }}{{ end }} | {{ if .Description }}{{ .Description }}{{ else }}{{ .AutoDescription }}{{ end }} | {{- end }} {{- end }} @@ -99,6 +99,17 @@ The ElasticSearch Component to store the synchronized resources and user data. {{- end }} {{- end }} +The MeiliSearch Component to store the synchronized resources and user data. + +| Key | Type | Default | Description | +|-----|------|---------|-------------| +{{- range .Values }} + {{- if hasPrefix "meilisearch" .Key }} +| {{ .Key }} | {{ .Type }} | {{ if .Default }}{{ .Default }}{{ else }}{{ .AutoDefault }}{{ end }} | {{ if .Description }}{{ .Description }}{{ else }}{{ .AutoDescription }}{{ end }} | + {{- end }} +{{- end }} + + ### ETCD The ETCD Component is the storage of Karpor Server as `apiserver`. diff --git a/charts/karpor/templates/_common.tpl b/charts/karpor/templates/_common.tpl index dc0704b..02923cd 100644 --- a/charts/karpor/templates/_common.tpl +++ b/charts/karpor/templates/_common.tpl @@ -34,3 +34,70 @@ Real image. .repo | join "/") }}:{{ if .needV }}v{{ end }}{{ default .context.Chart.AppVersion .tag }} {{- end -}} +{{/* +ElasticSearch URL. +*/}} +{{- define "elasticsearch.url" -}} +{{ if .Values.search.external.enabled }}{{ .Values.search.external.addresses | join "," }}{{else}}http://elasticsearch.{{ .Values.namespace }}.svc:{{ .Values.elasticsearch.port }}{{end}} +{{- end -}} + +{{/* +Meilisearch URL. +*/}} +{{- define "meilisearch.url" -}} +{{ if .Values.search.external.enabled }}{{ .Values.search.external.addresses | join "," }}{{else}}http://meilisearch.{{ .Values.namespace }}.svc:{{ .Values.meilisearch.port }}{{end}} +{{- end -}} + + + +{{/* +Search URL Args. +*/}} +{{- define "karpor.searchURL" -}} +{{ if eq .Values.search.engine "meilisearch" }}{{ include "meilisearch.url" .}}{{else}}{{ include "elasticsearch.url" . }}{{ end }} +{{- end -}} + +{{/* +Search User Args. +*/}} +{{- define "karpor.searchUsername" -}} +{{ if eq .Values.search.engine "meilisearch" }}{{ include "meilisearch.user" . }}{{else}}{{ include "elasticsearch.user" . }}{{ end }} +{{- end -}} + +{{/* +Search Password Args. +*/}} +{{- define "karpor.searchPassword" -}} +{{ if eq .Values.search.engine "meilisearch" }}{{ include "meilisearch.password" . }}{{else}}{{ include "elasticsearch.password" . }}{{ end }} +{{- end -}} + +{{/* +Meilisearch User. +*/}} +{{- define "meilisearch.user" -}} +{{ if .Values.search.external.enabled }}{{ .Values.search.external.username }}{{else}} {{ "" }}{{end}} +{{- end -}} + +{{/* +Meilisearch Password. +*/}} +{{- define "meilisearch.password" -}} +{{ if .Values.search.external.enabled }}{{ .Values.search.external.password }}{{else}}{{ .Values.meilisearch.key }}{{end}} +{{- end -}} + +{{/* +ElasticSearch User. +*/}} +{{- define "elasticsearch.user" -}} +{{ if .Values.search.external.enabled }}{{ .Values.search.external.username }}{{else}}{{ "" }}{{end}} +{{- end -}} + +{{/* +ElasticSearch Password. +*/}} +{{- define "elasticsearch.password" -}} +{{ if .Values.search.external.enabled }}{{ .Values.search.external.password }}{{else}}{{ "" }}{{end}} +{{- end -}} + + + diff --git a/charts/karpor/templates/elasticsearch.yml b/charts/karpor/templates/elasticsearch.yml index a4211dd..bc41a61 100644 --- a/charts/karpor/templates/elasticsearch.yml +++ b/charts/karpor/templates/elasticsearch.yml @@ -1,3 +1,4 @@ +{{- if and ( eq .Values.search.engine "elasticsearch") (not .Values.search.external) }} apiVersion: v1 kind: Service metadata: @@ -43,7 +44,7 @@ spec: - name: ES_JAVA_OPTS value: -Xms1g -Xmx1g image: {{ include "karpor.realImage" (dict "context" . "repo" .Values.elasticsearch.image.repo "tag" .Values.elasticsearch.image.tag) }} - imagePullPolicy: {{ .Values.global.image.imagePullPolicy }} + imagePullPolicy: {{ .Values.global.image.imagePullPolicy }} name: elasticsearch ports: - containerPort: {{ .Values.elasticsearch.port }} @@ -56,3 +57,4 @@ spec: volumes: - emptyDir: {} name: data + {{- end }} diff --git a/charts/karpor/templates/karpor-server.yml b/charts/karpor/templates/karpor-server.yml index bfe05c6..9726bea 100644 --- a/charts/karpor/templates/karpor-server.yml +++ b/charts/karpor/templates/karpor-server.yml @@ -1,3 +1,6 @@ +{{- if and ( ne .Values.search.engine "elasticsearch") (ne .Values.search.engine "meilisearch") }} +{{ fail "values.search.mode must be one of [elasticsearch,meilisearch] "}} +{{- end }} apiVersion: v1 kind: Service metadata: @@ -41,9 +44,12 @@ spec: spec: containers: - args: - - --search-storage-type=elasticsearch - - --elastic-search-addresses=http://elasticsearch.{{ .Values.namespace }}.svc:{{ .Values.elasticsearch.port }} - - --etcd-servers=http://etcd.{{ .Values.namespace }}.svc:{{ .Values.etcd.port }} + - --search-storage-type={{.Values.search.engine}} + - "--search-addresses={{ include "karpor.searchURL" . }}" + - "--search-username={{ include "karpor.searchUsername" . }}" + - "--search-password={{ include "karpor.searchPassword" . }}" +{{/* - --elastic-search-addresses=http://elasticsearch.{{ .Values.namespace }}.svc:{{ .Values.elasticsearch.port }}*/}} + - "--etcd-servers=http://etcd.{{ .Values.namespace }}.svc:{{ .Values.etcd.port }}" - --secure-port={{ .Values.server.port }} - --client-ca-file=/etc/karpor/ca.crt - --service-account-signing-key-file=/etc/karpor/ca.key @@ -81,7 +87,7 @@ spec: command: - /karpor image: {{ include "karpor.realImage" (dict "context" . "repo" .Values.server.image.repo "tag" .Values.server.image.tag "needV" (not (hasPrefix "v" .Values.server.image.tag))) }} - imagePullPolicy: {{ .Values.global.image.imagePullPolicy }} + imagePullPolicy: {{ .Values.global.image.imagePullPolicy }} name: karpor-server ports: - containerPort: {{ .Values.server.port }} diff --git a/charts/karpor/templates/karpor-syncer.yml b/charts/karpor/templates/karpor-syncer.yml index 81642e2..940ef1b 100644 --- a/charts/karpor/templates/karpor-syncer.yml +++ b/charts/karpor/templates/karpor-syncer.yml @@ -20,12 +20,15 @@ spec: - /karpor args: - syncer - - --elastic-search-addresses=http://elasticsearch.{{ .Values.namespace }}.svc:{{ .Values.elasticsearch.port }} + - "--search-storage-type={{ .Values.search.engine }}" + - "--search-addresses={{ include "karpor.searchURL" . }}" + - "--search-username={{ include "karpor.searchUsername" .}}" + - "--search-password={{ include "karpor.searchPassword" .}}" env: - name: KUBECONFIG value: /etc/karpor/config image: {{ include "karpor.realImage" (dict "context" . "repo" .Values.syncer.image.repo "tag" .Values.syncer.image.tag "needV" (not (hasPrefix "v" .Values.syncer.image.tag))) }} - imagePullPolicy: {{ .Values.global.image.imagePullPolicy }} + imagePullPolicy: {{ .Values.global.image.imagePullPolicy }} name: karpor-syncer ports: - containerPort: {{ .Values.syncer.port }} diff --git a/charts/karpor/templates/meilisearch.yaml b/charts/karpor/templates/meilisearch.yaml new file mode 100644 index 0000000..e0e54fd --- /dev/null +++ b/charts/karpor/templates/meilisearch.yaml @@ -0,0 +1,57 @@ +{{- if and (eq .Values.search.engine "meilisearch") (not .Values.search.external.enabled ) }} +apiVersion: v1 +kind: Service +metadata: + name: meilisearch + namespace: {{ .Values.namespace }} +spec: + ports: + - port: {{ .Values.meilisearch.port }} + selector: + {{- include "karpor.selectorLabels" (dict "context" . "component" .Values.meilisearch.name) | nindent 4 }} +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: meilisearch + namespace: {{ .Values.namespace }} + labels: + {{- include "karpor.labels" (dict "context" . "component" .Values.meilisearch.name) | nindent 4 }} +spec: + replicas: {{ .Values.meilisearch.replicas }} + selector: + matchLabels: + {{- include "karpor.selectorLabels" (dict "context" . "component" .Values.meilisearch.name) | nindent 6 }} + template: + metadata: + labels: + {{- include "karpor.selectorLabels" (dict "context" . "component" .Values.meilisearch.name) | nindent 8 }} + spec: + volumes: + - emptyDir: {} + name: data + containers: + - name: meilisearch + image: {{ include "karpor.realImage" (dict "context" . "repo" .Values.meilisearch.image.repo "tag" .Values.meilisearch.image.tag) }} + command: + - meilisearch + - --master-key + - {{ .Values.meilisearch.key}} + - --experimental-contains-filter + {{ if .Values.meilisearch.noAnalytics }} + - --no-analytics + {{ end }} + + ports: + - containerPort: {{ .Values.meilisearch.port }} + protocol: TCP + resources: + {{- toYaml .Values.meilisearch.resources | nindent 12 }} + volumeMounts: + - name: data + mountPath: /meili_data + terminationMessagePath: /dev/termination-log + terminationMessagePolicy: File + imagePullPolicy: {{ .Values.global.image.imagePullPolicy }} + restartPolicy: Always + {{- end }} diff --git a/charts/karpor/values.yaml b/charts/karpor/values.yaml index 16fc325..bd03316 100644 --- a/charts/karpor/values.yaml +++ b/charts/karpor/values.yaml @@ -95,7 +95,47 @@ syncer: cpu: 500m memory: 1Gi ephemeral-storage: 10Gi +search: + # -- Engine for storage,may elasticsearch or meilisearch + engine: elasticsearch + external: + # -- If external is set to be true. and fill the connection information in "external" section + enabled: false + # -- Address for search engine + addresses: + - "192.168.0.1:3456" + # -- Username for search engine + username: "" + # -- password for search engine + password: "" +# Configuration for meilisearch +meilisearch: + # -- Component name for meilisearch. + name: meilisearch + # -- The number of meilisearch pods to run. + replicas: 1 + # -- Port for meilisearch. + port: 7700 + # -- Default master key + key: danger!changeIt + # -- If set to be true, add flag --no-analytics + noAnalytics: true + image: + # -- Repository for meilisearch image. + repo: getmeili/meilisearch + # -- Specific tag for meilisearch image. + tag: "v1.13" + # -- Resource limits and requests for the karpor meilisearch pods. + resources: + requests: + cpu: "2" + memory: 4Gi + ephemeral-storage: 10Gi + limits: + cpu: "2" + memory: 4Gi + ephemeral-storage: 10Gi # Configuration for ElasticSearch elasticsearch: # -- Component name for ElasticSearch.