Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
35eaf45
rm DeepCopy from Status Updator (#6986)
arkodg Sep 17, 2025
b8a77b4
perf: avoid string concatenation overhead of fmt.Sprintf in Sort (#6987)
arkodg Sep 17, 2025
def5a76
perf: improve mem allocation in TruncatePolicyAncestors (#6998)
arkodg Sep 17, 2025
193041d
perf: reuse route rule metadata (#7001)
arkodg Sep 18, 2025
b2970f5
perf: reduce mem allocs in internal/metrics (#7004)
arkodg Sep 19, 2025
8328bb1
perf: aggregate publish metric counts and call once (#7005)
arkodg Sep 19, 2025
973f72c
perf: avoid loop variable in k8s provider (#7010)
arkodg Sep 19, 2025
475a77d
perf: remove reflect from BackendRefContext (#7015)
arkodg Sep 20, 2025
f09678f
rm reflect from gateway api runner (#7012)
arkodg Sep 21, 2025
ca5dc33
perf: lazy allocation for new condition in SetConditionForPolicyAnces…
arkodg Sep 23, 2025
86a3ee8
Fix weighted cluster generation in RouteAction when URLRewrite filter…
sekar-saravanan Sep 23, 2025
e35b754
fix: use SDS for service account token in Gateway Namespace Mode (#7002)
cnvergence Sep 23, 2025
c43cde8
perf: reduce ancestorRef copies in policy status (#7032)
arkodg Sep 24, 2025
92fbd47
perf: preallocate structs in securitypolicy processing (#7039)
arkodg Sep 24, 2025
e329070
perf: remove reflect.DeepCopy in parentRef comparison (#7040)
arkodg Sep 24, 2025
6f10ca3
fix: escape regex metacharacters from path prefix string (#7024)
rudrakhp Sep 24, 2025
bda5efd
perf: convert mockData into string and reuse in lua (#7078)
arkodg Sep 27, 2025
a3ffb3d
perf: make sets when needed in policy processing (#7076)
arkodg Sep 29, 2025
dc287ee
perf: preallocate slices in route processing (#7041)
arkodg Sep 24, 2025
3883e0e
perf: enable gocritic perfomance linter setting (#7056)
arkodg Sep 25, 2025
7a1620f
perf: avoid JSON Marshal when debug logger is disabled (#7066)
arkodg Sep 25, 2025
2e79b22
perf: avoid YAML to JSON conversion in JSONPatch (#7069)
arkodg Sep 26, 2025
c8832a4
Fix: Preserve route parent status for multi-parent routes (#7068)
rajsinghtech Sep 27, 2025
916e1f9
perf: remove watchable LoadAll() from gateway api runner (#7081)
arkodg Sep 30, 2025
194df72
perf: enable prealloc linter (#7055)
arkodg Oct 1, 2025
c6e2603
perf: pre allocate maps in btp processing (#7050)
arkodg Oct 1, 2025
9b25337
perf: fix possible memory leak in XDS snapshot (#7101)
rudrakhp Oct 1, 2025
f9f7d46
perf: direct assign policies in translate result instead of append (#…
arkodg Oct 1, 2025
d60b720
remove redundant file
zirain Oct 1, 2025
be37cd2
fix: do not add same service multiple times (#7119)
zirain Oct 1, 2025
7cea427
fix: use maps for backendRefMappings instead of Sets (#7120)
arkodg Oct 2, 2025
a88aa0e
bug: disable x-envoy-ratelimited by default (#7110)
arkodg Oct 2, 2025
77b8a40
fix: use lock when accessing mergeGateways Set (#7124)
arkodg Oct 3, 2025
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
4 changes: 2 additions & 2 deletions internal/cmd/certgen.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,8 @@ func patchTopologyInjectorWebhook(ctx context.Context, cli client.Client, cfg *c

var updated bool
desiredBundle := current.Data["ca.crt"]
for i, webhook := range webhookCfg.Webhooks {
if !bytes.Equal(desiredBundle, webhook.ClientConfig.CABundle) {
for i := range webhookCfg.Webhooks {
if !bytes.Equal(desiredBundle, webhookCfg.Webhooks[i].ClientConfig.CABundle) {
webhookCfg.Webhooks[i].ClientConfig.CABundle = desiredBundle
updated = true
}
Expand Down
12 changes: 6 additions & 6 deletions internal/cmd/egctl/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,10 @@ func fetchRunningEnvoyPods(c kube.CLIClient, nn types.NamespacedName, labelSelec
if err != nil {
return nil, err
}
for _, i := range namespaces.Items {
podList, err := c.PodsForSelector(i.Name, proxy.EnvoyAppLabelSelector()...)
for i := range namespaces.Items {
podList, err := c.PodsForSelector(namespaces.Items[i].Name, proxy.EnvoyAppLabelSelector()...)
if err != nil {
return nil, fmt.Errorf("list pods failed in ns %s: %w", i.Name, err)
return nil, fmt.Errorf("list pods failed in ns %s: %w", namespaces.Items[i].Name, err)
}

if len(podList.Items) == 0 {
Expand Down Expand Up @@ -170,9 +170,9 @@ func fetchRunningEnvoyPods(c kube.CLIClient, nn types.NamespacedName, labelSelec
}

podsNamespacedNames := make([]types.NamespacedName, 0, len(pods))
for _, pod := range pods {
podNsName := utils.NamespacedName(&pod)
if pod.Status.Phase != "Running" {
for i := range pods {
podNsName := utils.NamespacedName(&pods[i])
if pods[i].Status.Phase != "Running" {
return podsNamespacedNames, fmt.Errorf("pod %s is not running", podNsName)
}

Expand Down
10 changes: 5 additions & 5 deletions internal/cmd/egctl/config_ratelimit.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,14 @@ func fetchRunningRateLimitPods(cli kubernetes.CLIClient, namespace string, label
}

rlNN := []types.NamespacedName{}
for _, rlPod := range rlPods.Items {
for i := range rlPods.Items {
rlPodNsName := types.NamespacedName{
Namespace: rlPod.Namespace,
Name: rlPod.Name,
Namespace: rlPods.Items[i].Namespace,
Name: rlPods.Items[i].Name,
}

// Check that the rate limit pod is ready properly and can accept external traffic
if !checkRateLimitPodStatusReady(rlPod.Status) {
if !checkRateLimitPodStatusReady(&rlPods.Items[i].Status) {
continue
}

Expand All @@ -127,7 +127,7 @@ func fetchRunningRateLimitPods(cli kubernetes.CLIClient, namespace string, label
}

// checkRateLimitPodStatusReady Check that the rate limit pod is ready
func checkRateLimitPodStatusReady(status corev1.PodStatus) bool {
func checkRateLimitPodStatusReady(status *corev1.PodStatus) bool {
if status.Phase != corev1.PodRunning {
return false
}
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/egctl/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ func TestCheckRateLimitPodStatusReady(t *testing.T) {

for _, tc := range cases {
t.Run(tc.caseName, func(t *testing.T) {
actual := checkRateLimitPodStatusReady(tc.status)
actual := checkRateLimitPodStatusReady(&tc.status)
require.Equal(t, tc.expect, actual)
})
}
Expand Down
4 changes: 2 additions & 2 deletions internal/cmd/egctl/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ func fetchConditions(parent reflect.Value, quiet, verbose bool) [][]string {

// All conditions are sorted in descending order by time.
for i := len(conditions) - 1; i >= 0; i-- {
row := fetchCondition(conditions[i], verbose)
row := fetchCondition(&conditions[i], verbose)
rows = append(rows, row)

if quiet {
Expand All @@ -433,7 +433,7 @@ func fetchConditions(parent reflect.Value, quiet, verbose bool) [][]string {
}

// fetchCondition fetches the Type, Status, Reason of one condition, and more if verbose.
func fetchCondition(condition metav1.Condition, verbose bool) []string {
func fetchCondition(condition *metav1.Condition, verbose bool) []string {
row := []string{condition.Type, string(condition.Status), condition.Reason}

// Write more details about this condition if verbose is on.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@ xds:
typedConfig:
'@type': type.googleapis.com/envoy.extensions.filters.http.ratelimit.v3.RateLimit
domain: eag-ratelimit
disableXEnvoyRatelimitedHeader: true
failureModeDeny: true
rateLimitService:
grpcService:
Expand Down
4 changes: 2 additions & 2 deletions internal/cmd/egctl/translate.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ func translate(w io.Writer, inFile, inType string, outTypes []string, output, re
}
}
// Print
if err = printOutput(w, result, output); err != nil {
if err = printOutput(w, &result, output); err != nil {
return fmt.Errorf("failed to print result, error:%w", err)
}

Expand Down Expand Up @@ -406,7 +406,7 @@ func TranslateGatewayAPIToXds(namespace, dnsDomain, resourceType string, resourc
}

// printOutput prints the echo-backed gateway API and xDS output
func printOutput(w io.Writer, result TranslationResult, output string) error {
func printOutput(w io.Writer, result *TranslationResult, output string) error {
var (
out []byte
err error
Expand Down
8 changes: 4 additions & 4 deletions internal/cmd/egctl/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,14 @@ func versions(w io.Writer, containerName, output string, remote bool) error {
return fmt.Errorf("list EG pods failed: %w", err)
}

for _, pod := range pods.Items {
if pod.Status.Phase != "Running" {
for i := range pods.Items {
if pods.Items[i].Status.Phase != "Running" {

fmt.Fprintf(w, "WARN: pod %s/%s is not running, skipping it.", pod.Namespace, pod.Name)
fmt.Fprintf(w, "WARN: pod %s/%s is not running, skipping it.", pods.Items[i].Namespace, pods.Items[i].Name)
continue
}

nn := utils.NamespacedName(&pod)
nn := utils.NamespacedName(&pods.Items[i])
stdout, _, err := c.PodExec(nn, containerName, "envoy-gateway version -ojson")
if err != nil {
return fmt.Errorf("pod exec on %s/%s failed: %w", nn.Namespace, nn.Name, err)
Expand Down
2 changes: 1 addition & 1 deletion internal/cmd/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func TestGetConfigValidate(t *testing.T) {
require.NoError(t, err)
defer os.Remove(file.Name())

_, err = file.Write([]byte(test.input))
_, err = file.WriteString(test.input)
require.NoError(t, err)

_, err = getConfigByPath(os.Stderr, file.Name())
Expand Down
6 changes: 3 additions & 3 deletions internal/extension/registry/extension_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func NewManager(cfg *config.Server, inK8s bool) (extTypes.Manager, error) {
}, nil
}

func NewInMemoryManager(cfg egv1a1.ExtensionManager, server extension.EnvoyGatewayExtensionServer) (extTypes.Manager, func(), error) {
func NewInMemoryManager(cfg *egv1a1.ExtensionManager, server extension.EnvoyGatewayExtensionServer) (extTypes.Manager, func(), error) {
if server == nil {
return nil, nil, fmt.Errorf("in-memory manager must be passed a server")
}
Expand All @@ -108,7 +108,7 @@ func NewInMemoryManager(cfg egv1a1.ExtensionManager, server extension.EnvoyGatew
}

if cfg.Service != nil {
opts, err := setupGRPCOpts(context.Background(), nil, &cfg, "")
opts, err := setupGRPCOpts(context.Background(), nil, cfg, "")
if err != nil {
return nil, nil, err
}
Expand All @@ -126,7 +126,7 @@ func NewInMemoryManager(cfg egv1a1.ExtensionManager, server extension.EnvoyGatew

return &Manager{
extensionConnCache: conn,
extension: cfg,
extension: *cfg,
}, c, nil
}

Expand Down
11 changes: 6 additions & 5 deletions internal/extension/registry/extension_manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,7 @@ func Test_Integration_RetryPolicy_MaxAttempts(t *testing.T) {
},
}

mgr, _, err := NewInMemoryManager(extManager, &retryTestServer{})
mgr, _, err := NewInMemoryManager(&extManager, &retryTestServer{})
require.NoError(t, err)

hook, err := mgr.GetPostXDSHookClient(egv1a1.XDSRoute)
Expand Down Expand Up @@ -727,7 +727,7 @@ func Test_Integration_ClusterUpdateExtensionServer(t *testing.T) {
},
}

mgr, _, err := NewInMemoryManager(extManager, &clusterUpdateTestServer{})
mgr, _, err := NewInMemoryManager(&extManager, &clusterUpdateTestServer{})
require.NoError(t, err)

hook, err := mgr.GetPostXDSHookClient(egv1a1.XDSTranslation)
Expand Down Expand Up @@ -804,7 +804,7 @@ func TestPostTranslateModifyHookWithListenersAndRoutes(t *testing.T) {
},
}

mgr, _, err := NewInMemoryManager(extManager, &testServer{})
mgr, _, err := NewInMemoryManager(&extManager, &testServer{})
require.NoError(t, err)

hook, err := mgr.GetPostXDSHookClient(egv1a1.XDSTranslation)
Expand Down Expand Up @@ -934,9 +934,10 @@ func TestGetTranslationHookConfig(t *testing.T) {
var err error

if tt.config == nil {
mgr, _, err = NewInMemoryManager(egv1a1.ExtensionManager{}, &testServer{})
defaultExt := egv1a1.ExtensionManager{}
mgr, _, err = NewInMemoryManager(&defaultExt, &testServer{})
} else {
mgr, _, err = NewInMemoryManager(*tt.config, &testServer{})
mgr, _, err = NewInMemoryManager(tt.config, &testServer{})
}

require.NoError(t, err)
Expand Down
2 changes: 1 addition & 1 deletion internal/gatewayapi/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
)

func (t *Translator) ProcessBackends(backends []*egv1a1.Backend, backendTLSPolicies []*gwapiv1a3.BackendTLSPolicy) []*egv1a1.Backend {
var res []*egv1a1.Backend
res := make([]*egv1a1.Backend, 0, len(backends))
for _, backend := range backends {
// Ensure Backends are enabled
if !t.BackendEnabled {
Expand Down
14 changes: 7 additions & 7 deletions internal/gatewayapi/backendtlspolicy.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ func (t *Translator) processBackendTLSPolicy(

tlsBundle, err := getBackendTLSBundle(policy, resources)
ancestorRefs := getAncestorRefs(policy)
ancestorRefs = append(ancestorRefs, parent)
ancestorRefs = append(ancestorRefs, &parent)

if err != nil {
status.SetTranslationErrorForPolicyAncestors(&policy.Status,
Expand Down Expand Up @@ -222,7 +222,7 @@ func (t *Translator) applyEnvoyProxyBackendTLSSetting(tlsConfig *ir.TLSUpstreamC
return tlsConfig, nil
}

func backendTLSTargetMatched(policy gwapiv1a3.BackendTLSPolicy, target gwapiv1a2.LocalPolicyTargetReferenceWithSectionName, backendNamespace string) bool {
func backendTLSTargetMatched(policy *gwapiv1a3.BackendTLSPolicy, target gwapiv1a2.LocalPolicyTargetReferenceWithSectionName, backendNamespace string) bool {
for _, currTarget := range policy.Spec.TargetRefs {
if target.Group == currTarget.Group &&
target.Kind == currTarget.Kind &&
Expand All @@ -248,7 +248,7 @@ func getBackendTLSPolicy(
// SectionName is port number for EG Backend object
target := getTargetBackendReference(backendRef, backendNamespace, resources)
for _, policy := range policies {
if backendTLSTargetMatched(*policy, target, backendNamespace) {
if backendTLSTargetMatched(policy, target, backendNamespace) {
return policy
}
}
Expand All @@ -257,7 +257,7 @@ func getBackendTLSPolicy(

func getBackendTLSBundle(backendTLSPolicy *gwapiv1a3.BackendTLSPolicy, resources *resource.Resources) (*ir.TLSUpstreamConfig, error) {
// Translate SubjectAltNames from gwapiv1a3 to ir
var subjectAltNames []ir.SubjectAltName
subjectAltNames := make([]ir.SubjectAltName, 0, len(backendTLSPolicy.Spec.Validation.SubjectAltNames))
for _, san := range backendTLSPolicy.Spec.Validation.SubjectAltNames {
var subjectAltName ir.SubjectAltName
switch san.Type {
Expand Down Expand Up @@ -347,10 +347,10 @@ func getCaCertsFromCARefs(namespace string, caCertificates []gwapiv1.LocalObject
return []byte(ca), nil
}

func getAncestorRefs(policy *gwapiv1a3.BackendTLSPolicy) []gwapiv1a2.ParentReference {
ret := make([]gwapiv1a2.ParentReference, len(policy.Status.Ancestors))
func getAncestorRefs(policy *gwapiv1a3.BackendTLSPolicy) []*gwapiv1a2.ParentReference {
ret := make([]*gwapiv1a2.ParentReference, len(policy.Status.Ancestors))
for i, ancestor := range policy.Status.Ancestors {
ret[i] = ancestor.AncestorRef
ret[i] = &ancestor.AncestorRef
}
return ret
}
Loading