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

breakout envoyinit #10499

Merged
merged 5 commits into from
Jan 24, 2025
Merged
Show file tree
Hide file tree
Changes from 4 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
30 changes: 15 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -536,21 +536,21 @@ sds-distroless-docker: $(SDS_OUTPUT_DIR)/sds-linux-$(GOARCH) $(SDS_OUTPUT_DIR)/D
# Envoy init (BASE/SIDECAR)
#----------------------------------------------------------------------------------

# ENVOYINIT_DIR=projects/envoyinit/cmd
# ENVOYINIT_SOURCES=$(call get_sources,$(ENVOYINIT_DIR))
# ENVOYINIT_OUTPUT_DIR=$(OUTPUT_DIR)/$(ENVOYINIT_DIR)
ENVOYINIT_DIR=projects/envoyinit/cmd
ENVOYINIT_SOURCES=$(call get_sources,$(ENVOYINIT_DIR))
ENVOYINIT_OUTPUT_DIR=$(OUTPUT_DIR)/$(ENVOYINIT_DIR)

# $(ENVOYINIT_OUTPUT_DIR)/envoyinit-linux-$(GOARCH): $(ENVOYINIT_SOURCES)
# $(GO_BUILD_FLAGS) GOOS=linux go build -ldflags='$(LDFLAGS)' -gcflags='$(GCFLAGS)' -o $@ $(ENVOYINIT_DIR)/main.go
$(ENVOYINIT_OUTPUT_DIR)/envoyinit-linux-$(GOARCH): $(ENVOYINIT_SOURCES)
$(GO_BUILD_FLAGS) GOOS=linux go build -ldflags='$(LDFLAGS)' -gcflags='$(GCFLAGS)' -o $@ $(ENVOYINIT_DIR)/main.go

# .PHONY: envoyinit
# envoyinit: $(ENVOYINIT_OUTPUT_DIR)/envoyinit-linux-$(GOARCH)
.PHONY: envoyinit
envoyinit: $(ENVOYINIT_OUTPUT_DIR)/envoyinit-linux-$(GOARCH)

# $(ENVOYINIT_OUTPUT_DIR)/Dockerfile.envoyinit: $(ENVOYINIT_DIR)/Dockerfile.envoyinit
# cp $< $@
$(ENVOYINIT_OUTPUT_DIR)/Dockerfile.envoyinit: $(ENVOYINIT_DIR)/Dockerfile.envoyinit
cp $< $@

# $(ENVOYINIT_OUTPUT_DIR)/docker-entrypoint.sh: $(ENVOYINIT_DIR)/docker-entrypoint.sh
# cp $< $@
$(ENVOYINIT_OUTPUT_DIR)/docker-entrypoint.sh: $(ENVOYINIT_DIR)/docker-entrypoint.sh
cp $< $@

