From 566b758310b5ca3bbffa78a80fb3435b662867f8 Mon Sep 17 00:00:00 2001 From: Jason Vigil Date: Fri, 13 Dec 2024 21:13:44 +0000 Subject: [PATCH 1/2] feat: Promote WorkstationConfig to v1beta1 --- apis/workstations/v1beta1/cluster_types.go | 2 +- apis/workstations/v1beta1/config_identity.go | 132 ++ apis/workstations/v1beta1/config_reference.go | 83 ++ apis/workstations/v1beta1/config_types.go | 472 ++++++ .../v1beta1/zz_generated.deepcopy.go | 635 +++++++++ ...gs.workstations.cnrm.cloud.google.com.yaml | 630 ++++++++ .../compute_v1beta1_computenetwork.yaml | 21 + .../compute_v1beta1_computesubnetwork.yaml | 23 + ...rkstations_v1beta1_workstationcluster.yaml | 26 + ...orkstations_v1beta1_workstationconfig.yaml | 34 + config/servicemappings/workstations.yaml | 3 + dev/tools/controllerbuilder/generate.sh | 2 +- .../direct/workstations/config_controller.go | 2 +- .../direct/workstations/config_defaults.go | 2 +- .../direct/workstations/config_mappings.go | 14 +- .../direct/workstations/config_resolverefs.go | 2 +- pkg/gvks/supportedgvks/gvks_generated.go | 10 + .../snippetgeneration/snippetgeneration.go | 1 + pkg/test/resourcefixture/sets.go | 1 + ..._object_workstationconfig-full.golden.yaml | 4 +- .../workstationconfig-full/create.yaml | 2 +- .../workstationconfig-full/update.yaml | 2 +- ...ject_workstationconfig-minimal.golden.yaml | 4 +- .../workstationconfig-minimal/create.yaml | 2 +- .../resource-reference/_toc.yaml | 2 + .../workstations/workstationconfig.md | 1270 +++++++++++++++++ .../resource-reference/overview.md | 4 + .../workstations_workstationconfig.tmpl | 53 + 28 files changed, 3421 insertions(+), 17 deletions(-) create mode 100644 apis/workstations/v1beta1/config_identity.go create mode 100644 apis/workstations/v1beta1/config_reference.go create mode 100644 apis/workstations/v1beta1/config_types.go create mode 100644 config/samples/resources/workstationconfig/basic-workstationconfig/compute_v1beta1_computenetwork.yaml create mode 100644 config/samples/resources/workstationconfig/basic-workstationconfig/compute_v1beta1_computesubnetwork.yaml create mode 100644 config/samples/resources/workstationconfig/basic-workstationconfig/workstations_v1beta1_workstationcluster.yaml create mode 100644 config/samples/resources/workstationconfig/basic-workstationconfig/workstations_v1beta1_workstationconfig.yaml create mode 100644 scripts/generate-google3-docs/resource-reference/generated/resource-docs/workstations/workstationconfig.md create mode 100644 scripts/generate-google3-docs/resource-reference/templates/workstations_workstationconfig.tmpl diff --git a/apis/workstations/v1beta1/cluster_types.go b/apis/workstations/v1beta1/cluster_types.go index 1c12eb8ee3..b22184de3e 100644 --- a/apis/workstations/v1beta1/cluster_types.go +++ b/apis/workstations/v1beta1/cluster_types.go @@ -155,7 +155,6 @@ type WorkstationClusterObservedState struct { // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // +kubebuilder:resource:categories=gcp // +kubebuilder:subresource:status -// +kubebuilder:storageversion // +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" @@ -164,6 +163,7 @@ type WorkstationClusterObservedState struct { // WorkstationCluster is the Schema for the WorkstationCluster API // +k8s:openapi-gen=true +// +kubebuilder:storageversion type WorkstationCluster struct { metav1.TypeMeta `json:",inline"` metav1.ObjectMeta `json:"metadata,omitempty"` diff --git a/apis/workstations/v1beta1/config_identity.go b/apis/workstations/v1beta1/config_identity.go new file mode 100644 index 0000000000..591cd6c031 --- /dev/null +++ b/apis/workstations/v1beta1/config_identity.go @@ -0,0 +1,132 @@ +// 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 + +import ( + "context" + "fmt" + "strings" + + "github.com/GoogleCloudPlatform/k8s-config-connector/apis/common" + "sigs.k8s.io/controller-runtime/pkg/client" +) + +// WorkstationConfigIdentity defines the resource reference to WorkstationConfig, which "External" field +// holds the GCP identifier for the KRM object. +type WorkstationConfigIdentity struct { + parent *WorkstationConfigParent + id string +} + +func (i *WorkstationConfigIdentity) String() string { + return i.parent.String() + "/workstationConfigs/" + i.id +} + +func (i *WorkstationConfigIdentity) ID() string { + return i.id +} + +func (i *WorkstationConfigIdentity) Parent() *WorkstationConfigParent { + return i.parent +} + +type WorkstationConfigParent struct { + ProjectID string + Location string + Cluster string +} + +func (p *WorkstationConfigParent) String() string { + return "projects/" + p.ProjectID + "/locations/" + p.Location + "/workstationClusters/" + p.Cluster +} + +// New builds a ConfigIdentity from the Config Connector WorkstationConfig object. +func NewWorkstationConfigIdentity(ctx context.Context, reader client.Reader, obj *WorkstationConfig) (*WorkstationConfigIdentity, error) { + // Get Parent + clusterRef := obj.Spec.Parent + if clusterRef == nil { + return nil, fmt.Errorf("no parent cluster") + } + clusterExternal, err := clusterRef.NormalizedExternal(ctx, reader, obj.Namespace) + if err != nil { + return nil, fmt.Errorf("cannot resolve cluster: %w", err) + } + clusterParent, cluster, err := parseWorkstationClusterExternal(clusterExternal) + if err != nil { + return nil, fmt.Errorf("cannot parse external cluster: %w", err) + } + projectID := clusterParent.ProjectID + if projectID == "" { + return nil, fmt.Errorf("cannot resolve project") + } + location := clusterParent.Location + if location == "" { + return nil, fmt.Errorf("cannot resolve location") + } + + // Get desired ID + resourceID := common.ValueOf(obj.Spec.ResourceID) + if resourceID == "" { + resourceID = obj.GetName() + } + if resourceID == "" { + return nil, fmt.Errorf("cannot resolve resource ID") + } + + // Use approved External + externalRef := common.ValueOf(obj.Status.ExternalRef) + if externalRef != "" { + // Validate desired with actual + actualParent, actualResourceID, err := ParseWorkstationConfigExternal(externalRef) + if err != nil { + return nil, err + } + if actualParent.ProjectID != projectID { + return nil, fmt.Errorf("spec.projectRef changed, expect %s, got %s", actualParent.ProjectID, projectID) + } + if actualParent.Location != location { + return nil, fmt.Errorf("spec.location changed, expect %s, got %s", actualParent.Location, location) + } + if actualParent.Cluster != cluster { + return nil, fmt.Errorf("spec.cluster changed, expect %s, got %s", actualParent.Cluster, cluster) + } + if actualResourceID != resourceID { + return nil, fmt.Errorf("cannot reset `metadata.name` or `spec.resourceID` to %s, since it has already assigned to %s", + resourceID, actualResourceID) + } + } + return &WorkstationConfigIdentity{ + parent: &WorkstationConfigParent{ + ProjectID: projectID, + Location: location, + Cluster: cluster, + }, + id: resourceID, + }, nil +} + +func ParseWorkstationConfigExternal(external string) (parent *WorkstationConfigParent, resourceID string, err error) { + tokens := strings.Split(external, "/") + if len(tokens) != 8 || tokens[0] != "projects" || tokens[2] != "locations" || tokens[4] != "workstationClusters" || tokens[6] != "workstationConfigs" { + return nil, "", fmt.Errorf("format of Workstation external=%q was not known (use projects//locations//workstationClusters//workstationConfigs/)", external) + } + parent = &WorkstationConfigParent{ + ProjectID: tokens[1], + Location: tokens[3], + Cluster: tokens[5], + } + resourceID = tokens[7] + return parent, resourceID, nil +} diff --git a/apis/workstations/v1beta1/config_reference.go b/apis/workstations/v1beta1/config_reference.go new file mode 100644 index 0000000000..c6e2f925d6 --- /dev/null +++ b/apis/workstations/v1beta1/config_reference.go @@ -0,0 +1,83 @@ +// 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 + +import ( + "context" + "fmt" + + refsv1beta1 "github.com/GoogleCloudPlatform/k8s-config-connector/apis/refs/v1beta1" + "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/k8s" + apierrors "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" + "k8s.io/apimachinery/pkg/types" + "sigs.k8s.io/controller-runtime/pkg/client" +) + +var _ refsv1beta1.ExternalNormalizer = &WorkstationConfigRef{} + +// WorkstationConfigRef defines the resource reference to WorkstationConfig, which "External" field +// holds the GCP identifier for the KRM object. +type WorkstationConfigRef struct { + // A reference to an externally managed WorkstationConfig resource. + // Should be in the format "projects//locations//workstationClusters//workstationConfigs/". + External string `json:"external,omitempty"` + + // The name of a WorkstationConfig resource. + Name string `json:"name,omitempty"` + + // The namespace of a WorkstationConfig resource. + Namespace string `json:"namespace,omitempty"` +} + +// NormalizedExternal provision the "External" value for other resource that depends on WorkstationConfig. +// If the "External" is given in the other resource's spec.WorkstationConfigRef, the given value will be used. +// Otherwise, the "Name" and "Namespace" will be used to query the actual WorkstationConfig object from the cluster. +func (r *WorkstationConfigRef) NormalizedExternal(ctx context.Context, reader client.Reader, otherNamespace string) (string, error) { + if r.External != "" && r.Name != "" { + return "", fmt.Errorf("cannot specify both name and external on %s reference", WorkstationConfigGVK.Kind) + } + // From given External + if r.External != "" { + if _, _, err := ParseWorkstationConfigExternal(r.External); err != nil { + return "", err + } + return r.External, nil + } + + // From the Config Connector object + if r.Namespace == "" { + r.Namespace = otherNamespace + } + key := types.NamespacedName{Name: r.Name, Namespace: r.Namespace} + u := &unstructured.Unstructured{} + u.SetGroupVersionKind(WorkstationConfigGVK) + if err := reader.Get(ctx, key, u); err != nil { + if apierrors.IsNotFound(err) { + return "", k8s.NewReferenceNotFoundError(u.GroupVersionKind(), key) + } + return "", fmt.Errorf("reading referenced %s %s: %w", WorkstationConfigGVK, key, err) + } + // Get external from status.externalRef. This is the most trustworthy place. + actualExternalRef, _, err := unstructured.NestedString(u.Object, "status", "externalRef") + if err != nil { + return "", fmt.Errorf("reading status.externalRef: %w", err) + } + if actualExternalRef == "" { + return "", k8s.NewReferenceNotReadyError(u.GroupVersionKind(), key) + } + r.External = actualExternalRef + return r.External, nil +} diff --git a/apis/workstations/v1beta1/config_types.go b/apis/workstations/v1beta1/config_types.go new file mode 100644 index 0000000000..aa2f1c7e30 --- /dev/null +++ b/apis/workstations/v1beta1/config_types.go @@ -0,0 +1,472 @@ +// 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 + +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") + +// +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 { + // Parent is a reference to the parent WorkstationCluster for this WorkstationConfig. + Parent *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. + 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"` +} + +// WorkstationConfigObservedState is the state of the WorkstationConfig resource as most recently observed in GCP. +// +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. 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"` + + // Output only. 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. Observed state of the runtime host for the workstation + // configuration. + Host *WorkstationConfig_HostObservedState `json:"host,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. + GCPConditions []WorkstationServiceGCPCondition `json:"gcpConditions,omitempty"` +} + +// WorkstationConfigObservedState is the state of the WorkstationConfig_Host resource as most recently observed in GCP. +// +kcc:proto=google.cloud.workstations.v1.WorkstationConfig.Host +type WorkstationConfig_HostObservedState struct { + // Output only. Observed state of the Compute Engine runtime host for the workstation configuration. + GceInstance *WorkstationConfig_Host_GceInstanceObservedState `json:"gceInstance,omitempty"` +} + +// WorkstationConfigObservedState is the state of the WorkstationConfig_Host_GceInstanceObservedState resource as most recently observed in GCP. +// +kcc:proto=google.cloud.workstations.v1.WorkstationConfig.Host.GceInstance +type WorkstationConfig_Host_GceInstanceObservedState struct { + // 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,shortName=gcpworkstationconfig;gcpworkstationconfigs +// +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 +// +kubebuilder:storageversion +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/v1beta1/zz_generated.deepcopy.go b/apis/workstations/v1beta1/zz_generated.deepcopy.go index 59f72797fe..7a072baba9 100644 --- a/apis/workstations/v1beta1/zz_generated.deepcopy.go +++ b/apis/workstations/v1beta1/zz_generated.deepcopy.go @@ -303,6 +303,641 @@ func (in *WorkstationCluster_PrivateClusterConfig) DeepCopy() *WorkstationCluste 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 *WorkstationConfigIdentity) DeepCopyInto(out *WorkstationConfigIdentity) { + *out = *in + if in.parent != nil { + in, out := &in.parent, &out.parent + *out = new(WorkstationConfigParent) + **out = **in + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkstationConfigIdentity. +func (in *WorkstationConfigIdentity) DeepCopy() *WorkstationConfigIdentity { + if in == nil { + return nil + } + out := new(WorkstationConfigIdentity) + in.DeepCopyInto(out) + return out +} + +// 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.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.Host != nil { + in, out := &in.Host, &out.Host + *out = new(WorkstationConfig_HostObservedState) + (*in).DeepCopyInto(*out) + } + if in.Degraded != nil { + in, out := &in.Degraded, &out.Degraded + *out = new(bool) + **out = **in + } + if in.GCPConditions != nil { + in, out := &in.GCPConditions, &out.GCPConditions + *out = make([]WorkstationServiceGCPCondition, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } +} + +// 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 *WorkstationConfigParent) DeepCopyInto(out *WorkstationConfigParent) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkstationConfigParent. +func (in *WorkstationConfigParent) DeepCopy() *WorkstationConfigParent { + if in == nil { + return nil + } + out := new(WorkstationConfigParent) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *WorkstationConfigRef) DeepCopyInto(out *WorkstationConfigRef) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkstationConfigRef. +func (in *WorkstationConfigRef) DeepCopy() *WorkstationConfigRef { + if in == nil { + return nil + } + out := new(WorkstationConfigRef) + 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 + if in.Parent != nil { + in, out := &in.Parent, &out.Parent + *out = new(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([]v1alpha1.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(refsv1beta1.KMSCryptoKeyRef) + **out = **in + } + if in.ServiceAccountRef != nil { + in, out := &in.ServiceAccountRef, &out.ServiceAccountRef + *out = new(refsv1beta1.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_HostObservedState) DeepCopyInto(out *WorkstationConfig_HostObservedState) { + *out = *in + if in.GceInstance != nil { + in, out := &in.GceInstance, &out.GceInstance + *out = new(WorkstationConfig_Host_GceInstanceObservedState) + (*in).DeepCopyInto(*out) + } +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new WorkstationConfig_HostObservedState. +func (in *WorkstationConfig_HostObservedState) DeepCopy() *WorkstationConfig_HostObservedState { + if in == nil { + return nil + } + out := new(WorkstationConfig_HostObservedState) + 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(refsv1beta1.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_GceInstanceObservedState) DeepCopyInto(out *WorkstationConfig_Host_GceInstanceObservedState) { + *out = *in + 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 WorkstationConfig_Host_GceInstanceObservedState. +func (in *WorkstationConfig_Host_GceInstanceObservedState) DeepCopy() *WorkstationConfig_Host_GceInstanceObservedState { + if in == nil { + return nil + } + out := new(WorkstationConfig_Host_GceInstanceObservedState) + 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 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 index ec072b17f6..2286f03a7d 100644 --- 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 @@ -650,6 +650,636 @@ spec: type: object type: object served: true + storage: false + subresources: + status: {} + - 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: v1beta1 + 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: A reference to an externally managed WorkstationCluster + resource. Should be in the format "projects//locations//workstationClusters/". + type: string + name: + description: The name of a WorkstationCluster resource. + type: string + namespace: + description: The namespace 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 + 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 + 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: + 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: Output only. 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 + gcpConditions: + 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]. + format: int32 + 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 + host: + description: Output only. Observed state of the runtime host for + the workstation configuration. + properties: + gceInstance: + description: Output only. Observed state of the Compute Engine + runtime host for the workstation configuration. + properties: + pooledInstances: + description: Output only. Number of instances currently + available in the pool for faster workstation startup. + format: int32 + type: integer + type: object + type: object + 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/config/samples/resources/workstationconfig/basic-workstationconfig/compute_v1beta1_computenetwork.yaml b/config/samples/resources/workstationconfig/basic-workstationconfig/compute_v1beta1_computenetwork.yaml new file mode 100644 index 0000000000..224bcddf5b --- /dev/null +++ b/config/samples/resources/workstationconfig/basic-workstationconfig/compute_v1beta1_computenetwork.yaml @@ -0,0 +1,21 @@ +# 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. + +apiVersion: compute.cnrm.cloud.google.com/v1beta1 +kind: ComputeNetwork +metadata: + name: computenetwork-dep +spec: + routingMode: GLOBAL + autoCreateSubnetworks: false \ No newline at end of file diff --git a/config/samples/resources/workstationconfig/basic-workstationconfig/compute_v1beta1_computesubnetwork.yaml b/config/samples/resources/workstationconfig/basic-workstationconfig/compute_v1beta1_computesubnetwork.yaml new file mode 100644 index 0000000000..7e489aa7fb --- /dev/null +++ b/config/samples/resources/workstationconfig/basic-workstationconfig/compute_v1beta1_computesubnetwork.yaml @@ -0,0 +1,23 @@ +# 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. + +apiVersion: compute.cnrm.cloud.google.com/v1beta1 +kind: ComputeSubnetwork +metadata: + name: computesubnetwork-dep +spec: + ipCidrRange: 10.0.0.0/24 + region: us-west1 + networkRef: + name: computenetwork-dep \ No newline at end of file diff --git a/config/samples/resources/workstationconfig/basic-workstationconfig/workstations_v1beta1_workstationcluster.yaml b/config/samples/resources/workstationconfig/basic-workstationconfig/workstations_v1beta1_workstationcluster.yaml new file mode 100644 index 0000000000..d4c6930546 --- /dev/null +++ b/config/samples/resources/workstationconfig/basic-workstationconfig/workstations_v1beta1_workstationcluster.yaml @@ -0,0 +1,26 @@ +# 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. + +apiVersion: workstations.cnrm.cloud.google.com/v1beta1 +kind: WorkstationCluster +metadata: + name: workstationcluster-dep +spec: + projectRef: + external: "projects/${PROJECT_NUMBER1}" + location: us-west1 + networkRef: + name: computenetwork-dep + subnetworkRef: + name: computesubnetwork-dep \ No newline at end of file diff --git a/config/samples/resources/workstationconfig/basic-workstationconfig/workstations_v1beta1_workstationconfig.yaml b/config/samples/resources/workstationconfig/basic-workstationconfig/workstations_v1beta1_workstationconfig.yaml new file mode 100644 index 0000000000..b30866a19f --- /dev/null +++ b/config/samples/resources/workstationconfig/basic-workstationconfig/workstations_v1beta1_workstationconfig.yaml @@ -0,0 +1,34 @@ +# 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. + +apiVersion: workstations.cnrm.cloud.google.com/v1beta1 +kind: WorkstationConfig +metadata: + name: workstationconfig-sample +spec: + parentRef: + name: workstationcluster-dep + idleTimeout: "1200s" + runningTimeout: "43200s" + host: + gceInstance: + machineType: "e2-standard-4" + serviceAccountRef: + external: "service-${PROJECT_NUMBER1}@gcp-sa-workstationsvm.iam.gserviceaccount.com" + bootDiskSizeGB: 50 + container: + image: "us-west1-docker.pkg.dev/cloud-workstations-images/predefined/code-oss:latest" + replicaZones: + - us-west1-a + - us-west1-b \ No newline at end of file diff --git a/config/servicemappings/workstations.yaml b/config/servicemappings/workstations.yaml index fc7f2ad2d4..f0bd3e736f 100644 --- a/config/servicemappings/workstations.yaml +++ b/config/servicemappings/workstations.yaml @@ -24,4 +24,7 @@ spec: resources: - name: google_workstations_workstationcluster kind: WorkstationCluster + direct: true + - name: google_workstations_workstationconfig + kind: WorkstationConfig direct: true \ No newline at end of file diff --git a/dev/tools/controllerbuilder/generate.sh b/dev/tools/controllerbuilder/generate.sh index af084ea513..35b0465342 100755 --- a/dev/tools/controllerbuilder/generate.sh +++ b/dev/tools/controllerbuilder/generate.sh @@ -145,7 +145,7 @@ go run . generate-types \ go run . generate-types \ --service google.cloud.workstations.v1 \ - --api-version workstations.cnrm.cloud.google.com/v1alpha1 \ + --api-version workstations.cnrm.cloud.google.com/v1beta1 \ --resource WorkstationConfig:WorkstationConfig go run . generate-types \ diff --git a/pkg/controller/direct/workstations/config_controller.go b/pkg/controller/direct/workstations/config_controller.go index 806af1efa9..febc2c44ad 100644 --- a/pkg/controller/direct/workstations/config_controller.go +++ b/pkg/controller/direct/workstations/config_controller.go @@ -18,7 +18,7 @@ import ( "context" "fmt" - krm "github.com/GoogleCloudPlatform/k8s-config-connector/apis/workstations/v1alpha1" + krm "github.com/GoogleCloudPlatform/k8s-config-connector/apis/workstations/v1beta1" "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/config" "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/controller/direct" "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/controller/direct/common" diff --git a/pkg/controller/direct/workstations/config_defaults.go b/pkg/controller/direct/workstations/config_defaults.go index b484bf61fc..cd4aade5e3 100644 --- a/pkg/controller/direct/workstations/config_defaults.go +++ b/pkg/controller/direct/workstations/config_defaults.go @@ -16,7 +16,7 @@ package workstations import ( pb "cloud.google.com/go/workstations/apiv1/workstationspb" - krm "github.com/GoogleCloudPlatform/k8s-config-connector/apis/workstations/v1alpha1" + krm "github.com/GoogleCloudPlatform/k8s-config-connector/apis/workstations/v1beta1" "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/controller/direct" ) diff --git a/pkg/controller/direct/workstations/config_mappings.go b/pkg/controller/direct/workstations/config_mappings.go index 3a79236565..bb2dd8a161 100644 --- a/pkg/controller/direct/workstations/config_mappings.go +++ b/pkg/controller/direct/workstations/config_mappings.go @@ -17,7 +17,7 @@ package workstations import ( pb "cloud.google.com/go/workstations/apiv1/workstationspb" refs "github.com/GoogleCloudPlatform/k8s-config-connector/apis/refs/v1beta1" - krm "github.com/GoogleCloudPlatform/k8s-config-connector/apis/workstations/v1alpha1" + krm "github.com/GoogleCloudPlatform/k8s-config-connector/apis/workstations/v1beta1" "github.com/GoogleCloudPlatform/k8s-config-connector/pkg/controller/direct" ) @@ -33,7 +33,7 @@ func WorkstationConfigObservedState_FromProto(mapCtx *direct.MapContext, in *pb. out.Etag = direct.LazyPtr(in.GetEtag()) out.Host = WorkstationConfig_HostObservedState_FromProto(mapCtx, in.Host) out.Degraded = direct.LazyPtr(in.GetDegraded()) - out.GCPConditions = WorkstationGCPConditions_FromProto_Alpha(mapCtx, in.Conditions) + out.GCPConditions = WorkstationGCPConditions_FromProto(mapCtx, in.Conditions) return out } @@ -67,7 +67,7 @@ func WorkstationConfigObservedState_ToProto(mapCtx *direct.MapContext, in *krm.W out.Etag = direct.ValueOf(in.Etag) out.Host = WorkstationConfig_HostObservedState_ToProto(mapCtx, in.Host) out.Degraded = direct.ValueOf(in.Degraded) - out.Conditions = WorkstationGCPConditions_ToProto_Alpha(mapCtx, in.GCPConditions) + out.Conditions = WorkstationGCPConditions_ToProto(mapCtx, in.GCPConditions) return out } @@ -97,8 +97,8 @@ func WorkstationConfigSpec_FromProto(mapCtx *direct.MapContext, in *pb.Workstati } out := &krm.WorkstationConfigSpec{} out.DisplayName = direct.LazyPtr(in.GetDisplayName()) - out.Annotations = WorkstationAnnotations_FromProto_Alpha(mapCtx, in.Annotations) - out.Labels = WorkstationLabels_FromProto_Alpha(mapCtx, in.Labels) + out.Annotations = WorkstationAnnotations_FromProto(mapCtx, in.Annotations) + out.Labels = WorkstationLabels_FromProto(mapCtx, in.Labels) out.IdleTimeout = direct.StringDuration_FromProto(mapCtx, in.GetIdleTimeout()) out.RunningTimeout = direct.StringDuration_FromProto(mapCtx, in.GetRunningTimeout()) out.Host = WorkstationConfig_Host_FromProto(mapCtx, in.GetHost()) @@ -116,8 +116,8 @@ func WorkstationConfigSpec_ToProto(mapCtx *direct.MapContext, in *krm.Workstatio } out := &pb.WorkstationConfig{} out.DisplayName = direct.ValueOf(in.DisplayName) - out.Annotations = WorkstationAnnotations_ToProto_Alpha(mapCtx, in.Annotations) - out.Labels = WorkstationLabels_ToProto_Alpha(mapCtx, in.Labels) + out.Annotations = WorkstationAnnotations_ToProto(mapCtx, in.Annotations) + out.Labels = WorkstationLabels_ToProto(mapCtx, in.Labels) out.IdleTimeout = direct.StringDuration_ToProto(mapCtx, in.IdleTimeout) out.RunningTimeout = direct.StringDuration_ToProto(mapCtx, in.RunningTimeout) out.Host = WorkstationConfig_Host_ToProto(mapCtx, in.Host) diff --git a/pkg/controller/direct/workstations/config_resolverefs.go b/pkg/controller/direct/workstations/config_resolverefs.go index ccc612e196..85b858bf1b 100644 --- a/pkg/controller/direct/workstations/config_resolverefs.go +++ b/pkg/controller/direct/workstations/config_resolverefs.go @@ -18,7 +18,7 @@ import ( "context" refs "github.com/GoogleCloudPlatform/k8s-config-connector/apis/refs/v1beta1" - krm "github.com/GoogleCloudPlatform/k8s-config-connector/apis/workstations/v1alpha1" + krm "github.com/GoogleCloudPlatform/k8s-config-connector/apis/workstations/v1beta1" "sigs.k8s.io/controller-runtime/pkg/client" ) diff --git a/pkg/gvks/supportedgvks/gvks_generated.go b/pkg/gvks/supportedgvks/gvks_generated.go index 0c2de2f8ab..a9bd81f676 100644 --- a/pkg/gvks/supportedgvks/gvks_generated.go +++ b/pkg/gvks/supportedgvks/gvks_generated.go @@ -4518,6 +4518,16 @@ var SupportedGVKs = map[schema.GroupVersionKind]GVKMetadata{ "cnrm.cloud.google.com/system": "true", }, }, + { + Group: "workstations.cnrm.cloud.google.com", + Version: "v1beta1", + Kind: "WorkstationConfig", + }: { + Labels: map[string]string{ + "cnrm.cloud.google.com/managed-by-kcc": "true", + "cnrm.cloud.google.com/system": "true", + }, + }, { Group: "workstations.cnrm.cloud.google.com", Version: "v1alpha1", diff --git a/pkg/snippet/snippetgeneration/snippetgeneration.go b/pkg/snippet/snippetgeneration/snippetgeneration.go index 0437d92f82..4e5a813061 100644 --- a/pkg/snippet/snippetgeneration/snippetgeneration.go +++ b/pkg/snippet/snippetgeneration/snippetgeneration.go @@ -116,6 +116,7 @@ var preferredSampleForResource = map[string]string{ "vertexaidataset": "vertexai-dataset-encryptionkey", "vertexaiendpoint": "vertexai-endpoint-network", "workstationcluster": "basic-workstationcluster", + "workstationconfig": "basic-workstationconfig", "kmsautokeyconfig": "kmsautokeyconfig", "kmskeyhandle": "kmskeyhandle", } diff --git a/pkg/test/resourcefixture/sets.go b/pkg/test/resourcefixture/sets.go index 4305f28a6e..8c62779839 100644 --- a/pkg/test/resourcefixture/sets.go +++ b/pkg/test/resourcefixture/sets.go @@ -99,6 +99,7 @@ func IsPureDirectResource(gk schema.GroupKind) bool { "BigQueryAnalyticsHubDataExchange", "BigQueryAnalyticsHubListing", "WorkstationCluster", + "WorkstationConfig", "KMSAutokeyConfig", "KMSKeyHandle", } diff --git a/pkg/test/resourcefixture/testdata/basic/workstations/workstationconfig/workstationconfig-full/_generated_object_workstationconfig-full.golden.yaml b/pkg/test/resourcefixture/testdata/basic/workstations/workstationconfig/workstationconfig-full/_generated_object_workstationconfig-full.golden.yaml index 3689da5edb..4dfc68687a 100644 --- a/pkg/test/resourcefixture/testdata/basic/workstations/workstationconfig/workstationconfig-full/_generated_object_workstationconfig-full.golden.yaml +++ b/pkg/test/resourcefixture/testdata/basic/workstations/workstationconfig/workstationconfig-full/_generated_object_workstationconfig-full.golden.yaml @@ -1,6 +1,8 @@ -apiVersion: workstations.cnrm.cloud.google.com/v1alpha1 +apiVersion: workstations.cnrm.cloud.google.com/v1beta1 kind: WorkstationConfig metadata: + annotations: + cnrm.cloud.google.com/management-conflict-prevention-policy: none finalizers: - cnrm.cloud.google.com/finalizer - cnrm.cloud.google.com/deletion-defender diff --git a/pkg/test/resourcefixture/testdata/basic/workstations/workstationconfig/workstationconfig-full/create.yaml b/pkg/test/resourcefixture/testdata/basic/workstations/workstationconfig/workstationconfig-full/create.yaml index 4cabc3c5a3..0a279e2143 100644 --- a/pkg/test/resourcefixture/testdata/basic/workstations/workstationconfig/workstationconfig-full/create.yaml +++ b/pkg/test/resourcefixture/testdata/basic/workstations/workstationconfig/workstationconfig-full/create.yaml @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -apiVersion: workstations.cnrm.cloud.google.com/v1alpha1 +apiVersion: workstations.cnrm.cloud.google.com/v1beta1 kind: WorkstationConfig metadata: name: workstationconfig-${uniqueId} diff --git a/pkg/test/resourcefixture/testdata/basic/workstations/workstationconfig/workstationconfig-full/update.yaml b/pkg/test/resourcefixture/testdata/basic/workstations/workstationconfig/workstationconfig-full/update.yaml index 473d16a524..cbb36d969c 100644 --- a/pkg/test/resourcefixture/testdata/basic/workstations/workstationconfig/workstationconfig-full/update.yaml +++ b/pkg/test/resourcefixture/testdata/basic/workstations/workstationconfig/workstationconfig-full/update.yaml @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -apiVersion: workstations.cnrm.cloud.google.com/v1alpha1 +apiVersion: workstations.cnrm.cloud.google.com/v1beta1 kind: WorkstationConfig metadata: name: workstationconfig-${uniqueId} diff --git a/pkg/test/resourcefixture/testdata/basic/workstations/workstationconfig/workstationconfig-minimal/_generated_object_workstationconfig-minimal.golden.yaml b/pkg/test/resourcefixture/testdata/basic/workstations/workstationconfig/workstationconfig-minimal/_generated_object_workstationconfig-minimal.golden.yaml index fc7a382291..65d404af47 100644 --- a/pkg/test/resourcefixture/testdata/basic/workstations/workstationconfig/workstationconfig-minimal/_generated_object_workstationconfig-minimal.golden.yaml +++ b/pkg/test/resourcefixture/testdata/basic/workstations/workstationconfig/workstationconfig-minimal/_generated_object_workstationconfig-minimal.golden.yaml @@ -1,6 +1,8 @@ -apiVersion: workstations.cnrm.cloud.google.com/v1alpha1 +apiVersion: workstations.cnrm.cloud.google.com/v1beta1 kind: WorkstationConfig metadata: + annotations: + cnrm.cloud.google.com/management-conflict-prevention-policy: none finalizers: - cnrm.cloud.google.com/finalizer - cnrm.cloud.google.com/deletion-defender diff --git a/pkg/test/resourcefixture/testdata/basic/workstations/workstationconfig/workstationconfig-minimal/create.yaml b/pkg/test/resourcefixture/testdata/basic/workstations/workstationconfig/workstationconfig-minimal/create.yaml index 64f5b2281d..3bd83978b7 100644 --- a/pkg/test/resourcefixture/testdata/basic/workstations/workstationconfig/workstationconfig-minimal/create.yaml +++ b/pkg/test/resourcefixture/testdata/basic/workstations/workstationconfig/workstationconfig-minimal/create.yaml @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -apiVersion: workstations.cnrm.cloud.google.com/v1alpha1 +apiVersion: workstations.cnrm.cloud.google.com/v1beta1 kind: WorkstationConfig metadata: name: workstationconfig-${uniqueId} diff --git a/scripts/generate-google3-docs/resource-reference/_toc.yaml b/scripts/generate-google3-docs/resource-reference/_toc.yaml index f0a8434b0d..c6095253fc 100644 --- a/scripts/generate-google3-docs/resource-reference/_toc.yaml +++ b/scripts/generate-google3-docs/resource-reference/_toc.yaml @@ -571,3 +571,5 @@ toc: section: - title: "WorkstationCluster" path: /config-connector/docs/reference/resource-docs/workstations/workstationcluster.md + - title: "WorkstationConfig" + path: /config-connector/docs/reference/resource-docs/workstations/workstationconfig.md diff --git a/scripts/generate-google3-docs/resource-reference/generated/resource-docs/workstations/workstationconfig.md b/scripts/generate-google3-docs/resource-reference/generated/resource-docs/workstations/workstationconfig.md new file mode 100644 index 0000000000..0fee948b9e --- /dev/null +++ b/scripts/generate-google3-docs/resource-reference/generated/resource-docs/workstations/workstationconfig.md @@ -0,0 +1,1270 @@ +{# AUTOGENERATED. DO NOT EDIT. #} + +{% extends "config-connector/_base.html" %} + +{% block page_title %}WorkstationConfig{% endblock %} +{% block body %} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
PropertyValue
{{gcp_name_short}} Service NameCloud Workstations
{{gcp_name_short}} Service Documentation/workstations/docs/
{{gcp_name_short}} REST Resource Namev1.projects.locations.workstationClusters.workstationConfigs
{{gcp_name_short}} REST Resource Documentation +
Fields
+

annotations

+

Optional

+
+

list (object)

+

{% verbatim %}Optional. Client-specified annotations.{% endverbatim %}

+
+

annotations[]

+

Optional

+
+

object

+

{% verbatim %}{% endverbatim %}

+
+

annotations[].key

+

Optional

+
+

string

+

{% verbatim %}Key for the annotation.{% endverbatim %}

+
+

annotations[].value

+

Optional

+
+

string

+

{% verbatim %}Value for the annotation.{% endverbatim %}

+
+

container

+

Optional

+
+

object

+

{% verbatim %}Optional. Container that runs upon startup for each workstation using this workstation configuration.{% endverbatim %}

+
+

container.args

+

Optional

+
+

list (string)

+

{% verbatim %}Optional. Arguments passed to the entrypoint.{% endverbatim %}

+
+

container.args[]

+

Optional

+
+

string

+

{% verbatim %}{% endverbatim %}

+
+

container.command

+

Optional

+
+

list (string)

+

{% verbatim %}Optional. If set, overrides the default ENTRYPOINT specified by the image.{% endverbatim %}

+
+

container.command[]

+

Optional

+
+

string

+

{% verbatim %}{% endverbatim %}

+
+

container.env

+

Optional

+
+

list (object)

+

{% verbatim %}Optional. Environment variables passed to the container's entrypoint.{% endverbatim %}

+
+

container.env[]

+

Optional

+
+

object

+

{% verbatim %}{% endverbatim %}

+
+

container.env[].name

+

Optional

+
+

string

+

{% verbatim %}Name is the name of the environment variable.{% endverbatim %}

+
+

container.env[].value

+

Optional

+
+

string

+

{% verbatim %}Value is the value of the environment variable.{% endverbatim %}

+
+

container.image

+

Optional

+
+

string

+

{% verbatim %}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.{% endverbatim %}

+
+

container.runAsUser

+

Optional

+
+

integer

+

{% verbatim %}Optional. If set, overrides the USER specified in the image with the given uid.{% endverbatim %}

+
+

container.workingDir

+

Optional

+
+

string

+

{% verbatim %}Optional. If set, overrides the default DIR specified by the image.{% endverbatim %}

+
+

displayName

+

Optional

+
+

string

+

{% verbatim %}Optional. Human-readable name for this workstation configuration.{% endverbatim %}

+
+

encryptionKey

+

Optional

+
+

object

+

{% verbatim %}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.{% endverbatim %}

+
+

encryptionKey.kmsCryptoKeyRef

+

Optional

+
+

object

+

{% verbatim %}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.{% endverbatim %}

+
+

encryptionKey.kmsCryptoKeyRef.external

+

Optional

+
+

string

+

{% verbatim %}A reference to an externally managed KMSCryptoKey. Should be in the format `projects/[kms_project_id]/locations/[region]/keyRings/[key_ring_id]/cryptoKeys/[key]`.{% endverbatim %}

+
+

encryptionKey.kmsCryptoKeyRef.name

+

Optional

+
+

string

+

{% verbatim %}The `name` of a `KMSCryptoKey` resource.{% endverbatim %}

+
+

encryptionKey.kmsCryptoKeyRef.namespace

+

Optional

+
+

string

+

{% verbatim %}The `namespace` of a `KMSCryptoKey` resource.{% endverbatim %}

+
+

encryptionKey.serviceAccountRef

+

Optional

+
+

object

+

{% verbatim %}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).{% endverbatim %}

