Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.17/fix/persistproxyspec #10025

Merged
merged 25 commits into from
Sep 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
6a1c498
test/kube2e/upgrade: Clean function calls
nfuden Sep 12, 2024
d4b7d32
test/kube2e/upgrade: Need to add some more linters locally
nfuden Sep 12, 2024
e6816ad
test/kube2e/upgrade: Add in basic routing validation
nfuden Sep 12, 2024
ae3b835
test/kube2e/upgrade: petstore upstream
nfuden Sep 12, 2024
700aa16
test/kube2e/upgrade: string error
nfuden Sep 12, 2024
f3d7e57
test/kube2e/upgrade: namespaces
nfuden Sep 12, 2024
c2655ae
test/kube2e/upgrade: namespaces
nfuden Sep 12, 2024
9b15383
test/kube2e/upgrade: selector
nfuden Sep 12, 2024
8e7fc51
test/kube2e/upgrade: local via remote diffs
nfuden Sep 12, 2024
409940e
test/kube2e/upgrade: legacy test uses legacy namespace
nfuden Sep 13, 2024
119ce32
test/kube2e/upgrade: clean imports
nfuden Sep 13, 2024
e5bc3e7
test/kube2e/upgrade: naming
nfuden Sep 13, 2024
8c64364
test/kube2e/upgrade: add forwards
nfuden Sep 13, 2024
2e9db97
test/kube2e/upgrade: add testservers
nfuden Sep 13, 2024
422b6d0
test/kube2e/upgrade: move testservers
nfuden Sep 13, 2024
2ef25de
test/kube2e/upgrade: remove enterprise options that leaked
nfuden Sep 13, 2024
c2d3346
test/kube2e/upgrade: remove enterprise options that leaked
nfuden Sep 13, 2024
9400939
test/kube2e/upgrade: yaml formatting
nfuden Sep 13, 2024
84f0676
test/kube2e/upgrade: spaces not tabs
nfuden Sep 13, 2024
380a2c7
projects/syncers: Add in the ability to view old labels on proxies
nfuden Sep 12, 2024
aac4b85
changelog
nfuden Sep 13, 2024
9416451
Merge branch 'v1.17.x' into 1.17/fix/persistproxyspec
nfuden Sep 13, 2024
9093f82
changelog: add feature path
nfuden Sep 13, 2024
1a16b01
changelog; Make feature user facing
nfuden Sep 13, 2024
f775b9f
Merge branch 'v1.17.x' into 1.17/fix/persistproxyspec
nfuden Sep 15, 2024
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
12 changes: 12 additions & 0 deletions changelog/v1.17.8/persist-proxy-upgrade-fix.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
changelog:
- type: FIX
issueLink: https://github.com/solo-io/gloo/issues/9968
resolvesIssue: false
description: >-
Fixes an issue on upgrades to 1.17+ where persistproxyspec was set to true.
nfuden marked this conversation as resolved.
Show resolved Hide resolved
Persist proxy spec is configured in helm via gateway.persistProxySpec or in ee gloo.gateway.persistProxySpec
- type: NON_USER_FACING
description:
Updates upgrade test with some of the extra functionality previously only in the enterprise test steps.
This is used to validate the main issue for persistproxy spec.
The changes do not adhere to our current best practices on writing tests but follow the prior art in enterprise.
4 changes: 3 additions & 1 deletion projects/clusteringress/pkg/translator/translator_syncer.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,10 @@ var (
//
// This is only required for backwards compatibility.
// Once users have upgraded to a version with new labels, we can delete this code and read/write the same labels.
// gloo-knative-translator removed in 1.17
nfuden marked this conversation as resolved.
Show resolved Hide resolved
// knative removed in 1.12
proxyLabelSelectorOptions = clients.ListOpts{
ExpressionSelector: glooutils.GetTranslatorSelectorExpression(glooutils.KnativeProxyValue, "knative"),
ExpressionSelector: glooutils.GetTranslatorSelectorExpression(glooutils.KnativeProxyValue, "gloo-knative-translator", "knative"),
}
)

Expand Down
4 changes: 3 additions & 1 deletion projects/gateway/pkg/syncer/translator_syncer.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,11 @@ var (
//
// This is only required for backwards compatibility.
// Once users have upgraded to a version with new labels, we can delete this code and read/write the same labels.
// gloo-gateway-translator removed in 1.17
// gateway removed in 1.12
proxyLabelSelectorOptions = clients.ListOpts{
Selector: proxyLabelsToWrite,
ExpressionSelector: glooutils.GetTranslatorSelectorExpression(glooutils.GlooEdgeProxyValue, "gateway"),
ExpressionSelector: glooutils.GetTranslatorSelectorExpression(glooutils.GlooEdgeProxyValue, "gloo-gateway-translator", "gateway"),
}
)

Expand Down
3 changes: 3 additions & 0 deletions projects/gloo/pkg/utils/translators.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ import (
"github.com/solo-io/solo-kit/pkg/api/v1/resources/core"
)

// Danger any label changes here likely requires more than a drop in replacement string.
// Any selectors likely still have to take the union of the old string name in order to facilitate orderly upgrades.

