Skip to content

Helm charts does not take into account the frontend / backend split #313

@MozeBaltyk

Description

@MozeBaltyk

currently I add to use the extraDeploy to deploy frontend apart from backend... it would be worth to add a template in the charts to handle this use case. I guess I am not the only to wonder how to deploy Frontend/backend backstage with an helm charts ?

Second point (more related to source code), the helm charts allow to create a configmaps "backstage-app-config" which I tried to reuse in the frontend but seems not be imported by frontend package/app :

          containers:
            - name: frontend
              image: localhost:5000/backstage-frontend:local
              imagePullPolicy: Always
              # Trying to use the same config maps created by backend - but not working
              envFrom:
                - configMapRef:
                    name: backstage-app-config

thrid point, would be better integration for ingress ...

Here is , how currently I deploy :

backstage:
  image:
    registry: localhost:5000
    repository: backstage-backend
    tag: local
    pullPolicy: Always

  startupProbe:
    failureThreshold: 30
    initialDelaySeconds: 60
    periodSeconds: 10
    successThreshold: 1
    timeoutSeconds: 2

  # Allow to load app-config.<BACKSTAGE_ENV>.yaml.
  extraEnvVars:
    - name: BACKSTAGE_ENV
      value: k3d

  # Create an backstage-app-config config-maps
  appConfig:
    app:
      title: Backstage
      baseUrl: http://backstage-frontend.backstage.svc.cluster.local
    backend:
      baseUrl: http://backstage.backstage.svc.cluster.local
      cors: 
        origin: http://backstage-frontend.backstage.svc.cluster.local

  # kubectl create secret generic backstage-secrets --from-env-file=vanilla/.env -n backstage
  # extraEnvVarsSecrets: 
  #   - backstage-secrets

  podSecurityContext:
    runAsUser: 65532
    runAsNonRoot: true
    fsGroup: 65532

  containerSecurityContext:
    allowPrivilegeEscalation: false
    readOnlyRootFilesystem: true
    capabilities:
      drop:
        - ALL

  extraVolumes:
    - name: tmp
      emptyDir: {}

  extraVolumeMounts:
    - name: tmp
      mountPath: /tmp

# Postgre Block 
postgresql:
  # -- Switch to enable or disable the PostgreSQL helm chart
  enabled: true
  # -- The authentication details of the Postgres database
  auth:
    username: backstage
    password: backstagepassword
    postgresPassword: adminpassword

extraDeploy:
  # -----------------------------
  # Frontend Deployment
  # -----------------------------
  - apiVersion: apps/v1
    kind: Deployment
    metadata:
      name: backstage-frontend
      labels:
        app: backstage-frontend
    spec:
      replicas: 1
      selector:
        matchLabels:
          app: backstage-frontend
      template:
        metadata:
          labels:
            app: backstage-frontend
        spec:
          securityContext:
            runAsUser: 65532
            runAsNonRoot: true
          containers:
            - name: frontend
              image: localhost:5000/backstage-frontend:local
              imagePullPolicy: Always
              # env:
              #   - name: APP_CONFIG_app_title
              #     value: Backstage
              #   - name: APP_CONFIG_app_baseUrl
              #     value: https://backstage.io
              #   - name: APP_CONFIG_backend_baseUrl
              #     value: https://backstage.io

              # Trying to use the same config maps created by backend - but not working
              envFrom:
                - configMapRef:
                    name: backstage-app-config
              
              securityContext:
                allowPrivilegeEscalation: false
                capabilities:
                  drop:
                    - ALL
              ports:
                - name: http
                  containerPort: 8080
              # env:
              #   - name: PORT
              #     value: "3000"
              resources:
                requests:
                  cpu: 100m
                  memory: 128Mi
                limits:
                  cpu: 500m
                  memory: 256Mi
              readinessProbe:
                httpGet:
                  path: /
                  port: 8080
                initialDelaySeconds: 5
                periodSeconds: 10
              livenessProbe:
                httpGet:
                  path: /
                  port: 8080
                initialDelaySeconds: 15
                periodSeconds: 20

  # -----------------------------
  # Frontend Ingress
  # -----------------------------
  - apiVersion: networking.k8s.io/v1
    kind: Ingress
    metadata:
      name: backstage-ingress
    spec:
      ingressClassName: traefik
      rules:
        - host: backstage.localhost
          http:
            paths:
              - path: /api
                pathType: Prefix
                backend:
                  service:
                    name: release-name-backstage
                    port:
                      number: 7007

              - path: /
                pathType: Prefix
                backend:
                  service:
                    name: backstage-frontend
                    port:
                      number: 3000

  # -----------------------------
  # Frontend Service
  # -----------------------------
  - apiVersion: v1
    kind: Service
    metadata:
      name: backstage-frontend
    spec:
      type: ClusterIP
      selector:
        app: backstage-frontend
      ports:
        - name: http-frontend
          port: 3000
          targetPort: 8080

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions