Skip to content

Commit

Permalink
Merge pull request #97 from modular-magician/codegen-pr-1295
Browse files Browse the repository at this point in the history
Inspec regional cluster
  • Loading branch information
slevenick authored Jan 30, 2019
2 parents 2c51de4 + bf0e504 commit a562de7
Show file tree
Hide file tree
Showing 13 changed files with 639 additions and 1 deletion.
100 changes: 100 additions & 0 deletions docs/resources/google_container_regional_cluster.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
---
title: About the RegionalCluster resource
platform: gcp
---


## Syntax
A `google_container_regional_cluster` is used to test a Google RegionalCluster resource

## Examples
```
describe google_container_regional_cluster(project: 'chef-gcp-inspec', location: 'europe-west2', name: 'inspec-gcp-regional-cluster') do
it { should exist }
its('initial_node_count') { should eq '1'}
its('location') { should eq 'europe-west2'}
end
describe google_container_regional_cluster(project: 'chef-gcp-inspec', location: 'europe-west2', name: 'nonexistent') do
it { should_not exist }
end
```

## Properties
Properties that can be accessed from the `google_container_regional_cluster` resource:

* `name`: The name of this cluster. The name must be unique within this project and location, and can be up to 40 characters. Must be Lowercase letters, numbers, and hyphens only. Must start with a letter. Must end with a number or a letter.

* `description`: An optional description of this cluster.

* `initial_node_count`: The number of nodes to create in this cluster. You must ensure that your Compute Engine resource quota is sufficient for this number of instances. You must also have available firewall and routes quota. For requests, this field should only be used in lieu of a "nodePool" object, since this configuration (along with the "nodeConfig") will be used to create a "NodePool" object with an auto-generated name. Do not use this and a nodePool at the same time.

* `node_config`: Parameters used in creating the cluster's nodes. For requests, this field should only be used in lieu of a "nodePool" object, since this configuration (along with the "initialNodeCount") will be used to create a "NodePool" object with an auto-generated name. Do not use this and a nodePool at the same time. For responses, this field will be populated with the node configuration of the first node pool. If unspecified, the defaults are used.

* `machineType`: The name of a Google Compute Engine machine type (e.g. n1-standard-1). If unspecified, the default machine type is n1-standard-1.

* `diskSizeGb`: Size of the disk attached to each node, specified in GB. The smallest allowed disk size is 10GB. If unspecified, the default disk size is 100GB.

* `oauthScopes`: The set of Google API scopes to be made available on all of the node VMs under the "default" service account. The following scopes are recommended, but not required, and by default are not included: https://www.googleapis.com/auth/compute is required for mounting persistent storage on your nodes. https://www.googleapis.com/auth/devstorage.read_only is required for communicating with gcr.io (the Google Container Registry). If unspecified, no scopes are added, unless Cloud Logging or Cloud Monitoring are enabled, in which case their required scopes will be added.

* `serviceAccount`: The Google Cloud Platform Service Account to be used by the node VMs. If no Service Account is specified, the "default" service account is used.

* `metadata`: The metadata key/value pairs assigned to instances in the cluster. Keys must conform to the regexp [a-zA-Z0-9-_]+ and be less than 128 bytes in length. These are reflected as part of a URL in the metadata server. Additionally, to avoid ambiguity, keys must not conflict with any other metadata keys for the project or be one of the four reserved keys: "instance-template", "kube-env", "startup-script", and "user-data" Values are free-form strings, and only have meaning as interpreted by the image running in the instance. The only restriction placed on them is that each value's size must be less than or equal to 32 KB. The total size of all keys and values must be less than 512 KB. An object containing a list of "key": value pairs. Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.

* `imageType`: The image type to use for this node. Note that for a given image type, the latest version of it will be used.

* `labels`: The map of Kubernetes labels (key/value pairs) to be applied to each node. These will added in addition to any default label(s) that Kubernetes may apply to the node. In case of conflict in label keys, the applied set may differ depending on the Kubernetes version -- it's best to assume the behavior is undefined and conflicts should be avoided. For more information, including usage and the valid values, see: http://kubernetes.io/v1.1/docs/user-guide/labels.html An object containing a list of "key": value pairs. Example: { "name": "wrench", "mass": "1.3kg", "count": "3" }.

* `localSsdCount`: The number of local SSD disks to be attached to the node. The limit for this value is dependant upon the maximum number of disks available on a machine per zone. See: https://cloud.google.com/compute/docs/disks/local-ssd#local_ssd_limits for more information.

* `tags`: The list of instance tags applied to all nodes. Tags are used to identify valid sources or targets for network firewalls and are specified by the client during cluster or node pool creation. Each tag within the list must comply with RFC1035.

* `preemptible`: Whether the nodes are created as preemptible VM instances. See: https://cloud.google.com/compute/docs/instances/preemptible for more information about preemptible VM instances.

* `master_auth`: The authentication information for accessing the master endpoint.

