Skip to content

Expose the cnoe backstage as service and ingress route #13

Description

@cmoulliard

TODO

Expose the cnoe backstage application as a kubernetes service and deploy an ingress route to access it using the url https://backstage.idpbuilder.cnoe.io.local:8443/

Patch the following yaml to expose the service as ingress route

apiVersion: apps/v1
kind: Deployment
metadata:
  name: postgres
  namespace: backstage
spec:
  replicas: 1
  selector:
    matchLabels:
      app: postgres
  template:
    metadata:
      labels:
        app: postgres
    spec:
      containers:
        - name: postgres
          image: postgres:13.2-alpine
          imagePullPolicy: 'IfNotPresent'
          ports:
            - containerPort: 5432
          envFrom:
            - secretRef:
                name: postgres-secrets
          volumeMounts:
            - mountPath: /var/lib/postgresql/data
              name: postgresdb
      volumes:
        - name: postgresdb
          persistentVolumeClaim:
            claimName: postgres-storage-claim
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: backstage
  namespace: backstage
spec:
  replicas: 1
  selector:
    matchLabels:
      app: backstage
  template:
    metadata:
      labels:
        app: backstage
    spec:
      containers:
        - name: backstage
          image: public.ecr.aws/cnoe-io/backstage:v0.0.3
          imagePullPolicy: IfNotPresent
          ports:
            - name: backend
              containerPort: 7007
          envFrom:
            - secretRef:
                name: postgres-secrets
            #- secretRef:
            #    name: backstage-secrets
          volumeMounts:
            - mountPath: /app/app-config.yaml
              name: app-config
              subPath: app-config.yaml
      volumes:
        - configMap:
            defaultMode: 420
            name: app-config
          name: app-config
---
apiVersion: v1
kind: Service
metadata:
  name: backstage
  namespace: backstage
spec:
  ports:
  - name: http-backend
    port: 7007
    protocol: TCP
    targetPort: backend
  selector:
    app: backstage
  sessionAffinity: None
  type: ClusterIP
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: backstage
  namespace: backstage
spec:
  ingressClassName: nginx
  rules:
    - host: backstage.idpbuilder.cnoe.io.local
      http:
        paths:
          - backend:
              service:
                name: backstage
                port:
                  number: 7007
            path: /
            pathType: Prefix
---
apiVersion: v1
kind: ConfigMap
metadata:
  name: app-config
  namespace: backstage
data:
  app-config.yaml: |
    app:
      title: CNOE
      baseUrl: "https://backstage.idpbuilder.cnoe.io.local:8443"
    
    organization:
      name: CNOE

    backend:
      baseUrl: "https://backstage.idpbuilder.cnoe.io.local:8443"
      csp:
        connect-src: ['self', 'http:', 'https:']
      cors:
        origin: "https://backstage.idpbuilder.cnoe.io.local:8443"

      database:
        client: better-sqlite3
        connection: ':memory:'
      cache:
        store: memory
    
    auth:
      # see https://backstage.io/docs/auth/ to learn about auth providers
      environment: local
      providers: {}

    catalog:
      import:
        entityFilename: catalog-info.yaml
        pullRequestBranchName: backstage-integration
      locations: []
      rules:
        - allow:
            - Component
            - System
            - Group
            - Resource
            - Location
            - Template
            - API
    
    kubernetes:
      clusterLocatorMethods:
        - clusters:
            - authProvider: serviceAccount
              name: kind
              serviceAccountToken: /var/run/secrets/kubernetes.io/serviceaccount/token
              skipMetricsLookup: true
              skipTLSVerify: true
              url: https://kubernetes.default.svc
          type: config
      serviceLocatorMethod:
        type: multiTenant
    
    techdocs:
      builder: local
      generator:
        runIn: local
      publisher:
        type: local

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