const (
// ProxyTypeKey is the label key applied to Proxies generated by the Gloo Edge translator
ProxyTypeKey = "created_by"
Expand Down
4 changes: 3 additions & 1 deletion projects/ingress/pkg/translator/translator_syncer.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,10 @@ var (
//
// This is only required for backwards compatibility.
// Once users have upgraded to a version with new labels, we can delete this code and read/write the same labels.
// gloo-ingress-translator removed in 1.17
// ingress removed in 1.12
proxyLabelSelectorOptions = clients.ListOpts{
ExpressionSelector: glooutils.GetTranslatorSelectorExpression(glooutils.IngressProxyValue, "ingress"),
ExpressionSelector: glooutils.GetTranslatorSelectorExpression(glooutils.IngressProxyValue, "gloo-ingress-translator", "ingress"),
}
)

Expand Down
23 changes: 23 additions & 0 deletions test/kube2e/upgrade/testdata/petstorebase/petstore_deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: petstore
name: petstore
namespace: gloo-system
spec:
selector:
matchLabels:
app: petstore
replicas: 1
template:
metadata:
labels:
app: petstore
spec:
containers:
- image: soloio/petstore-example:latest
name: petstore
ports:
- containerPort: 8080
name: http
14 changes: 14 additions & 0 deletions test/kube2e/upgrade/testdata/petstorebase/petstore_svc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: v1
kind: Service
metadata:
name: petstore
namespace: gloo-system
labels:
service: petstore
spec:
ports:
- name: http
port: 8080
protocol: TCP
selector:
app: petstore
14 changes: 14 additions & 0 deletions test/kube2e/upgrade/testdata/petstorebase/petstore_ups.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: gloo.solo.io/v1
kind: Upstream
metadata:
labels:
app: petstore
discovered_by: kubernetesplugin
name: gloo-system-petstore-8080
namespace: gloo-system
spec:
discoveryMetadata: {}
kube:
serviceName: petstore
serviceNamespace: gloo-system
servicePort: 8080
29 changes: 29 additions & 0 deletions test/kube2e/upgrade/testdata/petstorevs/vs_postupgrade.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
apiVersion: gateway.solo.io/v1
kind: VirtualService
metadata:
name: petstore
namespace: gloo-system
ownerReferences: []
spec:
virtualHost:
domains:
- 'petstore'
routes:
- matchers:
- exact: /some-pets
options:
prefixRewrite: /api/pets
routeAction:
single:
upstream:
name: gloo-system-petstore-8080
namespace: gloo-system
- matchers:
- exact: /a-pet
options:
prefixRewrite: /api/pets
routeAction:
single:
upstream:
name: gloo-system-petstore-8080
namespace: gloo-system
29 changes: 29 additions & 0 deletions test/kube2e/upgrade/testdata/petstorevs/vs_preupgrade.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
apiVersion: gateway.solo.io/v1
kind: VirtualService
metadata:
name: petstore
namespace: gloo-system
ownerReferences: []
spec:
virtualHost:
domains:
- 'petstore'
routes:
- matchers:
- exact: /all-pets
options:
prefixRewrite: /api/pets
routeAction:
single:
upstream:
name: gloo-system-petstore-8080
namespace: gloo-system
- matchers:
- exact: /single-pet
options:
prefixRewrite: /api/pets
routeAction:
single:
upstream:
name: gloo-system-petstore-8080
namespace: gloo-system
44 changes: 44 additions & 0 deletions test/kube2e/upgrade/upgrade_data_validation_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package upgrade_test

import (
"time"

"github.com/solo-io/gloo/test/kube2e/helper"
)

// this package follows the current strategy in enterprise upgrade tests of using curl to test validity of traffic routing.
// Curl is chosen because it is closest to our end user's experience and is a simple way to test traffic routing.
// The downside is that this may be less reliable due to string parsing rather than using actual go code to test the traffic routing.
// TODO(nfuden): Refactor to make sure its not classic api locked but also supports kubernetes gateway api.

var (
// petstore is a simple deployment used for most of our docs to show basic traffic patterns
petStoreHost = "petstore"

// gateway is currently aligned with classic gateway deployment strategy
gatewayProxyName = "gateway-proxy"
gatewayProxyPort = 80
)

func validatePetstoreTraffic(testHelper *helper.SoloTestHelper, path string) {
petString := "[{\"id\":1,\"name\":\"Dog\",\"status\":\"available\"},{\"id\":2,\"name\":\"Cat\",\"status\":\"pending\"}]"
CurlAndAssertResponse(testHelper, petStoreHost, path, petString)
}

// ===================================
// Traffic Validation Curl Functions
// ===================================

func CurlAndAssertResponse(testHelper *helper.SoloTestHelper, host string, path string, expectedResponseSubstring string) {
testHelper.CurlEventuallyShouldRespond(helper.CurlOpts{
Protocol: "http",
Path: path,
Method: "GET",
Host: host,
Service: gatewayProxyName,
Port: gatewayProxyPort,
ConnectionTimeout: 5, // this is important, as the first curl call sometimes hangs indefinitely
Verbose: true,
LogResponses: false,
}, expectedResponseSubstring, 1, time.Minute*1)
}
Loading
Loading