From f73c3d9074f05db3c66aa791c8ee379a51263bcb Mon Sep 17 00:00:00 2001 From: Naitian Liu Date: Tue, 30 Apr 2024 21:57:28 +0000 Subject: [PATCH 01/13] Explicitly set to enableControlPlaneV2 field to immutable --- mmv1/products/gkeonprem/VmwareCluster.yaml | 1 + .../gkeonprem/resource_gkeonprem_vmware_cluster_test.go.erb | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/mmv1/products/gkeonprem/VmwareCluster.yaml b/mmv1/products/gkeonprem/VmwareCluster.yaml index 1613284c208c..8397fb78e30e 100644 --- a/mmv1/products/gkeonprem/VmwareCluster.yaml +++ b/mmv1/products/gkeonprem/VmwareCluster.yaml @@ -534,6 +534,7 @@ properties: - !ruby/object:Api::Type::Boolean name: 'enableControlPlaneV2' description: Enable control plane V2. Default to false. + immutable: true - !ruby/object:Api::Type::Boolean name: 'disableBundledIngress' description: Disable bundled ingress. diff --git a/mmv1/third_party/terraform/services/gkeonprem/resource_gkeonprem_vmware_cluster_test.go.erb b/mmv1/third_party/terraform/services/gkeonprem/resource_gkeonprem_vmware_cluster_test.go.erb index 829bb3fd99a2..86e1dfe690d1 100644 --- a/mmv1/third_party/terraform/services/gkeonprem/resource_gkeonprem_vmware_cluster_test.go.erb +++ b/mmv1/third_party/terraform/services/gkeonprem/resource_gkeonprem_vmware_cluster_test.go.erb @@ -464,7 +464,6 @@ func testAccGkeonpremVmwareCluster_vmwareClusterUpdateManualLb(context map[strin advanced_networking = true } vm_tracking_enabled = false - enable_control_plane_v2 = false disable_bundled_ingress = false upgrade_policy { control_plane_only = true From 8b858a494b1e27aa838b7076b7033dcf0d55fbc8 Mon Sep 17 00:00:00 2001 From: Naitian Liu Date: Tue, 30 Apr 2024 21:59:07 +0000 Subject: [PATCH 02/13] set default value of enableControlPlaneV2 to true --- mmv1/products/gkeonprem/VmwareCluster.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/mmv1/products/gkeonprem/VmwareCluster.yaml b/mmv1/products/gkeonprem/VmwareCluster.yaml index 8397fb78e30e..a486885f47f8 100644 --- a/mmv1/products/gkeonprem/VmwareCluster.yaml +++ b/mmv1/products/gkeonprem/VmwareCluster.yaml @@ -535,6 +535,7 @@ properties: name: 'enableControlPlaneV2' description: Enable control plane V2. Default to false. immutable: true + default_value: true - !ruby/object:Api::Type::Boolean name: 'disableBundledIngress' description: Disable bundled ingress. From a062519dbc0ed1fe8fdddbc40dbeb2f93041972b Mon Sep 17 00:00:00 2001 From: Naitian Liu Date: Wed, 1 May 2024 16:46:20 +0000 Subject: [PATCH 03/13] remove default value to avoid breaking change --- mmv1/products/gkeonprem/VmwareCluster.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/mmv1/products/gkeonprem/VmwareCluster.yaml b/mmv1/products/gkeonprem/VmwareCluster.yaml index a486885f47f8..8397fb78e30e 100644 --- a/mmv1/products/gkeonprem/VmwareCluster.yaml +++ b/mmv1/products/gkeonprem/VmwareCluster.yaml @@ -535,7 +535,6 @@ properties: name: 'enableControlPlaneV2' description: Enable control plane V2. Default to false. immutable: true - default_value: true - !ruby/object:Api::Type::Boolean name: 'disableBundledIngress' description: Disable bundled ingress. From 04e1444f9dfedc4a5f4e2087ca18b03f4f3f5c4f Mon Sep 17 00:00:00 2001 From: Naitian Liu Date: Tue, 15 Oct 2024 17:25:28 +0000 Subject: [PATCH 04/13] initial vmware admin cluster --- .../gkeonprem/VmwareAdminCluster.yaml | 683 ++++++++++++++++++ ...keonprem_vmware_admin_cluster_basic.tf.erb | 36 + 2 files changed, 719 insertions(+) create mode 100644 mmv1/products/gkeonprem/VmwareAdminCluster.yaml create mode 100644 mmv1/templates/terraform/examples/gkeonprem_vmware_admin_cluster_basic.tf.erb diff --git a/mmv1/products/gkeonprem/VmwareAdminCluster.yaml b/mmv1/products/gkeonprem/VmwareAdminCluster.yaml new file mode 100644 index 000000000000..c7a332c1f596 --- /dev/null +++ b/mmv1/products/gkeonprem/VmwareAdminCluster.yaml @@ -0,0 +1,683 @@ + +# 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: "VmwareAdminCluster" +min_version: beta +base_url: "projects/{{project}}/locations/{{location}}/vmwareAdminClusters" +create_url: "projects/{{project}}/locations/{{location}}/vmwareAdminClusters?vmware_admin_cluster_id={{name}}" +update_url: "projects/{{project}}/locations/{{location}}/vmwareAdminClusters/{{name}}" +delete_url: "projects/{{project}}/locations/{{location}}/vmwareAdminClusters/{{name}}:unenroll" +self_link: "projects/{{project}}/locations/{{location}}/vmwareAdminClusters/{{name}}" +update_verb: :PATCH +update_mask: true +description: "A Google VMware Admin Cluster." +autogen_async: false +skip_delete: true +taint_resource_on_failed_create: true +id_format: "projects/{{project}}/locations/{{location}}/vmwareAdminClusters/{{name}}" +import_format: ["projects/{{project}}/locations/{{location}}/vmwareAdminClusters/{{name}}"] +timeouts: !ruby/object:Api::Timeouts + insert_minutes: 60 + delete_minutes: 60 + update_minutes: 60 +examples: + - !ruby/object:Provider::Terraform::Examples + name: "gkeonprem_vmware_admin_cluster_basic" + primary_resource_id: "admin-cluster-basic" + min_version: beta + vars: + name: "basic" + test_env_vars: + project: "fake-backend-360322" +parameters: + - !ruby/object:Api::Type::String + name: "name" + description: The VMware admin cluster resource 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 VMware admin cluster. + - !ruby/object:Api::Type::String + name: "onPremVersion" + description: | + The Anthos clusters on the VMware version for the admin cluster. + - !ruby/object:Api::Type::String + name: "imageType" + description: | + The OS image type for the VMware admin cluster. + - !ruby/object:Api::Type::String + name: "bootstrapClusterMembership" + description: | + The bootstrap cluster this VMware admin cluster belongs to. + - !ruby/object:Api::Type::KeyValuePairs + name: "annotations" + description: | + Annotations on the VMware 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. + default_from_api: true + - !ruby/object:Api::Type::NestedObject + name: "networkConfig" + description: | + The VMware admin cluster network configuration. + required: true + 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. Only a single range is supported.. 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. + Only a single range is supported. This field cannot be changed after creation. + - !ruby/object:Api::Type::NestedObject + name: 'staticIpConfig' + description: Configuration settings for a static IP configuration. + exactly_one_of: + - network_config.0.static_ip_config + - network_config.0.dhcp_ip_config + properties: + - !ruby/object:Api::Type::Array + name: ipBlocks + description: + Represents the configuration values for static IP allocation to + nodes. + item_type: !ruby/object:Api::Type::NestedObject + properties: + - !ruby/object:Api::Type::String + name: 'netmask' + description: The netmask used by the VMware Admin Cluster. + required: true + - !ruby/object:Api::Type::String + name: 'gateway' + description: + The network gateway used by the VMware Admin Cluster. + required: true + - !ruby/object:Api::Type::Array + name: 'ips' + description: + The node's network configurations used by the VMware Admin + Cluster. + required: true + item_type: !ruby/object:Api::Type::NestedObject + properties: + - !ruby/object:Api::Type::String + name: 'ip' + description: + IP could be an IP address (like 1.2.3.4) or a CIDR + (like 1.2.3.0/24). + required: true + - !ruby/object:Api::Type::String + name: 'hostname' + description: + Hostname of the machine. VM's name will be used if + this field is empty. + default_from_api: true + - !ruby/object:Api::Type::NestedObject + name: 'dhcpIpConfig' + description: Configuration settings for a DHCP IP configuration. + exactly_one_of: + - network_config.0.static_ip_config + - network_config.0.dhcp_ip_config + default_from_api: true + properties: + - !ruby/object:Api::Type::Boolean + name: enabled + description: | + enabled is a flag to mark if DHCP IP allocation is + used for VMware admin clusters. + required: true + - !ruby/object:Api::Type::String + name: 'vcenterNetwork' + description: + vcenter_network specifies vCenter network name. + - !ruby/object:Api::Type::NestedObject + name: 'hostConfig' + description: + Represents common network settings irrespective of the host's IP + address. + default_from_api: true + properties: + - !ruby/object:Api::Type::Array + name: 'dnsServers' + description: DNS servers. + item_type: Api::Type::String + - !ruby/object:Api::Type::Array + name: 'ntpServers' + description: NTP servers. + item_type: Api::Type::String + - !ruby/object:Api::Type::Array + name: 'dnsSearchDomains' + description: DNS search domains. + item_type: Api::Type::String + - !ruby/object:Api::Type::NestedObject + name: 'haControlPlaneConfig' + description: + Configuration for HA admin cluster control plane. + properties: + - !ruby/object:Api::Type::NestedObject + name: 'controlPlaneIpBlock' + description: Static IP addresses for the control plane nodes. + properties: + - !ruby/object:Api::Type::String + name: 'netmask' + description: The netmask used by the VMware Admin Cluster. + required: true + - !ruby/object:Api::Type::String + name: 'gateway' + description: + The network gateway used by the VMware Admin Cluster. + required: true + - !ruby/object:Api::Type::Array + name: 'ips' + description: + The node's network configurations used by the VMware Admin + Cluster. + required: true + item_type: !ruby/object:Api::Type::NestedObject + properties: + - !ruby/object:Api::Type::String + name: 'ip' + description: + IP could be an IP address (like 1.2.3.4) or a CIDR + (like 1.2.3.0/24). + required: true + - !ruby/object:Api::Type::String + name: 'hostname' + description: + Hostname of the machine. VM's name will be used if + this field is empty. + default_from_api: true + - !ruby/object:Api::Type::NestedObject + name: "controlPlaneNode" + description: | + The VMware admin cluster control plane node configuration. + properties: + - !ruby/object:Api::Type::Integer + name: cpus + description: | + The number of vCPUs for the control-plane node of the admin cluster. + default_value: 4 + - !ruby/object:Api::Type::Integer + name: memory + description: | + The number of mebibytes of memory for the control-plane node of the admin cluster. + default_value: 8192 + - !ruby/object:Api::Type::Integer + name: replicas + description: | + The number of control plane nodes for this VMware admin cluster. + default_value: 1 + - !ruby/object:Api::Type::NestedObject + name: "addonNode" + description: | + The VMware admin cluster addon node configuration. + properties: + - !ruby/object:Api::Type::NestedObject + name: "autoResizeConfig" + description: | + Specifies auto resize config. + default_from_api: true + properties: + - !ruby/object:Api::Type::Boolean + name: enabled + description: | + Whether to enable controle plane node auto resizing. + required: true + - !ruby/object:Api::Type::NestedObject + name: "loadBalancer" + description: | + Specifies the load balancer configuration for VMware admin cluster. + 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::String + name: "addonsVip" + description: | + The VIP to configure the load balancer for add-ons. + - !ruby/object:Api::Type::NestedObject + name: 'f5Config' + description: Configuration for F5 Big IP typed load balancers. + exactly_one_of: + - loadBalancer.0.f5_config + - loadBalancer.0.manual_lb_config + - loadBalancer.0.metal_lb_config + properties: + - !ruby/object:Api::Type::String + name: 'address' + description: The load balancer's IP address. + - !ruby/object:Api::Type::String + name: 'partition' + description: | + he preexisting partition to be used by the load balancer. T + his partition is usually created for the admin cluster for example: + 'my-f5-admin-partition'. + - !ruby/object:Api::Type::String + name: 'snatPool' + description: The pool name. Only necessary, if using SNAT. + - !ruby/object:Api::Type::NestedObject + name: 'manualLbConfig' + description: Manually configured load balancers. + exactly_one_of: + - loadBalancer.0.f5_config + - loadBalancer.0.manual_lb_config + - loadBalancer.0.metal_lb_config + properties: + - !ruby/object:Api::Type::Integer + name: 'ingressHttpNodePort' + description: | + NodePort for ingress service's http. The ingress service in the admin + cluster is implemented as a Service of type NodePort (ex. 32527). + default_from_api: true + - !ruby/object:Api::Type::Integer + name: 'ingressHttpsNodePort' + description: | + NodePort for ingress service's https. The ingress service in the admin + cluster is implemented as a Service of type NodePort (ex. 30139). + default_from_api: true + - !ruby/object:Api::Type::Integer + name: 'controlPlaneNodePort' + description: | + NodePort for control plane service. The Kubernetes API server in the admin + cluster is implemented as a Service of type NodePort (ex. 30968). + default_from_api: true + - !ruby/object:Api::Type::Integer + name: 'konnectivityServerNodePort' + description: | + NodePort for konnectivity server service running as a sidecar in each + kube-apiserver pod (ex. 30564). + default_from_api: true + - !ruby/object:Api::Type::Integer + name: 'addonsNodePort' + description: | + NodePort for add-ons server in the admin cluster. + default_from_api: true + - !ruby/object:Api::Type::NestedObject + name: 'metalLbConfig' + description: Manually configured load balancers. + exactly_one_of: + - loadBalancer.0.f5_config + - loadBalancer.0.manual_lb_config + - loadBalancer.0.metal_lb_config + - !ruby/object:Api::Type::NestedObject + name: vcenter + description: | + Specifies vCenter config for the admin cluster. + properties: + - !ruby/object:Api::Type::String + name: 'resourcePool' + description: The name of the vCenter resource pool for the admin cluster. + - !ruby/object:Api::Type::String + name: 'datastore' + description: The name of the vCenter datastore for the admin cluster. + - !ruby/object:Api::Type::String + name: 'datacenter' + description: The name of the vCenter datacenter for the admin cluster. + - !ruby/object:Api::Type::String + name: 'cluster' + description: The name of the vCenter cluster for the admin cluster. + - !ruby/object:Api::Type::String + name: 'folder' + description: The name of the vCenter folder for the admin cluster. + - !ruby/object:Api::Type::String + name: 'caCertData' + description: + Contains the vCenter CA certificate public key for SSL verification. + - !ruby/object:Api::Type::String + name: 'address' + description: The vCenter IP address. + - !ruby/object:Api::Type::String + name: 'dataDisk' + description: The name of the virtual machine disk (VMDK) for the admin cluster. + - !ruby/object:Api::Type::String + name: 'storagePolicyName' + description: The name of the vCenter storage policy for the user cluster. + - !ruby/object:Api::Type::NestedObject + name: antiAffinityGroups + description: | + AAGConfig specifies whether to spread VMware Admin Cluster nodes across at + least three physical hosts in the datacenter. + default_from_api: true + properties: + - !ruby/object:Api::Type::Boolean + name: aagConfigDisabled + description: | + Spread nodes across at least three physical hosts (requires at least three + hosts). + Enabled by default. + required: true + - !ruby/object:Api::Type::NestedObject + name: autoRepairConfig + description: Configuration for auto repairing. + default_from_api: true + properties: + - !ruby/object:Api::Type::Boolean + name: enabled + description: Whether auto repair is enabled. + required: true + - !ruby/object:Api::Type::NestedObject + name: authorization + description: The VMware admin cluster authorization configuration. + properties: + - !ruby/object:Api::Type::Array + name: viewerUsers + 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`. + - !ruby/object:Api::Type::NestedObject + name: preparedSecrets + description: | + The VMware admin cluster prepared secrets configuration. It should always be + enabled by the Central API, instead of letting users set it. + default_from_api: true + properties: + - !ruby/object:Api::Type::Boolean + name: enabled + description: Whether prepared secrets is enabled. + required: true + - !ruby/object:Api::Type::NestedObject + name: platformConfig + description: | + The VMware platform configuration. + properties: + - !ruby/object:Api::Type::String + name: 'requiredPlatformVersion' + description: | + The required platform version e.g. 1.13.1. + If the current platform version is lower than the target version, + the platform version will be updated to the target version. + If the target version is not installed in the platform + (bundle versions), download the target version bundle. + ignore_read: true + - !ruby/object:Api::Type::String + name: 'platformVersion' + description: | + The platform version e.g. 1.13.2. + output: true + - !ruby/object:Api::Type::Array + name: bundles + description: | + The list of bundles installed in the admin cluster. + output: true + item_type: !ruby/object:Api::Type::NestedObject + properties: + - !ruby/object:Api::Type::String + name: 'version' + description: | + The version of the bundle. + output: true + - !ruby/object:Api::Type::NestedObject + name: status + description: ResourceStatus representing detailed cluster state. + output: true + 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) + output: true + - !ruby/object:Api::Type::String + name: 'reason' + description: | + Machine-readable message indicating details about last transition. + output: true + - !ruby/object:Api::Type::String + name: 'message' + description: | + Human-readable message indicating details about last transition. + output: true + - !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: status + description: ResourceStatus representing detailed cluster state. + output: true + 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) + output: true + - !ruby/object:Api::Type::String + name: 'reason' + description: | + Machine-readable message indicating details about last transition. + output: true + - !ruby/object:Api::Type::String + name: 'message' + description: | + Human-readable message indicating details about last transition. + output: true + - !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::String + name: "uid" + description: | + The unique identifier of the VMware Admin Cluster. + output: true + - !ruby/object:Api::Type::Enum + name: "state" + description: The lifecycle state of the VMware admin cluster. + output: true + values: + - STATE_UNSPECIFIED + - PROVISIONING + - RUNNING + - RECONCILING + - STOPPING + - ERROR + - DEGRADED + - !ruby/object:Api::Type::String + name: "endpoint" + description: | + The DNS name of VMware 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 VMware 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::String + name: "localName" + description: | + The object name of the VMwareAdminCluster 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::NestedObject + name: fleet + description: Fleet configuration for the cluster. + output: true + properties: + - !ruby/object:Api::Type::String + name: 'membership' + description: | + The name of the managed Fleet Membership resource associated to this cluster. + Membership names are formatted as + `projects//locations//memberships/`. + output: true + - !ruby/object:Api::Type::NestedObject + name: status + description: ResourceStatus representing detailed cluster state. + output: true + 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) + output: true + - !ruby/object:Api::Type::String + name: 'reason' + description: | + Machine-readable message indicating details about last transition. + output: true + - !ruby/object:Api::Type::String + name: 'message' + description: | + Human-readable message indicating details about last transition. + output: true + - !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 diff --git a/mmv1/templates/terraform/examples/gkeonprem_vmware_admin_cluster_basic.tf.erb b/mmv1/templates/terraform/examples/gkeonprem_vmware_admin_cluster_basic.tf.erb new file mode 100644 index 000000000000..210568bfa531 --- /dev/null +++ b/mmv1/templates/terraform/examples/gkeonprem_vmware_admin_cluster_basic.tf.erb @@ -0,0 +1,36 @@ + +resource "google_gkeonprem_vmware_admin_cluster" "<%= ctx[:primary_resource_id] %>" { + name = "cluster-<%= ctx[:vars]['name'] %>" + location = local.region + description = "test admin cluster" + on_prem_version = "1.31.0-gke.35" + image_type = "ubuntu_containerd" + vcenter { + resource_pool = "test resource pool" + datastore = "test data store" + datacenter = "test data center" + cluster = "test cluster" + folder = "test folder" + ca_cert_data = "test ca cert data" + adderess = "10.0.0.1" + data_disk = "test data disk" + } + network_config { + service_address_cidr_blocks = ["10.96.0.0/12"] + pod_address_cidr_blocks = ["192.168.0.0/16"] + } + control_plane_node { + cpus = 4 + memory = 8192 + } + load_balancer { + vip_config { + control_plane_vip = "10.251.133.5" + ingress_vip = "10.251.135.19" + } + f5_config { + address = "10.251.135.22" + partition = "test-parition" + } + } +} From 1db8e5686c84113fae9982ebb996692677133432 Mon Sep 17 00:00:00 2001 From: Naitian Liu Date: Tue, 15 Oct 2024 18:13:38 +0000 Subject: [PATCH 05/13] fix old syntax --- .../gkeonprem/VmwareAdminCluster.yaml | 256 +++++++++--------- ...onprem_vmware_admin_cluster_basic.tf.tmpl} | 7 +- 2 files changed, 138 insertions(+), 125 deletions(-) rename mmv1/templates/terraform/examples/{gkeonprem_vmware_admin_cluster_basic.tf.erb => gkeonprem_vmware_admin_cluster_basic.tf.tmpl} (76%) diff --git a/mmv1/products/gkeonprem/VmwareAdminCluster.yaml b/mmv1/products/gkeonprem/VmwareAdminCluster.yaml index c7a332c1f596..605a1585640f 100644 --- a/mmv1/products/gkeonprem/VmwareAdminCluster.yaml +++ b/mmv1/products/gkeonprem/VmwareAdminCluster.yaml @@ -20,11 +20,11 @@ create_url: "projects/{{project}}/locations/{{location}}/vmwareAdminClusters?vmw update_url: "projects/{{project}}/locations/{{location}}/vmwareAdminClusters/{{name}}" delete_url: "projects/{{project}}/locations/{{location}}/vmwareAdminClusters/{{name}}:unenroll" self_link: "projects/{{project}}/locations/{{location}}/vmwareAdminClusters/{{name}}" -update_verb: :PATCH +update_verb: "PATCH" update_mask: true description: "A Google VMware Admin Cluster." autogen_async: false -skip_delete: true +exclude_delete: true taint_resource_on_failed_create: true id_format: "projects/{{project}}/locations/{{location}}/vmwareAdminClusters/{{name}}" import_format: ["projects/{{project}}/locations/{{location}}/vmwareAdminClusters/{{name}}"] @@ -42,36 +42,36 @@ examples: test_env_vars: project: "fake-backend-360322" parameters: - - !ruby/object:Api::Type::String + - type: String name: "name" description: The VMware admin cluster resource name. immutable: true url_param_only: true required: true - - !ruby/object:Api::Type::String + - type: String name: "location" description: The location of the resource. immutable: true url_param_only: true required: true properties: - - !ruby/object:Api::Type::String + - type: String name: "description" description: | A human readable description of this VMware admin cluster. - - !ruby/object:Api::Type::String + - type: String name: "onPremVersion" description: | The Anthos clusters on the VMware version for the admin cluster. - - !ruby/object:Api::Type::String + - type: String name: "imageType" description: | The OS image type for the VMware admin cluster. - - !ruby/object:Api::Type::String + - type: String name: "bootstrapClusterMembership" description: | The bootstrap cluster this VMware admin cluster belongs to. - - !ruby/object:Api::Type::KeyValuePairs + - type: KeyValueAnnotations name: "annotations" description: | Annotations on the VMware Admin Cluster. @@ -83,71 +83,75 @@ properties: Name must be 63 characters or less, begin and end with alphanumerics, with dashes (-), underscores (_), dots (.), and alphanumerics between. default_from_api: true - - !ruby/object:Api::Type::NestedObject + - type: NestedObject name: "networkConfig" description: | The VMware admin cluster network configuration. required: true properties: - - !ruby/object:Api::Type::Array + - type: Array name: 'serviceAddressCidrBlocks' - item_type: Api::Type::String + item_type: + type: String required: true description: | All services in the cluster are assigned an RFC1918 IPv4 address from these ranges. Only a single range is supported.. This field cannot be changed after creation. - - !ruby/object:Api::Type::Array + - type: Array name: 'podAddressCidrBlocks' - item_type: Api::Type::String + item_type: + type: String required: true description: | All pods in the cluster are assigned an RFC1918 IPv4 address from these ranges. Only a single range is supported. This field cannot be changed after creation. - - !ruby/object:Api::Type::NestedObject + - type: NestedObject name: 'staticIpConfig' description: Configuration settings for a static IP configuration. exactly_one_of: - network_config.0.static_ip_config - network_config.0.dhcp_ip_config properties: - - !ruby/object:Api::Type::Array + - type: Array name: ipBlocks description: Represents the configuration values for static IP allocation to nodes. - item_type: !ruby/object:Api::Type::NestedObject + item_type: + type: NestedObject properties: - - !ruby/object:Api::Type::String + - type: String name: 'netmask' description: The netmask used by the VMware Admin Cluster. required: true - - !ruby/object:Api::Type::String + - type: String name: 'gateway' description: The network gateway used by the VMware Admin Cluster. required: true - - !ruby/object:Api::Type::Array + - type: Array name: 'ips' description: The node's network configurations used by the VMware Admin Cluster. required: true - item_type: !ruby/object:Api::Type::NestedObject + item_type: + type: NestedObject properties: - - !ruby/object:Api::Type::String + - type: String name: 'ip' description: IP could be an IP address (like 1.2.3.4) or a CIDR (like 1.2.3.0/24). required: true - - !ruby/object:Api::Type::String + - type: String name: 'hostname' description: Hostname of the machine. VM's name will be used if this field is empty. default_from_api: true - - !ruby/object:Api::Type::NestedObject + - type: NestedObject name: 'dhcpIpConfig' description: Configuration settings for a DHCP IP configuration. exactly_one_of: @@ -155,131 +159,135 @@ properties: - network_config.0.dhcp_ip_config default_from_api: true properties: - - !ruby/object:Api::Type::Boolean + - type: Boolean name: enabled description: | enabled is a flag to mark if DHCP IP allocation is used for VMware admin clusters. required: true - - !ruby/object:Api::Type::String + - type: String name: 'vcenterNetwork' description: vcenter_network specifies vCenter network name. - - !ruby/object:Api::Type::NestedObject + - type: NestedObject name: 'hostConfig' description: Represents common network settings irrespective of the host's IP address. default_from_api: true properties: - - !ruby/object:Api::Type::Array + - type: Array name: 'dnsServers' description: DNS servers. - item_type: Api::Type::String - - !ruby/object:Api::Type::Array + item_type: + type: String + - type: Array name: 'ntpServers' description: NTP servers. - item_type: Api::Type::String - - !ruby/object:Api::Type::Array + item_type: + type: String + - type: Array name: 'dnsSearchDomains' description: DNS search domains. - item_type: Api::Type::String - - !ruby/object:Api::Type::NestedObject + item_type: + type: String + - type: NestedObject name: 'haControlPlaneConfig' description: Configuration for HA admin cluster control plane. properties: - - !ruby/object:Api::Type::NestedObject + - type: NestedObject name: 'controlPlaneIpBlock' description: Static IP addresses for the control plane nodes. properties: - - !ruby/object:Api::Type::String + - type: String name: 'netmask' description: The netmask used by the VMware Admin Cluster. required: true - - !ruby/object:Api::Type::String + - type: String name: 'gateway' description: The network gateway used by the VMware Admin Cluster. required: true - - !ruby/object:Api::Type::Array + - type: Array name: 'ips' description: The node's network configurations used by the VMware Admin Cluster. required: true - item_type: !ruby/object:Api::Type::NestedObject + item_type: + type: NestedObject properties: - - !ruby/object:Api::Type::String + - type: String name: 'ip' description: IP could be an IP address (like 1.2.3.4) or a CIDR (like 1.2.3.0/24). required: true - - !ruby/object:Api::Type::String + - type: String name: 'hostname' description: Hostname of the machine. VM's name will be used if this field is empty. default_from_api: true - - !ruby/object:Api::Type::NestedObject + - type: NestedObject name: "controlPlaneNode" description: | The VMware admin cluster control plane node configuration. properties: - - !ruby/object:Api::Type::Integer + - type: Integer name: cpus description: | The number of vCPUs for the control-plane node of the admin cluster. default_value: 4 - - !ruby/object:Api::Type::Integer + - type: Integer name: memory description: | The number of mebibytes of memory for the control-plane node of the admin cluster. default_value: 8192 - - !ruby/object:Api::Type::Integer + - type: Integer name: replicas description: | The number of control plane nodes for this VMware admin cluster. default_value: 1 - - !ruby/object:Api::Type::NestedObject + - type: NestedObject name: "addonNode" description: | The VMware admin cluster addon node configuration. properties: - - !ruby/object:Api::Type::NestedObject + - type: NestedObject name: "autoResizeConfig" description: | Specifies auto resize config. default_from_api: true properties: - - !ruby/object:Api::Type::Boolean + - type: Boolean name: enabled description: | Whether to enable controle plane node auto resizing. required: true - - !ruby/object:Api::Type::NestedObject + - type: NestedObject name: "loadBalancer" description: | Specifies the load balancer configuration for VMware admin cluster. properties: - - !ruby/object:Api::Type::NestedObject + - type: NestedObject name: "vipConfig" required: true description: | Specified the Bare Metal Load Balancer Config properties: - - !ruby/object:Api::Type::String + - 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::String + - type: String name: "addonsVip" description: | The VIP to configure the load balancer for add-ons. - - !ruby/object:Api::Type::NestedObject + - type: NestedObject name: 'f5Config' description: Configuration for F5 Big IP typed load balancers. exactly_one_of: @@ -287,19 +295,19 @@ properties: - loadBalancer.0.manual_lb_config - loadBalancer.0.metal_lb_config properties: - - !ruby/object:Api::Type::String + - type: String name: 'address' description: The load balancer's IP address. - - !ruby/object:Api::Type::String + - type: String name: 'partition' description: | he preexisting partition to be used by the load balancer. T his partition is usually created for the admin cluster for example: 'my-f5-admin-partition'. - - !ruby/object:Api::Type::String + - type: String name: 'snatPool' description: The pool name. Only necessary, if using SNAT. - - !ruby/object:Api::Type::NestedObject + - type: NestedObject name: 'manualLbConfig' description: Manually configured load balancers. exactly_one_of: @@ -307,130 +315,130 @@ properties: - loadBalancer.0.manual_lb_config - loadBalancer.0.metal_lb_config properties: - - !ruby/object:Api::Type::Integer + - type: Integer name: 'ingressHttpNodePort' description: | NodePort for ingress service's http. The ingress service in the admin cluster is implemented as a Service of type NodePort (ex. 32527). default_from_api: true - - !ruby/object:Api::Type::Integer + - type: Integer name: 'ingressHttpsNodePort' description: | NodePort for ingress service's https. The ingress service in the admin cluster is implemented as a Service of type NodePort (ex. 30139). default_from_api: true - - !ruby/object:Api::Type::Integer + - type: Integer name: 'controlPlaneNodePort' description: | NodePort for control plane service. The Kubernetes API server in the admin cluster is implemented as a Service of type NodePort (ex. 30968). default_from_api: true - - !ruby/object:Api::Type::Integer + - type: Integer name: 'konnectivityServerNodePort' description: | NodePort for konnectivity server service running as a sidecar in each kube-apiserver pod (ex. 30564). default_from_api: true - - !ruby/object:Api::Type::Integer + - type: Integer name: 'addonsNodePort' description: | NodePort for add-ons server in the admin cluster. default_from_api: true - - !ruby/object:Api::Type::NestedObject - name: 'metalLbConfig' + - name: 'metalLbConfig' description: Manually configured load balancers. exactly_one_of: - loadBalancer.0.f5_config - loadBalancer.0.manual_lb_config - loadBalancer.0.metal_lb_config - - !ruby/object:Api::Type::NestedObject + - type: NestedObject name: vcenter description: | Specifies vCenter config for the admin cluster. properties: - - !ruby/object:Api::Type::String + - type: String name: 'resourcePool' description: The name of the vCenter resource pool for the admin cluster. - - !ruby/object:Api::Type::String + - type: String name: 'datastore' description: The name of the vCenter datastore for the admin cluster. - - !ruby/object:Api::Type::String + - type: String name: 'datacenter' description: The name of the vCenter datacenter for the admin cluster. - - !ruby/object:Api::Type::String + - type: String name: 'cluster' description: The name of the vCenter cluster for the admin cluster. - - !ruby/object:Api::Type::String + - type: String name: 'folder' description: The name of the vCenter folder for the admin cluster. - - !ruby/object:Api::Type::String + - type: String name: 'caCertData' description: Contains the vCenter CA certificate public key for SSL verification. - - !ruby/object:Api::Type::String + - type: String name: 'address' description: The vCenter IP address. - - !ruby/object:Api::Type::String + - type: String name: 'dataDisk' description: The name of the virtual machine disk (VMDK) for the admin cluster. - - !ruby/object:Api::Type::String + - type: String name: 'storagePolicyName' description: The name of the vCenter storage policy for the user cluster. - - !ruby/object:Api::Type::NestedObject + - type: NestedObject name: antiAffinityGroups description: | AAGConfig specifies whether to spread VMware Admin Cluster nodes across at least three physical hosts in the datacenter. default_from_api: true properties: - - !ruby/object:Api::Type::Boolean + - type: Boolean name: aagConfigDisabled description: | Spread nodes across at least three physical hosts (requires at least three hosts). Enabled by default. required: true - - !ruby/object:Api::Type::NestedObject + - type: NestedObject name: autoRepairConfig description: Configuration for auto repairing. default_from_api: true properties: - - !ruby/object:Api::Type::Boolean + - type: Boolean name: enabled description: Whether auto repair is enabled. required: true - - !ruby/object:Api::Type::NestedObject + - type: NestedObject name: authorization description: The VMware admin cluster authorization configuration. properties: - - !ruby/object:Api::Type::Array + - type: Array name: viewerUsers 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 + item_type: + type: NestedObject properties: - - !ruby/object:Api::Type::String + - type: String name: username required: true description: The name of the user, e.g. `my-gcp-id@gmail.com`. - - !ruby/object:Api::Type::NestedObject + - type: NestedObject name: preparedSecrets description: | The VMware admin cluster prepared secrets configuration. It should always be enabled by the Central API, instead of letting users set it. default_from_api: true properties: - - !ruby/object:Api::Type::Boolean + - type: Boolean name: enabled description: Whether prepared secrets is enabled. required: true - - !ruby/object:Api::Type::NestedObject + - type: NestedObject name: platformConfig description: | The VMware platform configuration. properties: - - !ruby/object:Api::Type::String + - type: String name: 'requiredPlatformVersion' description: | The required platform version e.g. 1.13.1. @@ -439,29 +447,30 @@ properties: If the target version is not installed in the platform (bundle versions), download the target version bundle. ignore_read: true - - !ruby/object:Api::Type::String + - type: String name: 'platformVersion' description: | The platform version e.g. 1.13.2. output: true - - !ruby/object:Api::Type::Array + - type: Array name: bundles description: | The list of bundles installed in the admin cluster. output: true - item_type: !ruby/object:Api::Type::NestedObject + item_type: + type: NestedObject properties: - - !ruby/object:Api::Type::String + - type: String name: 'version' description: | The version of the bundle. output: true - - !ruby/object:Api::Type::NestedObject + - type: NestedObject name: status description: ResourceStatus representing detailed cluster state. output: true properties: - - !ruby/object:Api::Type::String + - type: String name: 'errorMessage' description: | Human-friendly representation of the error message from the admin cluster @@ -470,25 +479,26 @@ properties: 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 + - 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 + item_type: + type: NestedObject properties: - - !ruby/object:Api::Type::String + - type: String name: 'type' description: | Type of the condition. (e.g., ClusterRunning, NodePoolRunning or ServerSidePreflightReady) output: true - - !ruby/object:Api::Type::String + - type: String name: 'reason' description: | Machine-readable message indicating details about last transition. output: true - - !ruby/object:Api::Type::String + - type: String name: 'message' description: | Human-readable message indicating details about last transition. @@ -502,17 +512,17 @@ properties: name: 'state' description: The lifecycle state of the condition. output: true - values: + enum_values: - STATE_UNSPECIFIED - STATE_TRUE - STATE_FALSE - STATE_UNKNOWN - - !ruby/object:Api::Type::NestedObject + - type: NestedObject name: status description: ResourceStatus representing detailed cluster state. output: true properties: - - !ruby/object:Api::Type::String + - type: String name: 'errorMessage' description: | Human-friendly representation of the error message from the admin cluster @@ -521,25 +531,26 @@ properties: 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 + - 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 + item_type: + type: NestedObject properties: - - !ruby/object:Api::Type::String + - type: String name: 'type' description: | Type of the condition. (e.g., ClusterRunning, NodePoolRunning or ServerSidePreflightReady) output: true - - !ruby/object:Api::Type::String + - type: String name: 'reason' description: | Machine-readable message indicating details about last transition. output: true - - !ruby/object:Api::Type::String + - type: String name: 'message' description: | Human-readable message indicating details about last transition. @@ -553,12 +564,12 @@ properties: name: 'state' description: The lifecycle state of the condition. output: true - values: + enum_values: - STATE_UNSPECIFIED - STATE_TRUE - STATE_FALSE - STATE_UNKNOWN - - !ruby/object:Api::Type::String + - type: String name: "uid" description: | The unique identifier of the VMware Admin Cluster. @@ -567,7 +578,7 @@ properties: name: "state" description: The lifecycle state of the VMware admin cluster. output: true - values: + enum_values: - STATE_UNSPECIFIED - PROVISIONING - RUNNING @@ -575,12 +586,12 @@ properties: - STOPPING - ERROR - DEGRADED - - !ruby/object:Api::Type::String + - type: String name: "endpoint" description: | The DNS name of VMware admin cluster's API server. output: true - - !ruby/object:Api::Type::Boolean + - type: Boolean name: "reconciling" description: | If set, there are currently changes in flight to the VMware admin cluster. @@ -595,7 +606,7 @@ properties: description: | The time the cluster was last updated, in RFC3339 text format. output: true - - !ruby/object:Api::Type::String + - type: String name: "localName" description: | The object name of the VMwareAdminCluster custom resource on the @@ -609,7 +620,7 @@ properties: kubectl and should expect to see the local name when viewing admin cluster controller logs. output: true - - !ruby/object:Api::Type::String + - type: String name: "etag" description: | This checksum is computed by the server based on the value of other @@ -618,24 +629,24 @@ properties: Allows clients to perform consistent read-modify-writes through optimistic concurrency control. output: true - - !ruby/object:Api::Type::NestedObject + - type: NestedObject name: fleet description: Fleet configuration for the cluster. output: true properties: - - !ruby/object:Api::Type::String + - type: String name: 'membership' description: | The name of the managed Fleet Membership resource associated to this cluster. Membership names are formatted as `projects//locations//memberships/`. output: true - - !ruby/object:Api::Type::NestedObject + - type: NestedObject name: status description: ResourceStatus representing detailed cluster state. output: true properties: - - !ruby/object:Api::Type::String + - type: String name: 'errorMessage' description: | Human-friendly representation of the error message from the admin cluster @@ -644,25 +655,26 @@ properties: 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 + - 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 + item_type: + type: NestedObject properties: - - !ruby/object:Api::Type::String + - type: String name: 'type' description: | Type of the condition. (e.g., ClusterRunning, NodePoolRunning or ServerSidePreflightReady) output: true - - !ruby/object:Api::Type::String + - type: String name: 'reason' description: | Machine-readable message indicating details about last transition. output: true - - !ruby/object:Api::Type::String + - type: String name: 'message' description: | Human-readable message indicating details about last transition. @@ -676,7 +688,7 @@ properties: name: 'state' description: The lifecycle state of the condition. output: true - values: + enum_values: - STATE_UNSPECIFIED - STATE_TRUE - STATE_FALSE diff --git a/mmv1/templates/terraform/examples/gkeonprem_vmware_admin_cluster_basic.tf.erb b/mmv1/templates/terraform/examples/gkeonprem_vmware_admin_cluster_basic.tf.tmpl similarity index 76% rename from mmv1/templates/terraform/examples/gkeonprem_vmware_admin_cluster_basic.tf.erb rename to mmv1/templates/terraform/examples/gkeonprem_vmware_admin_cluster_basic.tf.tmpl index 210568bfa531..c57a0ee2fc22 100644 --- a/mmv1/templates/terraform/examples/gkeonprem_vmware_admin_cluster_basic.tf.erb +++ b/mmv1/templates/terraform/examples/gkeonprem_vmware_admin_cluster_basic.tf.tmpl @@ -1,8 +1,9 @@ -resource "google_gkeonprem_vmware_admin_cluster" "<%= ctx[:primary_resource_id] %>" { - name = "cluster-<%= ctx[:vars]['name'] %>" - location = local.region +resource "google_gkeonprem_vmware_admin_cluster" "{{$.PrimaryResourceId}}" { + name = "{{index $.Vars "name"}}" + location = "us-west1" description = "test admin cluster" + bootstrap_cluster_membership = "projects/870316890899/locations/global/memberships/gkeonprem-terraform-test" on_prem_version = "1.31.0-gke.35" image_type = "ubuntu_containerd" vcenter { From d55d69a13dcb7e7a5822f51aef481483a8f7fe50 Mon Sep 17 00:00:00 2001 From: Naitian Liu Date: Tue, 15 Oct 2024 19:01:59 +0000 Subject: [PATCH 06/13] Update test --- .../gkeonprem/VmwareAdminCluster.yaml | 25 +++++++++++++------ ...eonprem_vmware_admin_cluster_basic.tf.tmpl | 9 ++++--- 2 files changed, 24 insertions(+), 10 deletions(-) diff --git a/mmv1/products/gkeonprem/VmwareAdminCluster.yaml b/mmv1/products/gkeonprem/VmwareAdminCluster.yaml index 605a1585640f..2b961a110cdc 100644 --- a/mmv1/products/gkeonprem/VmwareAdminCluster.yaml +++ b/mmv1/products/gkeonprem/VmwareAdminCluster.yaml @@ -1,4 +1,3 @@ - # 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. @@ -12,29 +11,41 @@ # See the License for the specific language governing permissions and # limitations under the License. ---- !ruby/object:Api::Resource +--- name: "VmwareAdminCluster" min_version: beta base_url: "projects/{{project}}/locations/{{location}}/vmwareAdminClusters" create_url: "projects/{{project}}/locations/{{location}}/vmwareAdminClusters?vmware_admin_cluster_id={{name}}" update_url: "projects/{{project}}/locations/{{location}}/vmwareAdminClusters/{{name}}" -delete_url: "projects/{{project}}/locations/{{location}}/vmwareAdminClusters/{{name}}:unenroll" self_link: "projects/{{project}}/locations/{{location}}/vmwareAdminClusters/{{name}}" update_verb: "PATCH" update_mask: true description: "A Google VMware Admin Cluster." -autogen_async: false exclude_delete: true -taint_resource_on_failed_create: true id_format: "projects/{{project}}/locations/{{location}}/vmwareAdminClusters/{{name}}" import_format: ["projects/{{project}}/locations/{{location}}/vmwareAdminClusters/{{name}}"] timeouts: !ruby/object:Api::Timeouts insert_minutes: 60 delete_minutes: 60 update_minutes: 60 +async: + actions: ['create', 'delete', 'update'] + type: 'OpAsync' + operation: + base_url: '{{op_id}}' + kind: 'gkeonprem#operation' + path: 'name' + wait_ms: 1000 + result: + path: 'response' + resource_inside_response: true + error: + path: 'error' + message: 'message' +custom_code: +taint_resource_on_failed_create: true examples: - - !ruby/object:Provider::Terraform::Examples - name: "gkeonprem_vmware_admin_cluster_basic" + - name: "gkeonprem_vmware_admin_cluster_basic" primary_resource_id: "admin-cluster-basic" min_version: beta vars: diff --git a/mmv1/templates/terraform/examples/gkeonprem_vmware_admin_cluster_basic.tf.tmpl b/mmv1/templates/terraform/examples/gkeonprem_vmware_admin_cluster_basic.tf.tmpl index c57a0ee2fc22..1b9618be83fd 100644 --- a/mmv1/templates/terraform/examples/gkeonprem_vmware_admin_cluster_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/gkeonprem_vmware_admin_cluster_basic.tf.tmpl @@ -1,5 +1,5 @@ - resource "google_gkeonprem_vmware_admin_cluster" "{{$.PrimaryResourceId}}" { + provider = google-beta name = "{{index $.Vars "name"}}" location = "us-west1" description = "test admin cluster" @@ -13,12 +13,15 @@ resource "google_gkeonprem_vmware_admin_cluster" "{{$.PrimaryResourceId}}" { cluster = "test cluster" folder = "test folder" ca_cert_data = "test ca cert data" - adderess = "10.0.0.1" + address = "10.0.0.1" data_disk = "test data disk" } network_config { service_address_cidr_blocks = ["10.96.0.0/12"] pod_address_cidr_blocks = ["192.168.0.0/16"] + dhcp_ip_config { + enabled = true + } } control_plane_node { cpus = 4 @@ -27,7 +30,7 @@ resource "google_gkeonprem_vmware_admin_cluster" "{{$.PrimaryResourceId}}" { load_balancer { vip_config { control_plane_vip = "10.251.133.5" - ingress_vip = "10.251.135.19" + addons_vip = "10.251.135.19" } f5_config { address = "10.251.135.22" From 64eabb41c596abe7281a99b55de0777ea8da7ca1 Mon Sep 17 00:00:00 2001 From: Naitian Liu Date: Tue, 15 Oct 2024 19:11:35 +0000 Subject: [PATCH 07/13] fxi trailing whitespace --- .../gkeonprem/VmwareAdminCluster.yaml | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/mmv1/products/gkeonprem/VmwareAdminCluster.yaml b/mmv1/products/gkeonprem/VmwareAdminCluster.yaml index 2b961a110cdc..5c7dd1e30305 100644 --- a/mmv1/products/gkeonprem/VmwareAdminCluster.yaml +++ b/mmv1/products/gkeonprem/VmwareAdminCluster.yaml @@ -11,7 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. ---- +--- name: "VmwareAdminCluster" min_version: beta base_url: "projects/{{project}}/locations/{{location}}/vmwareAdminClusters" @@ -129,7 +129,7 @@ properties: description: Represents the configuration values for static IP allocation to nodes. - item_type: + item_type: type: NestedObject properties: - type: String @@ -147,7 +147,7 @@ properties: The node's network configurations used by the VMware Admin Cluster. required: true - item_type: + item_type: type: NestedObject properties: - type: String @@ -226,7 +226,7 @@ properties: The node's network configurations used by the VMware Admin Cluster. required: true - item_type: + item_type: type: NestedObject properties: - type: String @@ -426,7 +426,7 @@ properties: description: | Users that will be granted the cluster-admin role on the cluster, providing full access to the cluster. - item_type: + item_type: type: NestedObject properties: - type: String @@ -435,8 +435,8 @@ properties: description: The name of the user, e.g. `my-gcp-id@gmail.com`. - type: NestedObject name: preparedSecrets - description: | - The VMware admin cluster prepared secrets configuration. It should always be + description: | + The VMware admin cluster prepared secrets configuration. It should always be enabled by the Central API, instead of letting users set it. default_from_api: true properties: @@ -468,7 +468,7 @@ properties: description: | The list of bundles installed in the admin cluster. output: true - item_type: + item_type: type: NestedObject properties: - type: String @@ -495,7 +495,7 @@ properties: description: | ResourceConditions provide a standard mechanism for higher-level status reporting from admin cluster controller. output: true - item_type: + item_type: type: NestedObject properties: - type: String @@ -547,7 +547,7 @@ properties: description: | ResourceConditions provide a standard mechanism for higher-level status reporting from admin cluster controller. output: true - item_type: + item_type: type: NestedObject properties: - type: String From 11111f360daea2ff3c3bbfc379dcc4ec2460bb5c Mon Sep 17 00:00:00 2001 From: Naitian Liu Date: Mon, 4 Nov 2024 18:21:11 +0000 Subject: [PATCH 08/13] increase test coverage --- .../gkeonprem/VmwareAdminCluster.yaml | 36 +++++--- ...eonprem_vmware_admin_cluster_basic.tf.tmpl | 1 + ...keonprem_vmware_admin_cluster_full.tf.tmpl | 88 +++++++++++++++++++ ...nprem_vmware_admin_cluster_metallb.tf.tmpl | 37 ++++++++ 4 files changed, 148 insertions(+), 14 deletions(-) create mode 100644 mmv1/templates/terraform/examples/gkeonprem_vmware_admin_cluster_full.tf.tmpl create mode 100644 mmv1/templates/terraform/examples/gkeonprem_vmware_admin_cluster_metallb.tf.tmpl diff --git a/mmv1/products/gkeonprem/VmwareAdminCluster.yaml b/mmv1/products/gkeonprem/VmwareAdminCluster.yaml index 5c7dd1e30305..37443aa94ef6 100644 --- a/mmv1/products/gkeonprem/VmwareAdminCluster.yaml +++ b/mmv1/products/gkeonprem/VmwareAdminCluster.yaml @@ -52,6 +52,20 @@ examples: name: "basic" test_env_vars: project: "fake-backend-360322" + - name: 'gkeonprem_vmware_admin_cluster_full' + primary_resource_id: 'admin-cluster-full' + min_version: beta + vars: + name: 'full' + test_env_vars: + project: 'fake-backend-360322' + - name: 'gkeonprem_vmware_admin_cluster_metallb' + primary_resource_id: 'admin-cluster-metallb' + min_version: beta + vars: + name: 'metallb' + test_env_vars: + project: 'fake-backend-360322' parameters: - type: String name: "name" @@ -286,14 +300,14 @@ properties: name: "vipConfig" required: true description: | - Specified the Bare Metal Load Balancer Config + Specified the VMware Load Balancer Config properties: - type: String name: "controlPlaneVip" required: true description: | The VIP which you previously set aside for the Kubernetes - API of this Bare Metal Admin Cluster. + API of this VMware Admin Cluster. - type: String name: "addonsVip" description: | @@ -355,12 +369,17 @@ properties: description: | NodePort for add-ons server in the admin cluster. default_from_api: true - - name: 'metalLbConfig' + - type: NestedObject + name: 'metalLbConfig' description: Manually configured load balancers. exactly_one_of: - loadBalancer.0.f5_config - loadBalancer.0.manual_lb_config - loadBalancer.0.metal_lb_config + properties: + - type: Boolean + name: enabled + description: Metal LB is enabled. - type: NestedObject name: vcenter description: | @@ -433,17 +452,6 @@ properties: name: username required: true description: The name of the user, e.g. `my-gcp-id@gmail.com`. - - type: NestedObject - name: preparedSecrets - description: | - The VMware admin cluster prepared secrets configuration. It should always be - enabled by the Central API, instead of letting users set it. - default_from_api: true - properties: - - type: Boolean - name: enabled - description: Whether prepared secrets is enabled. - required: true - type: NestedObject name: platformConfig description: | diff --git a/mmv1/templates/terraform/examples/gkeonprem_vmware_admin_cluster_basic.tf.tmpl b/mmv1/templates/terraform/examples/gkeonprem_vmware_admin_cluster_basic.tf.tmpl index 1b9618be83fd..33e2aa89c39a 100644 --- a/mmv1/templates/terraform/examples/gkeonprem_vmware_admin_cluster_basic.tf.tmpl +++ b/mmv1/templates/terraform/examples/gkeonprem_vmware_admin_cluster_basic.tf.tmpl @@ -35,6 +35,7 @@ resource "google_gkeonprem_vmware_admin_cluster" "{{$.PrimaryResourceId}}" { f5_config { address = "10.251.135.22" partition = "test-parition" + snat_pool = "test-snat-pool" } } } diff --git a/mmv1/templates/terraform/examples/gkeonprem_vmware_admin_cluster_full.tf.tmpl b/mmv1/templates/terraform/examples/gkeonprem_vmware_admin_cluster_full.tf.tmpl new file mode 100644 index 000000000000..b446a094452f --- /dev/null +++ b/mmv1/templates/terraform/examples/gkeonprem_vmware_admin_cluster_full.tf.tmpl @@ -0,0 +1,88 @@ +resource "google_gkeonprem_vmware_admin_cluster" "{{$.PrimaryResourceId}}" { + provider = google-beta + name = "{{index $.Vars "name"}}" + location = "us-west1" + description = "test admin cluster" + bootstrap_cluster_membership = "projects/870316890899/locations/global/memberships/gkeonprem-terraform-test" + on_prem_version = "1.31.0-gke.35" + image_type = "ubuntu_containerd" + annotations = {} + vcenter { + resource_pool = "test resource pool" + datastore = "test data store" + datacenter = "test data center" + cluster = "test cluster" + folder = "test folder" + ca_cert_data = "test ca cert data" + address = "10.0.0.1" + data_disk = "test data disk" + storage_policy_name = "storage_policy_name" + } + network_config { + service_address_cidr_blocks = ["10.96.0.0/12"] + pod_address_cidr_blocks = ["192.168.0.0/16"] + ha_control_plane_config { + control_plane_ip_block { + gateway = "10.0.0.3" + ips { + hostname = "hostname" + ip = "10.0.0.4" + } + netmask = "10.0.0.3/32" + } + } + host_config { + dns_servers = ["10.254.41.1"] + ntp_servers = ["216.239.35.8"] + dns_search_domains = ["test-domain"] + } + static_ip_config { + ip_blocks { + gateway = "10.0.0.1" + ips { + hostname = "hostname" + ip = "10.0.0.2" + } + netmask = "10.0.0.3/32" + } + } + vcenter_network = "test-vcenter-network" + } + control_plane_node { + cpus = 4 + memory = 8192 + replicas = 3 + } + load_balancer { + vip_config { + control_plane_vip = "10.251.133.5" + addons_vip = "10.251.135.19" + } + manual_lb_config { + addons_node_port = 30005 + control_plane_node_port = 30006 + ingress_http_node_port = 30007 + ingress_https_node_port = 30008 + konnectivity_server_node_port = 30009 + } + } + addon_node { + auto_resize_config { + enabled = true + } + } + anti_affinity_groups { + aag_config_disabled = true + } + authorization { + viewer_users { + username = "user1@gmail.com" + } + } + auto_repair_config { + enabled = true + } + platform_config { + required_platform_version = "1.31.0" + } +} diff --git a/mmv1/templates/terraform/examples/gkeonprem_vmware_admin_cluster_metallb.tf.tmpl b/mmv1/templates/terraform/examples/gkeonprem_vmware_admin_cluster_metallb.tf.tmpl new file mode 100644 index 000000000000..c7943e7681e3 --- /dev/null +++ b/mmv1/templates/terraform/examples/gkeonprem_vmware_admin_cluster_metallb.tf.tmpl @@ -0,0 +1,37 @@ +resource "google_gkeonprem_vmware_admin_cluster" "{{$.PrimaryResourceId}}" { + provider = google-beta + name = "{{index $.Vars "name"}}" + location = "us-west1" + description = "test admin cluster" + bootstrap_cluster_membership = "projects/870316890899/locations/global/memberships/gkeonprem-terraform-test" + on_prem_version = "1.31.0-gke.35" + image_type = "ubuntu_containerd" + vcenter { + resource_pool = "test resource pool" + datastore = "test data store" + datacenter = "test data center" + cluster = "test cluster" + folder = "test folder" + ca_cert_data = "test ca cert data" + address = "10.0.0.1" + data_disk = "test data disk" + } + network_config { + service_address_cidr_blocks = ["10.96.0.0/12"] + pod_address_cidr_blocks = ["192.168.0.0/16"] + dhcp_ip_config { + enabled = true + } + } + control_plane_node { + cpus = 4 + memory = 8192 + } + load_balancer { + vip_config { + control_plane_vip = "10.251.133.5" + addons_vip = "10.251.135.19" + } + metal_lb_config {} + } +} From 82e265c83eaa96ef6ad7c85361fc71d437dc980b Mon Sep 17 00:00:00 2001 From: Naitian Liu Date: Mon, 4 Nov 2024 18:22:25 +0000 Subject: [PATCH 09/13] trim whitespace --- mmv1/products/gkeonprem/VmwareAdminCluster.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mmv1/products/gkeonprem/VmwareAdminCluster.yaml b/mmv1/products/gkeonprem/VmwareAdminCluster.yaml index 37443aa94ef6..ba806cc8d41e 100644 --- a/mmv1/products/gkeonprem/VmwareAdminCluster.yaml +++ b/mmv1/products/gkeonprem/VmwareAdminCluster.yaml @@ -679,7 +679,7 @@ properties: description: | ResourceConditions provide a standard mechanism for higher-level status reporting from admin cluster controller. output: true - item_type: + item_type: type: NestedObject properties: - type: String From b0f26401b104bbf3b8d65690a3a9f7bc413450e1 Mon Sep 17 00:00:00 2001 From: Naitian Liu Date: Mon, 4 Nov 2024 18:28:19 +0000 Subject: [PATCH 10/13] remove trailing spaces --- mmv1/products/gkeonprem/VmwareAdminCluster.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mmv1/products/gkeonprem/VmwareAdminCluster.yaml b/mmv1/products/gkeonprem/VmwareAdminCluster.yaml index ba806cc8d41e..600886e667ee 100644 --- a/mmv1/products/gkeonprem/VmwareAdminCluster.yaml +++ b/mmv1/products/gkeonprem/VmwareAdminCluster.yaml @@ -376,7 +376,7 @@ properties: - loadBalancer.0.f5_config - loadBalancer.0.manual_lb_config - loadBalancer.0.metal_lb_config - properties: + properties: - type: Boolean name: enabled description: Metal LB is enabled. From 003cc6a234732957bf2b9dcd4039fa87eeb44efd Mon Sep 17 00:00:00 2001 From: Naitian Liu Date: Tue, 19 Nov 2024 22:24:17 +0000 Subject: [PATCH 11/13] add enabled field under metal lb config --- mmv1/products/gkeonprem/VmwareAdminCluster.yaml | 3 ++- .../examples/gkeonprem_vmware_admin_cluster_metallb.tf.tmpl | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/mmv1/products/gkeonprem/VmwareAdminCluster.yaml b/mmv1/products/gkeonprem/VmwareAdminCluster.yaml index 600886e667ee..bbac19ab3bf0 100644 --- a/mmv1/products/gkeonprem/VmwareAdminCluster.yaml +++ b/mmv1/products/gkeonprem/VmwareAdminCluster.yaml @@ -371,7 +371,8 @@ properties: default_from_api: true - type: NestedObject name: 'metalLbConfig' - description: Manually configured load balancers. + description: Metal LB load balancers. + send_empty_value: true exactly_one_of: - loadBalancer.0.f5_config - loadBalancer.0.manual_lb_config diff --git a/mmv1/templates/terraform/examples/gkeonprem_vmware_admin_cluster_metallb.tf.tmpl b/mmv1/templates/terraform/examples/gkeonprem_vmware_admin_cluster_metallb.tf.tmpl index c7943e7681e3..7c63fca0f19f 100644 --- a/mmv1/templates/terraform/examples/gkeonprem_vmware_admin_cluster_metallb.tf.tmpl +++ b/mmv1/templates/terraform/examples/gkeonprem_vmware_admin_cluster_metallb.tf.tmpl @@ -32,6 +32,8 @@ resource "google_gkeonprem_vmware_admin_cluster" "{{$.PrimaryResourceId}}" { control_plane_vip = "10.251.133.5" addons_vip = "10.251.135.19" } - metal_lb_config {} + metal_lb_config { + enabled = true + } } } From fb858949343b271c9ad743766d172d244cf407d1 Mon Sep 17 00:00:00 2001 From: Naitian Liu Date: Mon, 16 Dec 2024 18:28:57 +0000 Subject: [PATCH 12/13] default from api for some fields --- mmv1/products/gkeonprem/VmwareAdminCluster.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mmv1/products/gkeonprem/VmwareAdminCluster.yaml b/mmv1/products/gkeonprem/VmwareAdminCluster.yaml index bbac19ab3bf0..e492d84fb9d6 100644 --- a/mmv1/products/gkeonprem/VmwareAdminCluster.yaml +++ b/mmv1/products/gkeonprem/VmwareAdminCluster.yaml @@ -84,6 +84,7 @@ properties: name: "description" description: | A human readable description of this VMware admin cluster. + default_from_api: true - type: String name: "onPremVersion" description: | @@ -92,10 +93,12 @@ properties: name: "imageType" description: | The OS image type for the VMware admin cluster. + default_from_api: true - type: String name: "bootstrapClusterMembership" description: | The bootstrap cluster this VMware admin cluster belongs to. + default_from_api: true - type: KeyValueAnnotations name: "annotations" description: | @@ -279,6 +282,7 @@ properties: name: "addonNode" description: | The VMware admin cluster addon node configuration. + default_from_api: true properties: - type: NestedObject name: "autoResizeConfig" From 1715acfc659f0a8b2a6413cb77c9d3bcd84e893c Mon Sep 17 00:00:00 2001 From: Naitian Liu Date: Thu, 19 Dec 2024 21:52:52 +0000 Subject: [PATCH 13/13] Add default_from_api for vcenter and subfields --- mmv1/products/gkeonprem/VmwareCluster.yaml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/mmv1/products/gkeonprem/VmwareCluster.yaml b/mmv1/products/gkeonprem/VmwareCluster.yaml index 4c1f8cd97667..eafab093d91d 100644 --- a/mmv1/products/gkeonprem/VmwareCluster.yaml +++ b/mmv1/products/gkeonprem/VmwareCluster.yaml @@ -652,26 +652,33 @@ properties: description: | VmwareVCenterConfig specifies vCenter config for the user cluster. Inherited from the admin cluster. + default_from_api: true properties: - name: 'resourcePool' type: String description: The name of the vCenter resource pool for the user cluster. + default_from_api: true - name: 'datastore' type: String description: The name of the vCenter datastore for the user cluster. + default_from_api: true - name: 'datacenter' type: String description: The name of the vCenter datacenter for the user cluster. + default_from_api: true - name: 'cluster' type: String description: The name of the vCenter cluster for the user cluster. + default_from_api: true - name: 'folder' type: String description: The name of the vCenter folder for the user cluster. + default_from_api: true - name: 'caCertData' type: String description: Contains the vCenter CA certificate public key for SSL verification. + default_from_api: true - name: 'address' type: String description: The vCenter IP address. @@ -679,6 +686,7 @@ properties: - name: 'storagePolicyName' type: String description: The name of the vCenter storage policy for the user cluster. + default_from_api: true - name: 'status' type: NestedObject description: ResourceStatus representing detailed cluster state.