+
+

encryptionKey.serviceAccountRef.external

+

Optional

+
+

string

+

{% verbatim %}The `email` field of an `IAMServiceAccount` resource.{% endverbatim %}

+
+

encryptionKey.serviceAccountRef.name

+

Optional

+
+

string

+

{% verbatim %}Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names{% endverbatim %}

+
+

encryptionKey.serviceAccountRef.namespace

+

Optional

+
+

string

+

{% verbatim %}Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/{% endverbatim %}

+
+

host

+

Optional

+
+

object

+

{% verbatim %}Optional. Runtime host for the workstation.{% endverbatim %}

+
+

host.gceInstance

+

Optional

+
+

object

+

{% verbatim %}Specifies a Compute Engine instance as the host.{% endverbatim %}

+
+

host.gceInstance.bootDiskSizeGB

+

Optional

+
+

integer

+

{% verbatim %}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.{% endverbatim %}

+
+

host.gceInstance.confidentialInstanceConfig

+

Optional

+
+

object

+

{% verbatim %}Optional. A set of Compute Engine Confidential VM instance options.{% endverbatim %}

+
+

host.gceInstance.confidentialInstanceConfig.enableConfidentialCompute

+

Optional

+
+

boolean

+

{% verbatim %}Optional. Whether the instance has confidential compute enabled.{% endverbatim %}

