Skip to content

Commit

Permalink
Merge pull request #13 from FairwindsOps/nb/add-oauth-scope
Browse files Browse the repository at this point in the history
added additional oauth scopes
  • Loading branch information
bambash authored Oct 22, 2019
2 parents 6939c80 + 1420fd3 commit 2b88ec5
Show file tree
Hide file tree
Showing 8 changed files with 62 additions and 12 deletions.
4 changes: 4 additions & 0 deletions node_pool/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# node-pool-v2.1.0
- Addded ability to add additional oauth scopes to a node pool
- NOTE: changing oauth scopes will recreate your node pool

# node-pool-v2.0.0
- Added tags to be able to assign specific firewall rules to node pools in GCP - NOTE: Adding tags to nodepools _WILL RECREATE YOUR NODE POOL_! Use this option carefully!
- Added disk type to the node pool. Accepts the values 'pd-standard' or 'pd-ssd' _WILL RECREATE YOUR NODE POOL_! Use this option carefully!
Expand Down
11 changes: 11 additions & 0 deletions node_pool/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,17 @@ Default:
[]
```

#### additional\_oauth\_scope

Descriptio: List of strings for additional oauth scope in a node config

Type: `list`

Default:

```json
[]
```

## Future To-do Items

Expand Down
6 changes: 6 additions & 0 deletions node_pool/inputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,9 @@ variable "disk_type" {
description = "Type of the disk attached to each node"
default = "pd-standard"
}

variable "additional_oauth_scopes" {
type = "list"
description = "List of strings for additional oauth scope in a node config"
default = []
}
16 changes: 10 additions & 6 deletions node_pool/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,15 @@ resource "random_id" "entropy" {
byte_length = 2
}

locals {
base_oauth_scope = [
"https://www.googleapis.com/auth/devstorage.read_only",
"https://www.googleapis.com/auth/logging.write",
"https://www.googleapis.com/auth/monitoring",
"https://www.googleapis.com/auth/compute",
]
}

resource "google_container_node_pool" "node_pool" {
name = "${var.name}-${random_id.entropy.hex}"
cluster = "${var.gke_cluster_name}"
Expand All @@ -47,12 +56,7 @@ resource "google_container_node_pool" "node_pool" {
disk_type = "${var.disk_type}"
tags = ["${var.node_tags}"]

oauth_scopes = [
"https://www.googleapis.com/auth/devstorage.read_only",
"https://www.googleapis.com/auth/logging.write",
"https://www.googleapis.com/auth/monitoring",
"https://www.googleapis.com/auth/compute",
]
oauth_scopes = "${concat(local.base_oauth_scope, var.additional_oauth_scopes)}"
}

lifecycle {
Expand Down
4 changes: 4 additions & 0 deletions node_pool_taint/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
# node-pool-taint-v1.1.0
- added ability to add additional_oauth_scopes to node pools
- NOTE: changing oauth scopes will recreate your node pool

# node-pool-taint-v1.0.0
Initial release of `node-pool-taint` which leverages the `google-beta` provider to apply taints to node pools. This module should be roughly equivalent with the features of `node-pool` in the same repository.
11 changes: 11 additions & 0 deletions node_pool_taint/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,17 @@ Default:
[]
```

#### additional\_oauth\_scope

Descriptio: List of strings for additional oauth scope in a node config

Type: `list`

Default:

```json
[]
```

## Future To-do Items

Expand Down
6 changes: 6 additions & 0 deletions node_pool_taint/inputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,9 @@ variable "taint" {
description = "Key value pairs of taints to apply on nodes in the pool"
type = "map"
}

variable "additional_oauth_scopes" {
type = "list"
description = "List of strings for additional oauth scope in a node config"
default = []
}
16 changes: 10 additions & 6 deletions node_pool_taint/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,15 @@ resource "random_id" "entropy" {
byte_length = 2
}

locals {
base_oauth_scope = [
"https://www.googleapis.com/auth/devstorage.read_only",
"https://www.googleapis.com/auth/logging.write",
"https://www.googleapis.com/auth/monitoring",
"https://www.googleapis.com/auth/compute",
]
}

resource "google_container_node_pool" "node_pool" {
provider = "google-beta"
name = "${var.name}-${random_id.entropy.hex}"
Expand All @@ -50,12 +59,7 @@ resource "google_container_node_pool" "node_pool" {
disk_type = "${var.disk_type}"
tags = ["${var.node_tags}"]

oauth_scopes = [
"https://www.googleapis.com/auth/devstorage.read_only",
"https://www.googleapis.com/auth/logging.write",
"https://www.googleapis.com/auth/monitoring",
"https://www.googleapis.com/auth/compute",
]
oauth_scopes = "${concat(local.base_oauth_scope, var.additional_oauth_scopes)}"
}

lifecycle {
Expand Down

0 comments on commit 2b88ec5

Please sign in to comment.