diff --git a/README.md b/README.md index 824d219d..6909951e 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,131 @@ # helm-charts Helm charts for appbase.io, an API gateway for a supercharged Elasticsearch experience. +Via this Helm Chart you can localize Appbaseio on your kubernetes engine. + +## Requirements +You should have your **Kubernetes** cluster installed and configured and then you should install [helm]("https://helm.sh/docs/intro/install/") + +As Arc is an API gateway for your Elasticsearch, make sure that you already have an Elasticsearch cluster with it's basic credentials. + +If you don't have an Elasticsearch cluster, you can use this [guide]("https://www.elastic.co/guide/en/cloud-on-k8s/current/k8s-quickstart.html") + +## Why Helm Charts: + +Helm helps you manage Kubernetes applications — Helm Charts help you define, install, and upgrade even the most complex Kubernetes application. + +Charts are easy to create, version, share, and publish — so start using Helm and stop the copy-and-paste. + +Here we get benefit of Helm Charts to package Arc (which is an API Gateway that sits between a client and an ElasticSearch cluster) and install it in seconds. + +## How to install Appbaseio Helm Chart + +1- run `helm repo add appbase` + +2- run `helm install appbase --set ` + +Make sure that you set below variables which are mandatory: + +- `elasticsearch.clusterURL` + +- `appbase.id` + +- `appbase.username` :if you don't set this variable, by default will be set as "admin" +- `appbase.password` :if you don't set this variable, by default will be set as "admin" + + +## Configure the cluster with Values + +According to Helm chart [values]("https://helm.sh/docs/chart_template_guide/values_files/") you can customize the cluster in the way you want by set variables during the install. +We categorized variables in order to ease it's readability, for example `elasticsearch.clusterURL` means clusterURL is a subset of elasticsearch but while setting a vaiable we should follo it's indentation. +Here are the variables you can set for your cluster: +| Name |Default Value | Kind | Description | +|---|---|---|---| +| elasticsearch.clusterURL | "" | String | clusterURL based on basic authentication. fluent-bit splites this clusterURL soit should be in following pattern: "http://:@domain:port" ( Prtotocol Can also be -> https) | +| arc.name | arc | String | It's the name of Arc service which you can use to access your application via service name | +| arc.image | appbaseio/arc | String | This is the image Appbase.io provides as gateway for your elasticsearch, if you have your local repository, you can push Arc image into that then change the URL here. | +| arc.port | 8000 | Integer | The port that used for Arc service | +| appbase.id | "" | String | This is **APPBASE_ID** that you can get from [Appbase.io]("https://arc-dashboard.appbase.io/install") | +| appbase.username | admin | String | This is the username you choose for your Appbaseio | +| appbase.password | admin | String | This is the password you choose for your Appbaseio | +| appbase.domain | "" | String | If you are installing helm chart on your production and want to assigne a domain to it, set this variable to your domain, make sure that your loadBalancer.serviceType to be empty ("") | +| volume.name | pv | String | If you want to use default volume, leave name empty but if you want to use your Persistent volume, enter it's name, the PVC ( persistent volume claim) will be assigned to it | +| volume.storageClassName | standard | String | Your Storage class which should be the same with PVC, if you have a specific class for your Volume, set that here to also be set for PVC | +| volume.accessModes | ReadWriteMany | String | Access mode for volume | +| volume.storageSize | 1Gi | String | This is the size of PVC storage, Default volume size is 5Gi which you can handle how much of it be assigned to PVC | +| volume.pvcName | pvc | String | You can change PVC (Persitent Volume Claim) name here, it's assigned to PV(Persistent Volume) | +| cert.name | ssl | String | you can add your certificate here by configuring below values. name is the name of secret file containing your certificate information, if you have your own secret file, you can only fill the name value and leave the other empty | +| cert.tlsCrt | "" | String | "tlsCrt" is your "tls.crt" | +| cert.tlsKey | "" | String | "tlsKey" is "tls.key" | +| cert.caCrt | "" | String | "caCrt" is "ca.crt" | +| loadBalancer.serviceType | "" | String |If yo're using kubernetes locally and as you won't have external IP, Can be "NodePort" but if it's your production kubernetes, you can leave it empty which means serviceType is : "LoadBalancer"| + +**Tips:** + +- Some variables might be long to use in install command, so you can export it and then use it e.g. + + `export $(ES_ClusterURL=)` + + then you can use it while installing helm: + + `helm install appbase --set elasticsearch.clusterURL=ES_ClusterURL` + +## Kubernetes Distribution support: +You can check [this page]("https://helm.sh/docs/topics/kubernetes_distros/") to see what distros Helm is currently supporting +## Test on Minikube + +1- Make sure your Minikube is installed, if not, use [this]("https://minikube.sigs.k8s.io/docs/start/") and if you don't have kubectl installed, use this [link]("https://kubernetes.io/docs/tasks/tools/") + +2- Add Appbase helm repo and install it as it's said + + Make sure that you set loadBalancer.serviceType=NodePort + +3- After you install helm chart setting loadBalancer.serviceType=NodePort, you will see this result: +![image](https://user-images.githubusercontent.com/30385958/122102140-5bdb9e80-ce2a-11eb-960b-921c64a298e5.png) + +Which you can use the command to get access to your Appbaseio service + + If you changr arc.name, the command will be: minikube service --url -nodeport + +## How to use it by cloning the project +1- Clone this repositoy: + +`git clone git@github.com:appbaseio/helm-charts.git` + +and then head to `helm-charts` folder. + + +2- Now you should config helm chart to connect appbaseio to your elasticsearch: + +open **values.yaml** from `helm-charts/appbaseio/values.yaml` and fill the values you might need. +These are required values you must fill: + +- **Elasticsearch Domain**: This can be your Kubernetes service name or a valid domain which is reachble from your kubernetese cluster +- **Elasticsearch Username**: by default this username is `elastic` but if you have changed your ES_USERNAME, should change it here +- **Elasticsearch Password**: this is your decrypted password which you can leave empty here as we can change it while installing our helm chart. we will see that in following. +- **APPBASE_ID**: to get this, head to [Appbase]("https://arc-dashboard.appbase.io/install") and enter your email, You will receive an OTP on an entered email address. Enter OTP to verify the email address and then `APPBASE_ID` will be sent to our email. + +- **APPBASE_USERNAME**: This will be used while using appbaseio so you can choose your desired username by filling the variable +- **APPBASE_PASSWORD**: This will be used while using appbaseio so you can choose your desired password by filling the variable + +you can leave other settings as their default value but if you want more setting like use your own volume as storage, use SSL certificate for your Appbase cluster and so on, modify the related part. + +**Note:** +- handle arc version in Chart.yaml as **appVersion** + +3- We can set above values while running helm chart install command, the value will be replaced with what we have in values.yaml for example here we install appbase chart with setting the ES_PASSWORD + +- If you have a Kubernetes cluster, run below command : + +`PASSWORD=$(kubectl get secret -o go-template='{{.data.elastic | base64decode}}')` + + This Command will get ES_PASSWORD from ES secret, make sure to change your elasticsearch service name + +Now it's time to install our chart: + +`helm install appbaseio appbaseio/ --values appbaseio/values.yaml --set elasticsearch.esPassword=$PASSWORD ` + +To get more information about set value in helm install, take a look at this [page]("https://helm.sh/docs/helm/helm_install/") +4- Wait until your pods are in "Running" stat (see their status by `kubectl get pods`) and the LoadBalancer service is up and have an external IP (use this command: `kubectl get svc --namespace ingress-nginx`) + +When everything is OK you can access your Appbase with LoadBalancer IP and it's Port then you can go to [Arc dashboard]("https://arc-dashboard.appbase.io/login") to handle your elasticsearch visually diff --git a/appbaseio/.helmignore b/appbaseio/.helmignore new file mode 100644 index 00000000..0e8a0eb3 --- /dev/null +++ b/appbaseio/.helmignore @@ -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/ diff --git a/appbaseio/.values.yaml.swp b/appbaseio/.values.yaml.swp new file mode 100644 index 00000000..dc5f3b7d Binary files /dev/null and b/appbaseio/.values.yaml.swp differ diff --git a/appbaseio/Chart.yaml b/appbaseio/Chart.yaml new file mode 100644 index 00000000..ae174b42 --- /dev/null +++ b/appbaseio/Chart.yaml @@ -0,0 +1,14 @@ +apiVersion: v2 +name: appbaseio +description: A Helm chart for Kubernetes + +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: 0.1.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: "7.45.0-beta" diff --git a/appbaseio/templates/NOTES.txt b/appbaseio/templates/NOTES.txt new file mode 100644 index 00000000..46000b5a --- /dev/null +++ b/appbaseio/templates/NOTES.txt @@ -0,0 +1,6 @@ +{{- if eq .Values.loadBalancer.serviceType "NodePort"}} +Use below command to connect to get appbaseio Access URL: +minikube service --url {{ .Values.arc.name }}-nodeport + +** If you're not using minikube, you can set loadBalancer.serviceType to "LoadBalancer" +{{ end }} \ No newline at end of file diff --git a/appbaseio/templates/_helpers.tpl b/appbaseio/templates/_helpers.tpl new file mode 100644 index 00000000..88347a82 --- /dev/null +++ b/appbaseio/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "appbaseio.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 "appbaseio.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 "appbaseio.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "appbaseio.labels" -}} +helm.sh/chart: {{ include "appbaseio.chart" . }} +{{ include "appbaseio.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "appbaseio.selectorLabels" -}} +app.kubernetes.io/name: {{ include "appbaseio.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "appbaseio.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "appbaseio.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/appbaseio/templates/appbaseio.yaml b/appbaseio/templates/appbaseio.yaml new file mode 100644 index 00000000..98c405f9 --- /dev/null +++ b/appbaseio/templates/appbaseio.yaml @@ -0,0 +1,64 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + labels: + name: {{ .Values.arc.name }} + annotations: + deployment.kubernetes.io/revision: "1" + generation: 1 + name: {{ .Values.arc.name }} +spec: + selector: + matchLabels: + app: {{ .Values.arc.name }} + strategy: + type: RollingUpdate + template: + metadata: + creationTimestamp: null + labels: + app: {{ .Values.arc.name }} + spec: + containers: + - env: + - name: USERNAME + value: {{ .Values.appbase.username }} + - name: PASSWORD + value: {{ .Values.appbase.password }} + - name: APPBASE_ID + value: {{ .Values.appbase.id }} + - name: ES_CLUSTER_URL + value: {{ .Values.elasticsearch.clusterURL }} + - name: LOG_FILE_PATH + value: "/mnt/data/es.json" + image: {{.Values.arc.image}}:{{.Values.arc.tag | default .Chart.AppVersion}} + imagePullPolicy: IfNotPresent + name: {{ .Values.arc.name }} + ports: + - containerPort: {{ .Values.arc.port }} + name: http + protocol: TCP + volumeMounts: + - name: arcdata + mountPath: /mnt/data + subPath: es.json + volumes: + - name: arcdata + persistentVolumeClaim: + claimName: {{ .Values.volume.pvcName }} + + replicas: {{ .Values.arc.nodes }} +--- +apiVersion: v1 +kind: Service +metadata: + name: {{ .Values.arc.name }} + labels: + app: {{ .Values.arc.name }} +spec: + type: ClusterIP + ports: + - port: {{ .Values.arc.port }} + targetPort: {{ .Values.arc.port }} + selector: + app: {{ .Values.arc.name }} \ No newline at end of file diff --git a/appbaseio/templates/cert.yaml b/appbaseio/templates/cert.yaml new file mode 100644 index 00000000..ebe4447f --- /dev/null +++ b/appbaseio/templates/cert.yaml @@ -0,0 +1,12 @@ +{{ if .Values.cert.tlsCrt}} +apiVersion: v1 +kind: Secret +metadata: + name: {{ .Values.cert.name }} +type: Opaque +data: + tls.crt: {{ .Values.cert.tlsCrt }} + tls.key: {{ .Values.cert.tlsKey }} + ca.crt: {{ .Values.cert.caCrt }} + +{{ end }} \ No newline at end of file diff --git a/appbaseio/templates/fluentbit.yaml b/appbaseio/templates/fluentbit.yaml new file mode 100644 index 00000000..8e8481b5 --- /dev/null +++ b/appbaseio/templates/fluentbit.yaml @@ -0,0 +1,152 @@ +apiVersion: v1 +kind: ServiceAccount +metadata: + name: fluent-bit +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + name: fluent-bit-read +rules: + - apiGroups: [""] + resources: + - namespaces + - pods + verbs: ["get", "list", "watch"] + +{{ $a := split "//" .Values.elasticsearch.clusterURL}} +{{ $b := split ":" $a._1 }} +{{ $user := $b._0 }} +{{ $c := split "@" $b._1}} +{{ $pass := $c._0}} +{{ $domain := $c._1 }} +{{ $port := "" }} +{{ $port = $b._2 }} + +--- + +apiVersion: v1 +kind: ConfigMap +metadata: + name: fluent-bit-config + labels: + k8s-app: fluent-bit +data: + fluent-bit.conf: | + [SERVICE] + Flush 1 + Daemon off + Log_Level trace + Parsers_File parsers.conf + [INPUT] + Name tail + Path /mnt/data/es.json + Buffer_Chunk_Size 3MB + Buffer_Max_Size 487MB + [FILTER] + Name parser + Parser docker + Match * + Key_Name log + Reserve_Data true + [FILTER] + Name throttle + Match * + Rate 15 + Window 10 + Interval 15s + [OUTPUT] + Name es + Match * + Host "{{ $domain }}" + Port "{{ $port }}" + Index .logs + Type _doc + Generate_ID true + tls Off + tls.verify Off + HTTP_User "{{ $user }}" + HTTP_Passwd "{{ $pass }}" + parsers.conf: | + [PARSER] + Name docker + Format json + Time_Key timestamp + Time_Format %Y-%m-%dT%H:%M:%S.%LZ + Time_Keep On + +--- +apiVersion: apps/v1 +kind: DaemonSet +metadata: + name: fluent-bit + labels: + k8s-app: fluent-bit-logging + version: v1 + kubernetes.io/cluster-service: "true" +spec: + selector: + matchLabels: + k8s-app: fluent-bit-logging + template: + metadata: + labels: + k8s-app: fluent-bit-logging + version: v1 + kubernetes.io/cluster-service: "true" + annotations: + prometheus.io/scrape: "true" + prometheus.io/port: "2020" + prometheus.io/path: /api/v1/metrics/prometheus + spec: + containers: + - name: fluent-bit + image: fluent/fluent-bit:1.5 + imagePullPolicy: IfNotPresent + ports: + - containerPort: 2020 + env: + - name: ELASTICSEARCH_HOST + value: "{{ $domain }}" + - name: ELASTICSEARCH_PORT + value: "{{ $port }}" + - name: ELASTICSEARCH_USERNAME + value: "{{ $user }}" + - name: ELASTICSEARCH_PASSWORD + value: "{{ $pass }}" + volumeMounts: + - name: fluent-bit-data + mountPath: /mnt/data + subPath: es.json + - name: fluent-bit-config + mountPath: /fluent-bit/etc/ + terminationGracePeriodSeconds: 10 + volumes: + - name: fluent-bit-data + persistentVolumeClaim: + claimName: {{ .Values.volume.pvcName }} + - name: fluent-bit-config + configMap: + name: fluent-bit-config + serviceAccountName: fluent-bit + tolerations: + - key: node-role.kubernetes.io/master + operator: Exists + effect: NoSchedule + - operator: "Exists" + effect: "NoExecute" + - operator: "Exists" + effect: "NoSchedule" +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: fluent-bit-read +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: fluent-bit-read +subjects: + - kind: ServiceAccount + name: fluent-bit + namespace: default diff --git a/appbaseio/templates/ingress-nginx.yaml b/appbaseio/templates/ingress-nginx.yaml new file mode 100644 index 00000000..3d0d9c4a --- /dev/null +++ b/appbaseio/templates/ingress-nginx.yaml @@ -0,0 +1,261 @@ +{{ if empty .Values.loadBalancer.serviceType }} +apiVersion: v1 +kind: Namespace +metadata: + name: ingress-nginx +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: nginx-service-account +subjects: + - kind: ServiceAccount + name: default + namespace: ingress-nginx +roleRef: + kind: ClusterRole + name: cluster-admin + apiGroup: rbac.authorization.k8s.io +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + annotations: + deployment.kubernetes.io/revision: "1" + generation: 1 + labels: + app: default-http-backend + name: default-http-backend + namespace: ingress-nginx +spec: + progressDeadlineSeconds: 600 + replicas: 1 + revisionHistoryLimit: 10 + selector: + matchLabels: + app: default-http-backend + strategy: + rollingUpdate: + maxSurge: 25% + maxUnavailable: 25% + type: RollingUpdate + template: + metadata: + creationTimestamp: null + labels: + app: default-http-backend + spec: + containers: + - image: gcr.io/google_containers/defaultbackend:1.4 + imagePullPolicy: IfNotPresent + livenessProbe: + failureThreshold: 3 + httpGet: + path: /healthz + port: 8080 + scheme: HTTP + initialDelaySeconds: 30 + periodSeconds: 10 + successThreshold: 1 + timeoutSeconds: 5 + name: default-http-backend + ports: + - containerPort: 8080 + protocol: TCP + resources: + limits: + cpu: 10m + memory: 20Mi + requests: + cpu: 10m + memory: 20Mi + terminationMessagePath: /dev/termination-log + terminationMessagePolicy: File + dnsPolicy: ClusterFirst + restartPolicy: Always + schedulerName: default-scheduler +--- +apiVersion: v1 +kind: Service +metadata: + labels: + app: default-http-backend + name: default-http-backend + namespace: ingress-nginx +spec: + ports: + - port: 80 + protocol: TCP + targetPort: 8080 + selector: + app: default-http-backend + sessionAffinity: None + type: ClusterIP +status: + loadBalancer: {} +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + annotations: + deployment.kubernetes.io/revision: "1" + generation: 1 + name: nginx-ingress-controller + namespace: ingress-nginx +spec: + progressDeadlineSeconds: 600 + replicas: 1 + revisionHistoryLimit: 10 + selector: + matchLabels: + app: ingress-nginx + strategy: + rollingUpdate: + maxSurge: 25% + maxUnavailable: 25% + type: RollingUpdate + template: + metadata: + annotations: + prometheus.io/port: "10254" + prometheus.io/scrape: "true" + creationTimestamp: null + labels: + app: ingress-nginx + spec: + containers: + - args: + - /nginx-ingress-controller + - --default-backend-service=$(POD_NAMESPACE)/default-http-backend + - --configmap=$(POD_NAMESPACE)/nginx-configuration + - --tcp-services-configmap=$(POD_NAMESPACE)/tcp-services + - --udp-services-configmap=$(POD_NAMESPACE)/udp-services + - --annotations-prefix=nginx.ingress.kubernetes.io + - --publish-service=$(POD_NAMESPACE)/ingress-nginx + env: + - name: POD_NAME + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: metadata.name + - name: POD_NAMESPACE + valueFrom: + fieldRef: + apiVersion: v1 + fieldPath: metadata.namespace + image: quay.io/kubernetes-ingress-controller/nginx-ingress-controller:0.13.0 + imagePullPolicy: IfNotPresent + livenessProbe: + failureThreshold: 3 + httpGet: + path: /healthz + port: 10254 + scheme: HTTP + initialDelaySeconds: 10 + periodSeconds: 10 + successThreshold: 1 + timeoutSeconds: 1 + name: nginx-ingress-controller + ports: + - containerPort: 80 + name: http + protocol: TCP + - containerPort: 443 + name: https + protocol: TCP + readinessProbe: + failureThreshold: 3 + httpGet: + path: /healthz + port: 10254 + scheme: HTTP + periodSeconds: 10 + successThreshold: 1 + timeoutSeconds: 1 + resources: {} + terminationMessagePath: /dev/termination-log + terminationMessagePolicy: File + dnsPolicy: ClusterFirst + restartPolicy: Always + schedulerName: default-scheduler +--- +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + annotations: + kubernetes.io/ingress.class: nginx + kubernetes.io/tls-acme: "false" + nginx.ingress.kubernetes.io/configuration-snippet: | + add_header 'access-control-expose-headers' 'DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,X-Search-Id' always; + nginx.ingress.kubernetes.io/cors-allow-credentials: "false" + nginx.ingress.kubernetes.io/cors-allow-headers: DNT,X-CustomHeader,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization,X-Search-Id,X-Search-Click,X-Search-ClickPosition,X-Search-Suggestions-Click,X-Search-Suggestions-ClickPosition,X-Search-Conversion,X-Search-Query,X-Search-Filters,X-Request-Tag,X-Query-Tag,X-Search-State,X-Search-CustomEvent,X-User-Id + nginx.ingress.kubernetes.io/cors-allow-methods: + GET, PUT, POST, DELETE, PATCH, + OPTIONS, HEAD + nginx.ingress.kubernetes.io/enable-cors: "true" + nginx.ingress.kubernetes.io/proxy-body-size: 100m + nginx.ingress.kubernetes.io/rewrite-target: / + nginx.ingress.kubernetes.io/ssl-redirect: "false" + generation: 2 + name: arc-ingress + namespace: default +spec: + rules: + {{ if empty .Values.appbase.domain}} + - http: + paths: + - pathType: Prefix + path: / + backend: + service: + name: {{ .Values.arc.name }} + port: + number: {{ .Values.arc.port }} + {{else if .Values.appbase.domain}} + - host: {{ .Values.appbase.domain }} + http: + paths: + - pathType: Prefix + path: / + backend: + service: + name: {{ .Values.arc.name }} + port: + number: {{ .Values.arc.port }} + + + {{ end }} + + tls: + {{ if .Values.appbase.domain }} + - hosts: + - {{ .Values.appbase.domain }} + {{ end }} + - secretName: {{ .Values.cert.name }} +--- +apiVersion: v1 +kind: Service +metadata: + labels: + app: ingress-nginx + name: ingress-nginx + namespace: ingress-nginx +spec: + externalTrafficPolicy: Local + ports: + - name: http + nodePort: 30372 + port: 80 + protocol: TCP + targetPort: http + - name: https + nodePort: 31473 + port: 443 + protocol: TCP + targetPort: https + selector: + app: ingress-nginx + sessionAffinity: None + type: LoadBalancer + + {{ end }} \ No newline at end of file diff --git a/appbaseio/templates/node-port.yaml b/appbaseio/templates/node-port.yaml new file mode 100644 index 00000000..6a91c624 --- /dev/null +++ b/appbaseio/templates/node-port.yaml @@ -0,0 +1,17 @@ +{{ if eq .Values.loadBalancer.serviceType "NodePort" }} +apiVersion: v1 +kind: Service +metadata: + name: {{ .Values.arc.name }}-nodeport +spec: + type: NodePort + selector: + app: {{ .Values.arc.name }} + ports: + # By default and for convenience, the `targetPort` is set to the same value as the `port` field. + - port: 80 + targetPort: 8000 + # Optional field + # By default and for convenience, the Kubernetes control plane will allocate a port from a range (default: 30000-32767) + nodePort: 30077 +{{ end }} \ No newline at end of file diff --git a/appbaseio/templates/tests/test-connection.yaml b/appbaseio/templates/tests/test-connection.yaml new file mode 100644 index 00000000..1a679a54 --- /dev/null +++ b/appbaseio/templates/tests/test-connection.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Pod +metadata: + name: "{{ include "appbaseio.fullname" . }}-test-connection" + labels: + {{- include "appbaseio.labels" . | nindent 4 }} + annotations: + "helm.sh/hook": test +spec: + containers: + - name: curl + image: curlimages/curl + command: ['ping'] + args: ['{{.Values.arc.name }} -c1'] + restartPolicy: Never diff --git a/appbaseio/templates/volumes.yaml b/appbaseio/templates/volumes.yaml new file mode 100644 index 00000000..3e7488e8 --- /dev/null +++ b/appbaseio/templates/volumes.yaml @@ -0,0 +1,38 @@ +{{ if empty .Values.volume.name }} +apiVersion: v1 +kind: PersistentVolume +metadata: + name: pv + labels: + type: local +spec: + storageClassName: standard + capacity: + storage: 5Gi + accessModes: + - ReadWriteMany + hostPath: + path: "/" + +{{ end }} + + +{{ if eq .Values.volume.custom "true" }} + +{{ .Values.volume.customSetting }} + +{{ end }} + + +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: {{ .Values.volume.pvcName | default "pvc" }} +spec: + accessModes: + - {{ .Values.volume.accessModes}} + storageClassName: {{ .Values.volume.storageClassName}} + resources: + requests: + storage: {{ .Values.volume.storageSize}} \ No newline at end of file diff --git a/appbaseio/values.yaml b/appbaseio/values.yaml new file mode 100644 index 00000000..d94ab700 --- /dev/null +++ b/appbaseio/values.yaml @@ -0,0 +1,62 @@ +# ElasticSearch Configuration + # change defUsername if you have another usename defined for you elasticsearch + # change clusterDomain if you have another domain for your elasticsearch or change it if your elasticsearch kubernetes service name is different +elasticsearch: + # clusterURL based on basic authentication / fluent-bit splites this clusterURL so + # it should be in following pattern: http://:@domain:port ( Prtotocol Can also be -> https) + clusterURL: "" + +# arc configuraion +arc: + name: "arc" + nodes: 1 + image: "appbaseio/arc" + tag: "" + port: 8000 + storage: 1Gi + +# Appbase.io configuration / get id from "https://arc-dashboard.appbase.io/install" +appbase: + #APPBASE_ID + id: "" + #APPBASE_USERNAME + username: "admin" + #APPBASE_PASSWORD + password: "admin" + domain: "" + +# Volume configuration +# If you want it to create a Volume for you, leave name empty +# but if you want to use your Persistent volume, enter it's name +volume: + name: "" + storageClassName: "standard" + accessModes: "ReadWriteMany" + storageSize: 1Gi + # pvcName is the name of "Persistent Volume Claim" which we use to assign it to a "Persistent Volume" + pvcName: "pvc" + # custume: "true" you can customize your volume setting, what ever you wrtie in custome setting, will be replaced + custom: "false" + # customeSetting should be edited the same way / Note: Follow indent order + # in the following we used an AWS volume for test to show how this customizing works + customSetting: | + volumes: + - name: test-volume + # This AWS EBS volume must already exist. + awsElasticBlockStore: + volumeID: '' + fsType: ext4 + +# you can add your certificate here by configuring below values +# tlsCrt is your tls.crt / tlsKey is tls.key / caCrt is ca.crt +# name is the name of secret file containing your certificate information, if you have your own secret file, you can only fill the name value and leave the other empty +cert: + name: "ssl" + tlsCrt: "" + tlsKey: "" + caCrt: "" + +# Nginx LoadBalancer Config + +loadBalancer: + serviceType: "" \ No newline at end of file