diff --git a/platform/_partials/integrations/github-actions-pull-request-devspace.mdx b/platform/_partials/integrations/github-actions-pull-request-devspace.mdx index a8aeab0a4..7889a2663 100644 --- a/platform/_partials/integrations/github-actions-pull-request-devspace.mdx +++ b/platform/_partials/integrations/github-actions-pull-request-devspace.mdx @@ -15,15 +15,14 @@ jobs: uses: loft-sh/setup-devspace@main - name: Install vCluster CLI uses: loft-sh/setup-vcluster@main - - name: Login to vCluster Platform instance - env: - LOFT_URL: ${{ secrets.LOFT_URL }} - ACCESS_KEY: ${{ secrets.ACCESS_KEY }} - run: vcluster login $LOFT_URL --access-key $ACCESS_KEY + with: + url: ${{ secrets.VCLUSTER_PLATFORM_URL }} + # Specify your vCluster Platform access key here + access-key: ${{ secrets.VCLUSTER_PLATFORM_ACCESS_KEY }} - name: Create PR Virtual Cluster env: NAME: pr-${{ github.event.pull_request.number }}-${{ github.sha }}-${{ github.run_id }} - run: vcluster create $NAME --project default + run: vcluster platform create vcluster $NAME --project default - name: Run Tests run: devspace run e2e ``` diff --git a/platform/_partials/integrations/github-actions-spaces-pull-request-automatic.mdx b/platform/_partials/integrations/github-actions-spaces-pull-request-automatic.mdx index b05e5a630..361071d92 100644 --- a/platform/_partials/integrations/github-actions-spaces-pull-request-automatic.mdx +++ b/platform/_partials/integrations/github-actions-spaces-pull-request-automatic.mdx @@ -12,10 +12,11 @@ jobs: runs-on: ubuntu-latest steps: - name: Install vCluster CLI - uses: loft-sh/setup-loft@main + uses: loft-sh/setup-vcluster@main with: - url: ${{ secrets.LOFT_URL }} - access-key: ${{ secrets.LOFT_ACCESS_KEY }} + url: ${{ secrets.VCLUSTER_PLATFORM_URL }} + # Specify your vCluster Platform access key here + access-key: ${{ secrets.VCLUSTER_PLATFORM_ACCESS_KEY }} - name: Create Space for PR uses: loft-sh/create-space@main with: diff --git a/platform/_partials/integrations/github-actions-spaces-pull-request-manual.mdx b/platform/_partials/integrations/github-actions-spaces-pull-request-manual.mdx index 57d57b200..4fde92fd3 100644 --- a/platform/_partials/integrations/github-actions-spaces-pull-request-manual.mdx +++ b/platform/_partials/integrations/github-actions-spaces-pull-request-manual.mdx @@ -12,10 +12,11 @@ jobs: runs-on: ubuntu-latest steps: - name: Install vCluster CLI - uses: loft-sh/setup-loft@main + uses: loft-sh/setup-vcluster@main with: - url: ${{ secrets.LOFT_URL }} - access-key: ${{ secrets.LOFT_ACCESS_KEY }} + url: ${{ secrets.VCLUSTER_PLATFORM_URL }} + # Specify your vCluster Platform access key here + access-key: ${{ secrets.VCLUSTER_PLATFORM_ACCESS_KEY }} - name: Create Space for PR uses: loft-sh/create-space@main with: diff --git a/platform/_partials/integrations/github-actions-spaces-pull-request-reuse.mdx b/platform/_partials/integrations/github-actions-spaces-pull-request-reuse.mdx index 66d45a0de..7ca930f18 100644 --- a/platform/_partials/integrations/github-actions-spaces-pull-request-reuse.mdx +++ b/platform/_partials/integrations/github-actions-spaces-pull-request-reuse.mdx @@ -12,10 +12,11 @@ jobs: runs-on: ubuntu-latest steps: - name: Install vCluster CLI - uses: loft-sh/setup-loft@main + uses: loft-sh/setup-vcluster@main with: - url: ${{ secrets.LOFT_URL }} - access-key: ${{ secrets.LOFT_ACCESS_KEY }} + url: ${{ secrets.VCLUSTER_PLATFORM_URL }} + # Specify your vCluster Platform access key here + access-key: ${{ secrets.VCLUSTER_PLATFORM_ACCESS_KEY }} - name: Create Space for PR uses: loft-sh/create-space@main with: diff --git a/platform/_partials/integrations/github-actions-vclusters-pull-request-automatic.mdx b/platform/_partials/integrations/github-actions-vclusters-pull-request-automatic.mdx deleted file mode 100644 index 03b40d831..000000000 --- a/platform/_partials/integrations/github-actions-vclusters-pull-request-automatic.mdx +++ /dev/null @@ -1,37 +0,0 @@ -This example shows how to automatically delete a Virtual Cluster after testing an application named my-app for pull requests. - -```yaml {20} -# .github/workflows/vclusters.yaml -name: Pull Request Checks -on: - pull_request: - branches: - - 'main' -jobs: - e2e: - runs-on: ubuntu-latest - steps: - - name: Install vCluster CLI - uses: loft-sh/setup-loft@main - with: - url: ${{ secrets.LOFT_URL }} - access-key: ${{ secrets.LOFT_ACCESS_KEY }} - - name: Create Virtual Cluster for PR - uses: loft-sh/create-vcluster@main - with: - name: pr-${{ github.event.pull_request.number }}-${{ github.sha }}-${{ github.run_id }} - auto-cleanup: true - - name: Deploy Application - run: kubectl apply -Rf ./kubernetes - - name: Wait for Deployment - run: kubectl rollout status deployments/my-app - - name: Run Tests - run: make e2e -``` - -**Explanation:** -1. The [Setup Loft](https://github.com/loft-sh/setup-loft) action is used to install the vCluster CLI and login using the provided `url` and `access-key`. -2. The [Create Virtual Cluster](https://github.com/loft-sh/create-vcluster) action is used to create a unique virtual cluster using information about the pull request. This will automatically configure the kube context for the following steps. Additionally, we have enabled the `auto-cleanup` option, which will delete the virtual cluster after the job completes. -3. The next step deploys the application using the runner provided `kubectl` and manifests located under `./kubernetes`. -4. Before running tests, we use `kubectl` to wait for the `my-app` deployment to become ready. -5. Finally we run the end-to-end tests. In this example we're using `make` to run tests, but the command should be customized for your testing framework. There's no need to delete the virtual cluster since the `auto-cleanup` option was used when creating the virtual cluster. diff --git a/platform/_partials/integrations/github-actions-vclusters-pull-request-manual.mdx b/platform/_partials/integrations/github-actions-vclusters-pull-request-manual.mdx index 555a6073c..fa377a27e 100644 --- a/platform/_partials/integrations/github-actions-vclusters-pull-request-manual.mdx +++ b/platform/_partials/integrations/github-actions-vclusters-pull-request-manual.mdx @@ -7,21 +7,22 @@ on: pull_request: branches: - "main" + +env: + VCLUSTER_NAME: pr-${{ github.event.pull_request.number }}-${{ github.sha }}-${{ github.run_id }} + jobs: e2e: runs-on: ubuntu-latest steps: - name: Install vCluster CLI - uses: loft-sh/setup-vcluster@main - - name: Login to vCluster Platform instance - env: - LOFT_URL: ${{ secrets.LOFT_URL }} - ACCESS_KEY: ${{ secrets.ACCESS_KEY }} - run: vcluster login $LOFT_URL --access-key $ACCESS_KEY + uses: loft-sh/setup-vcluster@main + with: + url: ${{ secrets.VCLUSTER_PLATFORM_URL }} + # Specify your vCluster Platform access key here + access-key: ${{ secrets.VCLUSTER_PLATFORM_ACCESS_KEY }} - name: Create PR Virtual Cluster - env: - NAME: pr-${{ github.event.pull_request.number }}-${{ github.sha }}-${{ github.run_id }} - run: vcluster create $NAME --project default + run: vcluster platform create vcluster $VCLUSTER_NAME --project default - name: Deploy Application run: kubectl apply -Rf ./kubernetes - name: Wait for Deployment @@ -29,17 +30,14 @@ jobs: - name: Run Tests run: make e2e - name: Delete PR Virtual Cluster - env: - NAME: pr-${{ github.event.pull_request.number }}-${{ github.sha }}-${{ github.run_id }} - run: vcluster delete $NAME --project default + run: vcluster platform delete vcluster $VCLUSTER_NAME --project default ``` **Explanation:** -1. The [Setup vCluster Platform](https://github.com/loft-sh/setup-vcluster) action is used to install the vCluster CLI. -2. The `vcluster login` command is used to log in to the organization's vCluster Platform instance. Environment variables `LOFT_URL` and `ACCESS_KEY` are populated using [GitHub secrets](https://docs.github.com/en/actions/security-guides/using-secrets-in-github-actions). -3. The `vcluster create` command is used to create a unique virtual cluster using information about the pull request in the `default` project. This will automatically configure the kube context for the next steps. -4. The next step deploys the application using the runner provided `kubectl` and manifests located under `./kubernetes`. -5. Before running tests, we use `kubectl` to wait for the `my-app` deployment to become ready. -6. Now we run the end-to-end tests. In this example we're using `make` to run tests, but the command should be customized for your testing framework. -7. Finally, the `vcluster delete` command is used to delete the virtual cluster. +1. The [Setup vCluster Platform](https://github.com/loft-sh/setup-vcluster) action is used to install the vCluster CLI and log in to the organization's vCluster Platform instance. Environment variables `VCLUSTER_PLATFORM_URL` and `VCLUSTER_PLATFORM_ACCESS_KEY` are populated using [GitHub secrets](https://docs.github.com/en/actions/security-guides/using-secrets-in-github-actions). +2. The `vcluster platform create vcluster` command is used to create a unique virtual cluster using information about the pull request in the `default` project. This will automatically configure the kube context for the next steps. +3. The next step deploys the application using the runner provided `kubectl` and manifests located under `./kubernetes`. +4. Before running tests, we use `kubectl` to wait for the `my-app` deployment to become ready. +5. Now we run the end-to-end tests. In this example we're using `make` to run tests, but the command should be customized for your testing framework. +6. Finally, the `vcluster platform delete vcluster` command is used to delete the virtual cluster. diff --git a/platform/_partials/integrations/github-actions-vclusters-pull-request-use.mdx b/platform/_partials/integrations/github-actions-vclusters-pull-request-use.mdx index 05a10baf3..6bf722b88 100644 --- a/platform/_partials/integrations/github-actions-vclusters-pull-request-use.mdx +++ b/platform/_partials/integrations/github-actions-vclusters-pull-request-use.mdx @@ -7,21 +7,21 @@ on: pull_request: branches: - "main" + jobs: e2e: runs-on: ubuntu-latest steps: - - name: Install vCluster CLI - uses: loft-sh/setup-vcluster@main - - name: Login to vCluster Platform instance - env: - LOFT_URL: ${{ secrets.LOFT_URL }} - ACCESS_KEY: ${{ secrets.ACCESS_KEY }} - run: vcluster login $LOFT_URL --access-key $ACCESS_KEY + - name: Setup vCluster Platform + uses: loft-sh/setup-vcluster@main + with: + url: ${{ secrets.VCLUSTER_PLATFORM_URL }} + # Specify your vCluster Platform access key here + access-key: ${{ secrets.VCLUSTER_PLATFORM_ACCESS_KEY }} - name: Create PR Virtual Cluster env: NAME: pr-${{ github.event.pull_request.number }}-${{ github.sha }}-${{ github.run_id }} - run: vcluster create $NAME --project default --upgrade + run: vcluster platform create vcluster $NAME --project default --upgrade - name: Deploy Application run: kubectl apply -Rf ./kubernetes - name: Wait for Deployment @@ -32,9 +32,8 @@ jobs: **Explanation:** -1. The [Setup vCluster Platform](https://github.com/loft-sh/setup-vcluster) action is used to install the vCluster CLI. -2. The `vcluster login` command is used to log in to the organization's vCluster Platform instance. Environment variables `LOFT_URL` and `ACCESS_KEY` are populated using [GitHub secrets](https://docs.github.com/en/actions/security-guides/using-secrets-in-github-actions). -3. The `vcluster create` command is used to create a unique virtual cluster using information about the pull request in the `default` project. This will automatically configure the kube context for the next steps. The `--upgrade` flag has been added to reuse the existing virtual cluster and upgrade it to the latest version. Additional flags may be used to control the desired virtual cluster version. -4. The next step deploys the application using the runner provided `kubectl` and manifests located under `./kubernetes`. -5. Before running tests, we use `kubectl` to wait for the `my-app` deployment to become ready. -6. Now we run the end-to-end tests. In this example we're using `make` to run tests, but the command should be customized for your testing framework. +1. The [Setup vCluster Platform](https://github.com/loft-sh/setup-vcluster) action is used to install the vCluster CLI and to log in to the organization's vCluster Platform instance. Environment variables `VCLUSTER_PLATFORM_URL` and `VCLUSTER_PLATFORM_ACCESS_KEY` are populated using [GitHub secrets](https://docs.github.com/en/actions/security-guides/using-secrets-in-github-actions). +2. The `vcluster platform create vcluster` command is used to create a unique virtual cluster using information about the pull request in the `default` project. This will automatically configure the kube context for the next steps. The `--upgrade` flag has been added to reuse the existing virtual cluster and upgrade it to the latest version. Additional flags may be used to control the desired virtual cluster version. +3. The next step deploys the application using the runner provided `kubectl` and manifests located under `./kubernetes`. +4. Before running tests, we use `kubectl` to wait for the `my-app` deployment to become ready. +5. Now we run the end-to-end tests. In this example we're using `make` to run tests, but the command should be customized for your testing framework. diff --git a/platform/integrations/github-actions/preview-environments.mdx b/platform/integrations/github-actions/preview-environments.mdx index 78864782c..43388876c 100644 --- a/platform/integrations/github-actions/preview-environments.mdx +++ b/platform/integrations/github-actions/preview-environments.mdx @@ -75,12 +75,11 @@ jobs: uses: actions/checkout@v3 - name: Install vCluster CLI - uses: loft-sh/setup-loft@v2 + uses: loft-sh/setup-vcluster@main with: - version: v3.0.0 - url: https://url-to-your-loft-instance.com + url: ${{ secrets.VCLUSTER_PLATFORM_URL }} # Specify your vCluster Platform access key here - access-key: ${{ secrets.LOFT_PREVIEW_ACCESS_KEY }} + access-key: ${{ secrets.VCLUSTER_PLATFORM_ACCESS_KEY }} # Optional if your vCluster Platform domain certificate is insecure #insecure: true @@ -89,7 +88,7 @@ jobs: INGRESS_HOST=loft-preview-${{ github.event.pull_request.number }}.my-preview-environments.com # Make sure to recreate if there is an already existing environment - vcluster pro create loft-preview-${{ github.event.pull_request.number }} --project preview --recreate + vcluster plaltform create vcluster loft-preview-${{ github.event.pull_request.number }} --project preview --recreate # Deploy the application here with an ingress helm repo add argo https://argoproj.github.io/argo-helm @@ -129,17 +128,16 @@ jobs: uses: actions/checkout@v3 - name: Install vCluster CLI - uses: loft-sh/setup-loft@v2 + uses: loft-sh/setup-vcluster@main with: - version: v3.0.0 - url: https://url-to-your-loft-instance.com + url: ${{ secrets.VCLUSTER_PLATFORM_URL }} # Specify your vCluster Platform access key here - access-key: ${{ secrets.LOFT_PREVIEW_ACCESS_KEY }} + access-key: ${{ secrets.VCLUSTER_PLATFORM_ACCESS_KEY }} #insecure: true - name: Destroy Preview Environment run: | - loft delete vcluster loft-preview-${{ github.event.pull_request.number }} --project preview + vcluster platform delete vcluster loft-preview-${{ github.event.pull_request.number }} --project preview ``` ## Conclusion diff --git a/platform/integrations/github-actions/pull-requests.mdx b/platform/integrations/github-actions/pull-requests.mdx index 565546699..9f821a53c 100644 --- a/platform/integrations/github-actions/pull-requests.mdx +++ b/platform/integrations/github-actions/pull-requests.mdx @@ -7,7 +7,6 @@ sidebar_position: 1 import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem' -import PartialIntegrationsVclusterPullRequestAutomatic from '../../_partials/integrations/github-actions-vclusters-pull-request-automatic.mdx' import PartialIntegrationsVclusterPullRequestManual from '../../_partials/integrations/github-actions-vclusters-pull-request-manual.mdx' import PartialIntegrationsVclusterPullRequestUse from '../../_partials/integrations/github-actions-vclusters-pull-request-use.mdx' @@ -31,7 +30,6 @@ These examples show how to create and delete Virtual Clusters for pull requests. defaultValue="manual" values={[ {label: 'Basic', value: 'manual',}, - {label: 'Automatic Cleanup', value: 'automatic',}, {label: 'Reuse', value: 'use',}, ]}> @@ -40,9 +38,6 @@ These examples show how to create and delete Virtual Clusters for pull requests. - - - ## Deploying Spaces on Pull Requests