Skip to content

Commit

Permalink
breakout envoyinit
Browse files Browse the repository at this point in the history
  • Loading branch information
lgadban committed Jan 23, 2025
1 parent 3f28616 commit 30b0439
Show file tree
Hide file tree
Showing 9 changed files with 57 additions and 391 deletions.
26 changes: 13 additions & 13 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
4 changes: 4 additions & 0 deletions pkg/utils/defaults/defaults.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package defaults

const GlooSystem = "gloo-system"
const GlooFed = "gloo-system"
2 changes: 1 addition & 1 deletion pkg/utils/envoyutils/admincli/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@ import (
clusterv3 "github.com/envoyproxy/go-control-plane/envoy/config/cluster/v3"
listenerv3 "github.com/envoyproxy/go-control-plane/envoy/config/listener/v3"
"github.com/solo-io/gloo/pkg/utils/cmdutils"
"github.com/solo-io/gloo/pkg/utils/defaults"
"github.com/solo-io/gloo/pkg/utils/protoutils"
"github.com/solo-io/gloo/pkg/utils/requestutils/curl"
"github.com/solo-io/go-utils/threadsafe"

"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 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
// 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

0 comments on commit 30b0439

Please sign in to comment.