Skip to content

Commit

Permalink
Run make gen (istio#40255)
Browse files Browse the repository at this point in the history
  • Loading branch information
Eric Van Norman authored Aug 3, 2022
1 parent 48ca80d commit 47af21a
Show file tree
Hide file tree
Showing 68 changed files with 309 additions and 268 deletions.
5 changes: 3 additions & 2 deletions cni/pkg/repair/repair_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,9 @@ func TestBrokenPodReconciler_detectPod(t *testing.T) {

// Test the ListBrokenPods function
// TODO:(stewartbutler) Add some simple field selector filter test logic to the client-go
// fake client. The fake client does NOT support filtering by field selector,
// so we need to add that ourselves to complete the test.
//
// fake client. The fake client does NOT support filtering by field selector,
// so we need to add that ourselves to complete the test.
func TestBrokenPodReconciler_listBrokenPods(t *testing.T) {
type fields struct {
client kubernetes.Interface
Expand Down
2 changes: 1 addition & 1 deletion istioctl/cmd/kubeinject_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
Expand Down
1 change: 1 addition & 0 deletions manifests/manifest.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
)

// FS embeds the manifests
//
//go:embed charts/* profiles/*
//go:embed charts/gateways/istio-egress/templates/_affinity.tpl
//go:embed charts/gateways/istio-ingress/templates/_affinity.tpl
Expand Down
71 changes: 37 additions & 34 deletions operator/pkg/apis/istio/v1alpha1/values_types.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

69 changes: 36 additions & 33 deletions operator/pkg/patch/patch.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,78 +15,81 @@
/*
Package patch implements a simple patching mechanism for k8s resources.
Paths are specified in the form a.b.c.[key:value].d.[list_entry_value], where:
- [key:value] selects a list entry in list c which contains an entry with key:value
- [list_entry_value] selects a list entry in list d which is a regex match of list_entry_value.
- [key:value] selects a list entry in list c which contains an entry with key:value
- [list_entry_value] selects a list entry in list d which is a regex match of list_entry_value.
Some examples are given below. Given a resource:
kind: Deployment
metadata:
name: istio-citadel
namespace: istio-system
name: istio-citadel
namespace: istio-system
a:
b:
- name: n1
value: v1
- name: n2
list:
- "vv1"
- vv2=foo
b:
- name: n1
value: v1
- name: n2
list:
- "vv1"
- vv2=foo
values and list entries can be added, modifed or deleted.
MODIFY
# MODIFY
1. set v1 to v1new
path: a.b.[name:n1].value
value: v1new
path: a.b.[name:n1].value
value: v1new
2. set vv1 to vv3
// Note the lack of quotes around vv1 (see NOTES below).
path: a.b.[name:n2].list.[vv1]
value: vv3
// Note the lack of quotes around vv1 (see NOTES below).
path: a.b.[name:n2].list.[vv1]
value: vv3
3. set vv2=foo to vv2=bar (using regex match)
path: a.b.[name:n2].list.[vv2]
value: vv2=bar
path: a.b.[name:n2].list.[vv2]
value: vv2=bar
4. replace a port whose port was 15010
- path: spec.ports.[port:15010]
value:
port: 15020
name: grpc-xds
protocol: TCP
- path: spec.ports.[port:15010]
value:
port: 15020
name: grpc-xds
protocol: TCP
DELETE
# DELETE
1. Delete container with name: n1
path: a.b.[name:n1]
path: a.b.[name:n1]
2. Delete list value vv1
path: a.b.[name:n2].list.[vv1]
path: a.b.[name:n2].list.[vv1]
ADD
# ADD
1. Add vv3 to list
path: a.b.[name:n2].list.[1000]
value: vv3
path: a.b.[name:n2].list.[1000]
value: vv3
Note: the value 1000 is an example. That value used in the patch should
be a value greater than number of the items in the list. Choose 1000 is
just an example which normally is greater than the most of the lists used.
2. Add new key:value to container name: n1
path: a.b.[name:n1]
value:
new_attr: v3
path: a.b.[name:n1]
value:
new_attr: v3
*NOTES*
- Due to loss of string quoting during unmarshaling, keys and values should not be string quoted, even if they appear
Expand Down
2 changes: 1 addition & 1 deletion operator/pkg/util/k8s_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
Expand Down
2 changes: 1 addition & 1 deletion pilot/pkg/bootstrap/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
Expand Down
16 changes: 8 additions & 8 deletions pilot/pkg/config/kube/gateway/deploymentcontroller.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,14 @@ import (
//
// Server Side Apply with go templates is an odd choice (no one likes YAML templating...) but is one of the few
// remaining options after all others are ruled out.
// * Merge patch/Update cannot be used. If we always enforce that our object is *exactly* the same as
// the in-cluster object we will get in endless loops due to other controllers that like to add annotations, etc.
// If we chose to allow any unknown fields, then we would never be able to remove fields we added, as
// we cannot tell if we created it or someone else did. SSA fixes these issues
// * SSA using client-go Apply libraries is almost a good choice, but most third-party clients (Istio, MCS, and gateway-api)
// do not provide these libraries.
// * SSA using standard API types doesn't work well either: https://github.com/kubernetes-sigs/controller-runtime/issues/1669
// * This leaves YAML templates, converted to unstructured types and Applied with the dynamic client.
// - Merge patch/Update cannot be used. If we always enforce that our object is *exactly* the same as
// the in-cluster object we will get in endless loops due to other controllers that like to add annotations, etc.
// If we chose to allow any unknown fields, then we would never be able to remove fields we added, as
// we cannot tell if we created it or someone else did. SSA fixes these issues
// - SSA using client-go Apply libraries is almost a good choice, but most third-party clients (Istio, MCS, and gateway-api)
// do not provide these libraries.
// - SSA using standard API types doesn't work well either: https://github.com/kubernetes-sigs/controller-runtime/issues/1669
// - This leaves YAML templates, converted to unstructured types and Applied with the dynamic client.
type DeploymentController struct {
client kube.Client
queue controllers.Queue
Expand Down
1 change: 1 addition & 0 deletions pilot/pkg/config/kube/gateway/templates.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
)

// Templates embeds the templates
//
//go:embed templates/*
var Templates embed.FS

Expand Down
6 changes: 4 additions & 2 deletions pilot/pkg/model/gateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -435,8 +435,10 @@ func CheckDuplicates(hosts []string, knownHosts sets.Set) []string {
// Unlike sidecars where the RDS route name is the listener port number, gateways have a different
// structure for RDS.
// HTTP servers have route name set to http.<portNumber>.
// Multiple HTTP servers can exist on the same port and the code will combine all of them into
// one single RDS payload for http.<portNumber>
//
// Multiple HTTP servers can exist on the same port and the code will combine all of them into
// one single RDS payload for http.<portNumber>
//
// HTTPS servers with TLS termination (i.e. envoy decoding the content, and making outbound http calls to backends)
// will use route name https.<portNumber>.<portName>.<gatewayName>.<namespace>. HTTPS servers using SNI passthrough or
// non-HTTPS servers (e.g., TCP+TLS) with SNI passthrough will be setup as opaque TCP proxies without terminating
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ func TestRetry(t *testing.T) {
Retries: &networking.HTTPRetry{
// Explicitly not retrying.
Attempts: 2,
RetryOn: " some, ,fake , conditions, ,",
RetryOn: " some, ,fake , conditions, ,",
},
},
assertFunc: func(g *WithT, policy *envoyroute.RetryPolicy) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
Expand Down
19 changes: 9 additions & 10 deletions pilot/pkg/networking/grpcgen/grpcecho_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,13 @@
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
package grpcgen_test

import (
Expand Down Expand Up @@ -58,14 +57,14 @@ type configGenTest struct {
// For each of the given servers, we serve echo (only supporting Echo, no ForwardEcho) and
// create a corresponding WorkloadEntry. The WorkloadEntry will have the given format:
//
// meta:
// name: echo-{generated portnum}-{server.version}
// namespace: {server.namespace or "default"}
// labels: {"app": "grpc", "version": "{server.version}"}
// spec:
// address: {grpcEchoHost}
// ports:
// grpc: {generated portnum}
// meta:
// name: echo-{generated portnum}-{server.version}
// namespace: {server.namespace or "default"}
// labels: {"app": "grpc", "version": "{server.version}"}
// spec:
// address: {grpcEchoHost}
// ports:
// grpc: {generated portnum}
func newConfigGenTest(t *testing.T, discoveryOpts xds.FakeOptions, servers ...echoCfg) *configGenTest {
if runtime.GOOS == "darwin" && len(servers) > 1 {
// TODO always skip if this breaks anywhere else
Expand Down
Loading

0 comments on commit 47af21a

Please sign in to comment.