+
+

host.gceInstance.disablePublicIPAddresses

+

Optional

+
+

boolean

+

{% verbatim %}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).{% endverbatim %}

+
+

host.gceInstance.enableNestedVirtualization

+

Optional

+
+

boolean

+

{% verbatim %}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.{% endverbatim %}

+
+

host.gceInstance.machineType

+

Optional

+
+

string

+

{% verbatim %}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).{% endverbatim %}

+
+

host.gceInstance.poolSize

+

Optional

+
+

integer

+

{% verbatim %}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.{% endverbatim %}

+
+

host.gceInstance.serviceAccountRef

+

Optional

+
+

object

+

{% verbatim %}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.{% endverbatim %}

+
+

host.gceInstance.serviceAccountRef.external

+

Optional

+
+

string

+

{% verbatim %}The `email` field of an `IAMServiceAccount` resource.{% endverbatim %}

+
+

host.gceInstance.serviceAccountRef.name

+

Optional

+
+

string

+

{% verbatim %}Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names{% endverbatim %}

+
+

host.gceInstance.serviceAccountRef.namespace

+

Optional

+
+

string

+

{% verbatim %}Namespace of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/{% endverbatim %}

+
+

host.gceInstance.serviceAccountScopes

+

Optional

+
+

list (string)

+

