Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ tests:
dnsType: PlatformDefault
serviceEndpoints:
- {name: "UnknownService", url: "https://compute-myendpoint1.p.googleapis.com"}
expectedStatusError: "[status.platformStatus.gcp.serviceEndpoints[0].name: Unsupported value: \"UnknownService\": supported values: \"Compute\", \"Container\", \"CloudResourceManager\", \"DNS\", \"File\", \"IAM\", \"IAMCredentials\", \"OAuth\", \"ServiceUsage\", \"Storage\", \"STS\", <nil>: Invalid value: \"null\": some validation rules were not checked because the object was invalid; correct the existing errors to complete validation]"
expectedStatusError: "[status.platformStatus.gcp.serviceEndpoints[0].name: Unsupported value: \"UnknownService\": supported values: \"Compute\", \"Container\", \"CloudResourceManager\", \"DNS\", \"File\", \"IAM\", \"ServiceUsage\", \"Storage\", <nil>: Invalid value: \"null\": some validation rules were not checked because the object was invalid; correct the existing errors to complete validation"
- name: Service Endpoint End Slash
initial: |
apiVersion: config.openshift.io/v1
Expand Down
82 changes: 0 additions & 82 deletions config/v1/types_infrastructure.go
Original file line number Diff line number Diff line change
Expand Up @@ -688,75 +688,6 @@ const (
AzureStackCloud AzureCloudEnvironment = "AzureStackCloud"
)

// GCPServiceEndpointName is the name of the GCP Service Endpoint.
// +kubebuilder:validation:Enum=Compute;Container;CloudResourceManager;DNS;File;IAM;IAMCredentials;OAuth;ServiceUsage;Storage;STS
type GCPServiceEndpointName string

const (
// GCPServiceEndpointNameCompute is the name used for the GCP Compute Service endpoint.
GCPServiceEndpointNameCompute GCPServiceEndpointName = "Compute"

// GCPServiceEndpointNameContainer is the name used for the GCP Container Service endpoint.
GCPServiceEndpointNameContainer GCPServiceEndpointName = "Container"

// GCPServiceEndpointNameCloudResource is the name used for the GCP Resource Manager Service endpoint.
GCPServiceEndpointNameCloudResource GCPServiceEndpointName = "CloudResourceManager"

// GCPServiceEndpointNameDNS is the name used for the GCP DNS Service endpoint.
GCPServiceEndpointNameDNS GCPServiceEndpointName = "DNS"

// GCPServiceEndpointNameFile is the name used for the GCP File Service endpoint.
GCPServiceEndpointNameFile GCPServiceEndpointName = "File"

// GCPServiceEndpointNameIAM is the name used for the GCP IAM Service endpoint.
GCPServiceEndpointNameIAM GCPServiceEndpointName = "IAM"

// GCPServiceEndpointNameIAMCredentials is the name used for the GCP IAM Credentials Service endpoint.
GCPServiceEndpointNameIAMCredentials GCPServiceEndpointName = "IAMCredentials"

// GCPServiceEndpointNameOAuth is the name used for the GCP OAuth2 Service endpoint.
GCPServiceEndpointNameOAuth GCPServiceEndpointName = "OAuth"

// GCPServiceEndpointNameServiceUsage is the name used for the GCP Service Usage Service endpoint.
GCPServiceEndpointNameServiceUsage GCPServiceEndpointName = "ServiceUsage"

// GCPServiceEndpointNameStorage is the name used for the GCP Storage Service endpoint.
GCPServiceEndpointNameStorage GCPServiceEndpointName = "Storage"

// GCPServiceEndpointNameSTS is the name used for the GCP STS Service endpoint.
GCPServiceEndpointNameSTS GCPServiceEndpointName = "STS"
)

// GCPServiceEndpoint store the configuration of a custom url to
// override existing defaults of GCP Services.
type GCPServiceEndpoint struct {
// name is the name of the GCP service whose endpoint is being overridden.
// This must be provided and cannot be empty.
//
// Allowed values are Compute, Container, CloudResourceManager, DNS, File, IAM, ServiceUsage,
// Storage, and TagManager.
//
// As an example, when setting the name to Compute all requests made by the caller to the GCP Compute
// Service will be directed to the endpoint specified in the url field.
//
// +required
Name GCPServiceEndpointName `json:"name"`

// url is a fully qualified URI that overrides the default endpoint for a client using the GCP service specified
// in the name field.
// url is required, must use the scheme https, must not be more than 253 characters in length,
// and must be a valid URL according to Go's net/url package (https://pkg.go.dev/net/url#URL)
//
// An example of a valid endpoint that overrides the Compute Service: "https://compute-myendpoint1.p.googleapis.com"
//
// +required
// +kubebuilder:validation:MaxLength=253
// +kubebuilder:validation:XValidation:rule="isURL(self)",message="must be a valid URL"
// +kubebuilder:validation:XValidation:rule="isURL(self) ? (url(self).getScheme() == \"https\") : true",message="scheme must be https"
// +kubebuilder:validation:XValidation:rule="url(self).getEscapedPath() == \"\" || url(self).getEscapedPath() == \"/\"",message="url must consist only of a scheme and domain. The url path must be empty."
URL string `json:"url"`
}

// GCPPlatformSpec holds the desired state of the Google Cloud Platform infrastructure provider.
// This only includes fields that can be modified in the cluster.
type GCPPlatformSpec struct{}
Expand Down Expand Up @@ -810,19 +741,6 @@ type GCPPlatformStatus struct {
// +optional
// +nullable
CloudLoadBalancerConfig *CloudLoadBalancerConfig `json:"cloudLoadBalancerConfig,omitempty"`

// serviceEndpoints specifies endpoints that override the default endpoints
// used when creating clients to interact with GCP services.
// When not specified, the default endpoint for the GCP region will be used.
// Only 1 endpoint override is permitted for each GCP service.
// The maximum number of endpoint overrides allowed is 11.
// +listType=map
// +listMapKey=name
// +kubebuilder:validation:MaxItems=11
// +kubebuilder:validation:XValidation:rule="self.all(x, self.exists_one(y, x.name == y.name))",message="only 1 endpoint override is permitted per GCP service name"
// +optional
// +openshift:enable:FeatureGate=GCPCustomAPIEndpointsInstall
ServiceEndpoints []GCPServiceEndpoint `json:"serviceEndpoints,omitempty"`
}

// GCPResourceLabel is a label to apply to GCP resources created for the cluster.
Expand Down
Loading