Code Monkey home page Code Monkey logo

googlekubernetesr's Introduction

googleKubernetesR

An R package for the Google Kubernetes Engine API. Note: This package is in a very early stage of development and not recommended for use in production.

Thanks

A big thank you to Mark Edmondson for the googleAuthR package which is used extensively in this project.

Currently implemented

Installation

devtools::install_github("RhysJackson/googleKubernetesR")
library(googleKubernetesR)

Authentication

Authenticate with JSON file

# Create and download your OAuth 2.0 credentials from the Google Cloud Platform
k8s_auth(json = "client_secret.json")

Authenticate with client ID and client secret

# If making many API calls, create your own OAuth client credentials from the Google Cloud console and provide them here as options to googleAuthR
options(googleAuthR.client_id = "YOUR-CLIENT-ID",
        googleAuthR.client_secret = "YOUR-CLIENT-SECRET")

# Authenticate
k8s_auth()

Examples

Create a cluster

# Create a 3 node, n1-standard-1, 100Gb disk, cluster with the default name 'r-cluster'
# Cluster comes configured with recommended scopes https://www.googleapis.com/auth/compute and https://www.googleapis.com/auth/devstorage.read_only
createCluster(projectId = "myProject", "europe-west1-d")
# Create 5 node, n1-highmem-2, 500Gb disk, cluster with read/write access to Google Cloud Storage

# Define the cluster spec
clusterSpec <- list(
  name = "my-cluster",
  initialNodeCount = 5,
  nodeConfig = list(
    machineType = "n1-highmem-2",
    diskSizeGb = 500,
    oauthScopes = c("https://www.googleapis.com/auth/compute",
    				"https://www.googleapis.com/auth/devstorage.read_write")
  )
)

# Create the cluster
createCluster(projectId = "myProject",
	zone = "europe-west1-d",
	clusterSpec = clusterSpec)

List Clusters

# List all clusters in a project
listClusters(projectId = "myProject")
# List all clusters in a specific zone
listClusters(projectId = "myProject", zone = "europe-west1-d")

Set addons for an existing cluster

See the AddonsConfig documentation for details on how to specify the addonsConfig argument

# Define the addons configuration
addonsConfig <- list(
	httpLoadBalancing = list(disabled = TRUE)
)

# Disable the HTTP Load Balancing addon
setAddons(projectId = "myProject",
		  projectLocation = "europe-west1-d",
		  clusterId = "my-cluster",
		  addonsConfig = addonsConfig)

Delete Cluster

deleteCluster(projectId = "myProject", zone = "europe-west1-d", clusterId = "my-cluster")

googlekubernetesr's People

Contributors

rhysjackson avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.