{% verbatim %}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.{% endverbatim %}

+
+

host.gceInstance.serviceAccountScopes[]

+

Optional

+
+

string

+

{% verbatim %}{% endverbatim %}

+
+

host.gceInstance.shieldedInstanceConfig

+

Optional

+
+

object

+

{% verbatim %}Optional. A set of Compute Engine Shielded instance options.{% endverbatim %}

+
+

host.gceInstance.shieldedInstanceConfig.enableIntegrityMonitoring

+

Optional

+
+

boolean

+

{% verbatim %}Optional. Whether the instance has integrity monitoring enabled.{% endverbatim %}

+
+

host.gceInstance.shieldedInstanceConfig.enableSecureBoot

+

Optional

+
+

boolean

+

{% verbatim %}Optional. Whether the instance has Secure Boot enabled.{% endverbatim %}

+
+

host.gceInstance.shieldedInstanceConfig.enableVTPM

+

Optional

+
+

boolean

+

{% verbatim %}Optional. Whether the instance has the vTPM enabled.{% endverbatim %}

+
+

host.gceInstance.tags

+

Optional

+
+

list (string)

+

{% verbatim %}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).{% endverbatim %}

+
+

host.gceInstance.tags[]

+

Optional

+
+

string

+

{% verbatim %}{% endverbatim %}

+
+

idleTimeout

+

Optional

+
+

string

+

{% verbatim %}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).{% endverbatim %}

+
+

labels

+

Optional

+
+

list (object)

+

{% verbatim %}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.{% endverbatim %}

+
+

labels[]

+

Optional

+
+

object

+

{% verbatim %}{% endverbatim %}

+
+

labels[].key

+

Optional

+
+

string

+

{% verbatim %}Key for the label.{% endverbatim %}

+
+

labels[].value

+

Optional

+
+

string

+

{% verbatim %}Value for the label.{% endverbatim %}

+
+

parentRef

+

Required*

+
+

object

+

{% verbatim %}Parent is a reference to the parent WorkstationCluster for this WorkstationConfig.{% endverbatim %}

+
+

parentRef.external

+

Optional

+
+

string

+

{% verbatim %}A reference to an externally managed WorkstationCluster resource. Should be in the format "projects//locations//workstationClusters/".{% endverbatim %}

+
+

parentRef.name

+

Optional

+
+

string

+

{% verbatim %}The name of a WorkstationCluster resource.{% endverbatim %}

+
+

parentRef.namespace

+

Optional

+
+

string

+

{% verbatim %}The namespace of a WorkstationCluster resource.{% endverbatim %}

+
+

persistentDirectories

