-
Notifications
You must be signed in to change notification settings - Fork 104
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
39 changed files
with
761 additions
and
779 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Upgrading to v4.0 | ||
|
||
The v4.0 release of the `gh-runner-gke` module contains breaking changes. | ||
## Migration Instructions | ||
|
||
### `gh-runner-gke` module | ||
|
||
```diff | ||
module "runner-gke" { | ||
source = "terraform-google-modules/github-actions-runners/google//modules/gh-runner-gke" | ||
- version = "~> 3.0" | ||
+ version = "~> 4.0" | ||
|
||
project_id = var.project_id | ||
create_network = true | ||
+ cluster_suffix = "repo" | ||
- repo_name = "repo" | ||
- repo_owner = "repo_owner" | ||
- repo_url = "repo_url" | ||
- gh_token = "gh_token" | ||
+ gh_app_id = "123456" | ||
+ gh_app_installation_id = "12345678" | ||
+ gh_app_private_key = "sample" | ||
+ gh_config_url = "https://github.com/ORGANIZATION" | ||
} | ||
``` | ||
|
||
- Previously, the name of the created GKE cluster appended `repo_name` as a suffix. Now, the value of the suffix is set via `cluster_suffix`, as runner clusters can be created for workflows more than one GitHub repo. To prevent cluster deletion when upgrading, set the value of `cluster_suffix` to the previous value of `repo_name`. | ||
- The module now prefers authentication via GitHub App installation. Follow the instructions for [authenticating to ARC via GitHub App](https://docs.github.com/en/actions/hosting-your-own-runners/managing-self-hosted-runners-with-actions-runner-controller/authenticating-to-the-github-api#authenticating-arc-with-a-github-app), and provide the necessary values to the module instead of the previous repo authentication values. Upgrading will destroy the previously created `runner_k8s_config` kubernetes secret, so previous GitHub Runner images may fail. | ||
- Previously, the GKE cluster service account was provided with the `roles/storage.objectViewer` role to enable pulling images from Container Registry. The module no longer requires access to Container Registry, and so IAM membership has been removed. If your cluster relies on this role, you will need to add it again manually. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# Self Hosted runners on GKE that support dind-rootless | ||
|
||
## Overview | ||
|
||
This example shows how to deploy runners that support Docker Workflows on GKE in a rootless configuration. This example is based on the instructions published in [Deploying GitHub Action Runners on GKE with dind-rootless](https://medium.com/google-cloud/github-action-runners-on-gke-with-dind-rootless-bd54e23516c9). | ||
|
||
More examples of [Self Hosted Runners on GKE/Anthos](https://github.com/github-developer/self-hosted-runners-anthos). | ||
|
||
## Deployment | ||
|
||
1. Follow the instructions in the [GitHub documentation](https://docs.github.com/en/actions/hosting-your-own-runners/managing-self-hosted-runners-with-actions-runner-controller/authenticating-to-the-github-api#authenticating-arc-with-a-github-app) to create a GitHub App for authenticating ARC | ||
|
||
1. Gather the values for your GitHub App ID, GitHub App Installation ID, and GitHub App Private Key from the instructions linked above. | ||
|
||
1. Substitute your values into the example [`main.tf`](main.tf). Modify any other values as needed. For a full list of available variables, refer to the [module documentation](../../modules/gh-runner-gke/). | ||
|
||
1. Execute Terraform commands to create the required resources. | ||
```sh | ||
terraform init | ||
terraform apply | ||
``` | ||
|
||
1. Your runners should become active at `https://github.com/organizations/ORGANIZATION/settings/actions/runners`. | ||
|
||
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK --> | ||
## Inputs | ||
|
||
| Name | Description | Type | Default | Required | | ||
|------|-------------|------|---------|:--------:| | ||
| project\_id | The project id to deploy Github Runner MIG | `string` | n/a | yes | | ||
|
||
## Outputs | ||
|
||
| Name | Description | | ||
|------|-------------| | ||
| cluster\_name | Cluster name | | ||
| location | Cluster location | | ||
| project\_id | The project in which resources are created | | ||
| service\_account | The default service account used for running nodes. | | ||
|
||
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/** | ||
* Copyright 2020 Google LLC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
module "runner-gke" { | ||
source = "terraform-google-modules/github-actions-runners/google//modules/gh-runner-gke" | ||
version = "~> 3.0" | ||
|
||
project_id = var.project_id | ||
create_network = true | ||
network_name = "runner-network-dind-r" | ||
subnet_name = "runner-subnet-dind-r" | ||
cluster_suffix = "dind-rootless" | ||
gh_app_id = "123456" | ||
gh_app_installation_id = "12345678" | ||
gh_app_private_key = "sample" | ||
gh_config_url = "https://github.com/ORGANIZATION" | ||
|
||
# pass values.yaml for dind-rootless runners configuratin | ||
arc_runners_values = [ | ||
file("${path.module}/values.yaml") | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/** | ||
* Copyright 2020 Google LLC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
/***************************************** | ||
Kubernetes provider configuration | ||
*****************************************/ | ||
|
||
data "google_client_config" "default" { | ||
} | ||
|
||
provider "kubernetes" { | ||
host = "https://${module.runner-gke.kubernetes_endpoint}" | ||
token = data.google_client_config.default.access_token | ||
cluster_ca_certificate = base64decode(module.runner-gke.ca_certificate) | ||
} | ||
|
||
provider "helm" { | ||
kubernetes { | ||
host = "https://${module.runner-gke.kubernetes_endpoint}" | ||
token = data.google_client_config.default.access_token | ||
cluster_ca_certificate = base64decode(module.runner-gke.ca_certificate) | ||
exec { | ||
api_version = "client.authentication.k8s.io/v1beta1" | ||
command = "gke-gcloud-auth-plugin" | ||
} | ||
} | ||
} |
Oops, something went wrong.