Aller au contenu

How to create a Git Repositories

Objectives

Explain how to create a git repositories in kunai

Prerequisites

  • A Sylva management cluster with a provider for the desired environment.

Steps

  1. Create an empty git repository on Gitlab

    1. In GitLab, navigate to the project group where you want to create the repository and Click "New project/repository".

      gitlab_create_new_repo_1.PNG

    2. Choose "Create blank project"

      gitlab_create_new_repo_2.PNG

    3. Enter a project name and optional description. Ensure the visibility level is appropriate for your needs (e.g., private, internal, public).

      gitlab_create_new_repo_3.PNG 5. Click "Create project".

  2. Create access token

    We need to provide an acecss token to kunai with role "maintainer" and scope "api, read_repository, write_repository".

    1. In GitLab, go to your project settings (bottom left panel: "Settings").

      gitlab_access_token.PNG

    2. Click on "Add new Token"

      gitlab_access_token_2.PNG

    3. Enter a token name,set the expiration date, set role Maintainer and select the api, read_repository, and write_repository scopes.

      gitlab_access_token_3.PNG

    4. Click "Create project access token".

    5. Copy the generated token immediately. You won't be able to see it again.
  3. Retrieve a kubeconfig

    This example uses Rancher to retrieve the kubeconfig. Adapt these steps if you are using a different method.

    1. Access your Rancher instance (e.g., https://rancher.sylva/).
    2. Select the local cluster.

      rancher_local_cluster.PNG

    3. Click "Download Kubeconfig File".

      rancher_download_kubeconfig.PNG

    4. Note the server URL and the token from the downloaded kubeconfig file. You will need these for configuring Kunai. You can use the following command to extract the token:

      rancher_info.PNG

      Info

      If you are targeting a different management cluster than the one where kunai is deployed to, please decode the certificate-authority-data and provide it to kunai as cluster certificate

      echo "<certificate>"| base64 -d
      
  4. Create a Kunai gitRepository

    1. Access your Kunai instance (e.g., https://kunai.sylva/).
    2. Click "New" on the home page.

      kunai_create_gitrepository_1.PNG

    3. Enter the project name and other relevant details.

      kunai_create_gitrepository_2.PNG

      Info

      Please update the Git Certificate if your git repositories is using self signed certificate.

      Please update the Cluster Certificate if you are targeting a differente management cluster or using the service account.