From 86622f00633b7e9b9c4c62d0b7b4edeff40ae7dc Mon Sep 17 00:00:00 2001 From: Jason Vigil Date: Mon, 30 Sep 2024 17:07:18 +0000 Subject: [PATCH] feat: Add types for WorkstationConfig --- apis/refs/v1beta1/workstationclusterref.go | 24 + apis/workstations/v1alpha1/shared_types.go | 44 ++ apis/workstations/v1alpha1/types.generated.go | 371 ++++++++++ .../v1alpha1/workstationcluster_types.go | 35 +- .../v1alpha1/workstationconfig_types.go | 467 ++++++++++++ .../v1alpha1/zz_generated.deepcopy.go | 667 +++++++++++++++-- ...rs.workstations.cnrm.cloud.google.com.yaml | 4 +- ...gs.workstations.cnrm.cloud.google.com.yaml | 681 ++++++++++++++++++ .../workstationcluster_mappings.go | 22 +- 9 files changed, 2212 insertions(+), 103 deletions(-) create mode 100644 apis/refs/v1beta1/workstationclusterref.go create mode 100644 apis/workstations/v1alpha1/shared_types.go create mode 100644 apis/workstations/v1alpha1/workstationconfig_types.go create mode 100644 config/crds/resources/apiextensions.k8s.io_v1_customresourcedefinition_workstationconfigs.workstations.cnrm.cloud.google.com.yaml diff --git a/apis/refs/v1beta1/workstationclusterref.go b/apis/refs/v1beta1/workstationclusterref.go new file mode 100644 index 0000000000..608ee0d8b2 --- /dev/null +++ b/apis/refs/v1beta1/workstationclusterref.go @@ -0,0 +1,24 @@ +// Copyright 2024 Google LLC +// +// 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. + +package v1beta1 + +type WorkstationClusterRef struct { + /* The WorkstationCluster selfLink, when not managed by Config Connector. */ + External string `json:"external,omitempty"` + /* The `name` field of a `WorkstationCluster` resource. */ + Name string `json:"name,omitempty"` + /* The `namespace` field of a `WorkstationCluster` resource. */ + Namespace string `json:"namespace,omitempty"` +} diff --git a/apis/workstations/v1alpha1/shared_types.go b/apis/workstations/v1alpha1/shared_types.go new file mode 100644 index 0000000000..330f2bbc7d --- /dev/null +++ b/apis/workstations/v1alpha1/shared_types.go @@ -0,0 +1,44 @@ +// Copyright 2024 Google LLC +// +// 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. + +package v1alpha1 + +type WorkstationAnnotation struct { + // Key for the annotation. + Key string `json:"key,omitempty"` + + // Value for the annotation. + Value string `json:"value,omitempty"` +} + +type WorkstationLabel struct { + // Key for the label. + Key string `json:"key,omitempty"` + + // Value for the label. + Value string `json:"value,omitempty"` +} + +// +kcc:proto=google.rpc.Status +type WorkstationServiceGCPCondition struct { + // The status code, which should be an enum value of + // [google.rpc.Code][google.rpc.Code]. + Code *int `json:"code,omitempty"` + + // A developer-facing error message, which should be in English. Any + // user-facing error message should be localized and sent in the + // [google.rpc.Status.details][google.rpc.Status.details] field, or localized + // by the client. + Message *string `json:"message,omitempty"` +} diff --git a/apis/workstations/v1alpha1/types.generated.go b/apis/workstations/v1alpha1/types.generated.go index d018ae0c58..e5add0428f 100644 --- a/apis/workstations/v1alpha1/types.generated.go +++ b/apis/workstations/v1alpha1/types.generated.go @@ -108,6 +108,377 @@ type WorkstationCluster_PrivateClusterConfig struct { AllowedProjects []string `json:"allowedProjects,omitempty"` } +// +kcc:proto=google.cloud.workstations.v1.WorkstationConfig +type WorkstationConfig struct { + // Full name of this workstation configuration. + Name *string `json:"name,omitempty"` + + // Optional. Human-readable name for this workstation configuration. + DisplayName *string `json:"displayName,omitempty"` + + // Output only. A system-assigned unique identifier for this workstation + // configuration. + Uid *string `json:"uid,omitempty"` + + // Output only. Indicates whether this workstation configuration is currently + // being updated to match its intended state. + Reconciling *bool `json:"reconciling,omitempty"` + + // Optional. Client-specified annotations. + Annotations map[string]string `json:"annotations,omitempty"` + + // Optional. + // [Labels](https://cloud.google.com/workstations/docs/label-resources) that + // are applied to the workstation configuration and that are also propagated + // to the underlying Compute Engine resources. + Labels map[string]string `json:"labels,omitempty"` + + // Output only. Time when this workstation configuration was created. + CreateTime *string `json:"createTime,omitempty"` + + // Output only. Time when this workstation configuration was most recently + // updated. + UpdateTime *string `json:"updateTime,omitempty"` + + // Output only. Time when this workstation configuration was soft-deleted. + DeleteTime *string `json:"deleteTime,omitempty"` + + // Optional. Checksum computed by the server. May be sent on update and delete + // requests to make sure that the client has an up-to-date value before + // proceeding. + Etag *string `json:"etag,omitempty"` + + // Optional. Number of seconds to wait before automatically stopping a + // workstation after it last received user traffic. + // + // A value of `"0s"` indicates that Cloud Workstations VMs created with this + // configuration should never time out due to idleness. + // Provide + // [duration](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#duration) + // terminated by `s` for seconds—for example, `"7200s"` (2 hours). + // The default is `"1200s"` (20 minutes). + IdleTimeout *string `json:"idleTimeout,omitempty"` + + // Optional. Number of seconds that a workstation can run until it is + // automatically shut down. We recommend that workstations be shut down daily + // to reduce costs and so that security updates can be applied upon restart. + // The + // [idle_timeout][google.cloud.workstations.v1.WorkstationConfig.idle_timeout] + // and + // [running_timeout][google.cloud.workstations.v1.WorkstationConfig.running_timeout] + // fields are independent of each other. Note that the + // [running_timeout][google.cloud.workstations.v1.WorkstationConfig.running_timeout] + // field shuts down VMs after the specified time, regardless of whether or not + // the VMs are idle. + // + // Provide duration terminated by `s` for seconds—for example, `"54000s"` + // (15 hours). Defaults to `"43200s"` (12 hours). A value of `"0s"` indicates + // that workstations using this configuration should never time out. If + // [encryption_key][google.cloud.workstations.v1.WorkstationConfig.encryption_key] + // is set, it must be greater than `"0s"` and less than + // `"86400s"` (24 hours). + // + // Warning: A value of `"0s"` indicates that Cloud Workstations VMs created + // with this configuration have no maximum running time. This is strongly + // discouraged because you incur costs and will not pick up security updates. + RunningTimeout *string `json:"runningTimeout,omitempty"` + + // Optional. Runtime host for the workstation. + Host *WorkstationConfig_Host `json:"host,omitempty"` + + // Optional. Directories to persist across workstation sessions. + PersistentDirectories []WorkstationConfig_PersistentDirectory `json:"persistentDirectories,omitempty"` + + // Optional. Container that runs upon startup for each workstation using this + // workstation configuration. + Container *WorkstationConfig_Container `json:"container,omitempty"` + + // Immutable. Encrypts resources of this workstation configuration using a + // customer-managed encryption key (CMEK). + // + // If specified, the boot disk of the Compute Engine instance and the + // persistent disk are encrypted using this encryption key. If + // this field is not set, the disks are encrypted using a generated + // key. Customer-managed encryption keys do not protect disk metadata. + // + // If the customer-managed encryption key is rotated, when the workstation + // instance is stopped, the system attempts to recreate the + // persistent disk with the new version of the key. Be sure to keep + // older versions of the key until the persistent disk is recreated. + // Otherwise, data on the persistent disk might be lost. + // + // If the encryption key is revoked, the workstation session automatically + // stops within 7 hours. + // + // Immutable after the workstation configuration is created. + EncryptionKey *WorkstationConfig_CustomerEncryptionKey `json:"encryptionKey,omitempty"` + + // Optional. Readiness checks to perform when starting a workstation using + // this workstation configuration. Mark a workstation as running only after + // all specified readiness checks return 200 status codes. + ReadinessChecks []WorkstationConfig_ReadinessCheck `json:"readinessChecks,omitempty"` + + // Optional. Immutable. Specifies the zones used to replicate the VM and disk + // resources within the region. If set, exactly two zones within the + // workstation cluster's region must be specified—for example, + // `['us-central1-a', 'us-central1-f']`. If this field is empty, two default + // zones within the region are used. + // + // Immutable after the workstation configuration is created. + ReplicaZones []string `json:"replicaZones,omitempty"` + + // Output only. Whether this resource is degraded, in which case it may + // require user action to restore full functionality. See also the + // [conditions][google.cloud.workstations.v1.WorkstationConfig.conditions] + // field. + Degraded *bool `json:"degraded,omitempty"` + + // Output only. Status conditions describing the current resource state. + Conditions []Status `json:"conditions,omitempty"` +} + +// +kcc:proto=google.cloud.workstations.v1.WorkstationConfig.Container +type WorkstationConfig_Container struct { + // Optional. A Docker container image that defines a custom environment. + // + // Cloud Workstations provides a number of + // [preconfigured + // images](https://cloud.google.com/workstations/docs/preconfigured-base-images), + // but you can create your own + // [custom container + // images](https://cloud.google.com/workstations/docs/custom-container-images). + // If using a private image, the `host.gceInstance.serviceAccount` field + // must be specified in the workstation configuration and must have + // permission to pull the specified image. Otherwise, the image must be + // publicly accessible. + Image *string `json:"image,omitempty"` + + // Optional. If set, overrides the default ENTRYPOINT specified by the + // image. + Command []string `json:"command,omitempty"` + + // Optional. Arguments passed to the entrypoint. + Args []string `json:"args,omitempty"` + + // Optional. Environment variables passed to the container's entrypoint. + Env map[string]string `json:"env,omitempty"` + + // Optional. If set, overrides the default DIR specified by the image. + WorkingDir *string `json:"workingDir,omitempty"` + + // Optional. If set, overrides the USER specified in the image with the + // given uid. + RunAsUser *int32 `json:"runAsUser,omitempty"` +} + +// +kcc:proto=google.cloud.workstations.v1.WorkstationConfig.CustomerEncryptionKey +type WorkstationConfig_CustomerEncryptionKey struct { + // Immutable. The name of the Google Cloud KMS encryption key. For example, + // `"projects/PROJECT_ID/locations/REGION/keyRings/KEY_RING/cryptoKeys/KEY_NAME"`. + // The key must be in the same region as the workstation configuration. + KmsKey *string `json:"kmsKey,omitempty"` + + // Immutable. The service account to use with the specified + // KMS key. We recommend that you use a separate service account + // and follow KMS best practices. For more information, see + // [Separation of + // duties](https://cloud.google.com/kms/docs/separation-of-duties) and + // `gcloud kms keys add-iam-policy-binding` + // [`--member`](https://cloud.google.com/sdk/gcloud/reference/kms/keys/add-iam-policy-binding#--member). + KmsKeyServiceAccount *string `json:"kmsKeyServiceAccount,omitempty"` +} + +// +kcc:proto=google.cloud.workstations.v1.WorkstationConfig.Host +type WorkstationConfig_Host struct { + // Specifies a Compute Engine instance as the host. + GceInstance *WorkstationConfig_Host_GceInstance `json:"gceInstance,omitempty"` +} + +// +kcc:proto=google.cloud.workstations.v1.WorkstationConfig.Host.GceInstance +type WorkstationConfig_Host_GceInstance struct { + // Optional. The type of machine to use for VM instances—for example, + // `"e2-standard-4"`. For more information about machine types that + // Cloud Workstations supports, see the list of + // [available machine + // types](https://cloud.google.com/workstations/docs/available-machine-types). + MachineType *string `json:"machineType,omitempty"` + + // Optional. The email address of the service account for Cloud + // Workstations VMs created with this configuration. When specified, be + // sure that the service account has `logginglogEntries.create` permission + // on the project so it can write logs out to Cloud Logging. If using a + // custom container image, the service account must have permissions to + // pull the specified image. + // + // If you as the administrator want to be able to `ssh` into the + // underlying VM, you need to set this value to a service account + // for which you have the `iam.serviceAccounts.actAs` permission. + // Conversely, if you don't want anyone to be able to `ssh` into the + // underlying VM, use a service account where no one has that + // permission. + // + // If not set, VMs run with a service account provided by the + // Cloud Workstations service, and the image must be publicly + // accessible. + ServiceAccount *string `json:"serviceAccount,omitempty"` + + // Optional. Scopes to grant to the + // [service_account][google.cloud.workstations.v1.WorkstationConfig.Host.GceInstance.service_account]. + // Various scopes are automatically added based on feature usage. When + // specified, users of workstations under this configuration must have + // `iam.serviceAccounts.actAs` on the service account. + ServiceAccountScopes []string `json:"serviceAccountScopes,omitempty"` + + // Optional. Network tags to add to the Compute Engine VMs backing the + // workstations. This option applies + // [network + // tags](https://cloud.google.com/vpc/docs/add-remove-network-tags) to VMs + // created with this configuration. These network tags enable the creation + // of [firewall + // rules](https://cloud.google.com/workstations/docs/configure-firewall-rules). + Tags []string `json:"tags,omitempty"` + + // Optional. The number of VMs that the system should keep idle so that + // new workstations can be started quickly for new users. Defaults to `0` + // in the API. + PoolSize *int32 `json:"poolSize,omitempty"` + + // Output only. Number of instances currently available in the pool for + // faster workstation startup. + PooledInstances *int32 `json:"pooledInstances,omitempty"` + + // Optional. When set to true, disables public IP addresses for VMs. If + // you disable public IP addresses, you must set up Private Google Access + // or Cloud NAT on your network. If you use Private Google Access and you + // use `private.googleapis.com` or `restricted.googleapis.com` for + // Container Registry and Artifact Registry, make sure that you set + // up DNS records for domains `*.gcr.io` and `*.pkg.dev`. + // Defaults to false (VMs have public IP addresses). + DisablePublicIpAddresses *bool `json:"disablePublicIpAddresses,omitempty"` + + // Optional. Whether to enable nested virtualization on Cloud Workstations + // VMs created under this workstation configuration. + // + // Nested virtualization lets you run virtual machine (VM) instances + // inside your workstation. Before enabling nested virtualization, + // consider the following important considerations. Cloud Workstations + // instances are subject to the [same restrictions as Compute Engine + // instances](https://cloud.google.com/compute/docs/instances/nested-virtualization/overview#restrictions): + // + // * **Organization policy**: projects, folders, or + // organizations may be restricted from creating nested VMs if the + // **Disable VM nested virtualization** constraint is enforced in + // the organization policy. For more information, see the + // Compute Engine section, + // [Checking whether nested virtualization is + // allowed](https://cloud.google.com/compute/docs/instances/nested-virtualization/managing-constraint#checking_whether_nested_virtualization_is_allowed). + // * **Performance**: nested VMs might experience a 10% or greater + // decrease in performance for workloads that are CPU-bound and + // possibly greater than a 10% decrease for workloads that are + // input/output bound. + // * **Machine Type**: nested virtualization can only be enabled on + // workstation configurations that specify a + // [machine_type][google.cloud.workstations.v1.WorkstationConfig.Host.GceInstance.machine_type] + // in the N1 or N2 machine series. + // * **GPUs**: nested virtualization may not be enabled on workstation + // configurations with accelerators. + // * **Operating System**: Because + // [Container-Optimized + // OS](https://cloud.google.com/compute/docs/images/os-details#container-optimized_os_cos) + // does not support nested virtualization, when nested virtualization is + // enabled, the underlying Compute Engine VM instances boot from an + // [Ubuntu + // LTS](https://cloud.google.com/compute/docs/images/os-details#ubuntu_lts) + // image. + EnableNestedVirtualization *bool `json:"enableNestedVirtualization,omitempty"` + + // Optional. A set of Compute Engine Shielded instance options. + ShieldedInstanceConfig *WorkstationConfig_Host_GceInstance_GceShieldedInstanceConfig `json:"shieldedInstanceConfig,omitempty"` + + // Optional. A set of Compute Engine Confidential VM instance options. + ConfidentialInstanceConfig *WorkstationConfig_Host_GceInstance_GceConfidentialInstanceConfig `json:"confidentialInstanceConfig,omitempty"` + + // Optional. The size of the boot disk for the VM in gigabytes (GB). + // The minimum boot disk size is `30` GB. Defaults to `50` GB. + BootDiskSizeGb *int32 `json:"bootDiskSizeGb,omitempty"` +} + +// +kcc:proto=google.cloud.workstations.v1.WorkstationConfig.Host.GceInstance.GceConfidentialInstanceConfig +type WorkstationConfig_Host_GceInstance_GceConfidentialInstanceConfig struct { + // Optional. Whether the instance has confidential compute enabled. + EnableConfidentialCompute *bool `json:"enableConfidentialCompute,omitempty"` +} + +// +kcc:proto=google.cloud.workstations.v1.WorkstationConfig.Host.GceInstance.GceShieldedInstanceConfig +type WorkstationConfig_Host_GceInstance_GceShieldedInstanceConfig struct { + // Optional. Whether the instance has Secure Boot enabled. + EnableSecureBoot *bool `json:"enableSecureBoot,omitempty"` + + // Optional. Whether the instance has the vTPM enabled. + EnableVtpm *bool `json:"enableVtpm,omitempty"` + + // Optional. Whether the instance has integrity monitoring enabled. + EnableIntegrityMonitoring *bool `json:"enableIntegrityMonitoring,omitempty"` +} + +// +kcc:proto=google.cloud.workstations.v1.WorkstationConfig.PersistentDirectory +type WorkstationConfig_PersistentDirectory struct { + // A PersistentDirectory backed by a Compute Engine persistent disk. + GcePd *WorkstationConfig_PersistentDirectory_GceRegionalPersistentDisk `json:"gcePd,omitempty"` + + // Optional. Location of this directory in the running workstation. + MountPath *string `json:"mountPath,omitempty"` +} + +// +kcc:proto=google.cloud.workstations.v1.WorkstationConfig.PersistentDirectory.GceRegionalPersistentDisk +type WorkstationConfig_PersistentDirectory_GceRegionalPersistentDisk struct { + // Optional. The GB capacity of a persistent home directory for each + // workstation created with this configuration. Must be empty if + // [source_snapshot][google.cloud.workstations.v1.WorkstationConfig.PersistentDirectory.GceRegionalPersistentDisk.source_snapshot] + // is set. + // + // Valid values are `10`, `50`, `100`, `200`, `500`, or `1000`. + // Defaults to `200`. If less than `200` GB, the + // [disk_type][google.cloud.workstations.v1.WorkstationConfig.PersistentDirectory.GceRegionalPersistentDisk.disk_type] + // must be + // `"pd-balanced"` or `"pd-ssd"`. + SizeGb *int32 `json:"sizeGb,omitempty"` + + // Optional. Type of file system that the disk should be formatted with. + // The workstation image must support this file system type. Must be empty + // if + // [source_snapshot][google.cloud.workstations.v1.WorkstationConfig.PersistentDirectory.GceRegionalPersistentDisk.source_snapshot] + // is set. Defaults to `"ext4"`. + FsType *string `json:"fsType,omitempty"` + + // Optional. The [type of the persistent + // disk](https://cloud.google.com/compute/docs/disks#disk-types) for the + // home directory. Defaults to `"pd-standard"`. + DiskType *string `json:"diskType,omitempty"` + + // Optional. Name of the snapshot to use as the source for the disk. If + // set, + // [size_gb][google.cloud.workstations.v1.WorkstationConfig.PersistentDirectory.GceRegionalPersistentDisk.size_gb] + // and + // [fs_type][google.cloud.workstations.v1.WorkstationConfig.PersistentDirectory.GceRegionalPersistentDisk.fs_type] + // must be empty. + SourceSnapshot *string `json:"sourceSnapshot,omitempty"` + + // Optional. Whether the persistent disk should be deleted when the + // workstation is deleted. Valid values are `DELETE` and `RETAIN`. + // Defaults to `DELETE`. + ReclaimPolicy *string `json:"reclaimPolicy,omitempty"` +} + +// +kcc:proto=google.cloud.workstations.v1.WorkstationConfig.ReadinessCheck +type WorkstationConfig_ReadinessCheck struct { + // Optional. Path to which the request should be sent. + Path *string `json:"path,omitempty"` + + // Optional. Port to which the request should be sent. + Port *int32 `json:"port,omitempty"` +} + // +kcc:proto=google.protobuf.Any type Any struct { // A URL/resource name that uniquely identifies the type of the serialized diff --git a/apis/workstations/v1alpha1/workstationcluster_types.go b/apis/workstations/v1alpha1/workstationcluster_types.go index c93e10a8e9..9024f617c1 100644 --- a/apis/workstations/v1alpha1/workstationcluster_types.go +++ b/apis/workstations/v1alpha1/workstationcluster_types.go @@ -46,13 +46,13 @@ type WorkstationClusterSpec struct { DisplayName *string `json:"displayName,omitempty"` // Optional. Client-specified annotations. - Annotations []WorkstationClusterAnnotation `json:"annotations,omitempty"` + Annotations []WorkstationAnnotation `json:"annotations,omitempty"` // Optional. // [Labels](https://cloud.google.com/workstations/docs/label-resources) that // are applied to the workstation cluster and that are also propagated to the // underlying Compute Engine resources. - Labels []WorkstationClusterLabel `json:"labels,omitempty"` + Labels []WorkstationLabel `json:"labels,omitempty"` // Immutable. Reference to the Compute Engine network in which instances associated // with this workstation cluster will be created. @@ -67,22 +67,6 @@ type WorkstationClusterSpec struct { PrivateClusterConfig *WorkstationCluster_PrivateClusterConfig `json:"privateClusterConfig,omitempty"` } -type WorkstationClusterAnnotation struct { - // Key for the annotation. - Key string `json:"key,omitempty"` - - // Value for the annotation. - Value string `json:"value,omitempty"` -} - -type WorkstationClusterLabel struct { - // Key for the annotation. - Key string `json:"key,omitempty"` - - // Value for the annotation. - Value string `json:"value,omitempty"` -} - // +kcc:proto=google.cloud.workstations.v1.WorkstationCluster.PrivateClusterConfig type WorkstationCluster_PrivateClusterConfig struct { // Immutable. Whether Workstations endpoint is private. @@ -163,20 +147,7 @@ type WorkstationClusterObservedState struct { // Output only. Status conditions describing the workstation cluster's current // state. - GCPConditions []WorkstationClusterGCPCondition `json:"gcpConditions,omitempty"` -} - -// +kcc:proto=google.rpc.Status -type WorkstationClusterGCPCondition struct { - // The status code, which should be an enum value of - // [google.rpc.Code][google.rpc.Code]. - Code *int `json:"code,omitempty"` - - // A developer-facing error message, which should be in English. Any - // user-facing error message should be localized and sent in the - // [google.rpc.Status.details][google.rpc.Status.details] field, or localized - // by the client. - Message *string `json:"message,omitempty"` + GCPConditions []WorkstationServiceGCPCondition `json:"gcpConditions,omitempty"` } // +genclient diff --git a/apis/workstations/v1alpha1/workstationconfig_types.go b/apis/workstations/v1alpha1/workstationconfig_types.go new file mode 100644 index 0000000000..bf05439d5f --- /dev/null +++ b/apis/workstations/v1alpha1/workstationconfig_types.go @@ -0,0 +1,467 @@ +// Copyright 2024 Google LLC +// +// 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. + +package v1alpha1 + +import ( + refs "github.com/GoogleCloudPlatform/k8s-config-connector/apis/refs/v1beta1" + "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/apis/k8s/v1alpha1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +var WorkstationConfigGVK = GroupVersion.WithKind("WorkstationConfig") + +// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN! +// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized. + +// +kcc:proto=google.cloud.workstations.v1.WorkstationConfig.Host +type WorkstationConfig_Host struct { + // Specifies a Compute Engine instance as the host. + GceInstance *WorkstationConfig_Host_GceInstance `json:"gceInstance,omitempty"` +} + +// +kcc:proto=google.cloud.workstations.v1.WorkstationConfig.Host.GceInstance +type WorkstationConfig_Host_GceInstance struct { + // Optional. The type of machine to use for VM instances—for example, + // `"e2-standard-4"`. For more information about machine types that + // Cloud Workstations supports, see the list of + // [available machine + // types](https://cloud.google.com/workstations/docs/available-machine-types). + MachineType *string `json:"machineType,omitempty"` + + // Optional. A reference to the service account for Cloud + // Workstations VMs created with this configuration. When specified, be + // sure that the service account has `logginglogEntries.create` permission + // on the project so it can write logs out to Cloud Logging. If using a + // custom container image, the service account must have permissions to + // pull the specified image. + // + // If you as the administrator want to be able to `ssh` into the + // underlying VM, you need to set this value to a service account + // for which you have the `iam.serviceAccounts.actAs` permission. + // Conversely, if you don't want anyone to be able to `ssh` into the + // underlying VM, use a service account where no one has that + // permission. + // + // If not set, VMs run with a service account provided by the + // Cloud Workstations service, and the image must be publicly + // accessible. + ServiceAccountRef *refs.IAMServiceAccountRef `json:"serviceAccountRef,omitempty"` + + // Optional. Scopes to grant to the + // [service_account][google.cloud.workstations.v1.WorkstationConfig.Host.GceInstance.service_account]. + // Various scopes are automatically added based on feature usage. When + // specified, users of workstations under this configuration must have + // `iam.serviceAccounts.actAs` on the service account. + ServiceAccountScopes []string `json:"serviceAccountScopes,omitempty"` + + // Optional. Network tags to add to the Compute Engine VMs backing the + // workstations. This option applies + // [network + // tags](https://cloud.google.com/vpc/docs/add-remove-network-tags) to VMs + // created with this configuration. These network tags enable the creation + // of [firewall + // rules](https://cloud.google.com/workstations/docs/configure-firewall-rules). + Tags []string `json:"tags,omitempty"` + + // Optional. The number of VMs that the system should keep idle so that + // new workstations can be started quickly for new users. Defaults to `0` + // in the API. + PoolSize *int32 `json:"poolSize,omitempty"` + + // Optional. When set to true, disables public IP addresses for VMs. If + // you disable public IP addresses, you must set up Private Google Access + // or Cloud NAT on your network. If you use Private Google Access and you + // use `private.googleapis.com` or `restricted.googleapis.com` for + // Container Registry and Artifact Registry, make sure that you set + // up DNS records for domains `*.gcr.io` and `*.pkg.dev`. + // Defaults to false (VMs have public IP addresses). + DisablePublicIPAddresses *bool `json:"disablePublicIPAddresses,omitempty"` + + // Optional. Whether to enable nested virtualization on Cloud Workstations + // VMs created under this workstation configuration. + // + // Nested virtualization lets you run virtual machine (VM) instances + // inside your workstation. Before enabling nested virtualization, + // consider the following important considerations. Cloud Workstations + // instances are subject to the [same restrictions as Compute Engine + // instances](https://cloud.google.com/compute/docs/instances/nested-virtualization/overview#restrictions): + // + // * **Organization policy**: projects, folders, or + // organizations may be restricted from creating nested VMs if the + // **Disable VM nested virtualization** constraint is enforced in + // the organization policy. For more information, see the + // Compute Engine section, + // [Checking whether nested virtualization is + // allowed](https://cloud.google.com/compute/docs/instances/nested-virtualization/managing-constraint#checking_whether_nested_virtualization_is_allowed). + // * **Performance**: nested VMs might experience a 10% or greater + // decrease in performance for workloads that are CPU-bound and + // possibly greater than a 10% decrease for workloads that are + // input/output bound. + // * **Machine Type**: nested virtualization can only be enabled on + // workstation configurations that specify a + // [machine_type][google.cloud.workstations.v1.WorkstationConfig.Host.GceInstance.machine_type] + // in the N1 or N2 machine series. + // * **GPUs**: nested virtualization may not be enabled on workstation + // configurations with accelerators. + // * **Operating System**: Because + // [Container-Optimized + // OS](https://cloud.google.com/compute/docs/images/os-details#container-optimized_os_cos) + // does not support nested virtualization, when nested virtualization is + // enabled, the underlying Compute Engine VM instances boot from an + // [Ubuntu + // LTS](https://cloud.google.com/compute/docs/images/os-details#ubuntu_lts) + // image. + EnableNestedVirtualization *bool `json:"enableNestedVirtualization,omitempty"` + + // Optional. A set of Compute Engine Shielded instance options. + ShieldedInstanceConfig *WorkstationConfig_Host_GceInstance_GceShieldedInstanceConfig `json:"shieldedInstanceConfig,omitempty"` + + // Optional. A set of Compute Engine Confidential VM instance options. + ConfidentialInstanceConfig *WorkstationConfig_Host_GceInstance_GceConfidentialInstanceConfig `json:"confidentialInstanceConfig,omitempty"` + + // Optional. The size of the boot disk for the VM in gigabytes (GB). + // The minimum boot disk size is `30` GB. Defaults to `50` GB. + BootDiskSizeGB *int32 `json:"bootDiskSizeGB,omitempty"` +} + +// +kcc:proto=google.cloud.workstations.v1.WorkstationConfig.Host.GceInstance.GceShieldedInstanceConfig +type WorkstationConfig_Host_GceInstance_GceShieldedInstanceConfig struct { + // Optional. Whether the instance has Secure Boot enabled. + EnableSecureBoot *bool `json:"enableSecureBoot,omitempty"` + + // Optional. Whether the instance has the vTPM enabled. + EnableVTPM *bool `json:"enableVTPM,omitempty"` + + // Optional. Whether the instance has integrity monitoring enabled. + EnableIntegrityMonitoring *bool `json:"enableIntegrityMonitoring,omitempty"` +} + +// +kcc:proto=google.cloud.workstations.v1.WorkstationConfig.Host.GceInstance.GceConfidentialInstanceConfig +type WorkstationConfig_Host_GceInstance_GceConfidentialInstanceConfig struct { + // Optional. Whether the instance has confidential compute enabled. + EnableConfidentialCompute *bool `json:"enableConfidentialCompute,omitempty"` +} + +// +kcc:proto=google.cloud.workstations.v1.WorkstationConfig.PersistentDirectory +type WorkstationConfig_PersistentDirectory struct { + // A PersistentDirectory backed by a Compute Engine persistent disk. + GcePD *WorkstationConfig_PersistentDirectory_GceRegionalPersistentDisk `json:"gcePD,omitempty"` + + // Optional. Location of this directory in the running workstation. + MountPath *string `json:"mountPath,omitempty"` +} + +// +kcc:proto=google.cloud.workstations.v1.WorkstationConfig.PersistentDirectory.GceRegionalPersistentDisk +type WorkstationConfig_PersistentDirectory_GceRegionalPersistentDisk struct { + // Optional. The GB capacity of a persistent home directory for each + // workstation created with this configuration. Must be empty if + // [source_snapshot][google.cloud.workstations.v1.WorkstationConfig.PersistentDirectory.GceRegionalPersistentDisk.source_snapshot] + // is set. + // + // Valid values are `10`, `50`, `100`, `200`, `500`, or `1000`. + // Defaults to `200`. If less than `200` GB, the + // [disk_type][google.cloud.workstations.v1.WorkstationConfig.PersistentDirectory.GceRegionalPersistentDisk.disk_type] + // must be + // `"pd-balanced"` or `"pd-ssd"`. + SizeGB *int32 `json:"sizeGB,omitempty"` + + // Optional. Type of file system that the disk should be formatted with. + // The workstation image must support this file system type. Must be empty + // if + // [source_snapshot][google.cloud.workstations.v1.WorkstationConfig.PersistentDirectory.GceRegionalPersistentDisk.source_snapshot] + // is set. Defaults to `"ext4"`. + FSType *string `json:"fsType,omitempty"` + + // Optional. The [type of the persistent + // disk](https://cloud.google.com/compute/docs/disks#disk-types) for the + // home directory. Defaults to `"pd-standard"`. + DiskType *string `json:"diskType,omitempty"` + + // Optional. Name of the snapshot to use as the source for the disk. If + // set, + // [size_gb][google.cloud.workstations.v1.WorkstationConfig.PersistentDirectory.GceRegionalPersistentDisk.size_gb] + // and + // [fs_type][google.cloud.workstations.v1.WorkstationConfig.PersistentDirectory.GceRegionalPersistentDisk.fs_type] + // must be empty. + SourceSnapshot *string `json:"sourceSnapshot,omitempty"` + + // Optional. Whether the persistent disk should be deleted when the + // workstation is deleted. Valid values are `DELETE` and `RETAIN`. + // Defaults to `DELETE`. + ReclaimPolicy *string `json:"reclaimPolicy,omitempty"` +} + +// +kcc:proto=google.cloud.workstations.v1.WorkstationConfig.Container +type WorkstationConfig_Container struct { + // Optional. A Docker container image that defines a custom environment. + // + // Cloud Workstations provides a number of + // [preconfigured + // images](https://cloud.google.com/workstations/docs/preconfigured-base-images), + // but you can create your own + // [custom container + // images](https://cloud.google.com/workstations/docs/custom-container-images). + // If using a private image, the `host.gceInstance.serviceAccount` field + // must be specified in the workstation configuration and must have + // permission to pull the specified image. Otherwise, the image must be + // publicly accessible. + Image *string `json:"image,omitempty"` + + // Optional. If set, overrides the default ENTRYPOINT specified by the + // image. + Command []string `json:"command,omitempty"` + + // Optional. Arguments passed to the entrypoint. + Args []string `json:"args,omitempty"` + + // Optional. Environment variables passed to the container's entrypoint. + Env []WorkstationConfig_Container_EnvVar `json:"env,omitempty"` + + // Optional. If set, overrides the default DIR specified by the image. + WorkingDir *string `json:"workingDir,omitempty"` + + // Optional. If set, overrides the USER specified in the image with the + // given uid. + RunAsUser *int32 `json:"runAsUser,omitempty"` +} + +type WorkstationConfig_Container_EnvVar struct { + // Name is the name of the environment variable. + Name string `json:"name,omitempty"` + + // Value is the value of the environment variable. + Value string `json:"value,omitempty"` +} + +// +kcc:proto=google.cloud.workstations.v1.WorkstationConfig.CustomerEncryptionKey +type WorkstationConfig_CustomerEncryptionKey struct { + // Immutable. A reference to the Google Cloud KMS encryption key. For example, + // `"projects/PROJECT_ID/locations/REGION/keyRings/KEY_RING/cryptoKeys/KEY_NAME"`. + // The key must be in the same region as the workstation configuration. + KmsCryptoKeyRef *refs.KMSCryptoKeyRef `json:"kmsCryptoKeyRef,omitempty"` + + // Immutable. A reference to a service account to use with the specified + // KMS key. We recommend that you use a separate service account + // and follow KMS best practices. For more information, see + // [Separation of + // duties](https://cloud.google.com/kms/docs/separation-of-duties) and + // `gcloud kms keys add-iam-policy-binding` + // [`--member`](https://cloud.google.com/sdk/gcloud/reference/kms/keys/add-iam-policy-binding#--member). + ServiceAccountRef *refs.IAMServiceAccountRef `json:"serviceAccountRef,omitempty"` +} + +// +kcc:proto=google.cloud.workstations.v1.WorkstationConfig.ReadinessCheck +type WorkstationConfig_ReadinessCheck struct { + // Optional. Path to which the request should be sent. + Path *string `json:"path,omitempty"` + + // Optional. Port to which the request should be sent. + Port *int32 `json:"port,omitempty"` +} + +// WorkstationConfigSpec defines the desired state of WorkstationConfig +// +kcc:proto=google.cloud.workstations.v1.WorkstationConfig +type WorkstationConfigSpec struct { // Immutable. The Project that this resource belongs to. + // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="ResourceID field is immutable" + ProjectRef refs.ProjectRef `json:"projectRef"` + + // Parent is a reference to the parent WorkstationCluster for this WorkstationConfig. + Parent *refs.WorkstationClusterRef `json:"parentRef"` + + // +kubebuilder:validation:XValidation:rule="self == oldSelf",message="ResourceID field is immutable" + // Immutable. + // The WorkstationConfig name. If not given, the metadata.name will be used. + // + optional + ResourceID *string `json:"resourceID,omitempty"` + + // Optional. Human-readable name for this workstation configuration. + DisplayName *string `json:"displayName,omitempty"` + + // Optional. Client-specified annotations. + Annotations []WorkstationAnnotation `json:"annotations,omitempty"` + + // Optional. + // [Labels](https://cloud.google.com/workstations/docs/label-resources) that + // are applied to the workstation configuration and that are also propagated + // to the underlying Compute Engine resources. + Labels []WorkstationLabel `json:"labels,omitempty"` + + // Optional. Number of seconds to wait before automatically stopping a + // workstation after it last received user traffic. + // + // A value of `"0s"` indicates that Cloud Workstations VMs created with this + // configuration should never time out due to idleness. + // Provide + // [duration](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#duration) + // terminated by `s` for seconds—for example, `"7200s"` (2 hours). + // The default is `"1200s"` (20 minutes). + IdleTimeout *string `json:"idleTimeout,omitempty"` + + // Optional. Number of seconds that a workstation can run until it is + // automatically shut down. We recommend that workstations be shut down daily + // to reduce costs and so that security updates can be applied upon restart. + // The + // [idle_timeout][google.cloud.workstations.v1.WorkstationConfig.idle_timeout] + // and + // [running_timeout][google.cloud.workstations.v1.WorkstationConfig.running_timeout] + // fields are independent of each other. Note that the + // [running_timeout][google.cloud.workstations.v1.WorkstationConfig.running_timeout] + // field shuts down VMs after the specified time, regardless of whether or not + // the VMs are idle. + // + // Provide duration terminated by `s` for seconds—for example, `"54000s"` + // (15 hours). Defaults to `"43200s"` (12 hours). A value of `"0s"` indicates + // that workstations using this configuration should never time out. If + // [encryption_key][google.cloud.workstations.v1.WorkstationConfig.encryption_key] + // is set, it must be greater than `"0s"` and less than + // `"86400s"` (24 hours). + // + // Warning: A value of `"0s"` indicates that Cloud Workstations VMs created + // with this configuration have no maximum running time. This is strongly + // discouraged because you incur costs and will not pick up security updates. + RunningTimeout *string `json:"runningTimeout,omitempty"` + + // Optional. Runtime host for the workstation. + Host *WorkstationConfig_Host `json:"host,omitempty"` + + // Optional. Directories to persist across workstation sessions. + PersistentDirectories []WorkstationConfig_PersistentDirectory `json:"persistentDirectories,omitempty"` + + // Optional. Container that runs upon startup for each workstation using this + // workstation configuration. + Container *WorkstationConfig_Container `json:"container,omitempty"` + + // Immutable. Encrypts resources of this workstation configuration using a + // customer-managed encryption key (CMEK). + // + // If specified, the boot disk of the Compute Engine instance and the + // persistent disk are encrypted using this encryption key. If + // this field is not set, the disks are encrypted using a generated + // key. Customer-managed encryption keys do not protect disk metadata. + // + // If the customer-managed encryption key is rotated, when the workstation + // instance is stopped, the system attempts to recreate the + // persistent disk with the new version of the key. Be sure to keep + // older versions of the key until the persistent disk is recreated. + // Otherwise, data on the persistent disk might be lost. + // + // If the encryption key is revoked, the workstation session automatically + // stops within 7 hours. + // + // Immutable after the workstation configuration is created. + EncryptionKey *WorkstationConfig_CustomerEncryptionKey `json:"encryptionKey,omitempty"` + + // Optional. Readiness checks to perform when starting a workstation using + // this workstation configuration. Mark a workstation as running only after + // all specified readiness checks return 200 status codes. + ReadinessChecks []WorkstationConfig_ReadinessCheck `json:"readinessChecks,omitempty"` + + // Optional. Immutable. Specifies the zones used to replicate the VM and disk + // resources within the region. If set, exactly two zones within the + // workstation cluster's region must be specified—for example, + // `['us-central1-a', 'us-central1-f']`. If this field is empty, two default + // zones within the region are used. + // + // Immutable after the workstation configuration is created. + ReplicaZones []string `json:"replicaZones,omitempty"` +} + +// WorkstationConfigStatus defines the config connector machine state of WorkstationConfig +type WorkstationConfigStatus struct { + /* Conditions represent the latest available observations of the + object's current state. */ + Conditions []v1alpha1.Condition `json:"conditions,omitempty"` + + // ObservedGeneration is the generation of the resource that was most recently observed by the Config Connector controller. If this is equal to metadata.generation, then that means that the current reported status reflects the most recent desired state of the resource. + ObservedGeneration *int64 `json:"observedGeneration,omitempty"` + + // A unique specifier for the WorkstationConfig resource in GCP. + ExternalRef *string `json:"externalRef,omitempty"` + + // ObservedState is the state of the resource as most recently observed in GCP. + ObservedState *WorkstationConfigObservedState `json:"observedState,omitempty"` +} + +// WorkstationConfigSpec defines the desired state of WorkstationConfig +// +kcc:proto=google.cloud.workstations.v1.WorkstationConfig +type WorkstationConfigObservedState struct { + // Output only. A system-assigned unique identifier for this workstation + // configuration. + UID *string `json:"uid,omitempty"` + + // Output only. Indicates whether this workstation configuration is currently + // being updated to match its intended state. + Reconciling *bool `json:"reconciling,omitempty"` + + // Output only. Time when this workstation configuration was created. + CreateTime *string `json:"createTime,omitempty"` + + // Output only. Time when this workstation configuration was most recently + // updated. + UpdateTime *string `json:"updateTime,omitempty"` + + // Output only. Time when this workstation configuration was soft-deleted. + DeleteTime *string `json:"deleteTime,omitempty"` + + // Optional. Checksum computed by the server. May be sent on update and delete + // requests to make sure that the client has an up-to-date value before + // proceeding. + Etag *string `json:"etag,omitempty"` + + // Output only. Whether this resource is degraded, in which case it may + // require user action to restore full functionality. See also the + // [conditions][google.cloud.workstations.v1.WorkstationConfig.conditions] + // field. + Degraded *bool `json:"degraded,omitempty"` + + // Output only. Status conditions describing the current resource state. + Conditions []WorkstationServiceGCPCondition `json:"conditions,omitempty"` + + // Output only. Number of instances currently available in the pool for + // faster workstation startup. + PooledInstances *int32 `json:"pooledInstances,omitempty"` +} + +// +genclient +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +kubebuilder:resource:categories=gcp +// +kubebuilder:subresource:status +// +kubebuilder:metadata:labels="cnrm.cloud.google.com/managed-by-kcc=true";"cnrm.cloud.google.com/system=true" +// +kubebuilder:printcolumn:name="Age",JSONPath=".metadata.creationTimestamp",type="date" +// +kubebuilder:printcolumn:name="Ready",JSONPath=".status.conditions[?(@.type=='Ready')].status",type="string",description="When 'True', the most recent reconcile of the resource succeeded" +// +kubebuilder:printcolumn:name="Status",JSONPath=".status.conditions[?(@.type=='Ready')].reason",type="string",description="The reason for the value in 'Ready'" +// +kubebuilder:printcolumn:name="Status Age",JSONPath=".status.conditions[?(@.type=='Ready')].lastTransitionTime",type="date",description="The last transition time for the value in 'Status'" + +// WorkstationConfig is the Schema for the WorkstationConfig API +// +k8s:openapi-gen=true +type WorkstationConfig struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + + Spec WorkstationConfigSpec `json:"spec,omitempty"` + Status WorkstationConfigStatus `json:"status,omitempty"` +} + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// WorkstationConfigList contains a list of WorkstationConfig +type WorkstationConfigList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []WorkstationConfig `json:"items"` +} + +func init() { + SchemeBuilder.Register(&WorkstationConfig{}, &WorkstationConfigList{}) +} diff --git a/apis/workstations/v1alpha1/zz_generated.deepcopy.go b/apis/workstations/v1alpha1/zz_generated.deepcopy.go index e10d5482d0..728e57a798 100644 --- a/apis/workstations/v1alpha1/zz_generated.deepcopy.go +++ b/apis/workstations/v1alpha1/zz_generated.deepcopy.go @@ -10,6 +10,21 @@ import ( runtime "k8s.io/apimachinery/pkg/runtime" ) +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *WorkstationAnnotation) DeepCopyInto(out *WorkstationAnnotation) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkstationAnnotation. +func (in *WorkstationAnnotation) DeepCopy() *WorkstationAnnotation { + if in == nil { + return nil + } + out := new(WorkstationAnnotation) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *WorkstationCluster) DeepCopyInto(out *WorkstationCluster) { *out = *in @@ -37,61 +52,6 @@ func (in *WorkstationCluster) DeepCopyObject() runtime.Object { return nil } -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *WorkstationClusterAnnotation) DeepCopyInto(out *WorkstationClusterAnnotation) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkstationClusterAnnotation. -func (in *WorkstationClusterAnnotation) DeepCopy() *WorkstationClusterAnnotation { - if in == nil { - return nil - } - out := new(WorkstationClusterAnnotation) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *WorkstationClusterGCPCondition) DeepCopyInto(out *WorkstationClusterGCPCondition) { - *out = *in - if in.Code != nil { - in, out := &in.Code, &out.Code - *out = new(int) - **out = **in - } - if in.Message != nil { - in, out := &in.Message, &out.Message - *out = new(string) - **out = **in - } -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkstationClusterGCPCondition. -func (in *WorkstationClusterGCPCondition) DeepCopy() *WorkstationClusterGCPCondition { - if in == nil { - return nil - } - out := new(WorkstationClusterGCPCondition) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *WorkstationClusterLabel) DeepCopyInto(out *WorkstationClusterLabel) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkstationClusterLabel. -func (in *WorkstationClusterLabel) DeepCopy() *WorkstationClusterLabel { - if in == nil { - return nil - } - out := new(WorkstationClusterLabel) - in.DeepCopyInto(out) - return out -} - // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *WorkstationClusterList) DeepCopyInto(out *WorkstationClusterList) { *out = *in @@ -179,7 +139,7 @@ func (in *WorkstationClusterObservedState) DeepCopyInto(out *WorkstationClusterO } if in.GCPConditions != nil { in, out := &in.GCPConditions, &out.GCPConditions - *out = make([]WorkstationClusterGCPCondition, len(*in)) + *out = make([]WorkstationServiceGCPCondition, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } @@ -212,12 +172,12 @@ func (in *WorkstationClusterSpec) DeepCopyInto(out *WorkstationClusterSpec) { } if in.Annotations != nil { in, out := &in.Annotations, &out.Annotations - *out = make([]WorkstationClusterAnnotation, len(*in)) + *out = make([]WorkstationAnnotation, len(*in)) copy(*out, *in) } if in.Labels != nil { in, out := &in.Labels, &out.Labels - *out = make([]WorkstationClusterLabel, len(*in)) + *out = make([]WorkstationLabel, len(*in)) copy(*out, *in) } if in.NetworkRef != nil { @@ -306,3 +266,594 @@ func (in *WorkstationCluster_PrivateClusterConfig) DeepCopy() *WorkstationCluste in.DeepCopyInto(out) return out } + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *WorkstationConfig) DeepCopyInto(out *WorkstationConfig) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkstationConfig. +func (in *WorkstationConfig) DeepCopy() *WorkstationConfig { + if in == nil { + return nil + } + out := new(WorkstationConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *WorkstationConfig) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *WorkstationConfigList) DeepCopyInto(out *WorkstationConfigList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]WorkstationConfig, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkstationConfigList. +func (in *WorkstationConfigList) DeepCopy() *WorkstationConfigList { + if in == nil { + return nil + } + out := new(WorkstationConfigList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *WorkstationConfigList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *WorkstationConfigObservedState) DeepCopyInto(out *WorkstationConfigObservedState) { + *out = *in + if in.UID != nil { + in, out := &in.UID, &out.UID + *out = new(string) + **out = **in + } + if in.Reconciling != nil { + in, out := &in.Reconciling, &out.Reconciling + *out = new(bool) + **out = **in + } + if in.CreateTime != nil { + in, out := &in.CreateTime, &out.CreateTime + *out = new(string) + **out = **in + } + if in.UpdateTime != nil { + in, out := &in.UpdateTime, &out.UpdateTime + *out = new(string) + **out = **in + } + if in.DeleteTime != nil { + in, out := &in.DeleteTime, &out.DeleteTime + *out = new(string) + **out = **in + } + if in.Etag != nil { + in, out := &in.Etag, &out.Etag + *out = new(string) + **out = **in + } + if in.Degraded != nil { + in, out := &in.Degraded, &out.Degraded + *out = new(bool) + **out = **in + } + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]WorkstationServiceGCPCondition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.PooledInstances != nil { + in, out := &in.PooledInstances, &out.PooledInstances + *out = new(int32) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkstationConfigObservedState. +func (in *WorkstationConfigObservedState) DeepCopy() *WorkstationConfigObservedState { + if in == nil { + return nil + } + out := new(WorkstationConfigObservedState) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *WorkstationConfigSpec) DeepCopyInto(out *WorkstationConfigSpec) { + *out = *in + out.ProjectRef = in.ProjectRef + if in.Parent != nil { + in, out := &in.Parent, &out.Parent + *out = new(v1beta1.WorkstationClusterRef) + **out = **in + } + if in.ResourceID != nil { + in, out := &in.ResourceID, &out.ResourceID + *out = new(string) + **out = **in + } + if in.DisplayName != nil { + in, out := &in.DisplayName, &out.DisplayName + *out = new(string) + **out = **in + } + if in.Annotations != nil { + in, out := &in.Annotations, &out.Annotations + *out = make([]WorkstationAnnotation, len(*in)) + copy(*out, *in) + } + if in.Labels != nil { + in, out := &in.Labels, &out.Labels + *out = make([]WorkstationLabel, len(*in)) + copy(*out, *in) + } + if in.IdleTimeout != nil { + in, out := &in.IdleTimeout, &out.IdleTimeout + *out = new(string) + **out = **in + } + if in.RunningTimeout != nil { + in, out := &in.RunningTimeout, &out.RunningTimeout + *out = new(string) + **out = **in + } + if in.Host != nil { + in, out := &in.Host, &out.Host + *out = new(WorkstationConfig_Host) + (*in).DeepCopyInto(*out) + } + if in.PersistentDirectories != nil { + in, out := &in.PersistentDirectories, &out.PersistentDirectories + *out = make([]WorkstationConfig_PersistentDirectory, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.Container != nil { + in, out := &in.Container, &out.Container + *out = new(WorkstationConfig_Container) + (*in).DeepCopyInto(*out) + } + if in.EncryptionKey != nil { + in, out := &in.EncryptionKey, &out.EncryptionKey + *out = new(WorkstationConfig_CustomerEncryptionKey) + (*in).DeepCopyInto(*out) + } + if in.ReadinessChecks != nil { + in, out := &in.ReadinessChecks, &out.ReadinessChecks + *out = make([]WorkstationConfig_ReadinessCheck, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + if in.ReplicaZones != nil { + in, out := &in.ReplicaZones, &out.ReplicaZones + *out = make([]string, len(*in)) + copy(*out, *in) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkstationConfigSpec. +func (in *WorkstationConfigSpec) DeepCopy() *WorkstationConfigSpec { + if in == nil { + return nil + } + out := new(WorkstationConfigSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *WorkstationConfigStatus) DeepCopyInto(out *WorkstationConfigStatus) { + *out = *in + if in.Conditions != nil { + in, out := &in.Conditions, &out.Conditions + *out = make([]k8sv1alpha1.Condition, len(*in)) + copy(*out, *in) + } + if in.ObservedGeneration != nil { + in, out := &in.ObservedGeneration, &out.ObservedGeneration + *out = new(int64) + **out = **in + } + if in.ExternalRef != nil { + in, out := &in.ExternalRef, &out.ExternalRef + *out = new(string) + **out = **in + } + if in.ObservedState != nil { + in, out := &in.ObservedState, &out.ObservedState + *out = new(WorkstationConfigObservedState) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkstationConfigStatus. +func (in *WorkstationConfigStatus) DeepCopy() *WorkstationConfigStatus { + if in == nil { + return nil + } + out := new(WorkstationConfigStatus) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *WorkstationConfig_Container) DeepCopyInto(out *WorkstationConfig_Container) { + *out = *in + if in.Image != nil { + in, out := &in.Image, &out.Image + *out = new(string) + **out = **in + } + if in.Command != nil { + in, out := &in.Command, &out.Command + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.Args != nil { + in, out := &in.Args, &out.Args + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.Env != nil { + in, out := &in.Env, &out.Env + *out = make([]WorkstationConfig_Container_EnvVar, len(*in)) + copy(*out, *in) + } + if in.WorkingDir != nil { + in, out := &in.WorkingDir, &out.WorkingDir + *out = new(string) + **out = **in + } + if in.RunAsUser != nil { + in, out := &in.RunAsUser, &out.RunAsUser + *out = new(int32) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkstationConfig_Container. +func (in *WorkstationConfig_Container) DeepCopy() *WorkstationConfig_Container { + if in == nil { + return nil + } + out := new(WorkstationConfig_Container) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *WorkstationConfig_Container_EnvVar) DeepCopyInto(out *WorkstationConfig_Container_EnvVar) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkstationConfig_Container_EnvVar. +func (in *WorkstationConfig_Container_EnvVar) DeepCopy() *WorkstationConfig_Container_EnvVar { + if in == nil { + return nil + } + out := new(WorkstationConfig_Container_EnvVar) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *WorkstationConfig_CustomerEncryptionKey) DeepCopyInto(out *WorkstationConfig_CustomerEncryptionKey) { + *out = *in + if in.KmsCryptoKeyRef != nil { + in, out := &in.KmsCryptoKeyRef, &out.KmsCryptoKeyRef + *out = new(v1beta1.KMSCryptoKeyRef) + **out = **in + } + if in.ServiceAccountRef != nil { + in, out := &in.ServiceAccountRef, &out.ServiceAccountRef + *out = new(v1beta1.IAMServiceAccountRef) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkstationConfig_CustomerEncryptionKey. +func (in *WorkstationConfig_CustomerEncryptionKey) DeepCopy() *WorkstationConfig_CustomerEncryptionKey { + if in == nil { + return nil + } + out := new(WorkstationConfig_CustomerEncryptionKey) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *WorkstationConfig_Host) DeepCopyInto(out *WorkstationConfig_Host) { + *out = *in + if in.GceInstance != nil { + in, out := &in.GceInstance, &out.GceInstance + *out = new(WorkstationConfig_Host_GceInstance) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkstationConfig_Host. +func (in *WorkstationConfig_Host) DeepCopy() *WorkstationConfig_Host { + if in == nil { + return nil + } + out := new(WorkstationConfig_Host) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *WorkstationConfig_Host_GceInstance) DeepCopyInto(out *WorkstationConfig_Host_GceInstance) { + *out = *in + if in.MachineType != nil { + in, out := &in.MachineType, &out.MachineType + *out = new(string) + **out = **in + } + if in.ServiceAccountRef != nil { + in, out := &in.ServiceAccountRef, &out.ServiceAccountRef + *out = new(v1beta1.IAMServiceAccountRef) + **out = **in + } + if in.ServiceAccountScopes != nil { + in, out := &in.ServiceAccountScopes, &out.ServiceAccountScopes + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.Tags != nil { + in, out := &in.Tags, &out.Tags + *out = make([]string, len(*in)) + copy(*out, *in) + } + if in.PoolSize != nil { + in, out := &in.PoolSize, &out.PoolSize + *out = new(int32) + **out = **in + } + if in.DisablePublicIPAddresses != nil { + in, out := &in.DisablePublicIPAddresses, &out.DisablePublicIPAddresses + *out = new(bool) + **out = **in + } + if in.EnableNestedVirtualization != nil { + in, out := &in.EnableNestedVirtualization, &out.EnableNestedVirtualization + *out = new(bool) + **out = **in + } + if in.ShieldedInstanceConfig != nil { + in, out := &in.ShieldedInstanceConfig, &out.ShieldedInstanceConfig + *out = new(WorkstationConfig_Host_GceInstance_GceShieldedInstanceConfig) + (*in).DeepCopyInto(*out) + } + if in.ConfidentialInstanceConfig != nil { + in, out := &in.ConfidentialInstanceConfig, &out.ConfidentialInstanceConfig + *out = new(WorkstationConfig_Host_GceInstance_GceConfidentialInstanceConfig) + (*in).DeepCopyInto(*out) + } + if in.BootDiskSizeGB != nil { + in, out := &in.BootDiskSizeGB, &out.BootDiskSizeGB + *out = new(int32) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkstationConfig_Host_GceInstance. +func (in *WorkstationConfig_Host_GceInstance) DeepCopy() *WorkstationConfig_Host_GceInstance { + if in == nil { + return nil + } + out := new(WorkstationConfig_Host_GceInstance) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *WorkstationConfig_Host_GceInstance_GceConfidentialInstanceConfig) DeepCopyInto(out *WorkstationConfig_Host_GceInstance_GceConfidentialInstanceConfig) { + *out = *in + if in.EnableConfidentialCompute != nil { + in, out := &in.EnableConfidentialCompute, &out.EnableConfidentialCompute + *out = new(bool) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkstationConfig_Host_GceInstance_GceConfidentialInstanceConfig. +func (in *WorkstationConfig_Host_GceInstance_GceConfidentialInstanceConfig) DeepCopy() *WorkstationConfig_Host_GceInstance_GceConfidentialInstanceConfig { + if in == nil { + return nil + } + out := new(WorkstationConfig_Host_GceInstance_GceConfidentialInstanceConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *WorkstationConfig_Host_GceInstance_GceShieldedInstanceConfig) DeepCopyInto(out *WorkstationConfig_Host_GceInstance_GceShieldedInstanceConfig) { + *out = *in + if in.EnableSecureBoot != nil { + in, out := &in.EnableSecureBoot, &out.EnableSecureBoot + *out = new(bool) + **out = **in + } + if in.EnableVTPM != nil { + in, out := &in.EnableVTPM, &out.EnableVTPM + *out = new(bool) + **out = **in + } + if in.EnableIntegrityMonitoring != nil { + in, out := &in.EnableIntegrityMonitoring, &out.EnableIntegrityMonitoring + *out = new(bool) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkstationConfig_Host_GceInstance_GceShieldedInstanceConfig. +func (in *WorkstationConfig_Host_GceInstance_GceShieldedInstanceConfig) DeepCopy() *WorkstationConfig_Host_GceInstance_GceShieldedInstanceConfig { + if in == nil { + return nil + } + out := new(WorkstationConfig_Host_GceInstance_GceShieldedInstanceConfig) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *WorkstationConfig_PersistentDirectory) DeepCopyInto(out *WorkstationConfig_PersistentDirectory) { + *out = *in + if in.GcePD != nil { + in, out := &in.GcePD, &out.GcePD + *out = new(WorkstationConfig_PersistentDirectory_GceRegionalPersistentDisk) + (*in).DeepCopyInto(*out) + } + if in.MountPath != nil { + in, out := &in.MountPath, &out.MountPath + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkstationConfig_PersistentDirectory. +func (in *WorkstationConfig_PersistentDirectory) DeepCopy() *WorkstationConfig_PersistentDirectory { + if in == nil { + return nil + } + out := new(WorkstationConfig_PersistentDirectory) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *WorkstationConfig_PersistentDirectory_GceRegionalPersistentDisk) DeepCopyInto(out *WorkstationConfig_PersistentDirectory_GceRegionalPersistentDisk) { + *out = *in + if in.SizeGB != nil { + in, out := &in.SizeGB, &out.SizeGB + *out = new(int32) + **out = **in + } + if in.FSType != nil { + in, out := &in.FSType, &out.FSType + *out = new(string) + **out = **in + } + if in.DiskType != nil { + in, out := &in.DiskType, &out.DiskType + *out = new(string) + **out = **in + } + if in.SourceSnapshot != nil { + in, out := &in.SourceSnapshot, &out.SourceSnapshot + *out = new(string) + **out = **in + } + if in.ReclaimPolicy != nil { + in, out := &in.ReclaimPolicy, &out.ReclaimPolicy + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkstationConfig_PersistentDirectory_GceRegionalPersistentDisk. +func (in *WorkstationConfig_PersistentDirectory_GceRegionalPersistentDisk) DeepCopy() *WorkstationConfig_PersistentDirectory_GceRegionalPersistentDisk { + if in == nil { + return nil + } + out := new(WorkstationConfig_PersistentDirectory_GceRegionalPersistentDisk) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *WorkstationConfig_ReadinessCheck) DeepCopyInto(out *WorkstationConfig_ReadinessCheck) { + *out = *in + if in.Path != nil { + in, out := &in.Path, &out.Path + *out = new(string) + **out = **in + } + if in.Port != nil { + in, out := &in.Port, &out.Port + *out = new(int32) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkstationConfig_ReadinessCheck. +func (in *WorkstationConfig_ReadinessCheck) DeepCopy() *WorkstationConfig_ReadinessCheck { + if in == nil { + return nil + } + out := new(WorkstationConfig_ReadinessCheck) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *WorkstationLabel) DeepCopyInto(out *WorkstationLabel) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkstationLabel. +func (in *WorkstationLabel) DeepCopy() *WorkstationLabel { + if in == nil { + return nil + } + out := new(WorkstationLabel) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *WorkstationServiceGCPCondition) DeepCopyInto(out *WorkstationServiceGCPCondition) { + *out = *in + if in.Code != nil { + in, out := &in.Code, &out.Code + *out = new(int) + **out = **in + } + if in.Message != nil { + in, out := &in.Message, &out.Message + *out = new(string) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkstationServiceGCPCondition. +func (in *WorkstationServiceGCPCondition) DeepCopy() *WorkstationServiceGCPCondition { + if in == nil { + return nil + } + out := new(WorkstationServiceGCPCondition) + in.DeepCopyInto(out) + return out +} diff --git a/config/crds/resources/apiextensions.k8s.io_v1_customresourcedefinition_workstationclusters.workstations.cnrm.cloud.google.com.yaml b/config/crds/resources/apiextensions.k8s.io_v1_customresourcedefinition_workstationclusters.workstations.cnrm.cloud.google.com.yaml index f27c4145c8..8447ccf4c9 100644 --- a/config/crds/resources/apiextensions.k8s.io_v1_customresourcedefinition_workstationclusters.workstations.cnrm.cloud.google.com.yaml +++ b/config/crds/resources/apiextensions.k8s.io_v1_customresourcedefinition_workstationclusters.workstations.cnrm.cloud.google.com.yaml @@ -78,10 +78,10 @@ spec: items: properties: key: - description: Key for the annotation. + description: Key for the label. type: string value: - description: Value for the annotation. + description: Value for the label. type: string type: object type: array diff --git a/config/crds/resources/apiextensions.k8s.io_v1_customresourcedefinition_workstationconfigs.workstations.cnrm.cloud.google.com.yaml b/config/crds/resources/apiextensions.k8s.io_v1_customresourcedefinition_workstationconfigs.workstations.cnrm.cloud.google.com.yaml new file mode 100644 index 0000000000..2662d60080 --- /dev/null +++ b/config/crds/resources/apiextensions.k8s.io_v1_customresourcedefinition_workstationconfigs.workstations.cnrm.cloud.google.com.yaml @@ -0,0 +1,681 @@ +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + cnrm.cloud.google.com/version: 0.0.0-dev + creationTimestamp: null + labels: + cnrm.cloud.google.com/managed-by-kcc: "true" + cnrm.cloud.google.com/system: "true" + name: workstationconfigs.workstations.cnrm.cloud.google.com +spec: + group: workstations.cnrm.cloud.google.com + names: + categories: + - gcp + kind: WorkstationConfig + listKind: WorkstationConfigList + plural: workstationconfigs + singular: workstationconfig + preserveUnknownFields: false + scope: Namespaced + versions: + - additionalPrinterColumns: + - jsonPath: .metadata.creationTimestamp + name: Age + type: date + - description: When 'True', the most recent reconcile of the resource succeeded + jsonPath: .status.conditions[?(@.type=='Ready')].status + name: Ready + type: string + - description: The reason for the value in 'Ready' + jsonPath: .status.conditions[?(@.type=='Ready')].reason + name: Status + type: string + - description: The last transition time for the value in 'Status' + jsonPath: .status.conditions[?(@.type=='Ready')].lastTransitionTime + name: Status Age + type: date + name: v1alpha1 + schema: + openAPIV3Schema: + description: WorkstationConfig is the Schema for the WorkstationConfig API + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + description: WorkstationConfigSpec defines the desired state of WorkstationConfig + properties: + annotations: + description: Optional. Client-specified annotations. + items: + properties: + key: + description: Key for the annotation. + type: string + value: + description: Value for the annotation. + type: string + type: object + type: array + container: + description: Optional. Container that runs upon startup for each workstation + using this workstation configuration. + properties: + args: + description: Optional. Arguments passed to the entrypoint. + items: + type: string + type: array + command: + description: Optional. If set, overrides the default ENTRYPOINT + specified by the image. + items: + type: string + type: array + env: + description: Optional. Environment variables passed to the container's + entrypoint. + items: + properties: + name: + description: Name is the name of the environment variable. + type: string + value: + description: Value is the value of the environment variable. + type: string + type: object + type: array + image: + description: |- + Optional. A Docker container image that defines a custom environment. + + Cloud Workstations provides a number of + [preconfigured + images](https://cloud.google.com/workstations/docs/preconfigured-base-images), + but you can create your own + [custom container + images](https://cloud.google.com/workstations/docs/custom-container-images). + If using a private image, the `host.gceInstance.serviceAccount` field + must be specified in the workstation configuration and must have + permission to pull the specified image. Otherwise, the image must be + publicly accessible. + type: string + runAsUser: + description: Optional. If set, overrides the USER specified in + the image with the given uid. + format: int32 + type: integer + workingDir: + description: Optional. If set, overrides the default DIR specified + by the image. + type: string + type: object + displayName: + description: Optional. Human-readable name for this workstation configuration. + type: string + encryptionKey: + description: |- + Immutable. Encrypts resources of this workstation configuration using a + customer-managed encryption key (CMEK). + + If specified, the boot disk of the Compute Engine instance and the + persistent disk are encrypted using this encryption key. If + this field is not set, the disks are encrypted using a generated + key. Customer-managed encryption keys do not protect disk metadata. + + If the customer-managed encryption key is rotated, when the workstation + instance is stopped, the system attempts to recreate the + persistent disk with the new version of the key. Be sure to keep + older versions of the key until the persistent disk is recreated. + Otherwise, data on the persistent disk might be lost. + + If the encryption key is revoked, the workstation session automatically + stops within 7 hours. + + Immutable after the workstation configuration is created. + properties: + kmsCryptoKeyRef: + description: Immutable. A reference to the Google Cloud KMS encryption + key. For example, `"projects/PROJECT_ID/locations/REGION/keyRings/KEY_RING/cryptoKeys/KEY_NAME"`. + The key must be in the same region as the workstation configuration. + oneOf: + - not: + required: + - external + required: + - name + - not: + anyOf: + - required: + - name + - required: + - namespace + required: + - external + properties: + external: + description: A reference to an externally managed KMSCryptoKey. + Should be in the format `projects/[kms_project_id]/locations/[region]/keyRings/[key_ring_id]/cryptoKeys/[key]`. + type: string + name: + description: The `name` of a `KMSCryptoKey` resource. + type: string + namespace: + description: The `namespace` of a `KMSCryptoKey` resource. + type: string + type: object + serviceAccountRef: + description: Immutable. A reference to a service account to use + with the specified KMS key. We recommend that you use a separate + service account and follow KMS best practices. For more information, + see [Separation of duties](https://cloud.google.com/kms/docs/separation-of-duties) + and `gcloud kms keys add-iam-policy-binding` [`--member`](https://cloud.google.com/sdk/gcloud/reference/kms/keys/add-iam-policy-binding#--member). + oneOf: + - not: + required: + - external + required: + - name + - not: + anyOf: + - required: + - name + - required: + - namespace + required: + - external + properties: + external: + description: The `email` field of an `IAMServiceAccount` resource. + type: string + name: + description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names' + type: string + namespace: + description: 'Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/' + type: string + type: object + type: object + host: + description: Optional. Runtime host for the workstation. + properties: + gceInstance: + description: Specifies a Compute Engine instance as the host. + properties: + bootDiskSizeGB: + description: Optional. The size of the boot disk for the VM + in gigabytes (GB). The minimum boot disk size is `30` GB. + Defaults to `50` GB. + format: int32 + type: integer + confidentialInstanceConfig: + description: Optional. A set of Compute Engine Confidential + VM instance options. + properties: + enableConfidentialCompute: + description: Optional. Whether the instance has confidential + compute enabled. + type: boolean + type: object + disablePublicIPAddresses: + description: Optional. When set to true, disables public IP + addresses for VMs. If you disable public IP addresses, you + must set up Private Google Access or Cloud NAT on your network. + If you use Private Google Access and you use `private.googleapis.com` + or `restricted.googleapis.com` for Container Registry and + Artifact Registry, make sure that you set up DNS records + for domains `*.gcr.io` and `*.pkg.dev`. Defaults to false + (VMs have public IP addresses). + type: boolean + enableNestedVirtualization: + description: |- + Optional. Whether to enable nested virtualization on Cloud Workstations + VMs created under this workstation configuration. + + Nested virtualization lets you run virtual machine (VM) instances + inside your workstation. Before enabling nested virtualization, + consider the following important considerations. Cloud Workstations + instances are subject to the [same restrictions as Compute Engine + instances](https://cloud.google.com/compute/docs/instances/nested-virtualization/overview#restrictions): + + * **Organization policy**: projects, folders, or + organizations may be restricted from creating nested VMs if the + **Disable VM nested virtualization** constraint is enforced in + the organization policy. For more information, see the + Compute Engine section, + [Checking whether nested virtualization is + allowed](https://cloud.google.com/compute/docs/instances/nested-virtualization/managing-constraint#checking_whether_nested_virtualization_is_allowed). + * **Performance**: nested VMs might experience a 10% or greater + decrease in performance for workloads that are CPU-bound and + possibly greater than a 10% decrease for workloads that are + input/output bound. + * **Machine Type**: nested virtualization can only be enabled on + workstation configurations that specify a + [machine_type][google.cloud.workstations.v1.WorkstationConfig.Host.GceInstance.machine_type] + in the N1 or N2 machine series. + * **GPUs**: nested virtualization may not be enabled on workstation + configurations with accelerators. + * **Operating System**: Because + [Container-Optimized + OS](https://cloud.google.com/compute/docs/images/os-details#container-optimized_os_cos) + does not support nested virtualization, when nested virtualization is + enabled, the underlying Compute Engine VM instances boot from an + [Ubuntu + LTS](https://cloud.google.com/compute/docs/images/os-details#ubuntu_lts) + image. + type: boolean + machineType: + description: Optional. The type of machine to use for VM instances—for + example, `"e2-standard-4"`. For more information about machine + types that Cloud Workstations supports, see the list of + [available machine types](https://cloud.google.com/workstations/docs/available-machine-types). + type: string + poolSize: + description: Optional. The number of VMs that the system should + keep idle so that new workstations can be started quickly + for new users. Defaults to `0` in the API. + format: int32 + type: integer + serviceAccountRef: + description: |- + Optional. A reference to the service account for Cloud + Workstations VMs created with this configuration. When specified, be + sure that the service account has `logginglogEntries.create` permission + on the project so it can write logs out to Cloud Logging. If using a + custom container image, the service account must have permissions to + pull the specified image. + + If you as the administrator want to be able to `ssh` into the + underlying VM, you need to set this value to a service account + for which you have the `iam.serviceAccounts.actAs` permission. + Conversely, if you don't want anyone to be able to `ssh` into the + underlying VM, use a service account where no one has that + permission. + + If not set, VMs run with a service account provided by the + Cloud Workstations service, and the image must be publicly + accessible. + oneOf: + - not: + required: + - external + required: + - name + - not: + anyOf: + - required: + - name + - required: + - namespace + required: + - external + properties: + external: + description: The `email` field of an `IAMServiceAccount` + resource. + type: string + name: + description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names' + type: string + namespace: + description: 'Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/' + type: string + type: object + serviceAccountScopes: + description: Optional. Scopes to grant to the [service_account][google.cloud.workstations.v1.WorkstationConfig.Host.GceInstance.service_account]. + Various scopes are automatically added based on feature + usage. When specified, users of workstations under this + configuration must have `iam.serviceAccounts.actAs` on the + service account. + items: + type: string + type: array + shieldedInstanceConfig: + description: Optional. A set of Compute Engine Shielded instance + options. + properties: + enableIntegrityMonitoring: + description: Optional. Whether the instance has integrity + monitoring enabled. + type: boolean + enableSecureBoot: + description: Optional. Whether the instance has Secure + Boot enabled. + type: boolean + enableVTPM: + description: Optional. Whether the instance has the vTPM + enabled. + type: boolean + type: object + tags: + description: Optional. Network tags to add to the Compute + Engine VMs backing the workstations. This option applies + [network tags](https://cloud.google.com/vpc/docs/add-remove-network-tags) + to VMs created with this configuration. These network tags + enable the creation of [firewall rules](https://cloud.google.com/workstations/docs/configure-firewall-rules). + items: + type: string + type: array + type: object + type: object + idleTimeout: + description: |- + Optional. Number of seconds to wait before automatically stopping a + workstation after it last received user traffic. + + A value of `"0s"` indicates that Cloud Workstations VMs created with this + configuration should never time out due to idleness. + Provide + [duration](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#duration) + terminated by `s` for seconds—for example, `"7200s"` (2 hours). + The default is `"1200s"` (20 minutes). + type: string + labels: + description: Optional. [Labels](https://cloud.google.com/workstations/docs/label-resources) + that are applied to the workstation configuration and that are also + propagated to the underlying Compute Engine resources. + items: + properties: + key: + description: Key for the label. + type: string + value: + description: Value for the label. + type: string + type: object + type: array + parentRef: + description: Parent is a reference to the parent WorkstationCluster + for this WorkstationConfig. + oneOf: + - not: + required: + - external + required: + - name + - not: + anyOf: + - required: + - name + - required: + - namespace + required: + - external + properties: + external: + description: The WorkstationCluster selfLink, when not managed + by Config Connector. + type: string + name: + description: The `name` field of a `WorkstationCluster` resource. + type: string + namespace: + description: The `namespace` field of a `WorkstationCluster` resource. + type: string + type: object + persistentDirectories: + description: Optional. Directories to persist across workstation sessions. + items: + properties: + gcePD: + description: A PersistentDirectory backed by a Compute Engine + persistent disk. + properties: + diskType: + description: Optional. The [type of the persistent disk](https://cloud.google.com/compute/docs/disks#disk-types) + for the home directory. Defaults to `"pd-standard"`. + type: string + fsType: + description: Optional. Type of file system that the disk + should be formatted with. The workstation image must support + this file system type. Must be empty if [source_snapshot][google.cloud.workstations.v1.WorkstationConfig.PersistentDirectory.GceRegionalPersistentDisk.source_snapshot] + is set. Defaults to `"ext4"`. + type: string + reclaimPolicy: + description: Optional. Whether the persistent disk should + be deleted when the workstation is deleted. Valid values + are `DELETE` and `RETAIN`. Defaults to `DELETE`. + type: string + sizeGB: + description: |- + Optional. The GB capacity of a persistent home directory for each + workstation created with this configuration. Must be empty if + [source_snapshot][google.cloud.workstations.v1.WorkstationConfig.PersistentDirectory.GceRegionalPersistentDisk.source_snapshot] + is set. + + Valid values are `10`, `50`, `100`, `200`, `500`, or `1000`. + Defaults to `200`. If less than `200` GB, the + [disk_type][google.cloud.workstations.v1.WorkstationConfig.PersistentDirectory.GceRegionalPersistentDisk.disk_type] + must be + `"pd-balanced"` or `"pd-ssd"`. + format: int32 + type: integer + sourceSnapshot: + description: Optional. Name of the snapshot to use as the + source for the disk. If set, [size_gb][google.cloud.workstations.v1.WorkstationConfig.PersistentDirectory.GceRegionalPersistentDisk.size_gb] + and [fs_type][google.cloud.workstations.v1.WorkstationConfig.PersistentDirectory.GceRegionalPersistentDisk.fs_type] + must be empty. + type: string + type: object + mountPath: + description: Optional. Location of this directory in the running + workstation. + type: string + type: object + type: array + projectRef: + description: The Project that this resource belongs to. + oneOf: + - not: + required: + - external + required: + - name + - not: + anyOf: + - required: + - name + - required: + - namespace + required: + - external + properties: + external: + description: The `projectID` field of a project, when not managed + by Config Connector. + type: string + kind: + description: The kind of the Project resource; optional but must + be `Project` if provided. + type: string + name: + description: The `name` field of a `Project` resource. + type: string + namespace: + description: The `namespace` field of a `Project` resource. + type: string + type: object + x-kubernetes-validations: + - message: ResourceID field is immutable + rule: self == oldSelf + readinessChecks: + description: Optional. Readiness checks to perform when starting a + workstation using this workstation configuration. Mark a workstation + as running only after all specified readiness checks return 200 + status codes. + items: + properties: + path: + description: Optional. Path to which the request should be sent. + type: string + port: + description: Optional. Port to which the request should be sent. + format: int32 + type: integer + type: object + type: array + replicaZones: + description: |- + Optional. Immutable. Specifies the zones used to replicate the VM and disk + resources within the region. If set, exactly two zones within the + workstation cluster's region must be specified—for example, + `['us-central1-a', 'us-central1-f']`. If this field is empty, two default + zones within the region are used. + + Immutable after the workstation configuration is created. + items: + type: string + type: array + resourceID: + description: Immutable. The WorkstationConfig name. If not given, + the metadata.name will be used. + type: string + x-kubernetes-validations: + - message: ResourceID field is immutable + rule: self == oldSelf + runningTimeout: + description: |- + Optional. Number of seconds that a workstation can run until it is + automatically shut down. We recommend that workstations be shut down daily + to reduce costs and so that security updates can be applied upon restart. + The + [idle_timeout][google.cloud.workstations.v1.WorkstationConfig.idle_timeout] + and + [running_timeout][google.cloud.workstations.v1.WorkstationConfig.running_timeout] + fields are independent of each other. Note that the + [running_timeout][google.cloud.workstations.v1.WorkstationConfig.running_timeout] + field shuts down VMs after the specified time, regardless of whether or not + the VMs are idle. + + Provide duration terminated by `s` for seconds—for example, `"54000s"` + (15 hours). Defaults to `"43200s"` (12 hours). A value of `"0s"` indicates + that workstations using this configuration should never time out. If + [encryption_key][google.cloud.workstations.v1.WorkstationConfig.encryption_key] + is set, it must be greater than `"0s"` and less than + `"86400s"` (24 hours). + + Warning: A value of `"0s"` indicates that Cloud Workstations VMs created + with this configuration have no maximum running time. This is strongly + discouraged because you incur costs and will not pick up security updates. + type: string + required: + - parentRef + - projectRef + type: object + status: + description: WorkstationConfigStatus defines the config connector machine + state of WorkstationConfig + properties: + conditions: + description: Conditions represent the latest available observations + of the object's current state. + items: + properties: + lastTransitionTime: + description: Last time the condition transitioned from one status + to another. + type: string + message: + description: Human-readable message indicating details about + last transition. + type: string + reason: + description: Unique, one-word, CamelCase reason for the condition's + last transition. + type: string + status: + description: Status is the status of the condition. Can be True, + False, Unknown. + type: string + type: + description: Type is the type of the condition. + type: string + type: object + type: array + externalRef: + description: A unique specifier for the WorkstationConfig resource + in GCP. + type: string + observedGeneration: + description: ObservedGeneration is the generation of the resource + that was most recently observed by the Config Connector controller. + If this is equal to metadata.generation, then that means that the + current reported status reflects the most recent desired state of + the resource. + format: int64 + type: integer + observedState: + description: ObservedState is the state of the resource as most recently + observed in GCP. + properties: + conditions: + description: Output only. Status conditions describing the current + resource state. + items: + properties: + code: + description: The status code, which should be an enum value + of [google.rpc.Code][google.rpc.Code]. + type: integer + message: + description: A developer-facing error message, which should + be in English. Any user-facing error message should be + localized and sent in the [google.rpc.Status.details][google.rpc.Status.details] + field, or localized by the client. + type: string + type: object + type: array + createTime: + description: Output only. Time when this workstation configuration + was created. + type: string + degraded: + description: Output only. Whether this resource is degraded, in + which case it may require user action to restore full functionality. + See also the [conditions][google.cloud.workstations.v1.WorkstationConfig.conditions] + field. + type: boolean + deleteTime: + description: Output only. Time when this workstation configuration + was soft-deleted. + type: string + etag: + description: Optional. Checksum computed by the server. May be + sent on update and delete requests to make sure that the client + has an up-to-date value before proceeding. + type: string + pooledInstances: + description: Output only. Number of instances currently available + in the pool for faster workstation startup. + format: int32 + type: integer + reconciling: + description: Output only. Indicates whether this workstation configuration + is currently being updated to match its intended state. + type: boolean + uid: + description: Output only. A system-assigned unique identifier + for this workstation configuration. + type: string + updateTime: + description: Output only. Time when this workstation configuration + was most recently updated. + type: string + type: object + type: object + type: object + served: true + storage: true + subresources: + status: {} diff --git a/pkg/controller/direct/workstations/workstationcluster_mappings.go b/pkg/controller/direct/workstations/workstationcluster_mappings.go index 1163105b26..3047fbad07 100644 --- a/pkg/controller/direct/workstations/workstationcluster_mappings.go +++ b/pkg/controller/direct/workstations/workstationcluster_mappings.go @@ -38,7 +38,7 @@ func WorkstationClusterSpec_ToProto(mapCtx *direct.MapContext, in *krm.Workstati return out } -func WorkstationClusterAnnotations_ToProto(mapCtx *direct.MapContext, in []krm.WorkstationClusterAnnotation) map[string]string { +func WorkstationClusterAnnotations_ToProto(mapCtx *direct.MapContext, in []krm.WorkstationAnnotation) map[string]string { if in == nil { return nil } @@ -49,7 +49,7 @@ func WorkstationClusterAnnotations_ToProto(mapCtx *direct.MapContext, in []krm.W return out } -func WorkstationClusterLabels_ToProto(mapCtx *direct.MapContext, in []krm.WorkstationClusterLabel) map[string]string { +func WorkstationClusterLabels_ToProto(mapCtx *direct.MapContext, in []krm.WorkstationLabel) map[string]string { if in == nil { return nil } @@ -111,13 +111,13 @@ func WorkstationClusterSpec_FromProto(mapCtx *direct.MapContext, in *pb.Workstat return out } -func WorkstationClusterAnnotations_FromProto(mapCtx *direct.MapContext, in map[string]string) []krm.WorkstationClusterAnnotation { +func WorkstationClusterAnnotations_FromProto(mapCtx *direct.MapContext, in map[string]string) []krm.WorkstationAnnotation { if in == nil { return nil } - var out []krm.WorkstationClusterAnnotation + var out []krm.WorkstationAnnotation for k, v := range in { - out = append(out, krm.WorkstationClusterAnnotation{ + out = append(out, krm.WorkstationAnnotation{ Key: k, Value: v, }) @@ -125,13 +125,13 @@ func WorkstationClusterAnnotations_FromProto(mapCtx *direct.MapContext, in map[s return out } -func WorkstationClusterLabels_FromProto(mapCtx *direct.MapContext, in map[string]string) []krm.WorkstationClusterLabel { +func WorkstationClusterLabels_FromProto(mapCtx *direct.MapContext, in map[string]string) []krm.WorkstationLabel { if in == nil { return nil } - var out []krm.WorkstationClusterLabel + var out []krm.WorkstationLabel for k, v := range in { - out = append(out, krm.WorkstationClusterLabel{ + out = append(out, krm.WorkstationLabel{ Key: k, Value: v, }) @@ -215,13 +215,13 @@ func WorkstationClusterServiceAttachmentUri_FromProto(mapCtx *direct.MapContext, return direct.LazyPtr(in.GetServiceAttachmentUri()) } -func WorkstationClusterGCPConditions_FromProto(mapCtx *direct.MapContext, in []*status.Status) []krm.WorkstationClusterGCPCondition { +func WorkstationClusterGCPConditions_FromProto(mapCtx *direct.MapContext, in []*status.Status) []krm.WorkstationServiceGCPCondition { if in == nil { return nil } - var out []krm.WorkstationClusterGCPCondition + var out []krm.WorkstationServiceGCPCondition for _, c := range in { - out = append(out, krm.WorkstationClusterGCPCondition{ + out = append(out, krm.WorkstationServiceGCPCondition{ Code: direct.LazyPtr(int(c.Code)), Message: direct.LazyPtr(c.Message), })