Kubeconfig-injector

The kubeconfig-injector trait injects the kubeconfig file required to access the environment in which the application is deployed on with kubectl command or the standard Kubernetes API.

The following snippet shows an example application with a component and a kubeconfig-injector trait.

apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
  name: my-app
  annotations: 
    version: "v0.0.1"
    description: "My application"
spec:
  components:
    - name: busybox
      type: worker
      properties:
        image: my-app-image:v1.0.0
      traits:
        - type: kubeconfig-injector
          properties:
            name:  trait-name # (Required) the trait name
            mountName: kubeconfig # (Optional) the volume name where the kubeconfig is saved (kubeconfig by default) 
            saMountName: sa-volume # (Optional) the volume name where the user secret is saved (saMountName by default)

This trait generates a kubeconfig file in the /var/napptive/kubeconfig path and sets the KUBECONFIG environment variable so the containers can automatically use it without further configuration.