Skip to content

AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents

5.7 KB
Raw Blame
{{- if eq (include "activepieces.workloadType" .) "statefulset" }}
apiVersion: apps/v1
kind: StatefulSet
{{- else }}
apiVersion: argoproj.io/v1alpha1
kind: Rollout
{{- end }}
metadata:
  name: {{ include "activepieces.fullname" . }}
  labels:
    {{- include "activepieces.labels" . | nindent 4 }}
spec:
  {{- if not .Values.autoscaling.enabled }}
  replicas: {{ .Values.replicaCount }}
  {{- end }}
  {{- if eq (include "activepieces.workloadType" .) "statefulset" }}
  serviceName: {{ include "activepieces.fullname" . }}
  podManagementPolicy: {{ .Values.podManagementPolicy | default "OrderedReady" }}
  {{- end }}
  selector:
    matchLabels:
      {{- include "activepieces.selectorLabels" . | nindent 6 }}
  template:
    metadata:
      annotations:
        rollme: {{ randAlphaNum 8 | quote }}
        {{- with .Values.podAnnotations }}
        {{- toYaml . | nindent 8 }}
        {{- end }}
      labels:
        {{- include "activepieces.labels" . | nindent 8 }}
        {{- with .Values.podLabels }}
        {{- toYaml . | nindent 8 }}
        {{- end }}
    spec:
      {{- with .Values.imagePullSecrets }}
      imagePullSecrets:
        {{- toYaml . | nindent 8 }}
      {{- end }}
      serviceAccountName: {{ include "activepieces.serviceAccountName" . }}
      {{- with .Values.podSecurityContext }}
      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.container.port }}
              protocol: TCP
          envFrom:
            - secretRef:
                name: {{ include "activepieces.fullname" . }}-secrets
            - secretRef:
                name: {{ include "activepieces.fullname" . }}-jwt-secret
          {{- if or .Values.activepiecesEnvVariables .Values.activepiecesConfig }}
          env:
            {{- range $key, $value := .Values.activepiecesConfig }}
            - name: {{ $key }}
              value: {{ $value | quote }}
            {{- end }}
            {{- $fullname := include "activepieces.fullname" . }}
            {{- $legacyKeys := dict "AP_ENCRYPTION_KEY" (list (printf "%s-secrets" $fullname) "encryption-key") "AP_JWT_SECRET" (list (printf "%s-jwt-secret" $fullname) "jwt-secret") }}
            {{- range $secretName, $vars := .Values.activepiecesEnvVariables }}
            {{- range $vars }}
            {{- $ref := list $secretName . true }}
            {{- with get $legacyKeys . }}
            {{- if hasKey ((lookup "v1" "Secret" $.Release.Namespace $secretName).data | default dict) (index $ref 1) }}
            {{- $ref = list $secretName (index $ref 1) false }}
            {{- else if hasKey ((lookup "v1" "Secret" $.Release.Namespace (index . 0)).data | default dict) (index . 1) }}
            {{- $ref = list (index . 0) (index . 1) false }}
            {{- end }}
            {{- end }}
            - name: {{ . }}
              valueFrom:
                secretKeyRef:
                  name: {{ index $ref 0 | quote }}
                  key: {{ index $ref 1 }}
                  optional: {{ index $ref 2 }}
            {{- end }}
            {{- end }}
          {{- end }}
          {{- with .Values.livenessProbe }}
          livenessProbe:
            {{- toYaml . | nindent 12 }}
          {{- end }}
          {{- with .Values.readinessProbe }}
          readinessProbe:
            {{- toYaml . | nindent 12 }}
          {{- end }}
          {{- with .Values.resources }}
          resources:
            {{- toYaml . | nindent 12 }}
          {{- end }}
          {{- if or .Values.persistence.enabled .Values.volumeMounts }}
          volumeMounts:
            {{- if .Values.persistence.enabled }}
            - name: cache
              mountPath: {{ .Values.persistence.mountPath | quote }}
            {{- end }}
            {{- with .Values.volumeMounts }}
            {{- toYaml . | nindent 12 }}
            {{- end }}
          {{- end }}
          {{- if or .Values.persistence.enabled .Values.volumes }}
      volumes:
        {{- if and .Values.persistence.enabled (ne (include "activepieces.workloadType" .) "statefulset") }}
        - name: cache
          persistentVolumeClaim:
            claimName: {{ include "activepieces.fullname" . }}-cache
        {{- end }}
        {{- with .Values.volumes }}
        {{- toYaml . | nindent 8 }}
        {{- end }}
      {{- 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 }}
  {{- if eq (include "activepieces.workloadType" .) "statefulset" }}
  {{- if .Values.persistence.enabled }}
  volumeClaimTemplates:
    - metadata:
        name: cache
      spec:
        accessModes: [ "ReadWriteOnce" ]
        {{- with include "activepieces.cacheStorageClassName" . }}
        storageClassName: {{ . | quote }}
        {{- end }}
        resources:
          requests:
            storage: {{ .Values.persistence.size | quote }}
  {{- end }}
  {{- else }}
  strategy:
    blueGreen:
      activeService: {{ include "activepieces.fullname" . }}
      previewService: {{ include "activepieces.fullname" . }}-preview
      autoPromotionEnabled: {{ .Values.rollout.blueGreen.autoPromotionEnabled }}
      scaleDownDelaySeconds: {{ .Values.rollout.blueGreen.scaleDownDelaySeconds }}
  {{- end }}