* `username`: The username to use for HTTP basic authentication to the master endpoint.

* `password`: The password to use for HTTP basic authentication to the master endpoint. Because the master endpoint is open to the Internet, you should create a strong password.

* `clusterCaCertificate`: Base64-encoded public certificate that is the root of trust for the cluster.

* `clientCertificate`: Base64-encoded public certificate used by clients to authenticate to the cluster endpoint.

* `clientKey`: Base64-encoded private key used by clients to authenticate to the cluster endpoint.

* `logging_service`: The logging service the cluster should use to write logs. Currently available options: logging.googleapis.com - the Google Cloud Logging service. none - no logs will be exported from the cluster. if left as an empty string,logging.googleapis.com will be used.

* `monitoring_service`: The monitoring service the cluster should use to write metrics. Currently available options: monitoring.googleapis.com - the Google Cloud Monitoring service. none - no metrics will be exported from the cluster. if left as an empty string, monitoring.googleapis.com will be used.

* `network`: The name of the Google Compute Engine network to which the cluster is connected. If left unspecified, the default network will be used.

* `cluster_ipv4_cidr`: The IP address range of the container pods in this cluster, in CIDR notation (e.g. 10.96.0.0/14). Leave blank to have one automatically chosen or specify a /14 block in 10.0.0.0/8.

* `addons_config`: Configurations for the various addons available to run in the cluster.

* `httpLoadBalancing`: Configuration for the HTTP (L7) load balancing controller addon, which makes it easy to set up HTTP load balancers for services in a cluster.

* `horizontalPodAutoscaling`: Configuration for the horizontal pod autoscaling feature, which increases or decreases the number of replica pods a replication controller has based on the resource usage of the existing pods.

* `subnetwork`: The name of the Google Compute Engine subnetwork to which the cluster is connected.

* `endpoint`: The IP address of this cluster's master endpoint. The endpoint can be accessed from the internet at https://username:password@endpoint/ See the masterAuth property of this resource for username and password information.

* `initial_cluster_version`: The software version of the master endpoint and kubelets used in the cluster when it was first created. The version can be upgraded over time.

* `current_master_version`: The current software version of the master endpoint.

* `current_node_version`: The current version of the node software components. If they are currently at multiple versions because they're in the process of being upgraded, this reflects the minimum version of all nodes.

* `create_time`: The time the cluster was created, in RFC3339 text format.

* `node_ipv4_cidr_size`: The size of the address space on each node for hosting containers. This is provisioned from within the container_ipv4_cidr range.

* `services_ipv4_cidr`: The IP address range of the Kubernetes services in this cluster, in CIDR notation (e.g. 1.2.3.4/29). Service addresses are typically put in the last /16 from the container CIDR.

* `current_node_count`: The number of nodes currently in the cluster.

* `expire_time`: The time the cluster will be automatically deleted in RFC3339 text format.

* `location`: The location where the cluster is deployed
47 changes: 47 additions & 0 deletions docs/resources/google_container_regional_clusters.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
---
title: About the RegionalCluster resource
platform: gcp
---


## Syntax
A `google_container_regional_clusters` is used to test a Google RegionalCluster resource

## Examples
```
describe google_container_regional_clusters(project: 'chef-gcp-inspec', location: 'europe-west2') do
its('count') { should be >= 1 }
its('names') { should include 'inspec-gcp-regional-cluster' }
its('initial_node_counts') { should include '1'}
end
```

## Properties
Properties that can be accessed from the `google_container_regional_clusters` resource:

See [google_container_regional_cluster.md](google_container_regional_cluster.md) for more detailed information
* `names`: an array of `google_container_regional_cluster` name
* `descriptions`: an array of `google_container_regional_cluster` description
* `initial_node_counts`: an array of `google_container_regional_cluster` initial_node_count
* `node_configs`: an array of `google_container_regional_cluster` node_config
* `master_auths`: an array of `google_container_regional_cluster` master_auth
* `logging_services`: an array of `google_container_regional_cluster` logging_service
* `monitoring_services`: an array of `google_container_regional_cluster` monitoring_service
* `networks`: an array of `google_container_regional_cluster` network
* `cluster_ipv4_cidrs`: an array of `google_container_regional_cluster` cluster_ipv4_cidr
* `addons_configs`: an array of `google_container_regional_cluster` addons_config
* `subnetworks`: an array of `google_container_regional_cluster` subnetwork
* `endpoints`: an array of `google_container_regional_cluster` endpoint
* `initial_cluster_versions`: an array of `google_container_regional_cluster` initial_cluster_version
* `current_master_versions`: an array of `google_container_regional_cluster` current_master_version
* `current_node_versions`: an array of `google_container_regional_cluster` current_node_version
* `create_times`: an array of `google_container_regional_cluster` create_time
* `node_ipv4_cidr_sizes`: an array of `google_container_regional_cluster` node_ipv4_cidr_size
* `services_ipv4_cidrs`: an array of `google_container_regional_cluster` services_ipv4_cidr
* `current_node_counts`: an array of `google_container_regional_cluster` current_node_count
* `expire_times`: an array of `google_container_regional_cluster` expire_time
* `locations`: an array of `google_container_regional_cluster` location

