Deploy Git app

A deploy-git-app component allows you to deploy an application from a GitHub repository. The generated component, will clone the repository, compile the code if necessary and run the internal code. This component supports Golang, Python, NodeJS and static web sites as targets.

Basic information

Basic information includes the targetRepo that will be cloned and the application language. Additionally, the container can define its exposed ports so that it can communicate with other services, the ingresses to expose the application through internet, and the requested CPU and memory to better utilize the available quota. The following YAML file contains a minimal example of a deploy-from-git with basic information.

apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
  name: my-app
spec:
  components:
  - name: component # Component Name
    type: deploy-git-app # Set to deploy-git-app
    properties:
      language: GOLANG # Application Language. Must be "static", "python", "nodejs" or"golang".
      targetRepo: https://github.com/organization/repository.git # GitHub repository

Private repositories

To deploy an application from a private repository, a Git PAT (Personal Access Token) is required. Once obtained, create a secret with two entries:

apiVersion: v1
kind: Secret
metadata:
  creationTimestamp: "2022-12-13T08:55:10Z"
  name: my-secret # Secret Name
type: Opaque
data:
  pat: <Git Personal Access Token in base64>
  username: <Git user in base64>

And then, configure the repositoryAccessTokenSecret property with the name of the secret you have just created with the Git credentials.

apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
  name: my-app
spec:
  components:
  - name: component # Component Name
    type: deploy-git-app # Set to deploy-git-app
    properties:
      language: GOLANG # Application Language. Must be "static", "python", "nodejs" or"golang".
      targetRepo: https://github.com/organization/repository.git # GitHub repository
      repositoryAccessTokenSecret: my-secret # secret Name

Full example of a deploy git app component

The following YAML shows a complete example of a deploy-git-app with all the major options.

apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
  name: my-app
spec:
  components:
  - type: deploy-git-app # Set to deploy-git-app
    name: component # Component Name 
    properties:
      targetRepo: https://github.com/organization/repository.git # (Required)  GitHub repository
      repositoryAccessTokenSecret: my-secret # (Optional)  secret Name
      language: GOLANG # (Required) Application Language. Must be "static", "python", "nodejs" or"golang".
      annotations: # (Optional)  Map with annotations
        annotationKey: annotationValue
      labels: # Map with labels
        labelKey: labelValue
      args: # (Optional) arguments to run the application  
      - run
      - --debug
      mainPath: # (Optional) path of the file that contains the main function
      env: # (Optional) environment variables
        - name: envName # Direct environment variable value
          value: envValue
        - name: envName 
          valueFrom:
            configMapKeyRef: # Environment variable from a data in a configMap 
              name: configmap-name
              key: configmap-entry
        - name: envName
          valueFrom:
            secretKeyRef: # Environment variable from a data in a secret
              name: secret-name
              key: secret-entry
      ports: # (Optional) exposed ports to communicate with other services
      - port: 7060
      ingresses: # (Optional) ingresses to expose to internet
      - targetPort: 8080
      cpu: 100m # (Optional) cpu required
      memory: 256Mi # (Optional) memory required
      volumeMounts: # (Optional) Definition of the volumes to be mounted
        pvc: # Using a Persistent Volume Claim
        - name: data
          mountPath: "/var/lib/db"
          claimName: "db-pvc"
        configMap: # Using a Config Map
        - name: cm-data
          mountPath: "/config"
          cmName: "db-config"
        secret: # Using a Secret
        - name: cert-data
          mountPath: "/certs"
          secretName: "db-certs"
        emptyDir: # Using an ephemeral mount
        - name: temp-data
          mountPath: "/var/lib/tmp"          
      readinessProbe: # (Optional) Definition of the readiness probe to determine the 
      # if the component can accept traffic.
        httpGet:
          path: /healthz
          port: 8080
        initialDelaySeconds: 3 # Number of seconds after the container is started before the first
        # probe is initiated. Set to 0 by default.
        periodSeconds: 3 # How often, in seconds, to execute the probe. Set to 10 by default
      livenessProbe: # (Optional) Definition of the liveness probe to determine the 
        # health status of a component rebooting it if needed
        httpGet:
            path: /healthz
            port: 8080
        initialDelaySeconds: 3 # Number of seconds after the container is started before the first
        # probe is initiated. Set to 0 by default.
        periodSeconds: 3 # How often, in seconds, to execute the probe. Set to 10 by default