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

Suggest helm chart to deploy latest k8s #15

Open
hiondal opened this issue Jan 2, 2024 · 0 comments
Open

Suggest helm chart to deploy latest k8s #15

hiondal opened this issue Jan 2, 2024 · 0 comments

Comments

@hiondal
Copy link

hiondal commented Jan 2, 2024

How are you?
Thank you so much for providing such a great Axon framework.
It's helping me a lot to organize my MSA.
The reason I am writing this is that I have found some improvements while deploying axon server with the helm chart you provided.
There are three points.
First, ingress.yaml needs to be modified to match the latest k8s conventions.
Second, I would like to see an option added to ask whether to enable livenessProbe and readinessProbe in the statefulset. This is because on my local minikube, if I check liveness/readiness, the pod doesn't run properly.
Third, there shouldn't be a tag at the end of image.repository in values.yaml, because statefuleset.yaml tags the image.tag value or chart.fullname.

I'm uploading the axon.yaml, ingress.yaml, and statefulset.yaml together, which override the values.yaml.
I hope this helps you fix it.

Thanks.

------------------
axon.yaml
------------------
image:
  repository: axoniq/axonserver
  tag: latest
  pullPolicy: IfNotPresent

# Axon Server specific settings
axonserver:
  # The HTTP port to use inside the container, defaults to 8024
  httpPort: 8024
  # The client gRPC port to use inside the container, defaults to 8124
  grpcPort: 8124

healthcheck:
  enabled: false

serviceAccount:
  # Specifies whether a service account should be created
  create: true
  name: "axonserver"

volumes:
  eventStore:
    size: 1Gi
    # Configure here how your provider lets you map disks to Kubernetes volumes
    persistentVolumeSettings: 
      hostPath:
        path: /data
  data:
    size: 1Gi
    # Configure here how your provider lets you map disks to Kubernetes volumes
    persistentVolumeSettings: 
      hostPath:
        path: /data

services:
  httpService:
    enabled: true
    type: ClusterIP
    port: 8024
  grpcService:
    enabled: true
    type: Headless
    port: 8124

ingress:
  enabled: true
  hosts:
    - host: myaxon.io
      paths: [ "/" ]

-------------------------- 
templetes/ingress.yaml
--------------------------
{{- if .Values.ingress.enabled -}}
{{- $fullName := include "axon-server-se.fullname" . -}}
{{- $svcPort := .Values.services.httpService.port -}}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: {{ $fullName }}
  labels:
    {{- include "axon-server-se.labels" . | nindent 4 }}
  {{- with .Values.ingress.annotations }}
  annotations:
    {{- toYaml . | nindent 4 }}
  {{- end }}
spec:
  {{- if .Values.ingress.tls }}
  tls:
    {{- range .Values.ingress.tls }}
    - hosts:
        {{- range .hosts }}
        - {{ . | quote }}
        {{- end }}
      secretName: {{ .secretName }}
    {{- end }}
  {{- end }}
  rules:
    {{- range .Values.ingress.hosts }}
    - host: {{ .host | quote }}
      http:
        paths:
          {{- range .paths }}
          - path: {{ . }}
            pathType: Prefix
            backend:
              service:
                name: {{ $fullName }}-ui
                port:
                  number: {{ $svcPort }}
          {{- end }}
    {{- end }}
  {{- end }}

--------------------------------
templates/statefulset.yaml
--------------------------------
apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: {{ include "axon-server-se.fullname" . }}
  labels:
    {{- include "axon-server-se.labels" . | nindent 4 }}
spec:
  serviceName: {{ include "axon-server-se.fullname" . }}
  selector:
    matchLabels:
      {{- include "axon-server-se.selectorLabels" . | nindent 6 }}
  template:
    metadata:
    {{- with .Values.stsAnnotations }}
      annotations:
        {{- toYaml . | nindent 8 }}
    {{- end }}
      labels:
        {{- include "axon-server-se.selectorLabels" . | nindent 8 }}
    spec:
      {{- with .Values.imagePullSecrets }}
      imagePullSecrets:
        {{- toYaml . | nindent 8 }}
      {{- end }}
      serviceAccountName: {{ include "axon-server-se.serviceAccountName" . }}
      {{- with .Values.stsSecurityContext }}
      securityContext:
        {{- toYaml . | nindent 8 }}
      {{- end }}
      containers:
        - name: {{ .Chart.Name }}
          {{- with .Values.securityContext }}
          securityContext:
            {{- toYaml . | nindent 12 }}
          {{- end }}
          image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
          imagePullPolicy: {{ .Values.image.pullPolicy }}
          ports:
            - name: http
              containerPort: {{ .Values.axonserver.httpPort | default 8024 }}
              protocol: TCP
            - name: grpc
              containerPort: {{ .Values.axonserver.grpcPort | default 8124 }}
              protocol: TCP
          {{- if .Values.healthcheck.enabled -}}
          livenessProbe:
            httpGet:
              path: /actuator/info
              port: http
            initialDelaySeconds: 5
            periodSeconds: 10
            successThreshold: 1
            failureThreshold: 3
          readinessProbe:
            httpGet:
              path: /actuator/info
              port: http
            initialDelaySeconds: 5
            periodSeconds: 5
            timeoutSeconds: 1
            failureThreshold: 30
          {{- end }}
          {{- with .Values.resources }}
          resources:
            {{- toYaml . | nindent 12 }}
          {{- end }}
          volumeMounts:
            - name: data
              mountPath: /data
            - name: events
              mountPath: /eventdata
            - name: config
              mountPath: /config
              readOnly: true
      volumes:
        {{- if eq .Values.properties.kind "ConfigMap" "InlineConfigMap" }}
        - name: config
          configMap:
            name: {{ .Values.properties.configMapName | default "axon-server-config" }}
        {{- end}}
        {{- if eq .Values.properties.kind "Secret" "InlineSecret" }}
        - name: config
          secret:
            secretName: {{ .Values.properties.secretName | default "axon-server-secret" }}
        {{- end}}
      {{- with .Values.nodeSelector }}
      nodeSelector:
        {{- toYaml . | nindent 8 }}
      {{- end }}
      {{- with .Values.affinity }}
      affinity:
        {{- toYaml . | nindent 8 }}
      {{- end }}
      {{- with .Values.tolerations }}
      tolerations:
        {{- toYaml . | nindent 8 }}
      {{- end }}
  volumeClaimTemplates:
    - metadata:
        name: events
      spec:
        accessModes: [ "ReadWriteOnce" ]
        resources:
          requests:
            storage: {{ .Values.volumes.eventStore.size | default "5Gi" }}
    - metadata:
        name: data
      spec:
        accessModes: [ "ReadWriteOnce" ]
        resources:
          requests:
            storage: {{ .Values.volumes.data.size | default "1Gi" }}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant