Skip to content
Open
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
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ require (
github.com/onsi/gomega v1.39.1
github.com/opencontainers/go-digest v1.0.0
github.com/openshift-eng/openshift-tests-extension v0.0.0-20260707142426-572a3e9deb7a
github.com/openshift/api v0.0.0-20260810132456-8f52beb625b5
github.com/openshift/api v0.0.0-20260909133205-6733660e6ece
github.com/openshift/client-go v0.0.0-20260810202730-ddca5e0b7146
github.com/openshift/imagebuilder v1.2.21
github.com/openshift/library-go v0.0.0-20260720123941-85336565c3c7
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -651,8 +651,8 @@ github.com/opencontainers/selinux v1.13.1 h1:A8nNeceYngH9Ow++M+VVEwJVpdFmrlxsN22
github.com/opencontainers/selinux v1.13.1/go.mod h1:S10WXZ/osk2kWOYKy1x2f/eXF5ZHJoUs8UU/2caNRbg=
github.com/openshift-eng/openshift-tests-extension v0.0.0-20260707142426-572a3e9deb7a h1:ulT0JZ/x6S4hYhyjUJ9T49YAxDLl1i5idFOMm9RHBkY=
github.com/openshift-eng/openshift-tests-extension v0.0.0-20260707142426-572a3e9deb7a/go.mod h1:pHOS9c6BjZv91OkkHyIHAOWnYhxwcxWQkyYGEvPyUCE=
github.com/openshift/api v0.0.0-20260810132456-8f52beb625b5 h1:/UAIG4kF4dXdamTuN9rL5kSjbQZ9wDES9O2q/wS8Bsk=
github.com/openshift/api v0.0.0-20260810132456-8f52beb625b5/go.mod h1:k6qH5QOVa5GDln2VVm8Jz4NV3Z7R2SATHFLwGS6Wh3M=
github.com/openshift/api v0.0.0-20260909133205-6733660e6ece h1:coCyUoMidBLAL6dRDz+QVSMtkGNbjQ4CxLNKf6CqvEs=
github.com/openshift/api v0.0.0-20260909133205-6733660e6ece/go.mod h1:k6qH5QOVa5GDln2VVm8Jz4NV3Z7R2SATHFLwGS6Wh3M=
github.com/openshift/apiserver-library-go v0.0.0-20260715200723-42e5e402ca43 h1:V9hWaBi9cnohNk1F0Ph6wpI0otMWqMHleJ3oj5603Bc=
github.com/openshift/apiserver-library-go v0.0.0-20260715200723-42e5e402ca43/go.mod h1:ZuzfEq1ccZpHNx05xEUKlm2TcMHt2iXVutb79kAuTfM=
github.com/openshift/client-go v0.0.0-20260810202730-ddca5e0b7146 h1:fX/gaOPiS2vrYGSAFSeqqoWjj32H+NbMmB5RDjwhCnU=
Expand Down
38 changes: 38 additions & 0 deletions pkg/controller/template/gcp_healthchecks.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package template

// gcpPublicHealthCheckSourceRanges are the prober ranges for public GCP.
var gcpPublicHealthCheckSourceRanges = []string{
"35.191.0.0/16",
"130.211.0.0/22",
}

// gcdHealthCheckSourceRanges maps a GCD region to its prober ranges. Sourced
// from the "Probe IP ranges" section of each region's
// load-balancing/docs/firewall-rules (u-france-east1: https://documentation.s3ns.fr).
var gcdHealthCheckSourceRanges = map[string][]string{
"u-germany-northeast1": {
"34.3.144.0/23",
"34.3.151.0/26",
"34.3.151.64/26",
"136.124.104.0/22",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This and the following entry are listed for both germany and france, are they actually regional? Or global? (Doesn't affect the implementation I think but just curious)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm yes apparently both of these ranges are included in both S3NS france docs and the berlin region, the docs for which are not publicy available.

These are both for external passthrough load balancers so, yes they are global, although distinct from the gcp ranges.

"136.124.108.0/22",
},
"u-france-east1": {
"177.222.80.0/23",
"177.222.87.0/26",
"177.222.87.64/26",
"136.124.104.0/22",
"136.124.108.0/22",
},
}

// gcpHealthCheckSourceRanges returns the health-check prober source ranges to
// drop for the cluster's region. Only GCD regions have specific ranges.
func gcpHealthCheckSourceRanges(cfg RenderConfig) []string {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does https://github.com/openshift/api/blob/6733660e6ece5593234b36fd21327c4c8ec96db2/config/v1/types_infrastructure.go#L854 UniverseDomain intersect with this at all? Also I noticed that in the MCO vendored code, the featuregate for soverign cloud on GCP https://github.com/openshift/machine-config-operator/blob/main/vendor/github.com/openshift/api/features/features.go#L880 is still dev preview. Do you need a vendor bump?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does https://github.com/openshift/api/blob/6733660e6ece5593234b36fd21327c4c8ec96db2/config/v1/types_infrastructure.go#L854 UniverseDomain intersect with this at all?

Yes, it does intersect, in the sense that these GCD sovereign cloud regions have alternate universe domains. Most of the implementation for this feature has been updating clients to use an alternate universe domain when talking to GCD.

I'm not sure how strict the coupling is between GCD and alternate universe domains, it seems possible there will be uses of alternate universe domains separate from GCD.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also I noticed that in the MCO vendored code, the featuregate for soverign cloud on GCP https://github.com/openshift/machine-config-operator/blob/main/vendor/github.com/openshift/api/features/features.go#L880 is still dev preview. Do you need a vendor bump?

Maybe? I have not used feature gates in MCO before, and I wasn't aware it needed to be explicitly vendored in to be updated (the installer is like that too, but most components AFAIK do not need vendoring...)

On the other hand, nothing in the code is currently gated and the gated API field is not being used in this case, so it doesn't seem strictly necessary. That said, it seems like a good idea to have it up to date, so I can include a bump here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bumped openshift/api for good measure

if ps := cfg.Infra.Status.PlatformStatus; ps != nil && ps.GCP != nil {
if ranges, ok := gcdHealthCheckSourceRanges[ps.GCP.Region]; ok {
return ranges
}
}
return gcpPublicHealthCheckSourceRanges
}
60 changes: 60 additions & 0 deletions pkg/controller/template/gcp_healthchecks_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
package template

import (
"reflect"
"testing"

configv1 "github.com/openshift/api/config/v1"
mcfgv1 "github.com/openshift/api/machineconfiguration/v1"
)

func TestGCPHealthCheckSourceRanges(t *testing.T) {
renderConfig := func(region string) RenderConfig {
return RenderConfig{
ControllerConfigSpec: &mcfgv1.ControllerConfigSpec{
Infra: &configv1.Infrastructure{
Status: configv1.InfrastructureStatus{
PlatformStatus: &configv1.PlatformStatus{
GCP: &configv1.GCPPlatformStatus{Region: region},
},
},
},
},
}
}

tests := []struct {
name string
cfg RenderConfig
expected []string
}{
{
name: "public region uses public GCP ranges",
cfg: renderConfig("us-central1"),
expected: []string{"35.191.0.0/16", "130.211.0.0/22"},
},
{
name: "gcd berlin uses its own region ranges",
cfg: renderConfig("u-germany-northeast1"),
expected: []string{"34.3.144.0/23", "34.3.151.0/26", "34.3.151.64/26", "136.124.104.0/22", "136.124.108.0/22"},
},
{
name: "gcd france uses its own region ranges",
cfg: renderConfig("u-france-east1"),
expected: []string{"177.222.80.0/23", "177.222.87.0/26", "177.222.87.64/26", "136.124.104.0/22", "136.124.108.0/22"},
},
{
name: "nil gcp platform status falls back to public ranges",
cfg: RenderConfig{ControllerConfigSpec: &mcfgv1.ControllerConfigSpec{Infra: &configv1.Infrastructure{}}},
expected: []string{"35.191.0.0/16", "130.211.0.0/22"},
},
}

for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := gcpHealthCheckSourceRanges(tt.cfg); !reflect.DeepEqual(got, tt.expected) {
t.Errorf("gcpHealthCheckSourceRanges() = %v, want %v", got, tt.expected)
}
})
}
}
1 change: 1 addition & 0 deletions pkg/controller/template/render.go
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,7 @@ func renderTemplate(config RenderConfig, path string, b []byte) ([]byte, error)
funcs["cloudPlatformAPILoadBalancerIPs"] = cloudPlatformAPILoadBalancerIPs
funcs["cloudPlatformIngressLoadBalancerIPs"] = cloudPlatformIngressLoadBalancerIPs
funcs["platformType"] = platformType
funcs["gcpHealthCheckSourceRanges"] = gcpHealthCheckSourceRanges
funcs["join"] = strings.Join
tmpl, err := template.New(path).Funcs(funcs).Parse(string(b))
if err != nil {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,11 @@ contents:
# about to forward them off-node, which then prevents the bad conntrack entries
# from being created. The HealthCheck origin ip-ranges are documented:
# https://cloud.google.com/load-balancing/docs/health-check-concepts#ip-ranges
# GCD (sovereign) regions each have distinct ranges that need to be dropped.
add chain ip ${TABLE_NAME} forward { type filter hook forward priority filter; comment "gcp HealthCheck traffic"; }
add rule ip ${TABLE_NAME} forward ip saddr 35.191.0.0/16 drop
add rule ip ${TABLE_NAME} forward ip saddr 130.211.0.0/22 drop
{{- range gcpHealthCheckSourceRanges . }}
add rule ip ${TABLE_NAME} forward ip saddr {{ . }} drop
{{- end }}
EOF

mkdir -p "${RUN_DIR}"
Expand Down
2 changes: 1 addition & 1 deletion vendor/github.com/openshift/api/.golangci.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion vendor/github.com/openshift/api/config/v1/types.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 15 additions & 15 deletions vendor/github.com/openshift/api/config/v1/types_infrastructure.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading