Skip to main content
Skip table of contents

Create a Git Repository

These pages refer to DKP Enterprise and DKP Gov Advanced products.

Create a Git Repository in the Workspace namespace

Use the CLI to create the GitRepository resource and add a new repository to your Workspace.

  1. Refer to Air-gapped Environment setup instructions section, if you are running in air-gapped environment.

  2. Set the WORKSPACE_NAMESPACE environment variable to the name of your workspace’s namespace:

    CODE
    export WORKSPACE_NAMESPACE=<workspace_namespace>
  3. Adapt the URL of your Git repository:

    CODE
    kubectl apply -f - <<EOF
    apiVersion: source.toolkit.fluxcd.io/v1
    kind: GitRepository
    metadata:
      name: example-repo
      namespace: ${WORKSPACE_NAMESPACE}
      labels:
        kommander.d2iq.io/gitapps-gitrepository-type: catalog
        kommander.d2iq.io/gitrepository-type: catalog
    spec:
      interval: 1m0s
      ref:
        branch: <your-target-branch-name> # e.g., main
      timeout: 20s
      url: https://github.com/<example-org>/<example-repo>
    EOF 
  4. Ensure the status of the GitRepository signals a ready state:

    CODE
    kubectl get gitrepository example-repo -n ${WORKSPACE_NAMESPACE}

The repository commit also displays the ready state:

CODE
NAME         URL                                                        READY   STATUS                                                              AGE
example-repo https://github.com/example-org/example-repo                True    Fetched revision: master/6c54bd1722604bd03d25dcac7a31c44ff4e03c6a   11m

For more information on the GitRepository resource fields and how to make Flux aware of credentials required to access a private Git repository, see the Flux documentation.

Troubleshoot

To troubleshoot issues with adding the GitRepository, review the following logs:

CODE
kubectl -n kommander-flux logs -l app=source-controller
[...]
kubectl -n kommander-flux logs -l app=kustomize-controller
[...]
kubectl -n kommander-flux logs -l app=helm-controller
[...]

Related Information

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.