From 08934f1e4be56470f6f988429e4ee0207bd41eb7 Mon Sep 17 00:00:00 2001 From: Naitian Liu Date: Thu, 8 Jun 2023 17:46:49 +0000 Subject: [PATCH 1/6] add bare_metal_admin_cluster resource --- .../gkeonprem/BareMetalAdminCluster.yaml | 552 ++++++++++++++++++ ...prem_bare_metal_admin_cluster_basic.tf.erb | 59 ++ 2 files changed, 611 insertions(+) create mode 100644 mmv1/products/gkeonprem/BareMetalAdminCluster.yaml create mode 100644 mmv1/templates/terraform/examples/gkeonprem_bare_metal_admin_cluster_basic.tf.erb diff --git a/mmv1/products/gkeonprem/BareMetalAdminCluster.yaml b/mmv1/products/gkeonprem/BareMetalAdminCluster.yaml new file mode 100644 index 000000000000..d8cd8b4d7b49 --- /dev/null +++ b/mmv1/products/gkeonprem/BareMetalAdminCluster.yaml @@ -0,0 +1,552 @@ +# Copyright 2023 Google Inc. +# Licensed under the Apache License, Version 2.0 (the License); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +--- !ruby/object:Api::Resource +name: "BareMetalAdminCluster" +min_version: beta +base_url: "projects/{{project}}/locations/{{location}}/bareMetalAdminClusters" +create_url: "projects/{{project}}/locations/{{location}}/bareMetalAdminClusters/{{name}}?update_mask=description,bare_metal_version,annotations,network_config,control_plane,load_balancer,storage,cluster_operations,maintenance_config,node_config,proxy,security_config,node_access_config" +update_url: "projects/{{project}}/locations/{{location}}/bareMetalAdminClusters/{{name}}" +self_link: "projects/{{project}}/locations/{{location}}/bareMetalAdminClusters/{{name}}" +create_verb: :PATCH +update_verb: :PATCH +update_mask: true +autogen_async: false +id_format: "projects/{{project}}/locations/{{location}}/bareMetalAdminClusters/{{name}}" +description: "A Google Bare Metal Admin Cluster." +examples: + - !ruby/object:Provider::Terraform::Examples + name: "gkeonprem_bare_metal_admin_cluster_basic" + min_version: beta + primary_resource_id: "admin-cluster-basic" + vars: + name: "basic" + test_env_vars: + project: "fake-backend-360322" +parameters: + - !ruby/object:Api::Type::String + name: "name" + description: The bare metal admin cluster name. + immutable: true + url_param_only: true + required: true + - !ruby/object:Api::Type::String + name: "location" + description: The location of the resource. + immutable: true + url_param_only: true + required: true +properties: + - !ruby/object:Api::Type::String + name: "description" + description: | + A human readable description of this Bare Metal Admin Cluster. + - !ruby/object:Api::Type::String + name: "bareMetalVersion" + description: | + A human readable description of this Bare Metal Admin Cluster. + - !ruby/object:Api::Type::String + name: "uid" + description: | + The unique identifier of the Bare Metal Admin Cluster. + output: true + - !ruby/object:Api::Type::Enum + name: "state" + description: The current state of this cluster. + output: true + values: + - STATE_UNSPECIFIED + - PROVISIONING + - RUNNING + - RECONCILING + - STOPPING + - ERROR + - DEGRADED + - !ruby/object:Api::Type::String + name: "endpoint" + description: | + The IP address name of Bare Metal Admin Cluster's API server. + output: true + - !ruby/object:Api::Type::Boolean + name: "reconciling" + description: | + If set, there are currently changes in flight to the Bare Metal Admin Cluster. + output: true + - !ruby/object:Api::Type::Time + name: "createTime" + description: | + The time the cluster was created, in RFC3339 text format. + output: true + - !ruby/object:Api::Type::Time + name: "updateTime" + description: | + The time the cluster was last updated, in RFC3339 text format. + output: true + - !ruby/object:Api::Type::Time + name: "deleteTime" + description: | + The time the cluster was deleted, in RFC3339 text format. + output: true + - !ruby/object:Api::Type::String + name: "localName" + description: | + The object name of the Bare Metal Admin Cluster custom resource on the + associated admin cluster. This field is used to support conflicting + names when enrolling existing clusters to the API. When used as a part of + cluster enrollment, this field will differ from the ID in the resource + name. For new clusters, this field will match the user provided cluster ID + and be visible in the last component of the resource name. It is not + modifiable. + All users should use this name to access their cluster using gkectl or + kubectl and should expect to see the local name when viewing admin + cluster controller logs. + output: true + - !ruby/object:Api::Type::String + name: "etag" + description: | + This checksum is computed by the server based on the value of other + fields, and may be sent on update and delete requests to ensure the + client has an up-to-date value before proceeding. + Allows clients to perform consistent read-modify-writes + through optimistic concurrency control. + output: true + - !ruby/object:Api::Type::KeyValuePairs + name: "annotations" + description: | + Annotations on the Bare Metal Admin Cluster. + This field has the same restrictions as Kubernetes annotations. + The total size of all keys and values combined is limited to 256k. + Key can have 2 segments: prefix (optional) and name (required), + separated by a slash (/). + Prefix must be a DNS subdomain. + Name must be 63 characters or less, begin and end with alphanumerics, + with dashes (-), underscores (_), dots (.), and alphanumerics between. + - !ruby/object:Api::Type::NestedObject + name: "networkConfig" + description: | + Network configuration. + properties: + - !ruby/object:Api::Type::NestedObject + name: "islandModeCidr" + exactly_one_of: + - network_config.0.island_mode_cidr + properties: + - !ruby/object:Api::Type::Array + name: "serviceAddressCidrBlocks" + item_type: Api::Type::String + required: true + description: | + All services in the cluster are assigned an RFC1918 IPv4 address from these ranges. This field cannot be changed after creation. + - !ruby/object:Api::Type::Array + name: "podAddressCidrBlocks" + item_type: Api::Type::String + required: true + description: | + All pods in the cluster are assigned an RFC1918 IPv4 address from these ranges. This field cannot be changed after creation. + - !ruby/object:Api::Type::NestedObject + name: "controlPlane" + description: | + Specifies the control plane configuration. + properties: + - !ruby/object:Api::Type::NestedObject + name: "controlPlaneNodePoolConfig" + required: true + description: | + Configures the node pool running the control plane. If specified the corresponding NodePool will be created for the cluster's control plane. The NodePool will have the same name and namespace as the cluster. + properties: + - !ruby/object:Api::Type::NestedObject + name: "nodePoolConfig" + required: true + description: | + The generic configuration for a node pool running the control plane. + properties: + - !ruby/object:Api::Type::Array + name: "nodeConfigs" + description: The list of machine addresses in the Bare Metal Node Pool. + item_type: !ruby/object:Api::Type::NestedObject + properties: + - !ruby/object:Api::Type::String + name: "nodeIp" + description: | + The default IPv4 address for SSH access and Kubernetes node. + Example: 192.168.0.1 + - !ruby/object:Api::Type::KeyValuePairs + name: "labels" + description: | + 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" }. + - !ruby/object:Api::Type::String + name: "operatingSystem" + description: | + Specifies the nodes operating system (default: LINUX). + - !ruby/object:Api::Type::Array + name: "taints" + description: | + The initial taints assigned to nodes of this node pool. + item_type: !ruby/object:Api::Type::NestedObject + properties: + - !ruby/object:Api::Type::String + name: "key" + description: | + Key associated with the effect. + - !ruby/object:Api::Type::String + name: "value" + description: | + Value associated with the effect. + - !ruby/object:Api::Type::Enum + name: "effect" + description: | + Specifies the nodes operating system (default: LINUX). + values: + - EFFECT_UNSPECIFIED + - PREFER_NO_SCHEDULE + - NO_EXECUTE + - !ruby/object:Api::Type::KeyValuePairs + name: "labels" + description: | + 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" }. + - !ruby/object:Api::Type::NestedObject + name: "apiServerArgs" + description: | + Customizes the default API server args. Only a subset of + customized flags are supported. Please refer to the API server + documentation below to know the exact format: + https://kubernetes.io/docs/reference/command-line-tools-reference/kube-apiserver/ + properties: + - !ruby/object:Api::Type::String + name: "argument" + required: true + description: | + The argument name as it appears on the API Server command line please make sure to remove the leading dashes. + - !ruby/object:Api::Type::String + name: "value" + required: true + description: | + The value of the arg as it will be passed to the API Server command line. + - !ruby/object:Api::Type::NestedObject + name: "loadBalancer" + description: | + Specifies the load balancer configuration. + properties: + - !ruby/object:Api::Type::NestedObject + name: "vipConfig" + required: true + description: | + Specified the Bare Metal Load Balancer Config + properties: + - !ruby/object:Api::Type::String + name: "controlPlaneVip" + required: true + description: The VIP which you previously set aside for the Kubernetes API of this Bare Metal Admin Cluster. + - !ruby/object:Api::Type::NestedObject + name: "portConfig" + required: true + description: | + Specifies the load balancer ports. + properties: + - !ruby/object:Api::Type::Integer + name: "controlPlaneLoadBalancerPort" + required: true + description: | + The port that control plane hosted load balancers will listen on. + - !ruby/object:Api::Type::NestedObject + name: "manualLbConfig" + properties: + - !ruby/object:Api::Type::Boolean + name: "enabled" + required: true + description: | + Whether manual load balancing is enabled. + - !ruby/object:Api::Type::NestedObject + name: "storage" + description: | + Specifies the cluster storage configuration. + properties: + - !ruby/object:Api::Type::NestedObject + name: "lvpShareConfig" + required: true + description: | + Specifies the config for local PersistentVolumes backed by + subdirectories in a shared filesystem. These subdirectores are + automatically created during cluster creation. + properties: + - !ruby/object:Api::Type::NestedObject + name: "lvpConfig" + required: true + description: | + Defines the machine path and storage class for the LVP Share. + properties: + - !ruby/object:Api::Type::String + name: "path" + required: true + description: | + The host machine path. + - !ruby/object:Api::Type::String + name: "storageClass" + required: true + description: | + The StorageClass name that PVs will be created with. + - !ruby/object:Api::Type::Integer + name: "sharedPathPvCount" + description: | + The number of subdirectories to create under path. + - !ruby/object:Api::Type::NestedObject + name: "lvpNodeMountsConfig" + required: true + description: | + Specifies the config for local PersistentVolumes backed + by mounted node disks. These disks need to be formatted and mounted by the + user, which can be done before or after cluster creation. + properties: + - !ruby/object:Api::Type::String + name: "path" + required: true + description: | + The host machine path. + - !ruby/object:Api::Type::String + name: "storageClass" + required: true + description: | + The StorageClass name that PVs will be created with. + - !ruby/object:Api::Type::NestedObject + name: "proxy" + description: | + Specifies the cluster proxy configuration. + properties: + - !ruby/object:Api::Type::String + name: "uri" + required: true + description: | + Specifies the address of your proxy server. + Examples: http://domain + WARNING: Do not provide credentials in the format + http://(username:password@)domain these will be rejected by the server. + - !ruby/object:Api::Type::Array + name: "noProxy" + item_type: Api::Type::String + description: | + A list of IPs, hostnames, and domains that should skip the proxy. + Examples: ["127.0.0.1", "example.com", ".corp", "localhost"]. + - !ruby/object:Api::Type::NestedObject + name: "clusterOperations" + description: | + Specifies the Admin Cluster's observability infrastructure. + properties: + - !ruby/object:Api::Type::Boolean + name: "enableApplicationLogs" + description: | + Whether collection of application logs/metrics should be enabled (in addition to system logs/metrics). + - !ruby/object:Api::Type::NestedObject + name: "maintenanceConfig" + description: | + Specifies the workload node configurations. + properties: + - !ruby/object:Api::Type::Array + name: "maintenanceAddressCidrBlocks" + required: true + item_type: Api::Type::String + description: | + All IPv4 address from these ranges will be placed into maintenance mode. + Nodes in maintenance mode will be cordoned and drained. When both of these + are true, the "baremetal.cluster.gke.io/maintenance" annotation will be set + on the node resource. + - !ruby/object:Api::Type::NestedObject + name: "nodeConfig" + description: | + Specifies the workload node configurations. + properties: + - !ruby/object:Api::Type::Integer + name: "maxPodsPerNode" + description: | + The maximum number of pods a node can run. The size of the CIDR range + assigned to the node will be derived from this parameter. + - !ruby/object:Api::Type::NestedObject + name: "fleet" + output: true + description: | + Fleet related configuration. + Fleets are a Google Cloud concept for logically organizing clusters, + letting you use and manage multi-cluster capabilities and apply + consistent policies across your systems. + See [Anthos Fleets](https://cloud.google.com/anthos/multicluster-management/fleets) for + more details on Anthos multi-cluster capabilities using Fleets. + properties: + - !ruby/object:Api::Type::String + name: "membership" + description: | + The name of the managed Hub Membership resource associated to this cluster. + Membership names are formatted as + `projects//locations//memberships/`. + output: true + - !ruby/object:Api::Type::NestedObject + name: "status" + output: true + description: | + Specifies detailed cluster status. + properties: + - !ruby/object:Api::Type::String + name: "errorMessage" + description: | + Human-friendly representation of the error message from the admin cluster + controller. The error message can be temporary as the admin cluster + controller creates a cluster or node pool. If the error message persists + for a longer period of time, it can be used to surface error message to + indicate real problems requiring user intervention. + output: true + - !ruby/object:Api::Type::Array + name: "conditions" + description: | + ResourceConditions provide a standard mechanism for higher-level status reporting from admin cluster controller. + output: true + item_type: !ruby/object:Api::Type::NestedObject + properties: + - !ruby/object:Api::Type::String + name: "type" + description: | + Type of the condition. + (e.g., ClusterRunning, NodePoolRunning or ServerSidePreflightReady) + - !ruby/object:Api::Type::String + name: "reason" + description: | + Machine-readable message indicating details about last transition. + - !ruby/object:Api::Type::String + name: "message" + description: | + Human-readable message indicating details about last transition. + - !ruby/object:Api::Type::Time + name: "lastTransitionTime" + description: | + Last time the condition transit from one status to another. + output: true + - !ruby/object:Api::Type::Enum + name: "state" + description: The lifecycle state of the condition. + output: true + values: + - STATE_UNSPECIFIED + - STATE_TRUE + - STATE_FALSE + - STATE_UNKNOWN + - !ruby/object:Api::Type::NestedObject + name: "validationCheck" + output: true + description: | + Specifies the security related settings for the Bare Metal Admin Cluster. + properties: + - !ruby/object:Api::Type::Enum + name: "options" + description: Options used for the validation check. + output: true + values: + - OPTIONS_UNSPECIFIED + - SKIP_VALIDATION_CHECK_BLOCKING + - SKIP_VALIDATION_ALL + - !ruby/object:Api::Type::NestedObject + name: "status" + output: true + description: | + Specifies the detailed validation check status + properties: + - !ruby/object:Api::Type::Array + name: "result" + description: Individual checks which failed as part of the Preflight check execution. + output: true + item_type: !ruby/object:Api::Type::NestedObject + properties: + - !ruby/object:Api::Type::Enum + name: "options" + description: Options used for the validation check. + output: true + values: + - STATE_UNKNOWN + - STATE_FAILURE + - STATE_SKIPPED + - STATE_UNKNOWN + - STATE_FATAL + - STATE_WARNING + - !ruby/object:Api::Type::String + name: "description" + description: | + The description of the validation check. + output: true + - !ruby/object:Api::Type::String + name: "category" + description: | + The category of the validation. + output: true + - !ruby/object:Api::Type::String + name: "reason" + description: | + A human-readable message of the check failure. + output: true + - !ruby/object:Api::Type::String + name: "details" + description: | + Detailed failure information, which might be unformatted. + output: true + - !ruby/object:Api::Type::Enum + name: "scenario" + description: The scenario when the preflight checks were run.. + output: true + values: + - SCENARIO_UNSPECIFIED + - CREATE + - UPDATE + - !ruby/object:Api::Type::NestedObject + name: "nodeAccessConfig" + description: | + Specifies the node access related settings for the bare metal user cluster. + properties: + - !ruby/object:Api::Type::String + name: "loginUser" + required: false + description: | + LoginUser is the user name used to access node machines. + It defaults to "root" if not set. + - !ruby/object:Api::Type::NestedObject + name: "securityConfig" + description: | + Specifies the security related settings for the Bare Metal User Cluster. + properties: + - !ruby/object:Api::Type::NestedObject + name: "authorization" + description: | + Configures user access to the Bare Metal User cluster. + properties: + - !ruby/object:Api::Type::Array + name: "adminUsers" + required: true + description: Users that will be granted the cluster-admin role on the cluster, providing full access to the cluster. + item_type: !ruby/object:Api::Type::NestedObject + properties: + - !ruby/object:Api::Type::String + name: "username" + required: true + description: | + The name of the user, e.g. `my-gcp-id@gmail.com`. \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/gkeonprem_bare_metal_admin_cluster_basic.tf.erb b/mmv1/templates/terraform/examples/gkeonprem_bare_metal_admin_cluster_basic.tf.erb new file mode 100644 index 000000000000..af70a9f45935 --- /dev/null +++ b/mmv1/templates/terraform/examples/gkeonprem_bare_metal_admin_cluster_basic.tf.erb @@ -0,0 +1,59 @@ +resource "google_gkeonprem_bare_metal_admin_cluster" "<%= ctx[:primary_resource_id] %>" { + provider = google-beta + name = "<%= ctx[:vars]['name'] %>" + location = "us-west1" + bare_metal_version = "1.13.4" + network_config { + island_mode_cidr { + service_address_cidr_blocks = ["172.26.0.0/16"] + pod_address_cidr_blocks = ["10.240.0.0/13"] + } + } + node_config { + max_pods_per_node = 250 + } + control_plane { + control_plane_node_pool_config { + node_pool_config { + labels = {} + operating_system = "LINUX" + node_configs { + labels = {} + node_ip = "10.200.0.2" + } + node_configs { + labels = {} + node_ip = "10.200.0.3" + } + node_configs { + labels = {} + node_ip = "10.200.0.4" + } + } + } + } + load_balancer { + port_config { + control_plane_load_balancer_port = 443 + } + vip_config { + control_plane_vip = "10.200.0.5" + } + } + storage { + lvp_share_config { + lvp_config { + path = "/mnt/localpv-share" + storage_class = "local-shared" + } + shared_path_pv_count = 5 + } + lvp_node_mounts_config { + path = "/mnt/localpv-disk" + storage_class = "local-disks" + } + } + node_access_config { + login_user = "root" + } +} \ No newline at end of file From f980c8882e6c2b90782ccd63862e0cb1a0d6a192 Mon Sep 17 00:00:00 2001 From: Naitian Liu Date: Fri, 9 Jun 2023 18:59:36 +0000 Subject: [PATCH 2/6] correct create verb --- mmv1/products/gkeonprem/BareMetalAdminCluster.yaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mmv1/products/gkeonprem/BareMetalAdminCluster.yaml b/mmv1/products/gkeonprem/BareMetalAdminCluster.yaml index d8cd8b4d7b49..4f412c54b08d 100644 --- a/mmv1/products/gkeonprem/BareMetalAdminCluster.yaml +++ b/mmv1/products/gkeonprem/BareMetalAdminCluster.yaml @@ -14,14 +14,15 @@ name: "BareMetalAdminCluster" min_version: beta base_url: "projects/{{project}}/locations/{{location}}/bareMetalAdminClusters" -create_url: "projects/{{project}}/locations/{{location}}/bareMetalAdminClusters/{{name}}?update_mask=description,bare_metal_version,annotations,network_config,control_plane,load_balancer,storage,cluster_operations,maintenance_config,node_config,proxy,security_config,node_access_config" +create_url: "projects/{{project}}/locations/{{location}}/bareMetalAdminClusters/{{name}}?bare_metal_admin_cluster_id={{name}}" update_url: "projects/{{project}}/locations/{{location}}/bareMetalAdminClusters/{{name}}" +delete_url: "projects/{{project}}/locations/{{location}}/bareMetalAdminClusters/{{name}}:unenroll" self_link: "projects/{{project}}/locations/{{location}}/bareMetalAdminClusters/{{name}}" -create_verb: :PATCH update_verb: :PATCH update_mask: true autogen_async: false id_format: "projects/{{project}}/locations/{{location}}/bareMetalAdminClusters/{{name}}" +import_format: ["projects/{{project}}/locations/{{location}}/bareMetalAdminClusters/{{name}}"] description: "A Google Bare Metal Admin Cluster." examples: - !ruby/object:Provider::Terraform::Examples From 3bbaf53101a7e6e78459cb8eff836bd8f143dcb0 Mon Sep 17 00:00:00 2001 From: Naitian Liu Date: Tue, 13 Jun 2023 16:59:14 +0000 Subject: [PATCH 3/6] Correct create url --- mmv1/products/gkeonprem/BareMetalAdminCluster.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mmv1/products/gkeonprem/BareMetalAdminCluster.yaml b/mmv1/products/gkeonprem/BareMetalAdminCluster.yaml index 4f412c54b08d..ea7ac3d164e8 100644 --- a/mmv1/products/gkeonprem/BareMetalAdminCluster.yaml +++ b/mmv1/products/gkeonprem/BareMetalAdminCluster.yaml @@ -14,7 +14,7 @@ name: "BareMetalAdminCluster" min_version: beta base_url: "projects/{{project}}/locations/{{location}}/bareMetalAdminClusters" -create_url: "projects/{{project}}/locations/{{location}}/bareMetalAdminClusters/{{name}}?bare_metal_admin_cluster_id={{name}}" +create_url: "projects/{{project}}/locations/{{location}}/bareMetalAdminClusters?bare_metal_admin_cluster_id={{name}}" update_url: "projects/{{project}}/locations/{{location}}/bareMetalAdminClusters/{{name}}" delete_url: "projects/{{project}}/locations/{{location}}/bareMetalAdminClusters/{{name}}:unenroll" self_link: "projects/{{project}}/locations/{{location}}/bareMetalAdminClusters/{{name}}" From bedebf5f8d45c4d513157b269f5843958fa35551 Mon Sep 17 00:00:00 2001 From: Naitian Liu Date: Mon, 26 Jun 2023 17:20:35 +0000 Subject: [PATCH 4/6] Add test example covering all fields --- .../gkeonprem/BareMetalAdminCluster.yaml | 33 ++++--- mmv1/products/gkeonprem/VmwareCluster.yaml | 4 +- ...nprem_bare_metal_admin_cluster_full.tf.erb | 90 +++++++++++++++++++ .../gkeonprem_vmware_cluster_basic.tf.erb | 2 +- 4 files changed, 114 insertions(+), 15 deletions(-) create mode 100644 mmv1/templates/terraform/examples/gkeonprem_bare_metal_admin_cluster_full.tf.erb diff --git a/mmv1/products/gkeonprem/BareMetalAdminCluster.yaml b/mmv1/products/gkeonprem/BareMetalAdminCluster.yaml index ea7ac3d164e8..ef8eda3413c0 100644 --- a/mmv1/products/gkeonprem/BareMetalAdminCluster.yaml +++ b/mmv1/products/gkeonprem/BareMetalAdminCluster.yaml @@ -33,6 +33,14 @@ examples: name: "basic" test_env_vars: project: "fake-backend-360322" + - !ruby/object:Provider::Terraform::Examples + name: "gkeonprem_bare_metal_admin_cluster_full" + min_version: beta + primary_resource_id: "admin-cluster-basic" + vars: + name: "basic" + test_env_vars: + project: "fake-backend-360322" parameters: - !ruby/object:Api::Type::String name: "name" @@ -232,24 +240,25 @@ properties: 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" }. - - !ruby/object:Api::Type::NestedObject + - !ruby/object:Api::Type::Array name: "apiServerArgs" description: | Customizes the default API server args. Only a subset of customized flags are supported. Please refer to the API server documentation below to know the exact format: https://kubernetes.io/docs/reference/command-line-tools-reference/kube-apiserver/ - properties: - - !ruby/object:Api::Type::String - name: "argument" - required: true - description: | - The argument name as it appears on the API Server command line please make sure to remove the leading dashes. - - !ruby/object:Api::Type::String - name: "value" - required: true - description: | - The value of the arg as it will be passed to the API Server command line. + item_type: !ruby/object:Api::Type::NestedObject + properties: + - !ruby/object:Api::Type::String + name: "argument" + required: true + description: | + The argument name as it appears on the API Server command line please make sure to remove the leading dashes. + - !ruby/object:Api::Type::String + name: "value" + required: true + description: | + The value of the arg as it will be passed to the API Server command line. - !ruby/object:Api::Type::NestedObject name: "loadBalancer" description: | diff --git a/mmv1/products/gkeonprem/VmwareCluster.yaml b/mmv1/products/gkeonprem/VmwareCluster.yaml index cdd945d7a18d..c07fad290d4c 100644 --- a/mmv1/products/gkeonprem/VmwareCluster.yaml +++ b/mmv1/products/gkeonprem/VmwareCluster.yaml @@ -35,13 +35,13 @@ examples: - !ruby/object:Provider::Terraform::Examples name: 'gkeonprem_vmware_cluster_basic' # TODO: https://github.com/hashicorp/terraform-provider-google/issues/14417 - skip_test: true + # skip_test: true min_version: beta primary_resource_id: 'cluster-basic' vars: name: 'basic' test_env_vars: - project: 'fake-backend-360322' + project: ':PROJECT_ID' - !ruby/object:Provider::Terraform::Examples name: 'gkeonprem_vmware_cluster_f5lb' # TODO: https://github.com/hashicorp/terraform-provider-google/issues/14417 diff --git a/mmv1/templates/terraform/examples/gkeonprem_bare_metal_admin_cluster_full.tf.erb b/mmv1/templates/terraform/examples/gkeonprem_bare_metal_admin_cluster_full.tf.erb new file mode 100644 index 000000000000..58046c4f55cc --- /dev/null +++ b/mmv1/templates/terraform/examples/gkeonprem_bare_metal_admin_cluster_full.tf.erb @@ -0,0 +1,90 @@ +resource "google_gkeonprem_bare_metal_admin_cluster" "<%= ctx[:primary_resource_id] %>" { + provider = google-beta + name = "<%= ctx[:vars]['name'] %>" + location = "us-west1" + description = "test description" + bare_metal_version = "1.13.4" + annotations = {} + network_config { + island_mode_cidr { + service_address_cidr_blocks = ["172.26.0.0/16"] + pod_address_cidr_blocks = ["10.240.0.0/13"] + } + } + node_config { + max_pods_per_node = 250 + } + control_plane { + control_plane_node_pool_config { + node_pool_config { + labels = {} + operating_system = "LINUX" + node_configs { + labels = {} + node_ip = "10.200.0.2" + } + node_configs { + labels = {} + node_ip = "10.200.0.3" + } + node_configs { + labels = {} + node_ip = "10.200.0.4" + } + taints { + key = "test-key" + value = "test-value" + effect = "NO_EXECUTE" + } + } + } + api_server_args { + argument = "test argument" + value = "test value" + } + } + load_balancer { + port_config { + control_plane_load_balancer_port = 443 + } + vip_config { + control_plane_vip = "10.200.0.5" + } + manual_lb_config { + enabled = true + } + } + storage { + lvp_share_config { + lvp_config { + path = "/mnt/localpv-share" + storage_class = "local-shared" + } + shared_path_pv_count = 5 + } + lvp_node_mounts_config { + path = "/mnt/localpv-disk" + storage_class = "local-disks" + } + } + node_access_config { + login_user = "root" + } + security_config { + authorization { + admin_users { + username = "admin@hashicorptest.com" + } + } + } + maintenance_config { + maintenance_address_cidr_blocks = ["10.0.0.1/32", "10.0.0.2/32"] + } + cluster_operations { + enable_application_logs = true + } + proxy { + uri = "test proxy uri" + no_proxy = ["127.0.0.1"] + } +} \ No newline at end of file diff --git a/mmv1/templates/terraform/examples/gkeonprem_vmware_cluster_basic.tf.erb b/mmv1/templates/terraform/examples/gkeonprem_vmware_cluster_basic.tf.erb index ad380ba66b96..8c08e6380a53 100644 --- a/mmv1/templates/terraform/examples/gkeonprem_vmware_cluster_basic.tf.erb +++ b/mmv1/templates/terraform/examples/gkeonprem_vmware_cluster_basic.tf.erb @@ -2,7 +2,7 @@ resource "google_gkeonprem_vmware_cluster" "<%= ctx[:primary_resource_id] %>" { provider = google-beta name = "cluster-<%= ctx[:vars]['name'] %>" location = "us-west1" - admin_cluster_membership = "projects/870316890899/locations/global/memberships/gkeonprem-terraform-test" + admin_cluster_membership = "projects/<%= ctx[:test_env_vars]['project'] %>/locations/global/memberships/gkeonprem-terraform-test" description = "test cluster" on_prem_version = "1.13.1-gke.35" annotations = {} From 2b2b2e575d8b61e7b96300a93803ccb5cc23c8e8 Mon Sep 17 00:00:00 2001 From: Naitian Liu Date: Thu, 29 Jun 2023 17:49:15 +0000 Subject: [PATCH 5/6] revert unintended changes in vmware cluster --- mmv1/products/gkeonprem/VmwareCluster.yaml | 4 ++-- .../terraform/examples/gkeonprem_vmware_cluster_basic.tf.erb | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/mmv1/products/gkeonprem/VmwareCluster.yaml b/mmv1/products/gkeonprem/VmwareCluster.yaml index c07fad290d4c..cdd945d7a18d 100644 --- a/mmv1/products/gkeonprem/VmwareCluster.yaml +++ b/mmv1/products/gkeonprem/VmwareCluster.yaml @@ -35,13 +35,13 @@ examples: - !ruby/object:Provider::Terraform::Examples name: 'gkeonprem_vmware_cluster_basic' # TODO: https://github.com/hashicorp/terraform-provider-google/issues/14417 - # skip_test: true + skip_test: true min_version: beta primary_resource_id: 'cluster-basic' vars: name: 'basic' test_env_vars: - project: ':PROJECT_ID' + project: 'fake-backend-360322' - !ruby/object:Provider::Terraform::Examples name: 'gkeonprem_vmware_cluster_f5lb' # TODO: https://github.com/hashicorp/terraform-provider-google/issues/14417 diff --git a/mmv1/templates/terraform/examples/gkeonprem_vmware_cluster_basic.tf.erb b/mmv1/templates/terraform/examples/gkeonprem_vmware_cluster_basic.tf.erb index 8c08e6380a53..ad380ba66b96 100644 --- a/mmv1/templates/terraform/examples/gkeonprem_vmware_cluster_basic.tf.erb +++ b/mmv1/templates/terraform/examples/gkeonprem_vmware_cluster_basic.tf.erb @@ -2,7 +2,7 @@ resource "google_gkeonprem_vmware_cluster" "<%= ctx[:primary_resource_id] %>" { provider = google-beta name = "cluster-<%= ctx[:vars]['name'] %>" location = "us-west1" - admin_cluster_membership = "projects/<%= ctx[:test_env_vars]['project'] %>/locations/global/memberships/gkeonprem-terraform-test" + admin_cluster_membership = "projects/870316890899/locations/global/memberships/gkeonprem-terraform-test" description = "test cluster" on_prem_version = "1.13.1-gke.35" annotations = {} From 949196e87aa00137f405f0e1c8945c61526402ac Mon Sep 17 00:00:00 2001 From: Thomas Rodgers Date: Thu, 6 Jul 2023 12:58:39 -0700 Subject: [PATCH 6/6] Add newline at end of file --- mmv1/products/gkeonprem/BareMetalAdminCluster.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mmv1/products/gkeonprem/BareMetalAdminCluster.yaml b/mmv1/products/gkeonprem/BareMetalAdminCluster.yaml index ef8eda3413c0..288463c685db 100644 --- a/mmv1/products/gkeonprem/BareMetalAdminCluster.yaml +++ b/mmv1/products/gkeonprem/BareMetalAdminCluster.yaml @@ -559,4 +559,4 @@ properties: name: "username" required: true description: | - The name of the user, e.g. `my-gcp-id@gmail.com`. \ No newline at end of file + The name of the user, e.g. `my-gcp-id@gmail.com`.