## Filter Criteria
This resource supports all of the above properties as filter criteria, which can be used
with `where` as a block or a method.
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# frozen_string_literal: false

# ----------------------------------------------------------------------------
#
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
#
# ----------------------------------------------------------------------------
#
# This file is automatically generated by Magic Modules and manual
# changes will be clobbered when the file is regenerated.
#
# Please read more about how to change this file in README.md and
# CONTRIBUTING.md located at the root of this package.
#
# ----------------------------------------------------------------------------
require 'google/container/property/regionalcluster_horizontal_pod_autoscaling'
require 'google/container/property/regionalcluster_http_load_balancing'
module GoogleInSpec
module Container
module Property
class RegionalClusterAddonsconfig
attr_reader :http_load_balancing

attr_reader :horizontal_pod_autoscaling

def initialize(args = nil)
return if args.nil?
@http_load_balancing = GoogleInSpec::Container::Property::RegionalClusterHttploadbalancing.new(args['httpLoadBalancing'])
@horizontal_pod_autoscaling = GoogleInSpec::Container::Property::RegionalClusterHorizontalpodautoscaling.new(args['horizontalPodAutoscaling'])
end
end
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# frozen_string_literal: false

# ----------------------------------------------------------------------------
#
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
#
# ----------------------------------------------------------------------------
#
# This file is automatically generated by Magic Modules and manual
# changes will be clobbered when the file is regenerated.
#
# Please read more about how to change this file in README.md and
# CONTRIBUTING.md located at the root of this package.
#
# ----------------------------------------------------------------------------
module GoogleInSpec
module Container
module Property
class RegionalClusterHorizontalpodautoscaling
attr_reader :disabled

def initialize(args = nil)
return if args.nil?
@disabled = args['disabled']
end
end
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# frozen_string_literal: false

# ----------------------------------------------------------------------------
#
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
#
# ----------------------------------------------------------------------------
#
# This file is automatically generated by Magic Modules and manual
# changes will be clobbered when the file is regenerated.
#
# Please read more about how to change this file in README.md and
# CONTRIBUTING.md located at the root of this package.
#
# ----------------------------------------------------------------------------
module GoogleInSpec
module Container
module Property
class RegionalClusterHttploadbalancing
attr_reader :disabled

def initialize(args = nil)
return if args.nil?
@disabled = args['disabled']
end
end
end
end
end
41 changes: 41 additions & 0 deletions libraries/google/container/property/regionalcluster_master_auth.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# frozen_string_literal: false

# ----------------------------------------------------------------------------
#
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
#
# ----------------------------------------------------------------------------
#
# This file is automatically generated by Magic Modules and manual
# changes will be clobbered when the file is regenerated.
#
# Please read more about how to change this file in README.md and
# CONTRIBUTING.md located at the root of this package.
#
# ----------------------------------------------------------------------------
module GoogleInSpec
module Container
module Property
class RegionalClusterMasterauth
attr_reader :username

attr_reader :password

attr_reader :cluster_ca_certificate

attr_reader :client_certificate

attr_reader :client_key

def initialize(args = nil)
return if args.nil?
@username = args['username']
@password = args['password']
@cluster_ca_certificate = args['clusterCaCertificate']
@client_certificate = args['clientCertificate']
@client_key = args['clientKey']
end
end
end
end
end
56 changes: 56 additions & 0 deletions libraries/google/container/property/regionalcluster_node_config.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# frozen_string_literal: false

# ----------------------------------------------------------------------------
#
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
#
# ----------------------------------------------------------------------------
#
# This file is automatically generated by Magic Modules and manual
# changes will be clobbered when the file is regenerated.
#
# Please read more about how to change this file in README.md and
# CONTRIBUTING.md located at the root of this package.
#
# ----------------------------------------------------------------------------
module GoogleInSpec
module Container
module Property
class RegionalClusterNodeconfig
attr_reader :machine_type

attr_reader :disk_size_gb

attr_reader :oauth_scopes

attr_reader :service_account

attr_reader :metadata

attr_reader :image_type

attr_reader :labels

attr_reader :local_ssd_count

attr_reader :tags

attr_reader :preemptible

def initialize(args = nil)
return if args.nil?
@machine_type = args['machineType']
@disk_size_gb = args['diskSizeGb']
@oauth_scopes = args['oauthScopes']
@service_account = args['serviceAccount']
@metadata = args['metadata']
@image_type = args['imageType']
@labels = args['labels']
@local_ssd_count = args['localSsdCount']
@tags = args['tags']
@preemptible = args['preemptible']
end
end
end
end
end
Loading

0 comments on commit a562de7

Please sign in to comment.