+

Optional

+
+

list (object)

+

{% verbatim %}Optional. Directories to persist across workstation sessions.{% endverbatim %}

+
+

persistentDirectories[]

+

Optional

+
+

object

+

{% verbatim %}{% endverbatim %}

+
+

persistentDirectories[].gcePD

+

Optional

+
+

object

+

{% verbatim %}A PersistentDirectory backed by a Compute Engine persistent disk.{% endverbatim %}

+
+

persistentDirectories[].gcePD.diskType

+

Optional

+
+

string

+

{% verbatim %}Optional. The [type of the persistent disk](https://cloud.google.com/compute/docs/disks#disk-types) for the home directory. Defaults to `"pd-standard"`.{% endverbatim %}

+
+

persistentDirectories[].gcePD.fsType

+

Optional

+
+

string

+

{% verbatim %}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"`.{% endverbatim %}

+
+

persistentDirectories[].gcePD.reclaimPolicy

+

Optional

+
+

string

+

{% verbatim %}Optional. Whether the persistent disk should be deleted when the workstation is deleted. Valid values are `DELETE` and `RETAIN`. Defaults to `DELETE`.{% endverbatim %}

+
+

persistentDirectories[].gcePD.sizeGB

+

Optional

+
+

integer

+

{% verbatim %}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"`.{% endverbatim %}

+
+

persistentDirectories[].gcePD.sourceSnapshot

+

Optional

+
+

string

+

{% verbatim %}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.{% endverbatim %}

+
+

persistentDirectories[].mountPath

+

Optional

+
+

string

+

{% verbatim %}Optional. Location of this directory in the running workstation.{% endverbatim %}

+
+

readinessChecks

+

Optional

+
+

list (object)

+

{% verbatim %}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.{% endverbatim %}

+
+

readinessChecks[]

+

Optional

+
+

object

+

{% verbatim %}{% endverbatim %}

+
+

readinessChecks[].path

+

Optional

+
+

string

+

{% verbatim %}Optional. Path to which the request should be sent.{% endverbatim %}

+
+

readinessChecks[].port

+

Optional

+
+

integer

+

{% verbatim %}Optional. Port to which the request should be sent.{% endverbatim %}

+
+

replicaZones

+

Optional

+
+

list (string)

+

{% verbatim %}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.{% endverbatim %}

+
+

replicaZones[]

+

Optional

+
+

string

+

{% verbatim %}{% endverbatim %}

+
+

resourceID

+

Optional

+
+

string

+

{% verbatim %}Immutable. The WorkstationConfig name. If not given, the metadata.name will be used.{% endverbatim %}

+
+

runningTimeout

+

Optional

+
+

string

+

{% verbatim %}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.{% endverbatim %}

+
+ + +

* Field is required when parent field is specified

+ + +### Status +#### Schema +```yaml +conditions: +- lastTransitionTime: string + message: string + reason: string + status: string + type: string +externalRef: string +observedGeneration: integer +observedState: + createTime: string + degraded: boolean + deleteTime: string + etag: string + gcpConditions: + - code: integer + message: string + host: + gceInstance: + pooledInstances: integer + uid: string + updateTime: string +``` + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Fields
conditions +

list (object)

+

{% verbatim %}Conditions represent the latest available observations of the object's current state.{% endverbatim %}

+
conditions[] +

object

+

{% verbatim %}{% endverbatim %}

+
conditions[].lastTransitionTime +

string

+

{% verbatim %}Last time the condition transitioned from one status to another.{% endverbatim %}

+
conditions[].message +

string

+

{% verbatim %}Human-readable message indicating details about last transition.{% endverbatim %}

+
conditions[].reason +

string

+

{% verbatim %}Unique, one-word, CamelCase reason for the condition's last transition.{% endverbatim %}

+
conditions[].status +

string

+

{% verbatim %}Status is the status of the condition. Can be True, False, Unknown.{% endverbatim %}

+
conditions[].type +

string

+

{% verbatim %}Type is the type of the condition.{% endverbatim %}

+
externalRef +

string

+

{% verbatim %}A unique specifier for the WorkstationConfig resource in GCP.{% endverbatim %}

+
observedGeneration +

integer

+

{% verbatim %}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.{% endverbatim %}

+
observedState +

object

+

{% verbatim %}ObservedState is the state of the resource as most recently observed in GCP.{% endverbatim %}

+
observedState.createTime +

string

+

{% verbatim %}Output only. Time when this workstation configuration was created.{% endverbatim %}

+
observedState.degraded +

boolean

+

{% verbatim %}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.{% endverbatim %}

+
observedState.deleteTime +

string

+

{% verbatim %}Output only. Time when this workstation configuration was soft-deleted.{% endverbatim %}

+
observedState.etag +

string

+

{% verbatim %}Output only. 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.{% endverbatim %}

+
observedState.gcpConditions +

list (object)

+

{% verbatim %}Output only. Status conditions describing the current resource state.{% endverbatim %}

+
observedState.gcpConditions[] +

object

+

{% verbatim %}{% endverbatim %}

+
observedState.gcpConditions[].code +

integer

+

{% verbatim %}The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code].{% endverbatim %}

