Skip to content

Commit 2b8f0c7

Browse files
committed
CORS-4282: Remove the installer gcp service endpoints.
Service endpoints are no longer needed in favor of the PSCEndpoint.
1 parent 4180662 commit 2b8f0c7

File tree

6 files changed

+6
-125
lines changed

6 files changed

+6
-125
lines changed

data/data/install.openshift.io_installconfigs.yaml

Lines changed: 0 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -5885,64 +5885,6 @@ spec:
58855885
description: Region specifies the GCP region where the cluster
58865886
will be created.
58875887
type: string
5888-
serviceEndpoints:
5889-
description: |-
5890-
ServiceEndpoints list contains custom endpoints which will override default
5891-
service endpoint of GCP Services.
5892-
There must be only one ServiceEndpoint for a service.
5893-
items:
5894-
description: |-
5895-
GCPServiceEndpoint store the configuration of a custom url to
5896-
override existing defaults of GCP Services.
5897-
properties:
5898-
name:
5899-
description: |-
5900-
name is the name of the GCP service whose endpoint is being overridden.
5901-
This must be provided and cannot be empty.
5902-
5903-
Allowed values are Compute, Container, CloudResourceManager, DNS, File, IAM, ServiceUsage,
5904-
Storage, and TagManager.
5905-
5906-
As an example, when setting the name to Compute all requests made by the caller to the GCP Compute
5907-
Service will be directed to the endpoint specified in the url field.
5908-
enum:
5909-
- Compute
5910-
- Container
5911-
- CloudResourceManager
5912-
- DNS
5913-
- File
5914-
- IAM
5915-
- IAMCredentials
5916-
- OAuth
5917-
- ServiceUsage
5918-
- Storage
5919-
- STS
5920-
type: string
5921-
url:
5922-
description: |-
5923-
url is a fully qualified URI that overrides the default endpoint for a client using the GCP service specified
5924-
in the name field.
5925-
url is required, must use the scheme https, must not be more than 253 characters in length,
5926-
and must be a valid URL according to Go's net/url package (https://pkg.go.dev/net/url#URL)
5927-
5928-
An example of a valid endpoint that overrides the Compute Service: "https://compute-myendpoint1.p.googleapis.com"
5929-
maxLength: 253
5930-
type: string
5931-
x-kubernetes-validations:
5932-
- message: must be a valid URL
5933-
rule: isURL(self)
5934-
- message: scheme must be https
5935-
rule: 'isURL(self) ? (url(self).getScheme() == "https")
5936-
: true'
5937-
- message: url must consist only of a scheme and domain.
5938-
The url path must be empty.
5939-
rule: url(self).getEscapedPath() == "" || url(self).getEscapedPath()
5940-
== "/"
5941-
required:
5942-
- name
5943-
- url
5944-
type: object
5945-
type: array
59465888
userLabels:
59475889
description: |-
59485890
userLabels has additional keys and values that the installer will add as

