From a59937f3411a39f3812541ba8d5157c804ea4f65 Mon Sep 17 00:00:00 2001 From: Alex Stephen Date: Wed, 21 Aug 2019 18:27:59 +0000 Subject: [PATCH] adding new fields to container clusters Signed-off-by: Modular Magician --- .../google_container_regional_cluster.md | 20 +++++++ .../google_container_regional_clusters.md | 1 + .../regionalcluster_ip_allocation_policy.rb | 58 +++++++++++++++++++ .../google_container_regional_cluster.rb | 3 + .../google_container_regional_clusters.rb | 2 + 5 files changed, 84 insertions(+) create mode 100644 libraries/google/container/property/regionalcluster_ip_allocation_policy.rb diff --git a/docs/resources/google_container_regional_cluster.md b/docs/resources/google_container_regional_cluster.md index e1296aef2..163d98bea 100644 --- a/docs/resources/google_container_regional_cluster.md +++ b/docs/resources/google_container_regional_cluster.md @@ -122,6 +122,26 @@ Properties that can be accessed from the `google_container_regional_cluster` res * `max_pods_per_node`: Constraint enforced on the max num of pods per node. + * `ip_allocation_policy`: Configuration for controlling how IPs are allocated in the cluster + + * `use_ip_aliases`: Whether alias IPs will be used for pod IPs in the cluster + + * `create_subnetwork`: Whether a new subnetwork will be created automatically for the cluster + + * `subnetwork_name`: A custom subnetwork name to be used if createSubnetwork is true. If this field is empty, then an automatic name will be chosen for the new subnetwork. + + * `cluster_secondary_range_name`: The name of the secondary range to be used for the cluster CIDR block. The secondary range will be used for pod IP addresses. This must be an existing secondary range associated with the cluster subnetwork + + * `services_secondary_range_name`: The name of the secondary range to be used as for the services CIDR block. The secondary range will be used for service ClusterIPs. This must be an existing secondary range associated with the cluster subnetwork. + + * `cluster_ipv4_cidr_block`: The IP address range for the cluster pod IPs. If this field is set, then cluster.cluster_ipv4_cidr must be left blank. This field is only applicable when useIpAliases is true. Set to blank to have a range chosen with the default size. Set to /netmask (e.g. /14) to have a range chosen with a specific netmask. + + * `node_ipv4_cidr_block`: The IP address range of the instance IPs in this cluster. This is applicable only if createSubnetwork is true. Set to blank to have a range chosen with the default size. Set to /netmask (e.g. /14) to have a range chosen with a specific netmask. + + * `services_ipv4_cidr_block`: The IP address range of the services IPs in this cluster. If blank, a range will be automatically chosen with the default size. This field is only applicable when useIpAliases is true. Set to blank to have a range chosen with the default size. Set to /netmask (e.g. /14) to have a range chosen with a specific netmask. + + * `tpu_ipv4_cidr_block`: The IP address range of the Cloud TPUs in this cluster. If unspecified, a range will be automatically chosen with the default size. This field is only applicable when useIpAliases is true. If unspecified, the range will use the default size. Set to /netmask (e.g. /14) to have a range chosen with a specific netmask. + * `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. diff --git a/docs/resources/google_container_regional_clusters.md b/docs/resources/google_container_regional_clusters.md index 10b2af122..b1127be64 100644 --- a/docs/resources/google_container_regional_clusters.md +++ b/docs/resources/google_container_regional_clusters.md @@ -37,6 +37,7 @@ See [google_container_regional_cluster.md](google_container_regional_cluster.md) * `legacy_abacs`: an array of `google_container_regional_cluster` legacy_abac * `network_policies`: an array of `google_container_regional_cluster` network_policy * `default_max_pods_constraints`: an array of `google_container_regional_cluster` default_max_pods_constraint + * `ip_allocation_policies`: an array of `google_container_regional_cluster` ip_allocation_policy * `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 diff --git a/libraries/google/container/property/regionalcluster_ip_allocation_policy.rb b/libraries/google/container/property/regionalcluster_ip_allocation_policy.rb new file mode 100644 index 000000000..ca890adc2 --- /dev/null +++ b/libraries/google/container/property/regionalcluster_ip_allocation_policy.rb @@ -0,0 +1,58 @@ +# 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 RegionalClusterIpAllocationPolicy + attr_reader :use_ip_aliases + + attr_reader :create_subnetwork + + attr_reader :subnetwork_name + + attr_reader :cluster_secondary_range_name + + attr_reader :services_secondary_range_name + + attr_reader :cluster_ipv4_cidr_block + + attr_reader :node_ipv4_cidr_block + + attr_reader :services_ipv4_cidr_block + + attr_reader :tpu_ipv4_cidr_block + + def initialize(args = nil, parent_identifier = nil) + return if args.nil? + @parent_identifier = parent_identifier + @use_ip_aliases = args['useIpAliases'] + @create_subnetwork = args['createSubnetwork'] + @subnetwork_name = args['subnetworkName'] + @cluster_secondary_range_name = args['clusterSecondaryRangeName'] + @services_secondary_range_name = args['servicesSecondaryRangeName'] + @cluster_ipv4_cidr_block = args['clusterIpv4CidrBlock'] + @node_ipv4_cidr_block = args['nodeIpv4CidrBlock'] + @services_ipv4_cidr_block = args['servicesIpv4CidrBlock'] + @tpu_ipv4_cidr_block = args['tpuIpv4CidrBlock'] + end + + def to_s + "#{@parent_identifier} RegionalClusterIpAllocationPolicy" + end + end + end + end +end diff --git a/libraries/google_container_regional_cluster.rb b/libraries/google_container_regional_cluster.rb index c4d965f90..06ab4001f 100644 --- a/libraries/google_container_regional_cluster.rb +++ b/libraries/google_container_regional_cluster.rb @@ -20,6 +20,7 @@ require 'google/container/property/regionalcluster_addons_config_network_policy_config' require 'google/container/property/regionalcluster_conditions' require 'google/container/property/regionalcluster_default_max_pods_constraint' +require 'google/container/property/regionalcluster_ip_allocation_policy' require 'google/container/property/regionalcluster_legacy_abac' require 'google/container/property/regionalcluster_master_auth' require 'google/container/property/regionalcluster_master_auth_client_certificate_config' @@ -54,6 +55,7 @@ class RegionalCluster < GcpResourceBase attr_reader :legacy_abac attr_reader :network_policy attr_reader :default_max_pods_constraint + attr_reader :ip_allocation_policy attr_reader :endpoint attr_reader :initial_cluster_version attr_reader :current_master_version @@ -96,6 +98,7 @@ def parse @legacy_abac = GoogleInSpec::Container::Property::RegionalClusterLegacyAbac.new(@fetched['legacyAbac'], to_s) @network_policy = GoogleInSpec::Container::Property::RegionalClusterNetworkPolicy.new(@fetched['networkPolicy'], to_s) @default_max_pods_constraint = GoogleInSpec::Container::Property::RegionalClusterDefaultMaxPodsConstraint.new(@fetched['defaultMaxPodsConstraint'], to_s) + @ip_allocation_policy = GoogleInSpec::Container::Property::RegionalClusterIpAllocationPolicy.new(@fetched['ipAllocationPolicy'], to_s) @endpoint = @fetched['endpoint'] @initial_cluster_version = @fetched['initialClusterVersion'] @current_master_version = @fetched['currentMasterVersion'] diff --git a/libraries/google_container_regional_clusters.rb b/libraries/google_container_regional_clusters.rb index aa3488854..c42f0ec1f 100644 --- a/libraries/google_container_regional_clusters.rb +++ b/libraries/google_container_regional_clusters.rb @@ -41,6 +41,7 @@ class RegionalClusters < GcpResourceBase filter_table_config.add(:legacy_abacs, field: :legacy_abac) filter_table_config.add(:network_policies, field: :network_policy) filter_table_config.add(:default_max_pods_constraints, field: :default_max_pods_constraint) + filter_table_config.add(:ip_allocation_policies, field: :ip_allocation_policy) filter_table_config.add(:endpoints, field: :endpoint) filter_table_config.add(:initial_cluster_versions, field: :initial_cluster_version) filter_table_config.add(:current_master_versions, field: :current_master_version) @@ -113,6 +114,7 @@ def transformers 'legacyAbac' => ->(obj) { return :legacy_abac, GoogleInSpec::Container::Property::RegionalClusterLegacyAbac.new(obj['legacyAbac'], to_s) }, 'networkPolicy' => ->(obj) { return :network_policy, GoogleInSpec::Container::Property::RegionalClusterNetworkPolicy.new(obj['networkPolicy'], to_s) }, 'defaultMaxPodsConstraint' => ->(obj) { return :default_max_pods_constraint, GoogleInSpec::Container::Property::RegionalClusterDefaultMaxPodsConstraint.new(obj['defaultMaxPodsConstraint'], to_s) }, + 'ipAllocationPolicy' => ->(obj) { return :ip_allocation_policy, GoogleInSpec::Container::Property::RegionalClusterIpAllocationPolicy.new(obj['ipAllocationPolicy'], to_s) }, 'endpoint' => ->(obj) { return :endpoint, obj['endpoint'] }, 'initialClusterVersion' => ->(obj) { return :initial_cluster_version, obj['initialClusterVersion'] }, 'currentMasterVersion' => ->(obj) { return :current_master_version, obj['currentMasterVersion'] },