.PHONY: gloo-envoy-wrapper-docker
gloo-envoy-wrapper-docker: $(ENVOYINIT_OUTPUT_DIR)/envoyinit-linux-$(GOARCH) $(ENVOYINIT_OUTPUT_DIR)/Dockerfile.envoyinit $(ENVOYINIT_OUTPUT_DIR)/docker-entrypoint.sh
Expand All @@ -559,8 +559,8 @@ gloo-envoy-wrapper-docker: $(ENVOYINIT_OUTPUT_DIR)/envoyinit-linux-$(GOARCH) $(E
--build-arg ENVOY_IMAGE=$(ENVOY_GLOO_IMAGE) \
-t $(IMAGE_REGISTRY)/gloo-envoy-wrapper:$(VERSION)

# $(ENVOYINIT_OUTPUT_DIR)/Dockerfile.envoyinit.distroless: $(ENVOYINIT_DIR)/Dockerfile.envoyinit.distroless
# cp $< $@
$(ENVOYINIT_OUTPUT_DIR)/Dockerfile.envoyinit.distroless: $(ENVOYINIT_DIR)/Dockerfile.envoyinit.distroless
cp $< $@

# Explicitly specify the base image is amd64 as we only build the amd64 flavour of gloo envoy
.PHONY: gloo-envoy-wrapper-distroless-docker
Expand Down Expand Up @@ -763,7 +763,7 @@ docker-push-%:
.PHONY: docker-standard
docker-standard: check-go-version ## Build docker images (standard only)
docker-standard: gloo-docker
# docker-standard: gloo-envoy-wrapper-docker
docker-standard: gloo-envoy-wrapper-docker
docker-standard: sds-docker

.PHONY: docker-distroless
Expand Down Expand Up @@ -905,7 +905,7 @@ kind-reload-gloo-envoy-wrapper:

.PHONY: kind-build-and-load-standard
kind-build-and-load-standard: kind-build-and-load-gloo
# kind-build-and-load-standard: kind-build-and-load-gloo-envoy-wrapper
kind-build-and-load-standard: kind-build-and-load-gloo-envoy-wrapper
# kind-build-and-load-standard: kind-build-and-load-sds
# kind-build-and-load-standard: kind-build-and-load-certgen

Expand Down
10 changes: 7 additions & 3 deletions install/helm/gloo/templates/43-gatewayparameters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,13 @@ spec:
floatingUserId: {{ hasKey $global.securitySettings "floatingUserId" | ternary $global.securitySettings.floatingUserId (or $gg.floatingUserId false) }}
envoyContainer:
image:
registry: quay.io/solo-io
repository: gloo-envoy-wrapper
tag: 1.18.5
{{- $envoyImage := dict -}}
{{- if $gg.envoyContainer -}}
{{- if $gg.envoyContainer.image -}}
{{- $envoyImage = $gg.envoyContainer.image -}}
{{- end -}}{{/* if $gg.envoyContainer.image */}}
{{- end }}{{/* if $gg.envoyContainer */}}
{{- merge $envoyImage $global.image | include "gloo-gateway.gatewayParametersImage" | nindent 8 }}
{{- if $gg.envoyContainer -}}
{{- if $gg.envoyContainer.securityContext }}
securityContext:
Expand Down
2 changes: 0 additions & 2 deletions install/helm/gloo/values-template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ kubeGateway:
glooGateway:
envoyContainer:
image:
registry: quay.io/solo-io
repository: gloo-envoy-wrapper
tag: 1.18.5
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
Expand Down
7 changes: 4 additions & 3 deletions pkg/utils/envoyutils/admincli/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import (

"github.com/solo-io/gloo/pkg/utils/kubeutils/kubectl"
"github.com/solo-io/gloo/pkg/utils/kubeutils/portforward"
"github.com/solo-io/gloo/projects/gloo/pkg/defaults"
)

const (
Expand All @@ -32,6 +31,8 @@ const (
ServerInfoPath = "server_info"
)

var EnvoyAdminPort uint32 = 19000
Copy link
Member

Choose a reason for hiding this comment

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

Does this still need to be exported? I don't see any other references in the diff.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

leftover from copy/paste; fixed


// DumpOptions should have flags for any kind of underlying optional
// filtering or inclusion of Envoy dump data, such as including EDS, filters, etc.
type DumpOptions struct {
Expand All @@ -56,7 +57,7 @@ func NewClient() *Client {
curlOptions: []curl.Option{
curl.WithScheme("http"),
curl.WithHost("127.0.0.1"),
curl.WithPort(int(defaults.EnvoyAdminPort)),
curl.WithPort(int(EnvoyAdminPort)),
// 3 retries, exponential back-off, 10 second max
curl.WithRetries(3, 0, 10),
},
Expand All @@ -75,7 +76,7 @@ func NewPortForwardedClient(ctx context.Context, proxySelector, namespace string
// 1. Open a port-forward to the Kubernetes Deployment, so that we can query the Envoy Admin API directly
portForwarder, err := kubectl.NewCli().StartPortForward(ctx,
selector,
portforward.WithRemotePort(int(defaults.EnvoyAdminPort)))
portforward.WithRemotePort(int(EnvoyAdminPort)))
if err != nil {
return nil, nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/utils/envoyutils/bootstrap/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
"github.com/golang/protobuf/proto"
anypb "github.com/golang/protobuf/ptypes/any"
"github.com/rotisserie/eris"
"github.com/solo-io/gloo/projects/gloo/pkg/utils"
"github.com/solo-io/gloo/projects/gateway2/utils"
envoycache "github.com/solo-io/solo-kit/pkg/api/v1/control-plane/cache"
)

Expand Down
4 changes: 2 additions & 2 deletions pkg/utils/envoyutils/bootstrap/bootstrap_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package bootstrap
import (
"context"

envoytransformation "github.com/solo-io/gloo/projects/gloo/pkg/api/external/envoy/extensions/transformation"
"github.com/solo-io/gloo/projects/gloo/pkg/utils"
envoytransformation "github.com/solo-io/envoy-gloo/go/config/filter/http/transformation/v2"
"github.com/solo-io/gloo/projects/gateway2/utils"

envoycache "github.com/solo-io/solo-kit/pkg/api/v1/control-plane/cache"
"github.com/solo-io/solo-kit/pkg/api/v1/control-plane/resource"
Expand Down
6 changes: 4 additions & 2 deletions pkg/utils/envoyutils/validation/validation.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"github.com/solo-io/gloo/pkg/utils/envoyutils/bootstrap"
"github.com/solo-io/gloo/pkg/utils/envutils"
"github.com/solo-io/gloo/projects/envoyinit/pkg/runner"
"github.com/solo-io/gloo/projects/gloo/constants"
"github.com/solo-io/go-utils/contextutils"
envoycache "github.com/solo-io/solo-kit/pkg/api/v1/control-plane/cache"
)
Expand All @@ -20,10 +19,13 @@ const (
// projects/envoyinit/cmd/Dockerfile.envoyinit
// https://github.com/solo-io/envoy-gloo/blob/v1.30.4-patch5/ci/Dockerfile
defaultEnvoyPath = "/usr/local/bin/envoy"

// only usage, copied from projects/gloo/constants/envoy.go
EnvoyBinaryEnv = "ENVOY_BINARY"
)

func ValidateBootstrap(ctx context.Context, bootstrap string) error {
return runner.RunEnvoyValidate(ctx, envutils.GetOrDefault(constants.EnvoyBinaryEnv, defaultEnvoyPath, false), bootstrap)
return runner.RunEnvoyValidate(ctx, envutils.GetOrDefault(EnvoyBinaryEnv, defaultEnvoyPath, false), bootstrap)
}

// ValidateSnapshot accepts an xDS snapshot, clones it, and does the necessary
Expand Down
46 changes: 7 additions & 39 deletions projects/envoyinit/hack/filter_types/filter_types.gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

// GENERATED FILE -- DO NOT EDIT
// (PREVIOUSLY WAS A) GENERATED FILE -- DO NOT EDIT

package filter_types

Expand Down Expand Up @@ -328,42 +328,10 @@ import (
_ "github.com/envoyproxy/go-control-plane/ratelimit/service/ratelimit/v3"

// gloo filter types
_ "github.com/solo-io/gloo/projects/gloo/pkg/api/external/envoy/annotations"
_ "github.com/solo-io/gloo/projects/gloo/pkg/api/external/envoy/api/v2/cluster"
_ "github.com/solo-io/gloo/projects/gloo/pkg/api/external/envoy/api/v2/core"
_ "github.com/solo-io/gloo/projects/gloo/pkg/api/external/envoy/api/v2/route"
_ "github.com/solo-io/gloo/projects/gloo/pkg/api/external/envoy/config/common/mutation_rules/v3"
_ "github.com/solo-io/gloo/projects/gloo/pkg/api/external/envoy/config/core/v3"
_ "github.com/solo-io/gloo/projects/gloo/pkg/api/external/envoy/config/filter/http/gzip/v2"
_ "github.com/solo-io/gloo/projects/gloo/pkg/api/external/envoy/config/filter/listener/tls_cipher_inspector/v3"
_ "github.com/solo-io/gloo/projects/gloo/pkg/api/external/envoy/config/matching/custom_matchers/server_name/v3"
_ "github.com/solo-io/gloo/projects/gloo/pkg/api/external/envoy/config/matching/inputs/cipher_detection_input/v3"
_ "github.com/solo-io/gloo/projects/gloo/pkg/api/external/envoy/config/route/v3"
_ "github.com/solo-io/gloo/projects/gloo/pkg/api/external/envoy/config/trace/v3"
_ "github.com/solo-io/gloo/projects/gloo/pkg/api/external/envoy/extensions/advanced_http"
_ "github.com/solo-io/gloo/projects/gloo/pkg/api/external/envoy/extensions/aws"
_ "github.com/solo-io/gloo/projects/gloo/pkg/api/external/envoy/extensions/cache/grpc"
_ "github.com/solo-io/gloo/projects/gloo/pkg/api/external/envoy/extensions/extauth"
_ "github.com/solo-io/gloo/projects/gloo/pkg/api/external/envoy/extensions/filters/http/buffer/v3"
_ "github.com/solo-io/gloo/projects/gloo/pkg/api/external/envoy/extensions/filters/http/csrf/v3"
_ "github.com/solo-io/gloo/projects/gloo/pkg/api/external/envoy/extensions/filters/http/ext_proc/v3"
_ "github.com/solo-io/gloo/projects/gloo/pkg/api/external/envoy/extensions/filters/http/graphql/v2"
_ "github.com/solo-io/gloo/projects/gloo/pkg/api/external/envoy/extensions/filters/http/jwt_authn/v3"
_ "github.com/solo-io/gloo/projects/gloo/pkg/api/external/envoy/extensions/filters/http/wasm/v3"
_ "github.com/solo-io/gloo/projects/gloo/pkg/api/external/envoy/extensions/http_path"
_ "github.com/solo-io/gloo/projects/gloo/pkg/api/external/envoy/extensions/jwt"
_ "github.com/solo-io/gloo/projects/gloo/pkg/api/external/envoy/extensions/proxylatency"
_ "github.com/solo-io/gloo/projects/gloo/pkg/api/external/envoy/extensions/transformation"
_ "github.com/solo-io/gloo/projects/gloo/pkg/api/external/envoy/extensions/transformation_ee"
_ "github.com/solo-io/gloo/projects/gloo/pkg/api/external/envoy/extensions/transformers/xslt"
_ "github.com/solo-io/gloo/projects/gloo/pkg/api/external/envoy/extensions/upstream_wait"
_ "github.com/solo-io/gloo/projects/gloo/pkg/api/external/envoy/extensions/waf"
_ "github.com/solo-io/gloo/projects/gloo/pkg/api/external/envoy/extensions/wasm/v3"
_ "github.com/solo-io/gloo/projects/gloo/pkg/api/external/envoy/extensions/xff_offset"
_ "github.com/solo-io/gloo/projects/gloo/pkg/api/external/envoy/service/ext_proc/v3"
_ "github.com/solo-io/gloo/projects/gloo/pkg/api/external/envoy/type"
_ "github.com/solo-io/gloo/projects/gloo/pkg/api/external/envoy/type/matcher/v3"
_ "github.com/solo-io/gloo/projects/gloo/pkg/api/external/envoy/type/metadata/v3"
_ "github.com/solo-io/gloo/projects/gloo/pkg/api/external/envoy/type/tracing/v3"
_ "github.com/solo-io/gloo/projects/gloo/pkg/api/external/envoy/type/v3"
_ "github.com/solo-io/envoy-gloo/go/config/filter/http/aws_lambda/v2"
_ "github.com/solo-io/envoy-gloo/go/config/filter/http/nats/streaming/v2"
_ "github.com/solo-io/envoy-gloo/go/config/filter/http/transformation/v2"
_ "github.com/solo-io/envoy-gloo/go/config/filter/http/upstream_wait/v2"
_ "github.com/solo-io/envoy-gloo/go/config/transformer/aws_lambda/v2"
_ "github.com/solo-io/envoy-gloo/go/type/streaming"
)
37 changes: 20 additions & 17 deletions projects/envoyinit/hack/filter_types/filter_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,23 +10,26 @@
// See the License for the specific language governing permissions and
// limitations under the License.

//go:generate sh -c "echo '// Licensed under the Apache License, Version 2.0 (the \"License\");' > filter_types.gen.go"
//go:generate sh -c "echo '// you may not use this file except in compliance with the License.' >> filter_types.gen.go"
//go:generate sh -c "echo '// You may obtain a copy of the License at' >> filter_types.gen.go"
//go:generate sh -c "echo '//' >> filter_types.gen.go"
//go:generate sh -c "echo '// http://www.apache.org/licenses/LICENSE-2.0' >> filter_types.gen.go"
//go:generate sh -c "echo '//' >> filter_types.gen.go"
//go:generate sh -c "echo '// Unless required by applicable law or agreed to in writing, software' >> filter_types.gen.go"
//go:generate sh -c "echo '// distributed under the License is distributed on an \"AS IS\" BASIS,' >> filter_types.gen.go"
//go:generate sh -c "echo '// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.' >> filter_types.gen.go"
//go:generate sh -c "echo '// See the License for the specific language governing permissions and' >> filter_types.gen.go"
//go:generate sh -c "echo '// limitations under the License.\n' >> filter_types.gen.go"
//go:generate sh -c "echo '// GENERATED FILE -- DO NOT EDIT\n' >> filter_types.gen.go"
//go:generate sh -c "echo 'package filter_types\n\nimport (' >> filter_types.gen.go"
//go:generate sh -c "go list github.com/envoyproxy/go-control-plane/... | grep 'v[3-9]' | xargs -n1 -I{} echo '\t_ \"{}\"' >> filter_types.gen.go"
//go:generate sh -c "echo '\n\t// gloo filter types' >> filter_types.gen.go"
//go:generate sh -c "go list github.com/solo-io/gloo/projects/gloo/pkg/api/external/envoy/... | xargs -n1 -I{} echo '\t_ \"{}\"' >> filter_types.gen.go"
//go:generate sh -c "echo ')' >> filter_types.gen.go"
// TODO: commenting out go generate for now, it can't exist until we figure out how to get the types from within
Copy link
Contributor

Choose a reason for hiding this comment

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

i tried doing this locally and it seemed to work.. what are you seeing?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@yuval-k and I spent some time on this and was seeing the same behavior.

I think we'll need to move forward with this hack until we properly fix envoyinit

// the correct version of go-control-plane; see: https://github.com/kgateway-dev/kgateway/issues/10491

//xo:generate sh -c "echo '// Licensed under the Apache License, Version 2.0 (the \"License\");' > filter_types.gen.go"
//xo:generate sh -c "echo '// you may not use this file except in compliance with the License.' >> filter_types.gen.go"
//xo:generate sh -c "echo '// You may obtain a copy of the License at' >> filter_types.gen.go"
//xo:generate sh -c "echo '//' >> filter_types.gen.go"
//xo:generate sh -c "echo '// http://www.apache.org/licenses/LICENSE-2.0' >> filter_types.gen.go"
//xo:generate sh -c "echo '//' >> filter_types.gen.go"
//xo:generate sh -c "echo '// Unless required by applicable law or agreed to in writing, software' >> filter_types.gen.go"
//xo:generate sh -c "echo '// distributed under the License is distributed on an \"AS IS\" BASIS,' >> filter_types.gen.go"
//xo:generate sh -c "echo '// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.' >> filter_types.gen.go"
//xo:generate sh -c "echo '// See the License for the specific language governing permissions and' >> filter_types.gen.go"
//xo:generate sh -c "echo '// limitations under the License.\n' >> filter_types.gen.go"
//xo:generate sh -c "echo '// GENERATED FILE -- DO NOT EDIT\n' >> filter_types.gen.go"
//xo:generate sh -c "echo 'package filter_types\n\nimport (' >> filter_types.gen.go"
//xo:generate sh -c "go list github.com/envoyproxy/go-control-plane/... | grep 'v[3-9]' | xargs -n1 -I{} echo '\t_ \"{}\"' >> filter_types.gen.go"
//xo:generate sh -c "echo '\n\t// gloo filter types' >> filter_types.gen.go"
//xo:generate sh -c "go list github.com/solo-io/envoy-gloo/go/... | xargs -n1 -I{} echo '\t_ \"{}\"' >> filter_types.gen.go"
//xo:generate sh -c "echo ')' >> filter_types.gen.go"

package filter_types

Expand Down
Loading
Loading