pkg/asset/installconfig/gcp/validation.go

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ import (
55
"encoding/json"
66
"fmt"
77
"net"
8-
"net/http"
9-
"net/url"
108
"slices"
119
"strings"
1210

@@ -64,7 +62,6 @@ func Validate(client API, ic *types.InstallConfig) error {
6462
allErrs = append(allErrs, validateRegion(client, ic, field.NewPath("platform").Child("gcp"))...)
6563
allErrs = append(allErrs, validateZones(client, ic)...)
6664
allErrs = append(allErrs, validateNetworks(client, ic, field.NewPath("platform").Child("gcp"))...)
67-
allErrs = append(allErrs, validateServiceEndpoints(client, ic, field.NewPath("platform").Child("gcp"))...)
6865
allErrs = append(allErrs, validateInstanceTypes(client, ic)...)
6966
allErrs = append(allErrs, ValidateCredentialMode(client, ic)...)
7067
allErrs = append(allErrs, validatePreexistingServiceAccount(client, ic)...)
@@ -559,21 +556,6 @@ func validateNetworks(client API, ic *types.InstallConfig, fieldPath *field.Path
559556
return allErrs
560557
}
561558

562-
func validateServiceEndpoints(_ API, ic *types.InstallConfig, fieldPath *field.Path) field.ErrorList {
563-
allErrs := field.ErrorList{}
564-
565-
// attempt to resolve all the custom (overridden) endpoints. If any are not reachable,
566-
// then the installation should fail not skip the endpoint use.
567-
for id, serviceEndpoint := range ic.GCP.ServiceEndpoints {
568-
if _, err := url.Parse(serviceEndpoint.URL); err != nil {
569-
allErrs = append(allErrs, field.Invalid(fieldPath.Child("serviceEndpoints").Index(id), serviceEndpoint.URL, fmt.Sprintf("failed to parse service endpoint url: %v", err)))
570-
} else if _, err := http.Head(serviceEndpoint.URL); err != nil {
571-
allErrs = append(allErrs, field.Invalid(fieldPath.Child("serviceEndpoints").Index(id), serviceEndpoint.URL, fmt.Sprintf("error connecting to endpoint: %v", err)))
572-
}
573-
}
574-
return allErrs
575-
}
576-
577559
func validateSubnet(client API, ic *types.InstallConfig, fieldPath *field.Path, subnets []*compute.Subnetwork, name string) field.ErrorList {
578560
allErrs := field.ErrorList{}
579561

pkg/asset/installconfig/gcp/validation_test.go

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ import (
2222
"k8s.io/apimachinery/pkg/util/sets"
2323
"k8s.io/apimachinery/pkg/util/validation/field"
2424

25-
configv1 "github.com/openshift/api/config/v1"
2625
"github.com/openshift/installer/pkg/asset/installconfig/gcp/mock"
2726
"github.com/openshift/installer/pkg/ipnet"
2827
"github.com/openshift/installer/pkg/types"
@@ -119,26 +118,6 @@ var (
119118
invalidateBaseDomain = func(ic *types.InstallConfig) { ic.BaseDomain = invalidBaseDomain }
120119
enableCustomDNS = func(ic *types.InstallConfig) { ic.GCP.UserProvisionedDNS = customDNS.UserProvisionedDNSEnabled }
121120

122-
validServiceEndpoint = func(ic *types.InstallConfig) {
123-
ic.Publish = types.InternalPublishingStrategy
124-
ic.GCP.ServiceEndpoints = append(ic.GCP.ServiceEndpoints,
125-
configv1.GCPServiceEndpoint{
126-
Name: configv1.GCPServiceEndpointNameCompute,
127-
URL: validServiceEndpointURL,
128-
},
129-
)
130-
}
131-
132-
invalidServiceEndpointBadFormat = func(ic *types.InstallConfig) {
133-
ic.Publish = types.InternalPublishingStrategy
134-
ic.GCP.ServiceEndpoints = append(ic.GCP.ServiceEndpoints,
135-
configv1.GCPServiceEndpoint{
136-
Name: configv1.GCPServiceEndpointNameStorage,
137-
URL: invalidServiceEndpointURL,
138-
},
139-
)
140-
}
141-
142121
invalidKeyRing = gcp.KMSKeyReference{
143122
Name: "invalidKeyName",
144123
KeyRing: "invalidKeyRingName",
@@ -467,19 +446,6 @@ func TestGCPInstallConfigValidation(t *testing.T) {
467446
expectedError: true,
468447
expectedErrMsg: "platform.gcp.compute.encryptionKey.kmsKey.keyRing: Invalid value: \"invalidKeyRingName\": failed to find key ring invalidKeyRingName: data, platform.gcp.defaultMachinePool.encryptionKey.kmsKey.keyRing: Invalid value: \"invalidKeyRingName\": failed to find key ring invalidKeyRingName: data",
469448
},
470-
{
471-
name: "Valid Service Endpoint Override",
472-
edits: editFunctions{validServiceEndpoint},
473-
records: []*dns.ResourceRecordSet{{Name: "api.another-cluster-name.example.installer.domain."}},
474-
expectedError: false,
475-
},
476-
{
477-
name: "Invalid Service Endpoint Override Bad Format",
478-
edits: editFunctions{invalidServiceEndpointBadFormat},
479-
records: []*dns.ResourceRecordSet{{Name: "api.another-cluster-name.example.installer.domain."}},
480-
expectedError: true,
481-
expectedErrMsg: `[platform.gcp.serviceEndpoint\[0\]: Invalid value: \"http://badstorage.googleapis\": Head \"http://badstorage.googleapis\": dial tcp: lookup badstorage.googleapis: no such host]`,
482-
},
483449
{
484450
name: "Invalid Base Domain",
485451
edits: editFunctions{invalidateBaseDomain},

pkg/types/gcp/platform.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package gcp
33
import (
44
"fmt"
55

6-
configv1 "github.com/openshift/api/config/v1"
76
"github.com/openshift/installer/pkg/types/dns"
87
)
98

@@ -100,12 +99,6 @@ type Platform struct {
10099
// +kubebuilder:validation:Enum="Enabled";"Disabled"
101100
UserProvisionedDNS dns.UserProvisionedDNS `json:"userProvisionedDNS,omitempty"`
102101

103-
// ServiceEndpoints list contains custom endpoints which will override default
104-
// service endpoint of GCP Services.
105-
// There must be only one ServiceEndpoint for a service.
106-
// +optional
107-
ServiceEndpoints []configv1.GCPServiceEndpoint `json:"serviceEndpoints,omitempty"`
108-
109102
// Endpoint is the private service connect endpoint.
110103
// +optional
111104
Endpoint *PSCEndpoint `json:"endpoint,omitempty"`

pkg/types/gcp/validation/featuregates.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ func GatedFeatures(c *types.InstallConfig) []featuregates.GatedInstallConfigFeat
1515
return []featuregates.GatedInstallConfigFeature{
1616
{
1717
FeatureGateName: features.FeatureGateGCPCustomAPIEndpointsInstall,
18-
Condition: len(g.ServiceEndpoints) > 0,
19-
Field: field.NewPath("platform", "gcp", "serviceEndpoints"),
18+
Condition: g.Endpoint != nil,
19+
Field: field.NewPath("platform", "gcp", "endpoint"),
2020
},
2121
}
2222
}

pkg/types/validation/featuregate_test.go

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
"github.com/openshift/installer/pkg/types"
1111
"github.com/openshift/installer/pkg/types/azure"
1212
"github.com/openshift/installer/pkg/types/dns"
13+
gcptypes "github.com/openshift/installer/pkg/types/gcp"
1314
"github.com/openshift/installer/pkg/types/vsphere"
1415
)
1516

@@ -24,15 +25,12 @@ func TestFeatureGates(t *testing.T) {
2425
installConfig: func() *types.InstallConfig {
2526
c := validInstallConfig()
2627
c.GCP = validGCPPlatform()
27-
c.GCP.ServiceEndpoints = []v1.GCPServiceEndpoint{
28-
{
29-
Name: v1.GCPServiceEndpointNameCompute,
30-
URL: "https://compute.googleapis.com",
31-
},
28+
c.GCP.Endpoint = &gcptypes.PSCEndpoint{
29+
Name: "test-endpoint",
3230
}
3331
return c
3432
}(),
35-
expected: `^platform.gcp.serviceEndpoints: Forbidden: this field is protected by the GCPCustomAPIEndpointsInstall feature gate which must be enabled through either the TechPreviewNoUpgrade or CustomNoUpgrade feature set$`,
33+
expected: `^platform.gcp.endpoint: Forbidden: this field is protected by the GCPCustomAPIEndpointsInstall feature gate which must be enabled through either the TechPreviewNoUpgrade or CustomNoUpgrade feature set$`,
3634
},
3735
{
3836
name: "AWS UserProvisionedDNS is not allowed without Feature Gates",

0 commit comments

Comments
 (0)