-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
setClusterLocation, createCluster, deleteCluster
- Loading branch information
1 parent
dd993a3
commit 7beb212
Showing
13 changed files
with
205 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,11 @@ | ||
# Generated by roxygen2: do not edit by hand | ||
|
||
export(completeIpRotation) | ||
export(createCluster) | ||
export(deleteCluster) | ||
export(getCluster) | ||
export(getServerConfig) | ||
export(listClusters) | ||
export(setAddons) | ||
export(setClusterLocation) | ||
importFrom(googleAuthR,gar_api_generator) |
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,42 @@ | ||
#' createCluster | ||
#' | ||
#' Creates a cluster, consisting of the specified number and type of Google Compute Engine instances. | ||
#' By default, the cluster is created in the project's default network. | ||
#' One firewall is added for the cluster. After cluster creation, the cluster creates routes for each node to allow the containers on that node to communicate with all other instances in the cluster. | ||
#' Finally, an entry is added to the project's global metadata indicating which CIDR range is being used by the cluster. | ||
#' @param projectId The Google Developers Console project ID or project number. | ||
#' @param zone The name of the Google Compute Engine zone in which the cluster resides. | ||
#' @param clusterSpec A cluster specification. If no specification is provided, a 3 node, 100Gb disk, n1-standard-1 cluster will be created with the name "r-cluster". See here for specification: https://cloud.google.com/kubernetes-engine/docs/reference/rest/v1beta1/projects.zones.clusters | ||
#' @keywords projects.zones.clusters.create | ||
#' @importFrom googleAuthR gar_api_generator | ||
#' @export | ||
#' @examples | ||
#' createCluster(projectId = "myProjectId", zone = "europe-west1-d") | ||
|
||
createCluster <- function(projectId, zone, clusterSpec = NULL) { | ||
|
||
if(is.null(clusterSpec)) { | ||
clusterSpec <- list( | ||
name = "r-cluster", | ||
initialNodeCount = 3, | ||
nodeConfig = list( | ||
machineType = "n1-standard-1", | ||
diskSizeGb = 100, | ||
oauthScopes = c("https://www.googleapis.com/auth/compute", "https://www.googleapis.com/auth/devstorage.read_only"), | ||
imageType = "" | ||
) | ||
) | ||
} | ||
|
||
body <- list( | ||
cluster = clusterSpec | ||
) | ||
|
||
f <- gar_api_generator("https://container.googleapis.com/v1beta1", | ||
"POST", | ||
path_args = list(projects = projectId, zones = zone, clusters = "")) | ||
|
||
f(the_body = body) | ||
|
||
} | ||
|
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,24 @@ | ||
#' deleteCluster | ||
#' | ||
#' Deletes the cluster, including the Kubernetes endpoint and all worker nodes. | ||
#' Firewalls and routes that were configured during cluster creation are also deleted. | ||
#' Other Google Compute Engine resources that might be in use by the cluster (e.g. load balancer resources) will not be deleted if they weren't present at the initial create time. | ||
#' @param projectId The Google Developers Console project ID or project number. | ||
#' @param zone The name of the Google Compute Engine zone in which the cluster resides. | ||
#' @param clusterId The name of the cluster to delete. | ||
#' @keywords projects.zones.clusters.delete | ||
#' @importFrom googleAuthR gar_api_generator | ||
#' @export | ||
#' @examples | ||
#' deleteCluster(projectId = "myProjectId", zone = "europe-west1-d", clusterId = "r-cluster") | ||
|
||
deleteCluster <- function(projectId, zone, clusterId) { | ||
|
||
f <- gar_api_generator("https://container.googleapis.com/v1beta1", | ||
"DELETE", | ||
path_args = list(projects = projectId, zones = zone, clusters = clusterId)) | ||
|
||
f() | ||
|
||
} | ||
|
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
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,34 @@ | ||
#' setClusterLocation | ||
#' | ||
#' Sets the locations of a specific cluster. | ||
#' @param projectId The Google Developers Console project ID or project number. | ||
#' @param zone The name of the Google Compute Engine zone in which the cluster resides. | ||
#' @param clusterId The name of the cluster to upgrade. | ||
#' @param locations The desired list of Google Compute Engine locations in which the cluster's nodes should be located. Changing the locations a cluster is in will result in nodes being either created or removed from the cluster, depending on whether locations are being added or removed. This list must always include the cluster's primary zone. | ||
#' @keywords projects.zones.clusters.locations | ||
#' @importFrom googleAuthR gar_api_generator | ||
#' @export | ||
#' @examples | ||
#' setClusterLocation(projectId = "myProjectId", | ||
#' zone = "europe-west1-d", | ||
#' clusterId = "r-cluster", | ||
#' locations = c("europe-west1-d", | ||
#' "europe-west1-b")) | ||
|
||
setClusterLocation <- function(projectId, zone, clusterId, locations) { | ||
|
||
body <- list( | ||
locations = locations | ||
) | ||
|
||
f <- gar_api_generator("https://container.googleapis.com/v1beta1", | ||
"POST", | ||
path_args = list(projects = projectId, | ||
zones = zone, | ||
clusters = clusterId, | ||
locations = "")) | ||
|
||
f(the_body = body) | ||
|
||
} | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.