Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into oidc-doc
Browse files Browse the repository at this point in the history
  • Loading branch information
zhaohuabing committed Mar 10, 2024
2 parents 06da176 + 69010d2 commit ac4c0cc
Show file tree
Hide file tree
Showing 225 changed files with 6,382 additions and 982 deletions.
3 changes: 3 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ updates:
k8s.io:
patterns:
- "k8s.io/*"
go.opentelemetry.io:
patterns:
- "go.opentelemetry.io/*"
- package-ecosystem: pip
directory: /tools/src/codespell
schedule:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build_and_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ jobs:
needs: [build]
strategy:
matrix:
version: [ v1.27.3, v1.28.0, v1.29.0 ]
version: [ v1.26.14, v1.27.11, v1.28.7, v1.29.2 ]
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: ./tools/github-actions/setup-deps
Expand Down Expand Up @@ -108,7 +108,7 @@ jobs:
needs: [build]
strategy:
matrix:
version: [ v1.27.3, v1.28.0, v1.29.0 ]
version: [ v1.26.14, v1.27.11, v1.28.7, v1.29.2 ]
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: ./tools/github-actions/setup-deps
Expand Down
18 changes: 9 additions & 9 deletions .github/workflows/cherrypick.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,23 @@ permissions:
contents: read

jobs:
cherry_pick_release_v0_6:
cherry_pick_release_v1_0:
runs-on: ubuntu-22.04
name: Cherry pick into release-v0.6
if: ${{ contains(github.event.pull_request.labels.*.name, 'cherrypick/release-v0.6') && github.event.pull_request.merged == true }}
name: Cherry pick into release-v1.0
if: ${{ contains(github.event.pull_request.labels.*.name, 'cherrypick/release-v1.0') && github.event.pull_request.merged == true }}
steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
fetch-depth: 0
- name: Cherry pick into release/v0.6
- name: Cherry pick into release/v1.0
uses: carloscastrojumo/github-cherry-pick-action@a145da1b8142e752d3cbc11aaaa46a535690f0c5 # v1.0.9
with:
branch: release/v0.6
title: "[release/v0.6] {old_title}"
body: "Cherry picking #{old_pull_request_id} onto release/v0.6"
branch: release/v1.0
title: "[release/v1.0] {old_title}"
body: "Cherry picking #{old_pull_request_id} onto release/v1.0"
labels: |
cherrypick/release-v0.6
cherrypick/release-v1.0
# put release manager here
reviewers: |
arkodg
Xunzhuo
2 changes: 1 addition & 1 deletion .github/workflows/experimental_conformance.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
version: [ v1.26.6, v1.27.3, v1.28.0 ]
version: [ v1.26.14, v1.27.11, v1.28.7, v1.29.2 ]
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: ./tools/github-actions/setup-deps
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,6 @@ vendor/

# values.yaml file is generated from its template counterpart.
charts/gateway-helm/values.yaml

# VIM
.*.swp
2 changes: 1 addition & 1 deletion OWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ maintainers:
- zirain
- qicz
- zhaohuabing
- guydc

reviewers:

Expand All @@ -25,5 +26,4 @@ reviewers:
- tanujd11
- cnvergence
- shawnh2
- guydc
- liorokman
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v0.6.0
v1.0.0-rc.1
12 changes: 1 addition & 11 deletions api/v1alpha1/kubernetes_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,6 @@ import (
"k8s.io/utils/ptr"
)

// DefaultKubernetesDeploymentReplicas returns the default replica settings.
func DefaultKubernetesDeploymentReplicas() *int32 {
repl := int32(DefaultDeploymentReplicas)
return &repl
}

// DefaultKubernetesDeploymentStrategy returns the default deployment strategy settings.
func DefaultKubernetesDeploymentStrategy() *appv1.DeploymentStrategy {
return &appv1.DeploymentStrategy{
Expand All @@ -38,7 +32,6 @@ func DefaultKubernetesContainerImage(image string) *string {
// DefaultKubernetesDeployment returns a new KubernetesDeploymentSpec with default settings.
func DefaultKubernetesDeployment(image string) *KubernetesDeploymentSpec {
return &KubernetesDeploymentSpec{
Replicas: DefaultKubernetesDeploymentReplicas(),
Strategy: DefaultKubernetesDeploymentStrategy(),
Pod: DefaultKubernetesPod(),
Container: DefaultKubernetesContainer(image),
Expand Down Expand Up @@ -96,10 +89,6 @@ func GetKubernetesServiceExternalTrafficPolicy(serviceExternalTrafficPolicy Serv

// defaultKubernetesDeploymentSpec fill a default KubernetesDeploymentSpec if unspecified.
func (deployment *KubernetesDeploymentSpec) defaultKubernetesDeploymentSpec(image string) {
if deployment.Replicas == nil {
deployment.Replicas = DefaultKubernetesDeploymentReplicas()
}

if deployment.Strategy == nil {
deployment.Strategy = DefaultKubernetesDeploymentStrategy()
}
Expand All @@ -121,6 +110,7 @@ func (deployment *KubernetesDeploymentSpec) defaultKubernetesDeploymentSpec(imag
}
}

// setDefault fill a default HorizontalPodAutoscalerSpec if unspecified
func (hpa *KubernetesHorizontalPodAutoscalerSpec) setDefault() {
if len(hpa.Metrics) == 0 {
hpa.Metrics = DefaultEnvoyProxyHpaMetrics()
Expand Down
6 changes: 2 additions & 4 deletions api/v1alpha1/shared_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,6 @@ type KubernetesPodSpec struct {
// +optional
Volumes []corev1.Volume `json:"volumes,omitempty"`

// HostNetwork, If this is set to true, the pod will use host's network namespace.
// +optional
HostNetwork bool `json:"hostNetwork,omitempty"`

// ImagePullSecrets is an optional list of references to secrets
// in the same namespace to use for pulling any of the images used by this PodSpec.
// If specified, these secrets will be passed to individual puller implementations for them to use.
Expand Down Expand Up @@ -348,6 +344,8 @@ const (
)

// KubernetesHorizontalPodAutoscalerSpec defines Kubernetes Horizontal Pod Autoscaler settings of Envoy Proxy Deployment.
// When HPA is enabled, it is recommended that the value in `KubernetesDeploymentSpec.replicas` be removed, otherwise
// Envoy Gateway will revert back to this value every time reconciliation occurs.
// See k8s.io.autoscaling.v2.HorizontalPodAutoScalerSpec.
//
// +kubebuilder:validation:XValidation:message="maxReplicas cannot be less than minReplicas",rule="!has(self.minReplicas) || self.maxReplicas >= self.minReplicas"
Expand Down
5 changes: 1 addition & 4 deletions api/v1alpha1/validation/envoygateway_validate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -668,8 +668,7 @@ func TestEnvoyGatewayProvider(t *testing.T) {

envoyGatewayProvider.Kubernetes = &v1alpha1.EnvoyGatewayKubernetesProvider{
RateLimitDeployment: &v1alpha1.KubernetesDeploymentSpec{
Replicas: nil,
Pod: nil,
Pod: nil,
Container: &v1alpha1.KubernetesContainerSpec{
Resources: nil,
SecurityContext: nil,
Expand All @@ -684,8 +683,6 @@ func TestEnvoyGatewayProvider(t *testing.T) {

assert.NotNil(t, envoyGatewayProvider.Kubernetes.RateLimitDeployment)
assert.Equal(t, envoyGatewayProvider.Kubernetes.RateLimitDeployment, v1alpha1.DefaultKubernetesDeployment(v1alpha1.DefaultRateLimitImage))
assert.NotNil(t, envoyGatewayProvider.Kubernetes.RateLimitDeployment.Replicas)
assert.Equal(t, envoyGatewayProvider.Kubernetes.RateLimitDeployment.Replicas, v1alpha1.DefaultKubernetesDeploymentReplicas())
assert.NotNil(t, envoyGatewayProvider.Kubernetes.RateLimitDeployment.Pod)
assert.Equal(t, envoyGatewayProvider.Kubernetes.RateLimitDeployment.Pod, v1alpha1.DefaultKubernetesPod())
assert.NotNil(t, envoyGatewayProvider.Kubernetes.RateLimitDeployment.Container)
Expand Down
38 changes: 13 additions & 25 deletions api/v1alpha1/validation/envoyproxy_validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,15 @@ import (
"errors"
"fmt"
"net/netip"
"reflect"

bootstrapv3 "github.com/envoyproxy/go-control-plane/envoy/config/bootstrap/v3"
clusterv3 "github.com/envoyproxy/go-control-plane/envoy/config/cluster/v3"
"github.com/google/go-cmp/cmp"
"google.golang.org/protobuf/encoding/protojson"
"google.golang.org/protobuf/testing/protocmp"
utilerrors "k8s.io/apimachinery/pkg/util/errors"
"sigs.k8s.io/yaml"

egv1a1 "github.com/envoyproxy/gateway/api/v1alpha1"
"github.com/envoyproxy/gateway/internal/utils/proto"
"github.com/envoyproxy/gateway/internal/xds/bootstrap"
_ "github.com/envoyproxy/gateway/internal/xds/extensions" // register the generated types to support protojson unmarshalling
)
Expand Down Expand Up @@ -140,42 +138,33 @@ func validateService(spec *egv1a1.EnvoyProxySpec) []error {
}

func validateBootstrap(boostrapConfig *egv1a1.ProxyBootstrap) error {
// Validate user bootstrap config
defaultBootstrap := &bootstrapv3.Bootstrap{}
// TODO: need validate when enable prometheus?
defaultBootstrapStr, err := bootstrap.GetRenderedBootstrapConfig(nil)
if err != nil {
return err
}
if err := proto.FromYAML([]byte(defaultBootstrapStr), defaultBootstrap); err != nil {
return fmt.Errorf("unable to unmarshal default bootstrap: %w", err)
}
if err := defaultBootstrap.Validate(); err != nil {
return fmt.Errorf("default bootstrap validation failed: %w", err)
}

// Validate user bootstrap config
userBootstrapStr, err := bootstrap.ApplyBootstrapConfig(boostrapConfig, defaultBootstrapStr)
if err != nil {
return err
}

jsonData, err := yaml.YAMLToJSON([]byte(userBootstrapStr))
if err != nil {
return fmt.Errorf("unable to convert user bootstrap to json: %w", err)
}

userBootstrap := &bootstrapv3.Bootstrap{}
if err := protojson.Unmarshal(jsonData, userBootstrap); err != nil {
return fmt.Errorf("unable to unmarshal user bootstrap: %w", err)
if err := proto.FromYAML([]byte(userBootstrapStr), userBootstrap); err != nil {
return fmt.Errorf("failed to parse default bootstrap config: %w", err)
}

// Call Validate method
if err := userBootstrap.Validate(); err != nil {
return fmt.Errorf("validation failed for user bootstrap: %w", err)
}

jsonData, err = yaml.YAMLToJSON([]byte(defaultBootstrapStr))
if err != nil {
return fmt.Errorf("unable to convert default bootstrap to json: %w", err)
}

if err := protojson.Unmarshal(jsonData, defaultBootstrap); err != nil {
return fmt.Errorf("unable to unmarshal default bootstrap: %w", err)
}

// Ensure dynamic resources config is same
if userBootstrap.DynamicResources == nil ||
cmp.Diff(userBootstrap.DynamicResources, defaultBootstrap.DynamicResources, protocmp.Transform()) != "" {
Expand All @@ -196,9 +185,8 @@ func validateBootstrap(boostrapConfig *egv1a1.ProxyBootstrap) error {
break
}
}

// nolint // Circumvents this error "Error: copylocks: call of reflect.DeepEqual copies lock value:"
if userXdsCluster == nil || !reflect.DeepEqual(*userXdsCluster.LoadAssignment, *defaultXdsCluster.LoadAssignment) {
if userXdsCluster == nil ||
cmp.Diff(userXdsCluster.LoadAssignment, defaultXdsCluster.LoadAssignment, protocmp.Transform()) != "" {
return fmt.Errorf("xds_cluster's loadAssigntment cannot be modified")
}

Expand Down
2 changes: 0 additions & 2 deletions api/v1alpha1/validation/envoyproxy_validate_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -599,8 +599,6 @@ func TestEnvoyProxyProvider(t *testing.T) {

assert.NotNil(t, envoyProxyProvider.Kubernetes.EnvoyDeployment)
assert.Equal(t, envoyProxyProvider.Kubernetes.EnvoyDeployment, egv1a1.DefaultKubernetesDeployment(egv1a1.DefaultEnvoyProxyImage))
assert.NotNil(t, envoyProxyProvider.Kubernetes.EnvoyDeployment.Replicas)
assert.Equal(t, envoyProxyProvider.Kubernetes.EnvoyDeployment.Replicas, egv1a1.DefaultKubernetesDeploymentReplicas())
assert.NotNil(t, envoyProxyProvider.Kubernetes.EnvoyDeployment.Pod)
assert.Equal(t, envoyProxyProvider.Kubernetes.EnvoyDeployment.Pod, egv1a1.DefaultKubernetesPod())
assert.NotNil(t, envoyProxyProvider.Kubernetes.EnvoyDeployment.Container)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3282,10 +3282,6 @@ spec:
should be appended to the pods. By default, no pod
annotations are appended.
type: object
hostNetwork:
description: HostNetwork, If this is set to true,
the pod will use host's network namespace.
type: boolean
imagePullSecrets:
description: 'ImagePullSecrets is an optional list
of references to secrets in the same namespace to
Expand Down
23 changes: 16 additions & 7 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ module github.com/envoyproxy/gateway
go 1.21

require (
fortio.org/fortio v1.63.3
github.com/cncf/xds/go v0.0.0-20231128003011-0fa0005c9caa
github.com/davecgh/go-spew v1.1.1
github.com/envoyproxy/go-control-plane v0.12.0
Expand All @@ -20,7 +21,7 @@ require (
github.com/prometheus/common v0.49.0
github.com/spf13/cobra v1.8.0
github.com/spf13/pflag v1.0.5
github.com/stretchr/testify v1.8.4
github.com/stretchr/testify v1.9.0
github.com/telepresenceio/watchable v0.0.0-20220726211108-9bb86f92afa7
github.com/tsaarni/certyaml v0.9.3
go.opentelemetry.io/otel v1.24.0
Expand All @@ -31,10 +32,10 @@ require (
go.opentelemetry.io/otel/sdk/metric v1.24.0
go.opentelemetry.io/proto/otlp v1.1.0
go.uber.org/zap v1.27.0
golang.org/x/exp v0.0.0-20231006140011-7918f672742d
golang.org/x/sys v0.17.0
google.golang.org/grpc v1.62.0
google.golang.org/protobuf v1.32.0
golang.org/x/exp v0.0.0-20231206192017-f3f8817b8deb
golang.org/x/sys v0.18.0
google.golang.org/grpc v1.62.1
google.golang.org/protobuf v1.33.0
gopkg.in/yaml.v3 v3.0.1
k8s.io/api v0.29.2
k8s.io/apiextensions-apiserver v0.29.2
Expand All @@ -49,6 +50,14 @@ require (
sigs.k8s.io/yaml v1.4.0
)

require (
fortio.org/dflag v1.7.0 // indirect
fortio.org/log v1.12.0 // indirect
fortio.org/sets v1.0.3 // indirect
fortio.org/struct2env v0.4.0 // indirect
fortio.org/version v1.0.3 // indirect
)

require (
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect
github.com/MakeNowJust/heredoc v1.0.0 // indirect
Expand Down Expand Up @@ -107,10 +116,10 @@ require (
go.starlark.net v0.0.0-20230525235612-a134d8f9ddca // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/mod v0.14.0 // indirect
golang.org/x/net v0.21.0
golang.org/x/net v0.22.0
golang.org/x/oauth2 v0.17.0 // indirect
golang.org/x/sync v0.6.0 // indirect
golang.org/x/term v0.17.0 // indirect
golang.org/x/term v0.18.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/time v0.3.0 // indirect
golang.org/x/tools v0.17.0 // indirect
Expand Down
Loading

0 comments on commit ac4c0cc

Please sign in to comment.