+
observedState.gcpConditions[].message +

string

+

{% verbatim %}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.{% endverbatim %}

+
observedState.host +

object

+

{% verbatim %}Output only. Observed state of the runtime host for the workstation configuration.{% endverbatim %}

+
observedState.host.gceInstance +

object

+

{% verbatim %}Output only. Observed state of the Compute Engine runtime host for the workstation configuration.{% endverbatim %}

+
observedState.host.gceInstance.pooledInstances +

integer

+

{% verbatim %}Output only. Number of instances currently available in the pool for faster workstation startup.{% endverbatim %}

+
observedState.uid +

string

+

{% verbatim %}Output only. A system-assigned unique identifier for this workstation configuration.{% endverbatim %}

+
observedState.updateTime +

string

+

{% verbatim %}Output only. Time when this workstation configuration was most recently updated.{% endverbatim %}

+
+ +## Sample YAML(s) + +### Basic WorkstationConfig +```yaml +# 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. + +apiVersion: workstations.cnrm.cloud.google.com/v1beta1 +kind: WorkstationConfig +metadata: + name: workstationconfig-sample +spec: + parentRef: + name: workstationcluster-dep + idleTimeout: "1200s" + runningTimeout: "43200s" + host: + gceInstance: + machineType: "e2-standard-4" + serviceAccountRef: + external: "service-${PROJECT_NUMBER1}@gcp-sa-workstationsvm.iam.gserviceaccount.com" + bootDiskSizeGB: 50 + container: + image: "us-west1-docker.pkg.dev/cloud-workstations-images/predefined/code-oss:latest" + replicaZones: + - us-west1-a + - us-west1-b +--- +apiVersion: compute.cnrm.cloud.google.com/v1beta1 +kind: ComputeNetwork +metadata: + name: computenetwork-dep +spec: + routingMode: GLOBAL + autoCreateSubnetworks: false +--- +apiVersion: compute.cnrm.cloud.google.com/v1beta1 +kind: ComputeSubnetwork +metadata: + name: computesubnetwork-dep +spec: + ipCidrRange: 10.0.0.0/24 + region: us-west1 + networkRef: + name: computenetwork-dep +--- +apiVersion: workstations.cnrm.cloud.google.com/v1beta1 +kind: WorkstationCluster +metadata: + name: workstationcluster-dep +spec: + projectRef: + external: "projects/${PROJECT_NUMBER1}" + location: us-west1 + networkRef: + name: computenetwork-dep + subnetworkRef: + name: computesubnetwork-dep +``` + + +Note: If you have any trouble with instantiating the resource, refer to Troubleshoot Config Connector. + +{% endblock %} diff --git a/scripts/generate-google3-docs/resource-reference/overview.md b/scripts/generate-google3-docs/resource-reference/overview.md index c4bff67a75..817c1e5efb 100644 --- a/scripts/generate-google3-docs/resource-reference/overview.md +++ b/scripts/generate-google3-docs/resource-reference/overview.md @@ -902,6 +902,10 @@ issues for {{product_name_short}}. {{workstations_name}} WorkstationCluster + + {{workstations_name}} + WorkstationConfig + diff --git a/scripts/generate-google3-docs/resource-reference/templates/workstations_workstationconfig.tmpl b/scripts/generate-google3-docs/resource-reference/templates/workstations_workstationconfig.tmpl new file mode 100644 index 0000000000..d3e98bbaa6 --- /dev/null +++ b/scripts/generate-google3-docs/resource-reference/templates/workstations_workstationconfig.tmpl @@ -0,0 +1,53 @@ +{{template "headercomment.tmpl" .}} + +{% extends "config-connector/_base.html" %} + +{% block page_title %}{{ .Kind}}{% endblock %} +{% block body %} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +{{template "iamsupport.tmpl" .}} + + + + + +
PropertyValue
{{"{{gcp_name_short}}"}} Service NameCloud Workstations
{{"{{gcp_name_short}}"}} Service Documentation/workstations/docs/
{{"{{gcp_name_short}}"}} REST Resource Namev1.projects.locations.workstationClusters.workstationConfigs
{{"{{gcp_name_short}}"}} REST Resource Documentation +{{ .ShortNames}}
{{"{{product_name_short}}"}} Service Nameworkstations.googleapis.com
{{"{{product_name_short}}"}} Resource Fully Qualified Name{{ .FullyQualifiedName}}
{{"{{product_name_short}}"}} Default Average Reconcile Interval In Seconds{{ .DefaultReconcileInterval}}
+ +{{template "resource.tmpl" .}} +{{template "endnote.tmpl" .}} +{% endblock %} From 05e927ee6b17f84bdf89ac630ec4c2016dfae8bb Mon Sep 17 00:00:00 2001 From: Jason Vigil Date: Wed, 18 Dec 2024 22:39:39 +0000 Subject: [PATCH 2/2] fix: Update workstations for latest reference format --- apis/workstations/v1alpha1/config_identity.go | 2 +- apis/workstations/v1alpha1/workstation_identity.go | 2 +- apis/workstations/v1beta1/config_identity.go | 2 +- apis/workstations/v1beta1/config_reference.go | 2 +- ...n_workstationconfigs.workstations.cnrm.cloud.google.com.yaml | 2 +- .../generated/resource-docs/workstations/workstationconfig.md | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/apis/workstations/v1alpha1/config_identity.go b/apis/workstations/v1alpha1/config_identity.go index 7ea038fd91..198360da2e 100644 --- a/apis/workstations/v1alpha1/config_identity.go +++ b/apis/workstations/v1alpha1/config_identity.go @@ -119,7 +119,7 @@ func NewWorkstationConfigIdentity(ctx context.Context, reader client.Reader, obj func ParseWorkstationConfigExternal(external string) (parent *WorkstationConfigParent, resourceID string, err error) { tokens := strings.Split(external, "/") if len(tokens) != 8 || tokens[0] != "projects" || tokens[2] != "locations" || tokens[4] != "workstationClusters" || tokens[6] != "workstationConfigs" { - return nil, "", fmt.Errorf("format of Workstation external=%q was not known (use projects//locations//workstationClusters//workstationConfigs/)", external) + return nil, "", fmt.Errorf("format of Workstation external=%q was not known (use projects/{{projectID}}/locations/{{location}}/workstationClusters/{{workstationclusterID}}/workstationConfigs/{{workstationconfigID}})", external) } parent = &WorkstationConfigParent{ ProjectID: tokens[1], diff --git a/apis/workstations/v1alpha1/workstation_identity.go b/apis/workstations/v1alpha1/workstation_identity.go index 16cb819ce7..5415656cea 100644 --- a/apis/workstations/v1alpha1/workstation_identity.go +++ b/apis/workstations/v1alpha1/workstation_identity.go @@ -128,7 +128,7 @@ func NewWorkstationIdentity(ctx context.Context, reader client.Reader, obj *Work func ParseWorkstationExternal(external string) (parent *WorkstationParent, resourceID string, err error) { tokens := strings.Split(external, "/") if len(tokens) != 10 || tokens[0] != "projects" || tokens[2] != "locations" || tokens[4] != "workstationClusters" || tokens[6] != "workstationConfigs" || tokens[8] != "workstations" { - return nil, "", fmt.Errorf("format of Workstation external=%q was not known (use projects//locations//workstationClusters//workstationConfigs//workstations/)", external) + return nil, "", fmt.Errorf("format of Workstation external=%q was not known (use projects/{{projectID}}/locations/{{location}}/workstationClusters/{{workstationclusterID}}/workstationConfigs/{{workstationconfigID}}/workstations/{{workstationID}})", external) } parent = &WorkstationParent{ ProjectID: tokens[1], diff --git a/apis/workstations/v1beta1/config_identity.go b/apis/workstations/v1beta1/config_identity.go index 591cd6c031..dbda18ac11 100644 --- a/apis/workstations/v1beta1/config_identity.go +++ b/apis/workstations/v1beta1/config_identity.go @@ -120,7 +120,7 @@ func NewWorkstationConfigIdentity(ctx context.Context, reader client.Reader, obj func ParseWorkstationConfigExternal(external string) (parent *WorkstationConfigParent, resourceID string, err error) { tokens := strings.Split(external, "/") if len(tokens) != 8 || tokens[0] != "projects" || tokens[2] != "locations" || tokens[4] != "workstationClusters" || tokens[6] != "workstationConfigs" { - return nil, "", fmt.Errorf("format of Workstation external=%q was not known (use projects//locations//workstationClusters//workstationConfigs/)", external) + return nil, "", fmt.Errorf("format of Workstation external=%q was not known (use projects/{{projectID}}/locations/{{location}}/workstationClusters/{{workstationclusterID}}/workstationConfigs/{{workstationconfigID}})", external) } parent = &WorkstationConfigParent{ ProjectID: tokens[1], diff --git a/apis/workstations/v1beta1/config_reference.go b/apis/workstations/v1beta1/config_reference.go index c6e2f925d6..f1ca966d9f 100644 --- a/apis/workstations/v1beta1/config_reference.go +++ b/apis/workstations/v1beta1/config_reference.go @@ -32,7 +32,7 @@ var _ refsv1beta1.ExternalNormalizer = &WorkstationConfigRef{} // holds the GCP identifier for the KRM object. type WorkstationConfigRef struct { // A reference to an externally managed WorkstationConfig resource. - // Should be in the format "projects//locations//workstationClusters//workstationConfigs/". + // Should be in the format "projects/{{projectID}}/locations/{{location}}/workstationClusters/{{workstationclusterID}}/workstationConfigs/{{workstationconfigID}}". External string `json:"external,omitempty"` // The name of a WorkstationConfig resource. 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 index 2286f03a7d..9c688483fe 100644 --- 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 @@ -1048,7 +1048,7 @@ spec: properties: external: description: A reference to an externally managed WorkstationCluster - resource. Should be in the format "projects//locations//workstationClusters/". + resource. Should be in the format "projects/{{projectID}}/locations/{{location}}/workstationClusters/{{workstationclusterID}}". type: string name: description: The name of a WorkstationCluster resource. diff --git a/scripts/generate-google3-docs/resource-reference/generated/resource-docs/workstations/workstationconfig.md b/scripts/generate-google3-docs/resource-reference/generated/resource-docs/workstations/workstationconfig.md index 0fee948b9e..989eb6f1d9 100644 --- a/scripts/generate-google3-docs/resource-reference/generated/resource-docs/workstations/workstationconfig.md +++ b/scripts/generate-google3-docs/resource-reference/generated/resource-docs/workstations/workstationconfig.md @@ -760,7 +760,7 @@ runningTimeout: string

string

-

{% verbatim %}A reference to an externally managed WorkstationCluster resource. Should be in the format "projects//locations//workstationClusters/".{% endverbatim %}

+

{% verbatim %}A reference to an externally managed WorkstationCluster resource. Should be in the format "projects/{{projectID}}/locations/{{location}}/workstationClusters/{{workstationclusterID}}".{% endverbatim %}