From dc6ddc6ba2b0fe8245fb9f6ed24242868a2c2d8f Mon Sep 17 00:00:00 2001 From: Flynn Date: Tue, 15 Oct 2024 22:30:23 -0400 Subject: [PATCH] Have the start of cmd/migrator to migrate between v3 & v4 CRDs. Use it to migrate all the v3alpha1 testdata for emissary-ingress.dev/v4alpha1 over to proper v4 CRDs. Signed-off-by: Flynn --- cmd/migrator/converter.go | 277 ++++ go.mod | 6 +- .../v4alpha1/native_conversions.go | 126 -- .../v4alpha1/roundtrip_test.go | 3 + .../v4alpha1/testdata/authsvc.yaml | 142 +- .../v4alpha1/testdata/authsvc_v3.yaml | 87 ++ .../v4alpha1/testdata/devportals.yaml | 94 +- .../v4alpha1/testdata/devportals_v3.yaml | 53 + .../v4alpha1/testdata/hosts.yaml | 278 ++-- .../v4alpha1/testdata/hosts_v3.yaml | 184 +++ .../v4alpha1/testdata/logsvc.yaml | 202 +-- .../v4alpha1/testdata/logsvc_v3.yaml | 109 ++ .../v4alpha1/testdata/mappings.yaml | 1206 +++++++++-------- .../v4alpha1/testdata/mappings_v3.yaml | 628 +++++++++ .../v4alpha1/testdata/modules.yaml | 23 +- .../v4alpha1/testdata/modules_v3.yaml | 12 + .../v4alpha1/testdata/ratelimitsvc.yaml | 54 +- .../v4alpha1/testdata/ratelimitsvc_v3.yaml | 35 + .../v4alpha1/testdata/tcpmappings.yaml | 241 ++-- .../v4alpha1/testdata/tcpmappings_v3.yaml | 148 ++ .../v4alpha1/testdata/tlscontexts.yaml | 84 +- .../v4alpha1/testdata/tlscontexts_v3.yaml | 54 + .../v4alpha1/testdata/tracingsvc.yaml | 172 +-- .../v4alpha1/testdata/tracingsvc_v3.yaml | 102 ++ 24 files changed, 2954 insertions(+), 1366 deletions(-) create mode 100644 cmd/migrator/converter.go delete mode 100644 pkg/api/emissary-ingress.dev/v4alpha1/native_conversions.go create mode 100644 pkg/api/emissary-ingress.dev/v4alpha1/testdata/authsvc_v3.yaml create mode 100644 pkg/api/emissary-ingress.dev/v4alpha1/testdata/devportals_v3.yaml create mode 100644 pkg/api/emissary-ingress.dev/v4alpha1/testdata/hosts_v3.yaml create mode 100644 pkg/api/emissary-ingress.dev/v4alpha1/testdata/logsvc_v3.yaml create mode 100644 pkg/api/emissary-ingress.dev/v4alpha1/testdata/mappings_v3.yaml create mode 100644 pkg/api/emissary-ingress.dev/v4alpha1/testdata/modules_v3.yaml create mode 100644 pkg/api/emissary-ingress.dev/v4alpha1/testdata/ratelimitsvc_v3.yaml create mode 100644 pkg/api/emissary-ingress.dev/v4alpha1/testdata/tcpmappings_v3.yaml create mode 100644 pkg/api/emissary-ingress.dev/v4alpha1/testdata/tlscontexts_v3.yaml create mode 100644 pkg/api/emissary-ingress.dev/v4alpha1/testdata/tracingsvc_v3.yaml diff --git a/cmd/migrator/converter.go b/cmd/migrator/converter.go new file mode 100644 index 0000000000..ced39f7f2a --- /dev/null +++ b/cmd/migrator/converter.go @@ -0,0 +1,277 @@ +package main + +import ( + "encoding/json" + "fmt" + "io" + "os" + "reflect" + + // yaml "github.com/goccy/go-yaml" + "gopkg.in/yaml.v2" + k8syaml "sigs.k8s.io/yaml" + + // v3yaml "github.com/emissary-ingress/emissary/v3/pkg/yaml" + + // v3crds "github.com/emissary-ingress/emissary/v3/pkg/api/getambassador.io/v3alpha1" + + v4crds "github.com/emissary-ingress/emissary/v3/pkg/api/emissary-ingress.dev/v4alpha1" + v3json "github.com/emissary-ingress/emissary/v3/pkg/json" +) + +type v4ConversionFunc func(nativeResource interface{}) error + +type conversionInfo struct { + nativeType reflect.Type + toV4 v4ConversionFunc +} + +type conversionMap map[string]conversionInfo + +func (cMap conversionMap) addConversion(kind string, v interface{}, toV4 v4ConversionFunc) { + nativeType := reflect.TypeOf(v) + // fmt.Printf("add %s: %s - %s\n", kind, nativeType.Kind(), nativeType.Name()) + + cMap[kind] = conversionInfo{nativeType, toV4} +} + +func (cMap conversionMap) lookup(kind string) (bool, reflect.Type, v4ConversionFunc) { + info, ok := cMap[kind] + + if !ok { + return false, nil, nil + } + + return true, info.nativeType, info.toV4 +} + +func fixAPIVersion(nativeResource interface{}) error { + // Swap the apiVersion... + reflectedValue := reflect.ValueOf(nativeResource).Elem() + typeMetaField := reflectedValue.FieldByName("TypeMeta") + + if !typeMetaField.IsValid() { + return fmt.Errorf("no TypeMeta field in %#v", nativeResource) + } + + apiVersionField := typeMetaField.FieldByName("APIVersion") + + if !apiVersionField.IsValid() { + return fmt.Errorf("no APIVersion field in %#v", nativeResource) + } + + apiVersionField.SetString("emissary-ingress.dev/v4alpha1") + + return nil +} + +func convertV3toV4(originalResource interface{}, typeMap conversionMap) (interface{}, error) { + var unstructuredResource map[string]interface{} + + switch originalResource := originalResource.(type) { + case map[string]interface{}, map[interface{}]interface{}: + unstructuredResource = convertMap(originalResource).(map[string]interface{}) + + default: + return nil, fmt.Errorf("unsupported type %s: %#v", reflect.TypeOf(originalResource).Name(), originalResource) + } + + // fmt.Printf("---\n") + // fmt.Printf("%#v\n", unstructuredResource) + + // fmt.Printf("\nTypeMap:\n") + // for k, v := range typeMap { + // fmt.Printf(" %s: %s\n", k, v.nativeType.Name()) + // } + + // Grab the apiVersion and kind. + apiVersion, ok := unstructuredResource["apiVersion"].(string) + + if !ok { + return nil, fmt.Errorf("apiVersion not found or not a string: %#v", unstructuredResource) + } + + // Is this a getambassador.io/v3alpha1 resource? + if apiVersion != "getambassador.io/v3alpha1" { + // Nope. + return nil, fmt.Errorf("unknown apiVersion %s: %#v", apiVersion, unstructuredResource) + } + + kind, ok := unstructuredResource["kind"].(string) + + if !ok { + return nil, fmt.Errorf("kind not found or not a string: %#v", unstructuredResource) + } + + ok, nativeType, toV4 := typeMap.lookup(kind) + + if !ok { + return nil, fmt.Errorf("unknown kind %s: %#v", kind, unstructuredResource) + } + + // fmt.Printf("kind %s: native type %s\n", kind, nativeType.Name()) + + nativeResource := reflect.New(nativeType).Interface() + // fmt.Printf("kind %s: native resource type %s\n", kind, reflect.TypeOf(nativeResource).Name()) + + // Convert our unstructured resource to JSON... + rawJSON, err := json.MarshalIndent(unstructuredResource, "", " ") + + if err != nil { + return nil, fmt.Errorf("couldn't convert unstructured to JSON? %s", err) + } + + // fmt.Printf("V3: %s\n", string(rawJSON)) + + // ...then unmarshal that JSON into our native resource, using the "v3" tag. + err = v3json.Unmarshal(rawJSON, nativeResource) + // err := v4crds.UnstructuredToNative(unstructuredResource, nativeResource, "v3") + + if err != nil { + return nil, fmt.Errorf("error converting object to native %#v: %s", unstructuredResource, err) + } + + // Run the conversion (if any). + if toV4 == nil { + toV4 = fixAPIVersion + } + + err = toV4(nativeResource) + + if err != nil { + return nil, fmt.Errorf("error converting object to v4 %#v: %s", unstructuredResource, err) + } + + return nativeResource, nil + + // // Dump as YAML. + // yamlBytes, err := k8syaml.Marshal(nativeResource) + + // if err != nil { + // return nil, fmt.Errorf("error marshaling to YAML %#v: %s", unstructuredResource, err) + // } + + // // fmt.Prinf("V4:\n") + // fmt.Printf("---\n%s", string(yamlBytes)) + // return nil +} + +// convertMap converts a map[interface{}]interface{} to a map[string]interface{}. +// It's kind of infuriating the YAML decoder requires this. +func convertMap(m interface{}) interface{} { + var retval interface{} + + switch m := m.(type) { + case []interface{}: + newArray := reflect.MakeSlice(reflect.SliceOf(reflect.TypeOf(m).Elem()), 0, len(m)).Interface().([]interface{}) + for _, e := range m { + newArray = append(newArray, convertMap(e)) + } + + retval = newArray + + case map[interface{}]interface{}: + newMap := make(map[string]interface{}, len(m)) + + for key, value := range m { + newMap[key.(string)] = convertMap(value) + } + + retval = newMap + + default: + retval = m + } + + return retval +} + +func convertSingleResource(unstructuredResource interface{}, typeMap conversionMap) (interface{}, error) { + switch value := unstructuredResource.(type) { + case []interface{}: + // This is a list of resources. Loop through them. + result := make([]interface{}, 0, len(value)) + + for i, item := range value { + // fmt.Printf("item %d: %#v\n", i, item) + v4obj, error := convertSingleResource(item, typeMap) + + if error != nil { + return nil, fmt.Errorf("failed to convert array item %d (%#v): %v", i, item, error) + } + + result = append(result, v4obj) + } + + return result, nil + + default: + return convertV3toV4(unstructuredResource, typeMap) + } +} + +func main() { + typeMap := make(conversionMap) + + typeMap.addConversion("AuthService", v4crds.AuthService{}, nil) + typeMap.addConversion("DevPortal", v4crds.DevPortal{}, nil) + typeMap.addConversion("Host", v4crds.Host{}, nil) + typeMap.addConversion("Listener", v4crds.Listener{}, nil) + typeMap.addConversion("LogService", v4crds.LogService{}, nil) + typeMap.addConversion("Mapping", v4crds.Mapping{}, nil) + typeMap.addConversion("Module", v4crds.Module{}, nil) + typeMap.addConversion("Features", v4crds.Features{}, nil) + typeMap.addConversion("RateLimitService", v4crds.RateLimitService{}, nil) + typeMap.addConversion("KubernetesServiceResolver", v4crds.KubernetesServiceResolver{}, nil) + typeMap.addConversion("KubernetesEndpointResolver", v4crds.KubernetesEndpointResolver{}, nil) + typeMap.addConversion("ConsulResolver", v4crds.ConsulResolver{}, nil) + typeMap.addConversion("TCPMapping", v4crds.TCPMapping{}, nil) + typeMap.addConversion("TLSContext", v4crds.TLSContext{}, nil) + typeMap.addConversion("TracingService", v4crds.TracingService{}, nil) + + if len(os.Args) < 2 { + fmt.Println("Usage: converter ... ") + return + } + + for _, path := range os.Args[1:] { + reader, err := os.Open(path) + + if err != nil { + fmt.Printf("Error reading file %s: %v\n", path, err) + continue + } + + decoder := yaml.NewDecoder(reader) + + // Loop through all the YAML documents + for { + // Decode the next YAML document into unstructuredResource. + var unstructuredResource interface{} + err := decoder.Decode(&unstructuredResource) + + if err == io.EOF { + // End of the YAML input + break + } else if err != nil { + fmt.Printf("Error decoding YAML: %v\n", err) + continue + } + + v4obj, error := convertSingleResource(unstructuredResource, typeMap) + + if error != nil { + fmt.Printf("error converting resource %#v: %v\n", v4obj, error) + } + + // Dump as YAML. + yamlBytes, err := k8syaml.Marshal(v4obj) + + if err != nil { + fmt.Printf("error marshaling to YAML %#v: %s\n", v4obj, err) + } else { + fmt.Printf("%s", string(yamlBytes)) + } + } + } +} diff --git a/go.mod b/go.mod index 7921cdc315..51fdac66d3 100644 --- a/go.mod +++ b/go.mod @@ -90,6 +90,7 @@ require ( github.com/envoyproxy/go-control-plane v0.11.1 github.com/fsnotify/fsnotify v1.7.0 github.com/go-logr/zapr v1.2.4 + github.com/google/go-cmp v0.6.0 github.com/google/uuid v1.5.0 github.com/gorilla/websocket v1.5.1 github.com/hashicorp/consul/api v1.26.1 @@ -110,6 +111,7 @@ require ( google.golang.org/grpc v1.60.1 google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.3.0 google.golang.org/protobuf v1.33.0 + gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c gopkg.in/yaml.v2 v2.4.0 k8s.io/api v0.28.5 k8s.io/apiextensions-apiserver v0.28.5 @@ -172,7 +174,6 @@ require ( github.com/google/btree v1.0.1 // indirect github.com/google/cel-go v0.18.1 // indirect github.com/google/gnostic-models v0.6.8 // indirect - github.com/google/go-cmp v0.6.0 // indirect github.com/google/gofuzz v1.2.0 // indirect github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect github.com/gregjones/httpcache v0.0.0-20190611155906-901d90724c79 // indirect @@ -192,6 +193,8 @@ require ( github.com/josharian/intern v1.0.1-0.20211109044230-42b52b674af5 // indirect github.com/json-iterator/go v1.1.12 // indirect github.com/kevinburke/ssh_config v1.2.0 // indirect + github.com/kr/pretty v0.3.1 // indirect + github.com/kr/text v0.2.0 // indirect github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de // indirect github.com/magiconair/properties v1.8.1 // indirect github.com/mailru/easyjson v0.7.7 // indirect @@ -216,6 +219,7 @@ require ( github.com/prometheus/client_golang v1.17.0 // indirect github.com/prometheus/common v0.45.0 // indirect github.com/prometheus/procfs v0.12.0 // indirect + github.com/rogpeppe/go-internal v1.11.0 // indirect github.com/russross/blackfriday/v2 v2.1.0 // indirect github.com/sergi/go-diff v1.3.1 // indirect github.com/skeema/knownhosts v1.2.1 // indirect diff --git a/pkg/api/emissary-ingress.dev/v4alpha1/native_conversions.go b/pkg/api/emissary-ingress.dev/v4alpha1/native_conversions.go deleted file mode 100644 index ec9a5e9411..0000000000 --- a/pkg/api/emissary-ingress.dev/v4alpha1/native_conversions.go +++ /dev/null @@ -1,126 +0,0 @@ -package v4alpha1 - -import ( - "fmt" - "reflect" - "strings" -) - -// NativeToUnstructured converts a native v4 struct to a -// map[string]interface{} representation that can be easily serialized to JSON -// or YAML, using the given convention ("json" or "v3") to determine the field -// names in the resulting map. -func NativeToUnstructured(v interface{}, convention string) (map[string]interface{}, error) { - if convention != "json" && convention != "v3" { - return nil, fmt.Errorf("Invalid convention: %s", convention) - } - - result := make(map[string]interface{}) - val := reflect.ValueOf(v) - typ := reflect.TypeOf(v) - - // Loop through the struct fields - for i := 0; i < typ.NumField(); i++ { - field := typ.Field(i) - value := val.Field(i) - - // Get the appropriate tag based on the convention - fieldName := field.Tag.Get(convention) - - // If the field is a struct, recursively serialize it - if fieldName != "" { - if value.Kind() == reflect.Struct { - nestedResult, err := NativeToUnstructured(value.Interface(), convention) - if err != nil { - return nil, err - } - result[fieldName] = nestedResult - } else { - result[fieldName] = value.Interface() - } - } - } - - return result, nil -} - -// UnstructuredToNative converts an unstructured map[string]interface{} to a -// native v4 struct, using the given convention ("json" or "v3") to determine -// the field names in the input map. The "v" input must be a native-type -// variable. -func UnstructuredToNative(data map[string]interface{}, v interface{}, convention string) error { - if convention != "json" && convention != "v3" { - return fmt.Errorf("Invalid convention: %s", convention) - } - - typ := reflect.TypeOf(v) - val := reflect.ValueOf(v) - - fmt.Printf("kind %s, type %s, value %#v\n", typ.Kind(), typ.Name(), val) - fmt.Printf("data %#v\n", data) - - // Ensure the input is a pointer to a struct - if typ.Kind() != reflect.Ptr || typ.Elem().Kind() != reflect.Struct { - return fmt.Errorf("Invalid input type: %s", typ) - } - - // Loop through the struct fields - structType := typ.Elem() - - for i := 0; i < structType.NumField(); i++ { - field := structType.Field(i) - - // Get the appropriate tag based on the convention - fieldName := field.Tag.Get(convention) - - if (fieldName == "") && (convention == "v3") { - // If the field name is empty, try the "json" convention - fieldName = field.Tag.Get("json") - } - - // Split the field name on comma and use only the first part - idx := strings.Index(fieldName, ",") - - if idx != -1 { - fieldName = fieldName[:idx] - } - - fmt.Printf("%d: %s - kind %s, type %s, tag %s\n", - i, field.Name, field.Type.Kind(), field.Type.Name(), fieldName) - - if fieldName != "" { - if (field.Type.Kind() == reflect.Struct) || - (field.Type.Kind() == reflect.Ptr && - field.Type.Elem().Kind() == reflect.Struct) { - // If it's a pointer to a struct, recursively deserialize - nestedData, ok := data[fieldName].(map[string]interface{}) - - if ok { - nestedStructPtr := reflect.New(field.Type).Interface() - - if err := UnstructuredToNative(nestedData, nestedStructPtr, convention); err != nil { - return err - } - val.Field(i).Set(reflect.ValueOf(nestedStructPtr)) - } else { - fmt.Printf(" ptr struct is not a map: %#v\n", data[fieldName]) - // return fmt.Errorf("Expected nested struct data for field %s", fieldName) - } - } else { - // Otherwise, set the field value directly - value, ok := data[fieldName] - - if ok { - valueOf := reflect.ValueOf(value) - - fmt.Printf("%d: direct set (canset %#v) to kind %s, type %s, tag %s\n", - i, field.Type.AssignableTo(valueOf.Type()), valueOf.Kind(), valueOf.Type().Name(), valueOf) - - val.Field(i).Set(valueOf) - } - } - } - } - - return nil -} diff --git a/pkg/api/emissary-ingress.dev/v4alpha1/roundtrip_test.go b/pkg/api/emissary-ingress.dev/v4alpha1/roundtrip_test.go index 8b03036961..223c35eaf1 100644 --- a/pkg/api/emissary-ingress.dev/v4alpha1/roundtrip_test.go +++ b/pkg/api/emissary-ingress.dev/v4alpha1/roundtrip_test.go @@ -66,6 +66,7 @@ func TestTracingSvcRoundTrip(t *testing.T) { func checkRoundtrip(t *testing.T, filename string, ptr interface{}) { bytes, err := ioutil.ReadFile(path.Join("testdata", filename)) require.NoError(t, err) + t.Logf("checkRoundtrip: loaded %s\n", filename) canonical := func() string { var untyped interface{} @@ -79,8 +80,10 @@ func checkRoundtrip(t *testing.T, filename string, ptr interface{}) { // Round-trip twice, to get map field ordering, instead of struct field ordering. // first + t.Logf("actual: bytes %s\n", string(bytes)) require.NoError(t, yaml.UnmarshalStrict(bytes, ptr)) first, err := json.Marshal(ptr) + t.Logf("actual marshal 1: %s\n", string(first)) require.NoError(t, err) // second diff --git a/pkg/api/emissary-ingress.dev/v4alpha1/testdata/authsvc.yaml b/pkg/api/emissary-ingress.dev/v4alpha1/testdata/authsvc.yaml index ae40ef8071..e1c2a4c0a8 100644 --- a/pkg/api/emissary-ingress.dev/v4alpha1/testdata/authsvc.yaml +++ b/pkg/api/emissary-ingress.dev/v4alpha1/testdata/authsvc.yaml @@ -1,87 +1,87 @@ -- apiVersion: "getambassador.io/v3alpha1" - kind: "AuthService" +- apiVersion: emissary-ingress.dev/v4alpha1 + kind: AuthService metadata: - creationTimestamp: "2020-07-03T02:19:06Z" - name: "authsvc-no-timeout" - namespace: "default" + creationTimestamp: "2020-07-03T02:19:06Z" + name: authsvc-no-timeout + namespace: default spec: - auth_service: "authservice" - proto: "grpc" -- apiVersion: "getambassador.io/v3alpha1" - kind: "AuthService" + authService: authservice + proto: grpc +- apiVersion: emissary-ingress.dev/v4alpha1 + kind: AuthService metadata: - creationTimestamp: "2020-07-03T02:19:06Z" - name: "authsvc-with-stats-name" - namespace: "default" + creationTimestamp: "2020-07-03T02:19:06Z" + name: authsvc-with-stats-name + namespace: default spec: - auth_service: "authservice" - proto: "grpc" - stats_name: "alt-stats-name" -- apiVersion: "getambassador.io/v3alpha1" - kind: "AuthService" + authService: authservice + proto: grpc + statsName: alt-stats-name +- apiVersion: emissary-ingress.dev/v4alpha1 + kind: AuthService metadata: - creationTimestamp: "2020-07-03T02:19:06Z" - name: "authsvc-timeout" - namespace: "default" + creationTimestamp: "2020-07-03T02:19:06Z" + name: authsvc-timeout + namespace: default spec: - auth_service: "authservice" - proto: "grpc" - timeout_ms: 5000 -- apiVersion: "getambassador.io/v3alpha1" - kind: "AuthService" + authService: authservice + proto: grpc + timeoutMS: 5000 +- apiVersion: emissary-ingress.dev/v4alpha1 + kind: AuthService metadata: - creationTimestamp: "2020-07-03T02:19:06Z" - name: "authsvc-zero-timeout" - namespace: "default" + creationTimestamp: "2020-07-03T02:19:06Z" + name: authsvc-zero-timeout + namespace: default spec: - auth_service: "authservice" - proto: "grpc" - timeout_ms: 0 -- apiVersion: "getambassador.io/v3alpha1" - kind: "AuthService" + authService: authservice + proto: grpc + timeoutMS: 0 +- apiVersion: emissary-ingress.dev/v4alpha1 + kind: AuthService metadata: - creationTimestamp: "2020-07-03T02:19:06Z" - name: "authsvc-all-false" - namespace: "default" + creationTimestamp: "2020-07-03T02:19:06Z" + name: authsvc-all-false + namespace: default spec: - auth_service: "authservice" - proto: "grpc" - allow_request_body: false - add_linkerd_headers: false - failure_mode_allow: false -- apiVersion: "getambassador.io/v3alpha1" - kind: "AuthService" + addLinkerdHeaders: false + allowRequestBody: false + authService: authservice + failureModeAllow: false + proto: grpc +- apiVersion: emissary-ingress.dev/v4alpha1 + kind: AuthService metadata: - creationTimestamp: "2020-07-03T02:19:06Z" - name: "authsvc-one-true" - namespace: "default" + creationTimestamp: "2020-07-03T02:19:06Z" + name: authsvc-one-true + namespace: default spec: - auth_service: "authservice" - proto: "grpc" - allow_request_body: true - add_linkerd_headers: false - failure_mode_allow: false -- apiVersion: "getambassador.io/v3alpha1" - kind: "AuthService" + addLinkerdHeaders: false + allowRequestBody: true + authService: authservice + failureModeAllow: false + proto: grpc +- apiVersion: emissary-ingress.dev/v4alpha1 + kind: AuthService metadata: - creationTimestamp: "2020-07-03T02:19:06Z" - name: "authsvc-two-true" - namespace: "default" + creationTimestamp: "2020-07-03T02:19:06Z" + name: authsvc-two-true + namespace: default spec: - auth_service: "authservice" - proto: "grpc" - allow_request_body: false - add_linkerd_headers: true - failure_mode_allow: true -- apiVersion: "getambassador.io/v3alpha1" - kind: "AuthService" + addLinkerdHeaders: true + allowRequestBody: false + authService: authservice + failureModeAllow: true + proto: grpc +- apiVersion: emissary-ingress.dev/v4alpha1 + kind: AuthService metadata: - creationTimestamp: "2020-07-03T02:19:06Z" - name: "authsvc-all-true" - namespace: "default" + creationTimestamp: "2020-07-03T02:19:06Z" + name: authsvc-all-true + namespace: default spec: - auth_service: "authservice" - proto: "grpc" - allow_request_body: true - add_linkerd_headers: true - failure_mode_allow: true + addLinkerdHeaders: true + allowRequestBody: true + authService: authservice + failureModeAllow: true + proto: grpc diff --git a/pkg/api/emissary-ingress.dev/v4alpha1/testdata/authsvc_v3.yaml b/pkg/api/emissary-ingress.dev/v4alpha1/testdata/authsvc_v3.yaml new file mode 100644 index 0000000000..ae40ef8071 --- /dev/null +++ b/pkg/api/emissary-ingress.dev/v4alpha1/testdata/authsvc_v3.yaml @@ -0,0 +1,87 @@ +- apiVersion: "getambassador.io/v3alpha1" + kind: "AuthService" + metadata: + creationTimestamp: "2020-07-03T02:19:06Z" + name: "authsvc-no-timeout" + namespace: "default" + spec: + auth_service: "authservice" + proto: "grpc" +- apiVersion: "getambassador.io/v3alpha1" + kind: "AuthService" + metadata: + creationTimestamp: "2020-07-03T02:19:06Z" + name: "authsvc-with-stats-name" + namespace: "default" + spec: + auth_service: "authservice" + proto: "grpc" + stats_name: "alt-stats-name" +- apiVersion: "getambassador.io/v3alpha1" + kind: "AuthService" + metadata: + creationTimestamp: "2020-07-03T02:19:06Z" + name: "authsvc-timeout" + namespace: "default" + spec: + auth_service: "authservice" + proto: "grpc" + timeout_ms: 5000 +- apiVersion: "getambassador.io/v3alpha1" + kind: "AuthService" + metadata: + creationTimestamp: "2020-07-03T02:19:06Z" + name: "authsvc-zero-timeout" + namespace: "default" + spec: + auth_service: "authservice" + proto: "grpc" + timeout_ms: 0 +- apiVersion: "getambassador.io/v3alpha1" + kind: "AuthService" + metadata: + creationTimestamp: "2020-07-03T02:19:06Z" + name: "authsvc-all-false" + namespace: "default" + spec: + auth_service: "authservice" + proto: "grpc" + allow_request_body: false + add_linkerd_headers: false + failure_mode_allow: false +- apiVersion: "getambassador.io/v3alpha1" + kind: "AuthService" + metadata: + creationTimestamp: "2020-07-03T02:19:06Z" + name: "authsvc-one-true" + namespace: "default" + spec: + auth_service: "authservice" + proto: "grpc" + allow_request_body: true + add_linkerd_headers: false + failure_mode_allow: false +- apiVersion: "getambassador.io/v3alpha1" + kind: "AuthService" + metadata: + creationTimestamp: "2020-07-03T02:19:06Z" + name: "authsvc-two-true" + namespace: "default" + spec: + auth_service: "authservice" + proto: "grpc" + allow_request_body: false + add_linkerd_headers: true + failure_mode_allow: true +- apiVersion: "getambassador.io/v3alpha1" + kind: "AuthService" + metadata: + creationTimestamp: "2020-07-03T02:19:06Z" + name: "authsvc-all-true" + namespace: "default" + spec: + auth_service: "authservice" + proto: "grpc" + allow_request_body: true + add_linkerd_headers: true + failure_mode_allow: true diff --git a/pkg/api/emissary-ingress.dev/v4alpha1/testdata/devportals.yaml b/pkg/api/emissary-ingress.dev/v4alpha1/testdata/devportals.yaml index da350377d4..a96f126b3b 100644 --- a/pkg/api/emissary-ingress.dev/v4alpha1/testdata/devportals.yaml +++ b/pkg/api/emissary-ingress.dev/v4alpha1/testdata/devportals.yaml @@ -1,53 +1,53 @@ -- apiVersion: "getambassador.io/v3alpha1" - kind: "DevPortal" +- apiVersion: emissary-ingress.dev/v4alpha1 + kind: DevPortal metadata: - creationTimestamp: "2020-07-03T02:19:06Z" - name: "devportal-base" - namespace: "default" + creationTimestamp: "2020-07-03T02:19:06Z" + name: devportal-base + namespace: default spec: - content: - branch: "devportal-base" - docs: - - service: "myservice" - url: "https://devportal-base/" - selector: - matchLabels: - string: "string" - matchNamespaces: - - "string" -- apiVersion: "getambassador.io/v3alpha1" - kind: "DevPortal" + content: + branch: devportal-base + docs: + - service: myservice + url: https://devportal-base/ + selector: + matchLabels: + string: string + matchNamespaces: + - string +- apiVersion: emissary-ingress.dev/v4alpha1 + kind: DevPortal metadata: - creationTimestamp: "2020-07-03T02:19:06Z" - name: "devportal-default-true" - namespace: "default" + creationTimestamp: "2020-07-03T02:19:06Z" + name: devportal-default-true + namespace: default spec: - content: - branch: "devportal-default-true" - default: true - docs: - - service: "myservice" - url: "https://devportal-default-true/" - selector: - matchLabels: - string: "string" - matchNamespaces: - - "string" -- apiVersion: "getambassador.io/v3alpha1" - kind: "DevPortal" + content: + branch: devportal-default-true + default: true + docs: + - service: myservice + url: https://devportal-default-true/ + selector: + matchLabels: + string: string + matchNamespaces: + - string +- apiVersion: emissary-ingress.dev/v4alpha1 + kind: DevPortal metadata: - creationTimestamp: "2020-07-03T02:19:06Z" - name: "devportal-default-false" - namespace: "default" + creationTimestamp: "2020-07-03T02:19:06Z" + name: devportal-default-false + namespace: default spec: - content: - branch: "devportal-default-false" - default: false - docs: - - service: "myservice" - url: "https://devportal-default-false/" - selector: - matchLabels: - string: "string" - matchNamespaces: - - "string" + content: + branch: devportal-default-false + default: false + docs: + - service: myservice + url: https://devportal-default-false/ + selector: + matchLabels: + string: string + matchNamespaces: + - string diff --git a/pkg/api/emissary-ingress.dev/v4alpha1/testdata/devportals_v3.yaml b/pkg/api/emissary-ingress.dev/v4alpha1/testdata/devportals_v3.yaml new file mode 100644 index 0000000000..da350377d4 --- /dev/null +++ b/pkg/api/emissary-ingress.dev/v4alpha1/testdata/devportals_v3.yaml @@ -0,0 +1,53 @@ +- apiVersion: "getambassador.io/v3alpha1" + kind: "DevPortal" + metadata: + creationTimestamp: "2020-07-03T02:19:06Z" + name: "devportal-base" + namespace: "default" + spec: + content: + branch: "devportal-base" + docs: + - service: "myservice" + url: "https://devportal-base/" + selector: + matchLabels: + string: "string" + matchNamespaces: + - "string" +- apiVersion: "getambassador.io/v3alpha1" + kind: "DevPortal" + metadata: + creationTimestamp: "2020-07-03T02:19:06Z" + name: "devportal-default-true" + namespace: "default" + spec: + content: + branch: "devportal-default-true" + default: true + docs: + - service: "myservice" + url: "https://devportal-default-true/" + selector: + matchLabels: + string: "string" + matchNamespaces: + - "string" +- apiVersion: "getambassador.io/v3alpha1" + kind: "DevPortal" + metadata: + creationTimestamp: "2020-07-03T02:19:06Z" + name: "devportal-default-false" + namespace: "default" + spec: + content: + branch: "devportal-default-false" + default: false + docs: + - service: "myservice" + url: "https://devportal-default-false/" + selector: + matchLabels: + string: "string" + matchNamespaces: + - "string" diff --git a/pkg/api/emissary-ingress.dev/v4alpha1/testdata/hosts.yaml b/pkg/api/emissary-ingress.dev/v4alpha1/testdata/hosts.yaml index 13d1bc612b..78d381f2de 100644 --- a/pkg/api/emissary-ingress.dev/v4alpha1/testdata/hosts.yaml +++ b/pkg/api/emissary-ingress.dev/v4alpha1/testdata/hosts.yaml @@ -1,44 +1,44 @@ -- apiVersion: "getambassador.io/v3alpha1" - kind: "Host" +- apiVersion: emissary-ingress.dev/v4alpha1 + kind: Host metadata: - creationTimestamp: "2020-07-03T02:19:06Z" - name: "host-base" - namespace: "alt2-namespace" + creationTimestamp: "2020-07-03T02:19:06Z" + name: host-base + namespace: alt2-namespace spec: - acmeProvider: - authority: "none" - hostname: "host-base" + acmeProvider: + authority: none + hostname: host-base status: {} -- apiVersion: "getambassador.io/v3alpha1" - kind: "Host" +- apiVersion: emissary-ingress.dev/v4alpha1 + kind: Host metadata: - creationTimestamp: "2020-07-03T02:19:06Z" - name: "host-tls-base" - namespace: "alt2-namespace" + creationTimestamp: "2020-07-03T02:19:06Z" + name: host-tls-base + namespace: alt2-namespace spec: - acmeProvider: - authority: "none" - hostname: "host-tls-base" - tls: - ca_secret: "hostcrdclientcertsamenamespace-ca" - tlsSecret: - name: "hostcrdclientcertsamenamespace.server" + acmeProvider: + authority: none + hostname: host-tls-base + tls: + caSecret: hostcrdclientcertsamenamespace-ca + tlsSecret: + name: hostcrdclientcertsamenamespace.server status: {} -- apiVersion: "getambassador.io/v3alpha1" - kind: "Host" +- apiVersion: emissary-ingress.dev/v4alpha1 + kind: Host metadata: - creationTimestamp: "2020-07-03T02:19:06Z" - name: "host-tls-ccr-true" - namespace: "alt2-namespace" + creationTimestamp: "2020-07-03T02:19:06Z" + name: host-tls-ccr-true + namespace: alt2-namespace spec: - acmeProvider: - authority: "none" - hostname: "host-tls-ccr-true" - tls: - ca_secret: "hostcrdclientcertsamenamespace-ca" - cert_required: true - tlsSecret: - name: "hostcrdclientcertsamenamespace.server" + acmeProvider: + authority: none + hostname: host-tls-ccr-true + tls: + caSecret: hostcrdclientcertsamenamespace-ca + certRequired: true + tlsSecret: + name: hostcrdclientcertsamenamespace.server status: errorBackoff: 5m0s errorReason: tlsSecret does not exist @@ -46,139 +46,139 @@ phaseCompleted: DefaultsFilled state: Error tlsCertificateSource: Other -- apiVersion: "getambassador.io/v3alpha1" - kind: "Host" +- apiVersion: emissary-ingress.dev/v4alpha1 + kind: Host metadata: - creationTimestamp: "2020-07-03T02:19:06Z" - name: "host-tls-ccr-true-rcf-set" - namespace: "alt2-namespace" + creationTimestamp: "2020-07-03T02:19:06Z" + name: host-tls-ccr-true-rcf-set + namespace: alt2-namespace spec: - acmeProvider: - authority: "none" - hostname: "host-tls-ccr-true-rcf-set" - tls: - ca_secret: "hostcrdclientcertsamenamespace-ca" - cert_required: true - redirect_cleartext_from: 8888 - tlsSecret: - name: "hostcrdclientcertsamenamespace.server" + acmeProvider: + authority: none + hostname: host-tls-ccr-true-rcf-set + tls: + caSecret: hostcrdclientcertsamenamespace-ca + certRequired: true + redirectCleartextFrom: 8888 + tlsSecret: + name: hostcrdclientcertsamenamespace.server status: {} -- apiVersion: "getambassador.io/v3alpha1" - kind: "Host" +- apiVersion: emissary-ingress.dev/v4alpha1 + kind: Host metadata: - creationTimestamp: "2020-07-03T02:19:06Z" - name: "host-tls-ccr-false-rcf-zero" - namespace: "alt2-namespace" + creationTimestamp: "2020-07-03T02:19:06Z" + name: host-tls-ccr-false-rcf-zero + namespace: alt2-namespace spec: - acmeProvider: - authority: "none" - hostname: "host-tls-ccr-false-rcf-zero" - tls: - ca_secret: "hostcrdclientcertsamenamespace-ca" - cert_required: false - redirect_cleartext_from: 0 - tlsSecret: - name: "hostcrdclientcertsamenamespace.server" + acmeProvider: + authority: none + hostname: host-tls-ccr-false-rcf-zero + tls: + caSecret: hostcrdclientcertsamenamespace-ca + certRequired: false + redirectCleartextFrom: 0 + tlsSecret: + name: hostcrdclientcertsamenamespace.server status: {} -- apiVersion: "getambassador.io/v3alpha1" - kind: "Host" +- apiVersion: emissary-ingress.dev/v4alpha1 + kind: Host metadata: - creationTimestamp: "2020-07-03T02:19:06Z" - name: "host-addlport-negative-1" - namespace: "default" + creationTimestamp: "2020-07-03T02:19:06Z" + name: host-addlport-negative-1 + namespace: default spec: - acmeProvider: - authority: "none" - hostname: "host-addlport-negative-1" - requestPolicy: - insecure: - additionalPort: -1 + acmeProvider: + authority: none + hostname: host-addlport-negative-1 + requestPolicy: + insecure: + additionalPort: -1 status: {} -- apiVersion: "getambassador.io/v3alpha1" - kind: "Host" +- apiVersion: emissary-ingress.dev/v4alpha1 + kind: Host metadata: - creationTimestamp: "2020-07-03T02:19:06Z" - name: "host-addlport-8080" - namespace: "default" + creationTimestamp: "2020-07-03T02:19:06Z" + name: host-addlport-8080 + namespace: default spec: - acmeProvider: - authority: "none" - hostname: "host-addlport-8080" - requestPolicy: - insecure: - additionalPort: 8080 + acmeProvider: + authority: none + hostname: host-addlport-8080 + requestPolicy: + insecure: + additionalPort: 8080 status: {} -- apiVersion: "getambassador.io/v3alpha1" - kind: "Host" +- apiVersion: emissary-ingress.dev/v4alpha1 + kind: Host metadata: - creationTimestamp: "2020-07-03T02:19:06Z" - name: "host-addlport-0" - namespace: "default" + creationTimestamp: "2020-07-03T02:19:06Z" + name: host-addlport-0 + namespace: default spec: - acmeProvider: - authority: "none" - hostname: "host-addlport-0" - requestPolicy: - insecure: - additionalPort: 0 + acmeProvider: + authority: none + hostname: host-addlport-0 + requestPolicy: + insecure: + additionalPort: 0 status: {} -- apiVersion: "getambassador.io/v3alpha1" - kind: "Host" +- apiVersion: emissary-ingress.dev/v4alpha1 + kind: Host metadata: - creationTimestamp: "2020-07-03T02:19:06Z" - name: "host-no-addlport" - namespace: "default" + creationTimestamp: "2020-07-03T02:19:06Z" + name: host-no-addlport + namespace: default spec: - acmeProvider: - authority: "none" - hostname: "host-no-addlport" - requestPolicy: - insecure: - action: "Route" + acmeProvider: + authority: none + hostname: host-no-addlport + requestPolicy: + insecure: + action: Route status: {} -- apiVersion: "getambassador.io/v3alpha1" - kind: "Host" +- apiVersion: emissary-ingress.dev/v4alpha1 + kind: Host metadata: - creationTimestamp: "2020-07-03T02:19:06Z" - name: "host-no-preview-enabled" - namespace: "default" + creationTimestamp: "2020-07-03T02:19:06Z" + name: host-no-preview-enabled + namespace: default spec: - hostname: "host-no-preview-enabled" - previewUrl: - type: "Path" + hostname: host-no-preview-enabled + previewUrl: + type: Path status: {} -- apiVersion: "getambassador.io/v3alpha1" - kind: "Host" +- apiVersion: emissary-ingress.dev/v4alpha1 + kind: Host metadata: - creationTimestamp: "2020-07-03T02:19:06Z" - name: "host-preview-enabled-false" - namespace: "default" + creationTimestamp: "2020-07-03T02:19:06Z" + name: host-preview-enabled-false + namespace: default spec: - hostname: "host-preview-enabled-false" - previewUrl: - enabled: false - type: "Path" + hostname: host-preview-enabled-false + previewUrl: + enabled: false + type: Path status: {} -- apiVersion: "getambassador.io/v3alpha1" - kind: "Host" +- apiVersion: emissary-ingress.dev/v4alpha1 + kind: Host metadata: - creationTimestamp: "2020-07-03T02:19:06Z" - name: "host-preview-enabled-true" - namespace: "default" + creationTimestamp: "2020-07-03T02:19:06Z" + name: host-preview-enabled-true + namespace: default spec: - hostname: "host-preview-enabled-true" - previewUrl: - enabled: true - type: "Path" + hostname: host-preview-enabled-true + previewUrl: + enabled: true + type: Path status: {} -- apiVersion: "getambassador.io/v3alpha1" - kind: "Host" +- apiVersion: emissary-ingress.dev/v4alpha1 + kind: Host metadata: - creationTimestamp: "2020-07-03T02:19:06Z" - name: "host-preview-enabled-true" + creationTimestamp: "2020-07-03T02:19:06Z" + name: host-preview-enabled-true spec: - hostname: "host-preview-enabled-true" - mappingSelector: - matchLabels: - app.example.com/name: foo + hostname: host-preview-enabled-true + mappingSelector: + matchLabels: + app.example.com/name: foo status: {} diff --git a/pkg/api/emissary-ingress.dev/v4alpha1/testdata/hosts_v3.yaml b/pkg/api/emissary-ingress.dev/v4alpha1/testdata/hosts_v3.yaml new file mode 100644 index 0000000000..13d1bc612b --- /dev/null +++ b/pkg/api/emissary-ingress.dev/v4alpha1/testdata/hosts_v3.yaml @@ -0,0 +1,184 @@ +- apiVersion: "getambassador.io/v3alpha1" + kind: "Host" + metadata: + creationTimestamp: "2020-07-03T02:19:06Z" + name: "host-base" + namespace: "alt2-namespace" + spec: + acmeProvider: + authority: "none" + hostname: "host-base" + status: {} +- apiVersion: "getambassador.io/v3alpha1" + kind: "Host" + metadata: + creationTimestamp: "2020-07-03T02:19:06Z" + name: "host-tls-base" + namespace: "alt2-namespace" + spec: + acmeProvider: + authority: "none" + hostname: "host-tls-base" + tls: + ca_secret: "hostcrdclientcertsamenamespace-ca" + tlsSecret: + name: "hostcrdclientcertsamenamespace.server" + status: {} +- apiVersion: "getambassador.io/v3alpha1" + kind: "Host" + metadata: + creationTimestamp: "2020-07-03T02:19:06Z" + name: "host-tls-ccr-true" + namespace: "alt2-namespace" + spec: + acmeProvider: + authority: "none" + hostname: "host-tls-ccr-true" + tls: + ca_secret: "hostcrdclientcertsamenamespace-ca" + cert_required: true + tlsSecret: + name: "hostcrdclientcertsamenamespace.server" + status: + errorBackoff: 5m0s + errorReason: tlsSecret does not exist + errorTimestamp: "2021-11-29T19:51:04Z" + phaseCompleted: DefaultsFilled + state: Error + tlsCertificateSource: Other +- apiVersion: "getambassador.io/v3alpha1" + kind: "Host" + metadata: + creationTimestamp: "2020-07-03T02:19:06Z" + name: "host-tls-ccr-true-rcf-set" + namespace: "alt2-namespace" + spec: + acmeProvider: + authority: "none" + hostname: "host-tls-ccr-true-rcf-set" + tls: + ca_secret: "hostcrdclientcertsamenamespace-ca" + cert_required: true + redirect_cleartext_from: 8888 + tlsSecret: + name: "hostcrdclientcertsamenamespace.server" + status: {} +- apiVersion: "getambassador.io/v3alpha1" + kind: "Host" + metadata: + creationTimestamp: "2020-07-03T02:19:06Z" + name: "host-tls-ccr-false-rcf-zero" + namespace: "alt2-namespace" + spec: + acmeProvider: + authority: "none" + hostname: "host-tls-ccr-false-rcf-zero" + tls: + ca_secret: "hostcrdclientcertsamenamespace-ca" + cert_required: false + redirect_cleartext_from: 0 + tlsSecret: + name: "hostcrdclientcertsamenamespace.server" + status: {} +- apiVersion: "getambassador.io/v3alpha1" + kind: "Host" + metadata: + creationTimestamp: "2020-07-03T02:19:06Z" + name: "host-addlport-negative-1" + namespace: "default" + spec: + acmeProvider: + authority: "none" + hostname: "host-addlport-negative-1" + requestPolicy: + insecure: + additionalPort: -1 + status: {} +- apiVersion: "getambassador.io/v3alpha1" + kind: "Host" + metadata: + creationTimestamp: "2020-07-03T02:19:06Z" + name: "host-addlport-8080" + namespace: "default" + spec: + acmeProvider: + authority: "none" + hostname: "host-addlport-8080" + requestPolicy: + insecure: + additionalPort: 8080 + status: {} +- apiVersion: "getambassador.io/v3alpha1" + kind: "Host" + metadata: + creationTimestamp: "2020-07-03T02:19:06Z" + name: "host-addlport-0" + namespace: "default" + spec: + acmeProvider: + authority: "none" + hostname: "host-addlport-0" + requestPolicy: + insecure: + additionalPort: 0 + status: {} +- apiVersion: "getambassador.io/v3alpha1" + kind: "Host" + metadata: + creationTimestamp: "2020-07-03T02:19:06Z" + name: "host-no-addlport" + namespace: "default" + spec: + acmeProvider: + authority: "none" + hostname: "host-no-addlport" + requestPolicy: + insecure: + action: "Route" + status: {} +- apiVersion: "getambassador.io/v3alpha1" + kind: "Host" + metadata: + creationTimestamp: "2020-07-03T02:19:06Z" + name: "host-no-preview-enabled" + namespace: "default" + spec: + hostname: "host-no-preview-enabled" + previewUrl: + type: "Path" + status: {} +- apiVersion: "getambassador.io/v3alpha1" + kind: "Host" + metadata: + creationTimestamp: "2020-07-03T02:19:06Z" + name: "host-preview-enabled-false" + namespace: "default" + spec: + hostname: "host-preview-enabled-false" + previewUrl: + enabled: false + type: "Path" + status: {} +- apiVersion: "getambassador.io/v3alpha1" + kind: "Host" + metadata: + creationTimestamp: "2020-07-03T02:19:06Z" + name: "host-preview-enabled-true" + namespace: "default" + spec: + hostname: "host-preview-enabled-true" + previewUrl: + enabled: true + type: "Path" + status: {} +- apiVersion: "getambassador.io/v3alpha1" + kind: "Host" + metadata: + creationTimestamp: "2020-07-03T02:19:06Z" + name: "host-preview-enabled-true" + spec: + hostname: "host-preview-enabled-true" + mappingSelector: + matchLabels: + app.example.com/name: foo + status: {} diff --git a/pkg/api/emissary-ingress.dev/v4alpha1/testdata/logsvc.yaml b/pkg/api/emissary-ingress.dev/v4alpha1/testdata/logsvc.yaml index e721fe8562..972e3cef7d 100644 --- a/pkg/api/emissary-ingress.dev/v4alpha1/testdata/logsvc.yaml +++ b/pkg/api/emissary-ingress.dev/v4alpha1/testdata/logsvc.yaml @@ -1,109 +1,109 @@ -- apiVersion: "getambassador.io/v3alpha1" - kind: "LogService" +- apiVersion: emissary-ingress.dev/v4alpha1 + kind: LogService metadata: - creationTimestamp: "2020-07-03T02:19:06Z" - name: "logsvc-no-flush" - namespace: "default" + creationTimestamp: "2020-07-03T02:19:06Z" + name: logsvc-no-flush + namespace: default spec: - driver: "http" - driver_config: - additional_log_headers: - - header_name: "included-on-all" - - during_trailer: false - header_name: "not-included-on-trailer" - - during_response: false - during_trailer: false - header_name: "not-included on resp-trail" - - during_request: false - during_response: false - during_trailer: false - header_name: "not-anywhere" - - during_trailer: true - header_name: "included-on-trailer" - - during_response: true - during_trailer: true - header_name: "included on resp-trail" - - during_request: true - during_response: true - during_trailer: true - header_name: "everywhere" - service: "logsvc" -- apiVersion: "getambassador.io/v3alpha1" - kind: "LogService" + driver: http + driverConfig: + additionalLogHeaders: + - headerName: included-on-all + - duringTrailer: false + headerName: not-included-on-trailer + - duringResponse: false + duringTrailer: false + headerName: not-included on resp-trail + - duringRequest: false + duringResponse: false + duringTrailer: false + headerName: not-anywhere + - duringTrailer: true + headerName: included-on-trailer + - duringResponse: true + duringTrailer: true + headerName: included on resp-trail + - duringRequest: true + duringResponse: true + duringTrailer: true + headerName: everywhere + service: logsvc +- apiVersion: emissary-ingress.dev/v4alpha1 + kind: LogService metadata: - creationTimestamp: "2020-07-03T02:19:06Z" - name: "logsvc-with-stats-name" - namespace: "default" + creationTimestamp: "2020-07-03T02:19:06Z" + name: logsvc-with-stats-name + namespace: default spec: - driver: "http" - driver_config: - additional_log_headers: - - header_name: "included-on-all" - - during_trailer: false - header_name: "not-included-on-trailer" - - during_response: false - during_trailer: false - header_name: "not-included on resp-trail" - - during_request: false - during_response: false - during_trailer: false - header_name: "not-anywhere" - - during_trailer: true - header_name: "included-on-trailer" - - during_response: true - during_trailer: true - header_name: "included on resp-trail" - - during_request: true - during_response: true - during_trailer: true - header_name: "everywhere" - service: "logsvc" - stats_name: "alt-stats-name" -- apiVersion: "getambassador.io/v3alpha1" - kind: "LogService" + driver: http + driverConfig: + additionalLogHeaders: + - headerName: included-on-all + - duringTrailer: false + headerName: not-included-on-trailer + - duringResponse: false + duringTrailer: false + headerName: not-included on resp-trail + - duringRequest: false + duringResponse: false + duringTrailer: false + headerName: not-anywhere + - duringTrailer: true + headerName: included-on-trailer + - duringResponse: true + duringTrailer: true + headerName: included on resp-trail + - duringRequest: true + duringResponse: true + duringTrailer: true + headerName: everywhere + service: logsvc + statsName: alt-stats-name +- apiVersion: emissary-ingress.dev/v4alpha1 + kind: LogService metadata: - creationTimestamp: "2020-07-03T02:19:06Z" - name: "logsvc-flush" - namespace: "default" + creationTimestamp: "2020-07-03T02:19:06Z" + name: logsvc-flush + namespace: default spec: - driver: "http" - grpc: false - driver_config: - additional_log_headers: - - header_name: "included-on-all" - - during_trailer: false - header_name: "not-included-on-trailer" - - during_response: false - during_trailer: false - header_name: "not-included on resp-trail" - - during_request: false - during_response: false - during_trailer: false - header_name: "not-anywhere" - flush_interval_byte_size: 1 - flush_interval_time: 1 - service: "logsvc" -- apiVersion: "getambassador.io/v3alpha1" - kind: "LogService" + driver: http + driverConfig: + additionalLogHeaders: + - headerName: included-on-all + - duringTrailer: false + headerName: not-included-on-trailer + - duringResponse: false + duringTrailer: false + headerName: not-included on resp-trail + - duringRequest: false + duringResponse: false + duringTrailer: false + headerName: not-anywhere + flushIntervalByteSize: 1 + flushIntervalTime: 1 + grpc: false + service: logsvc +- apiVersion: emissary-ingress.dev/v4alpha1 + kind: LogService metadata: - creationTimestamp: "2020-07-03T02:19:06Z" - name: "logsvc-zero-flush" - namespace: "default" + creationTimestamp: "2020-07-03T02:19:06Z" + name: logsvc-zero-flush + namespace: default spec: - driver: "http" - grpc: true - driver_config: - additional_log_headers: - - header_name: "included-on-all" - - during_trailer: false - header_name: "not-included-on-trailer" - - during_response: false - during_trailer: false - header_name: "not-included on resp-trail" - - during_request: false - during_response: false - during_trailer: false - header_name: "not-anywhere" - flush_interval_byte_size: 0 - flush_interval_time: 0 - service: "logsvc" + driver: http + driverConfig: + additionalLogHeaders: + - headerName: included-on-all + - duringTrailer: false + headerName: not-included-on-trailer + - duringResponse: false + duringTrailer: false + headerName: not-included on resp-trail + - duringRequest: false + duringResponse: false + duringTrailer: false + headerName: not-anywhere + flushIntervalByteSize: 0 + flushIntervalTime: 0 + grpc: true + service: logsvc diff --git a/pkg/api/emissary-ingress.dev/v4alpha1/testdata/logsvc_v3.yaml b/pkg/api/emissary-ingress.dev/v4alpha1/testdata/logsvc_v3.yaml new file mode 100644 index 0000000000..e721fe8562 --- /dev/null +++ b/pkg/api/emissary-ingress.dev/v4alpha1/testdata/logsvc_v3.yaml @@ -0,0 +1,109 @@ +- apiVersion: "getambassador.io/v3alpha1" + kind: "LogService" + metadata: + creationTimestamp: "2020-07-03T02:19:06Z" + name: "logsvc-no-flush" + namespace: "default" + spec: + driver: "http" + driver_config: + additional_log_headers: + - header_name: "included-on-all" + - during_trailer: false + header_name: "not-included-on-trailer" + - during_response: false + during_trailer: false + header_name: "not-included on resp-trail" + - during_request: false + during_response: false + during_trailer: false + header_name: "not-anywhere" + - during_trailer: true + header_name: "included-on-trailer" + - during_response: true + during_trailer: true + header_name: "included on resp-trail" + - during_request: true + during_response: true + during_trailer: true + header_name: "everywhere" + service: "logsvc" +- apiVersion: "getambassador.io/v3alpha1" + kind: "LogService" + metadata: + creationTimestamp: "2020-07-03T02:19:06Z" + name: "logsvc-with-stats-name" + namespace: "default" + spec: + driver: "http" + driver_config: + additional_log_headers: + - header_name: "included-on-all" + - during_trailer: false + header_name: "not-included-on-trailer" + - during_response: false + during_trailer: false + header_name: "not-included on resp-trail" + - during_request: false + during_response: false + during_trailer: false + header_name: "not-anywhere" + - during_trailer: true + header_name: "included-on-trailer" + - during_response: true + during_trailer: true + header_name: "included on resp-trail" + - during_request: true + during_response: true + during_trailer: true + header_name: "everywhere" + service: "logsvc" + stats_name: "alt-stats-name" +- apiVersion: "getambassador.io/v3alpha1" + kind: "LogService" + metadata: + creationTimestamp: "2020-07-03T02:19:06Z" + name: "logsvc-flush" + namespace: "default" + spec: + driver: "http" + grpc: false + driver_config: + additional_log_headers: + - header_name: "included-on-all" + - during_trailer: false + header_name: "not-included-on-trailer" + - during_response: false + during_trailer: false + header_name: "not-included on resp-trail" + - during_request: false + during_response: false + during_trailer: false + header_name: "not-anywhere" + flush_interval_byte_size: 1 + flush_interval_time: 1 + service: "logsvc" +- apiVersion: "getambassador.io/v3alpha1" + kind: "LogService" + metadata: + creationTimestamp: "2020-07-03T02:19:06Z" + name: "logsvc-zero-flush" + namespace: "default" + spec: + driver: "http" + grpc: true + driver_config: + additional_log_headers: + - header_name: "included-on-all" + - during_trailer: false + header_name: "not-included-on-trailer" + - during_response: false + during_trailer: false + header_name: "not-included on resp-trail" + - during_request: false + during_response: false + during_trailer: false + header_name: "not-anywhere" + flush_interval_byte_size: 0 + flush_interval_time: 0 + service: "logsvc" diff --git a/pkg/api/emissary-ingress.dev/v4alpha1/testdata/mappings.yaml b/pkg/api/emissary-ingress.dev/v4alpha1/testdata/mappings.yaml index 5dcf41414f..ce23e04bd1 100644 --- a/pkg/api/emissary-ingress.dev/v4alpha1/testdata/mappings.yaml +++ b/pkg/api/emissary-ingress.dev/v4alpha1/testdata/mappings.yaml @@ -1,628 +1,642 @@ -- apiVersion: "getambassador.io/v3alpha1" - kind: "Mapping" - metadata: - creationTimestamp: "2020-07-03T02:19:06Z" - generation: 1 - labels: - product: "aes" - name: "ambassador-devportal-api" - namespace: "ambassador" - resourceVersion: "701" - uid: "2fd46b2e-a553-455c-9a67-5b22848c1167" - spec: - prefix: "/openapi/" - auto_host_rewrite: false - prefix_regex: false - rewrite: "" - service: "127.0.0.1:8500" +- apiVersion: emissary-ingress.dev/v4alpha1 + kind: Mapping + metadata: + creationTimestamp: "2020-07-03T02:19:06Z" + generation: 1 + labels: + product: aes + name: ambassador-devportal-api + namespace: ambassador + resourceVersion: "701" + uid: 2fd46b2e-a553-455c-9a67-5b22848c1167 + spec: + autoHostRewrite: false + prefix: /openapi/ + prefixRegex: false + rewrite: "" + service: 127.0.0.1:8500 status: - state: "Running" -- apiVersion: "getambassador.io/v3alpha1" - kind: "Mapping" - metadata: - creationTimestamp: "2020-07-03T02:19:06Z" - generation: 1 - labels: - product: "aes" - name: "ambassador-mapping-with-stats-name" - namespace: "ambassador" - resourceVersion: "701" - uid: "2fd46b2e-a553-455c-9a67-5b22848c1167" - spec: - prefix: "/openapi/" - auto_host_rewrite: false - prefix_regex: false - rewrite: "" - service: "127.0.0.1:8500" - stats_name: "alt-stats-name" + state: Running +- apiVersion: emissary-ingress.dev/v4alpha1 + kind: Mapping + metadata: + creationTimestamp: "2020-07-03T02:19:06Z" + generation: 1 + labels: + product: aes + name: ambassador-mapping-with-stats-name + namespace: ambassador + resourceVersion: "701" + uid: 2fd46b2e-a553-455c-9a67-5b22848c1167 + spec: + autoHostRewrite: false + prefix: /openapi/ + prefixRegex: false + rewrite: "" + service: 127.0.0.1:8500 + statsName: alt-stats-name status: - state: "Running" -- apiVersion: "getambassador.io/v3alpha1" - kind: "Mapping" - metadata: - creationTimestamp: "2020-07-03T02:19:06Z" - generation: 1 - labels: - product: "aes" - name: "ambassador-devportal" - namespace: "ambassador" - resourceVersion: "702" - uid: "d19f50c2-ad3c-4b8b-8a90-20263aa7beee" - spec: - prefix: "/docs/" - auto_host_rewrite: true - prefix_regex: false - rewrite: "/docs/" - service: "127.0.0.1:8500" + state: Running +- apiVersion: emissary-ingress.dev/v4alpha1 + kind: Mapping + metadata: + creationTimestamp: "2020-07-03T02:19:06Z" + generation: 1 + labels: + product: aes + name: ambassador-devportal + namespace: ambassador + resourceVersion: "702" + uid: d19f50c2-ad3c-4b8b-8a90-20263aa7beee + spec: + autoHostRewrite: true + prefix: /docs/ + prefixRegex: false + rewrite: /docs/ + service: 127.0.0.1:8500 status: - state: "Running" -- apiVersion: "getambassador.io/v3alpha1" - kind: "Mapping" - metadata: - creationTimestamp: "2020-08-11T20:54:11Z" - generation: 1 - name: "mapping-for-echo" - namespace: "ambassador" - resourceVersion: "4462369" - uid: "486c2af1-70d3-4d7b-9fc8-99bd19fd9107" - spec: - prefix: "/echo/" - prefix_regex: true - prefix_exact: false - service: "echo" -- apiVersion: "getambassador.io/v3alpha1" - kind: "Mapping" - metadata: - creationTimestamp: "2020-08-11T20:54:11Z" - generation: 1 - name: "filter-actions-on-mapping" - namespace: "ambassador" - resourceVersion: "4462382" - uid: "f30549f4-1cf7-4b03-a775-b2dab1e789a0" - spec: - host_rewrite: "httpbin.org" - prefix: "/filter-actions/on/" - prefix_exact: true - add_linkerd_headers: false - rewrite: "/" - service: "httpbin.default.svc.cluster.local" - timeout_ms: 5000 -- apiVersion: "getambassador.io/v3alpha1" - kind: "Mapping" - metadata: - creationTimestamp: "2020-08-11T20:54:12Z" - generation: 1 - name: "filter-actions-if-mapping" - namespace: "ambassador" - resourceVersion: "4462389" - uid: "410db612-dd15-461c-bc08-bf3a5a47f1cc" - spec: - host_rewrite: "httpbin.org" - add_linkerd_headers: true - case_sensitive: false - prefix: "/filter-actions/if/" - rewrite: "/" - service: "httpbin.default.svc.cluster.local" - timeout_ms: 0 -- apiVersion: "getambassador.io/v3alpha1" - kind: "Mapping" - metadata: - creationTimestamp: "2020-08-11T20:54:13Z" - generation: 1 - name: "external-grpc-mapping" - namespace: "ambassador" - resourceVersion: "4462430" - uid: "be652a11-10f4-4c72-b4e7-b234cc3c6e93" - spec: - host_rewrite: "httpbin.org" - prefix: "/external-grpc/" - service: "httpbin.default.svc.cluster.local" - case_sensitive: true - enable_ipv4: false - timeout_ms: 5000 - idle_timeout_ms: 0 -- apiVersion: "getambassador.io/v3alpha1" - kind: "Mapping" - metadata: - creationTimestamp: "2020-08-11T20:54:14Z" - generation: 1 - name: "external-http-mapping" - namespace: "ambassador" - resourceVersion: "4462431" - uid: "fcb3a3f1-7c91-4eb5-8769-7a83f7bec196" - spec: - host_rewrite: "httpbin.org" - prefix: "/external-http/" - service: "httpbin.default.svc.cluster.local" - enable_ipv4: true - enable_ipv6: false - timeout_ms: 5000 - weight: 0 -- apiVersion: "getambassador.io/v3alpha1" - kind: "Mapping" - metadata: - creationTimestamp: "2020-08-11T20:54:14Z" - generation: 1 - name: "invalid-mapping" - namespace: "ambassador" - resourceVersion: "4462434" - uid: "40e2b505-eba8-4798-b9ef-99e83b2cfec0" - spec: - host_rewrite: "httpbin.org" - prefix: "/invalid/" - service: "httpbin.default.svc.cluster.local" - enable_ipv6: true - grpc: false - timeout_ms: 5000 -- apiVersion: "getambassador.io/v3alpha1" - kind: "Mapping" - metadata: - creationTimestamp: "2020-08-11T20:54:15Z" - generation: 1 - name: "jwt-filter-mapping" - namespace: "ambassador" - resourceVersion: "4462442" - uid: "4345821c-9e99-42d2-aa41-6fd78a72967f" - spec: - host_rewrite: "httpbin.org" - prefix: "/jwt/" - service: "httpbin.default.svc.cluster.local" - grpc: true - host_redirect: false - timeout_ms: 5000 -- apiVersion: "getambassador.io/v3alpha1" - kind: "Mapping" - metadata: - creationTimestamp: "2020-08-11T20:54:15Z" - generation: 1 - name: "oauth2-auth0-nojwt-and-plugin-and-whitelist" - namespace: "ambassador" - resourceVersion: "4462448" - uid: "6ed048d0-e8b3-4eec-a016-27743871d12a" - spec: - host_rewrite: "httpbin.org" - prefix: "/oauth2-auth0-nojwt-and-plugin-and-whitelist/" - rewrite: "/" - service: "httpbin.default.svc.cluster.local" - host_redirect: true - method_regex: false - timeout_ms: 5000 -- apiVersion: "getambassador.io/v3alpha1" - kind: "Mapping" - metadata: - creationTimestamp: "2020-08-11T20:54:16Z" - generation: 1 - name: "oauth2-auth0-nojwt-and-k8ssecret-and-xhrerror" - namespace: "ambassador" - resourceVersion: "4462459" - uid: "117a70a0-b0c2-465d-aa06-d4cd1dae475c" - spec: - host_rewrite: "httpbin.org" - prefix: "/oauth2-auth0-nojwt-and-k8ssecret-and-xhrerror/" - rewrite: "/" - service: "httpbin.default.svc.cluster.local" - method_regex: true - redirect_response_code: 0 - timeout_ms: 5000 -- apiVersion: "getambassador.io/v3alpha1" - kind: "Mapping" - metadata: - creationTimestamp: "2020-08-11T20:54:17Z" - generation: 1 - name: "oauth2-auth0-nojwt-and-anyerror" - namespace: "ambassador" - resourceVersion: "4462463" - uid: "3e4e6047-e30f-4f98-bee2-3f7cb5eac929" - spec: - host_rewrite: "httpbin.org" - prefix: "/oauth2-auth0-nojwt-and-anyerror/" - rewrite: "/" - redirect_response_code: 400 - precedence: 0 - service: "httpbin.default.svc.cluster.local" - timeout_ms: 5000 -- apiVersion: "getambassador.io/v3alpha1" - kind: "Mapping" - metadata: - creationTimestamp: "2020-08-11T20:54:17Z" - generation: 1 - name: "oauth2-auth0-simplejwt" - namespace: "ambassador" - resourceVersion: "4462468" - uid: "d8a48a30-012a-4173-ada6-820834a96018" - spec: - host_rewrite: "httpbin.org" - prefix: "/oauth2-auth0-simplejwt/" - rewrite: "/" - service: "httpbin.default.svc.cluster.local" - precedence: 100 - shadow: false - timeout_ms: 5000 -- apiVersion: "getambassador.io/v3alpha1" - kind: "Mapping" - metadata: - creationTimestamp: "2020-08-11T20:54:19Z" - generation: 1 - name: "oauth2-auth0-complexjwt" - namespace: "ambassador" - resourceVersion: "4462486" - uid: "0c4e65b7-6193-4e9f-9c65-060b85d8e50d" - spec: - host_rewrite: "httpbin.org" - prefix: "/oauth2-auth0-complexjwt/" - rewrite: "/" - service: "httpbin.default.svc.cluster.local" - shadow: true - use_websocket: false - timeout_ms: 5000 -- apiVersion: "getambassador.io/v3alpha1" - kind: "Mapping" - metadata: - creationTimestamp: "2020-08-11T20:54:19Z" - generation: 1 - name: "oauth2-auth0-differingscope-1" - namespace: "ambassador" - resourceVersion: "4462488" - uid: "eb9e5b6a-617b-4e69-a00e-978aa79c8aa2" - spec: - prefix: "/differingscope/endpoint1/" - rewrite: "/" - use_websocket: true - bypass_auth: false - service: "httpbin.default.svc.cluster.local" -- apiVersion: "getambassador.io/v3alpha1" - kind: "Mapping" - metadata: - creationTimestamp: "2020-08-11T20:54:19Z" - generation: 1 - name: "oauth2-auth0-differingscope-2" - namespace: "ambassador" - resourceVersion: "4462489" - uid: "6140233e-0edc-4d55-84dc-4723e69344d6" - spec: - prefix: "/differingscope/endpoint2/" - rewrite: "/" - bypass_auth: true - bypass_error_response_overrides: false - service: "httpbin.default.svc.cluster.local" -- apiVersion: "getambassador.io/v3alpha1" - kind: "Mapping" - metadata: - creationTimestamp: "2020-08-11T20:54:20Z" - generation: 1 - name: "filter-oauth2-azure-header-credentialsmapping" - namespace: "ambassador" - resourceVersion: "4462492" - uid: "39ecb9d6-5703-4d81-9690-5c6445283821" - spec: - host_rewrite: "httpbin.org" - prefix: "/azure-header-credentials/httpbin/" - rewrite: "/" - bypass_error_response_overrides: true - host_regex: false - service: "httpbin.default.svc.cluster.local" - timeout_ms: 5000 -- apiVersion: "getambassador.io/v3alpha1" - kind: "Mapping" - metadata: - creationTimestamp: "2020-08-11T20:54:21Z" - generation: 1 - name: "filter-oauth2-azure-mapping" - namespace: "ambassador" - resourceVersion: "4462500" - uid: "6f46fee5-9fb6-4a21-9f6d-d3ea0e2e293e" - spec: - host_rewrite: "httpbin.org" - prefix: "/azure/httpbin/" - rewrite: "/" - service: "httpbin.default.svc.cluster.local" - host_regex: true - timeout_ms: 5000 - docs: {} -- apiVersion: "getambassador.io/v3alpha1" - kind: "Mapping" - metadata: - creationTimestamp: "2020-08-11T20:54:21Z" - generation: 1 - name: "filter-oauth2-google-mapping" - namespace: "ambassador" - resourceVersion: "4462511" - uid: "7ad1622b-11cf-47fb-9a46-625238a6021b" - spec: - host_rewrite: "httpbin.org" - prefix: "/google/httpbin/" - rewrite: "/" - service: "httpbin.default.svc.cluster.local" - timeout_ms: 5000 - docs: - ignored: false - path: "ffs" -- apiVersion: "getambassador.io/v3alpha1" - kind: "Mapping" - metadata: - creationTimestamp: "2020-08-11T20:54:22Z" - generation: 1 - name: "filter-oauth2-keycloak-mapping" - namespace: "ambassador" - resourceVersion: "4462515" - uid: "7bf6a07d-2b5a-40bb-b047-feadf1801d91" - spec: - host_rewrite: "httpbin.org" - prefix: "/keycloak/httpbin/" - rewrite: "/" - service: "httpbin.default.svc.cluster.local" - timeout_ms: 5000 - docs: - ignored: true - url: "ffs" - -- apiVersion: "getambassador.io/v3alpha1" - kind: "Mapping" - metadata: - creationTimestamp: "2020-08-11T20:54:23Z" - generation: 1 - name: "filter-oauth2-okta-client-credentialsmapping" - namespace: "ambassador" - resourceVersion: "4462519" - uid: "71379014-130e-45aa-a49b-5869ba135fad" - spec: - host_rewrite: "httpbin.org" - prefix: "/okta-client-credentials/httpbin/" - rewrite: "/" - service: "httpbin.default.svc.cluster.local" - timeout_ms: 5000 - load_balancer: {} -- apiVersion: "getambassador.io/v3alpha1" - kind: "Mapping" - metadata: - creationTimestamp: "2020-08-11T20:54:23Z" - generation: 1 - name: "filter-oauth2-okta-mapping" - namespace: "ambassador" - resourceVersion: "4462523" - uid: "69a04d0c-ca45-4671-b056-ec315b64fae7" - spec: - host_rewrite: "httpbin.org" - prefix: "/okta/httpbin/" - rewrite: "/" - service: "httpbin.default.svc.cluster.local" - timeout_ms: 5000 - load_balancer: - source_ip: false -- apiVersion: "getambassador.io/v3alpha1" - kind: "Mapping" - metadata: - creationTimestamp: "2020-08-11T20:54:24Z" - generation: 1 - name: "filter-oauth2-uaa-mapping" - namespace: "ambassador" - resourceVersion: "4462528" - uid: "6e1a60ea-6ea0-400a-98b2-218b60aaf514" - spec: - host_rewrite: "httpbin.org" - prefix: "/uaa/httpbin/" - rewrite: "/" - service: "httpbin.default.svc.cluster.local" - timeout_ms: 5000 - load_balancer: - policy: "some_policy" - source_ip: true -- apiVersion: "getambassador.io/v3alpha1" - kind: "Mapping" - metadata: - creationTimestamp: "2020-08-11T20:54:25Z" - generation: 1 - name: "filter-oauth2-logout-mapping" - namespace: "ambassador" - resourceVersion: "4462553" - uid: "3b35230c-0c59-4d98-8871-6e13d4cb7f86" - spec: - prefix: "/logout" - service: "filter-oauth2-logout-service.default" - cors: {} -- apiVersion: "getambassador.io/v3alpha1" - kind: "Mapping" - metadata: - creationTimestamp: "2020-08-11T20:54:25Z" - generation: 1 - name: "mapping-for-intercepted" - namespace: "ambassador" - resourceVersion: "4462562" - uid: "8727af82-ca1c-4a29-82ad-8ba94bfc3c52" - spec: - prefix: "/intercepted/" - service: "intercepted.default" - cors: - credentials: false -- apiVersion: "getambassador.io/v3alpha1" - kind: "Mapping" - metadata: - creationTimestamp: "2020-08-11T20:54:27Z" - generation: 1 - name: "load-testing-base" - namespace: "ambassador" - resourceVersion: "4462591" - uid: "d5ef2932-a6a3-439b-bca8-d80f195cd9f6" - spec: - prefix: "/load-testing/" - service: "load-http-echo.default" - cors: - origins: [ "ffs", "ffs2" ] - credentials: true -- apiVersion: "getambassador.io/v3alpha1" - kind: "Mapping" - metadata: - creationTimestamp: "2020-08-11T20:54:28Z" - generation: 1 - name: "load-testing-rl-minute" - namespace: "ambassador" - resourceVersion: "4462630" - uid: "ad827545-4844-4005-90e4-208f4a53fb72" - spec: - labels: - ambassador: - - request_label_group: - - generic_key: { value: "minute" } - prefix: "/load-testing/rl-minute/" - service: "load-http-echo.default" -- apiVersion: "getambassador.io/v3alpha1" - kind: "Mapping" - metadata: - creationTimestamp: "2020-08-11T20:54:30Z" - generation: 1 - name: "load-testing-rl-second" - namespace: "ambassador" - resourceVersion: "4462660" - uid: "143cde54-642b-4069-a03b-033928eab103" - spec: - labels: - ambassador: - - request_label_group: - - generic_key: { value: "second" } - prefix: "/load-testing/rl-second/" - service: "load-http-echo.default" -- apiVersion: "getambassador.io/v3alpha1" - kind: "Mapping" - metadata: - creationTimestamp: "2020-08-11T20:54:32Z" - generation: 1 - name: "rl-test" - namespace: "ambassador" - resourceVersion: "4462685" - uid: "3d0b7b27-7876-4f55-bfbe-9fa1462f60f0" - spec: - labels: - ambassador: - - test_limit: - - source_cluster: { key: "source_cluster" } - - destination_cluster: { key: "destination_cluster" } - - remote_address: { key: "remote_address" } - - generic_key: { value: "rltest" } - prefix: "/rl/" - service: "httpbin.default.svc.cluster.local" - retry_policy: {} -- apiVersion: "getambassador.io/v3alpha1" - kind: "Mapping" - metadata: - creationTimestamp: "2021-01-07T20:27:54Z" - generation: 2 - labels: - kat-ambassador-id: "consultest" - name: "a" - namespace: "default" - resourceVersion: "9298" - uid: "caf33312-1f60-4aed-9d8d-7a9f37b68da0" - spec: - add_response_headers: - Strict-Transport-Security: { value: "max-age=31536000" } - ambassador_id: [ "consultest" ] - labels: - ambassador: - - d0: - - generic_key: { value: "a" } - - request_headers: - key: xratelimitid - header_name: "X-Ratelimit-Id" - omit_if_not_present: true - - request_headers: - key: xratelimitid2 - header_name: "X-Ratelimit-Id2" - omit_if_not_present: false - - request_headers: - key: xratelimitid3 - header_name: "X-Ratelimit-Id3" - prefix: "/api/[^/]+/projects/[^/]+/a(/.*)?" - prefix_regex: true - retry_policy: - num_retries: 15 - retry_on: "gateway-error" - rewrite: "" - service: "https://a" - timeout_ms: 10000 -- apiVersion: "getambassador.io/v3alpha1" - kind: "Mapping" - metadata: - creationTimestamp: "2020-08-11T20:54:33Z" - generation: 1 - name: "rl-dual" - namespace: "ambassador" - resourceVersion: "4462691" - uid: "27c54989-78df-433c-97a0-7c516d0bd9f5" - spec: - labels: - ambassador: - - minute_group: - - generic_key: { value: "backend" } - - generic_key: { value: "minutely" } - - hour_group: - - generic_key: { value: "backend" } - - generic_key: { value: "hourly" } - prefix: "/backend/" - retry_policy: - num_retries: 0 - retry_on: "gateway-error" - service: "httpbin.default.svc.cluster.local" -- apiVersion: "getambassador.io/v3alpha1" - kind: "Mapping" - metadata: - creationTimestamp: "2020-08-11T20:54:33Z" - name: "rl-dual" - spec: - prefix: "/demo/" - host: "example\\.com" - host_regex: true - service: "httpbin.default.svc.cluster.local" -- apiVersion: getambassador.io/v3alpha1 + state: Running +- apiVersion: emissary-ingress.dev/v4alpha1 + kind: Mapping + metadata: + creationTimestamp: "2020-08-11T20:54:11Z" + generation: 1 + name: mapping-for-echo + namespace: ambassador + resourceVersion: "4462369" + uid: 486c2af1-70d3-4d7b-9fc8-99bd19fd9107 + spec: + prefix: /echo/ + prefixExact: false + prefixRegex: true + service: echo +- apiVersion: emissary-ingress.dev/v4alpha1 + kind: Mapping + metadata: + creationTimestamp: "2020-08-11T20:54:11Z" + generation: 1 + name: filter-actions-on-mapping + namespace: ambassador + resourceVersion: "4462382" + uid: f30549f4-1cf7-4b03-a775-b2dab1e789a0 + spec: + addLinkerdHeaders: false + hostRewrite: httpbin.org + prefix: /filter-actions/on/ + prefixExact: true + rewrite: / + service: httpbin.default.svc.cluster.local + timeoutMS: 5000 +- apiVersion: emissary-ingress.dev/v4alpha1 + kind: Mapping + metadata: + creationTimestamp: "2020-08-11T20:54:12Z" + generation: 1 + name: filter-actions-if-mapping + namespace: ambassador + resourceVersion: "4462389" + uid: 410db612-dd15-461c-bc08-bf3a5a47f1cc + spec: + addLinkerdHeaders: true + caseSensitive: false + hostRewrite: httpbin.org + prefix: /filter-actions/if/ + rewrite: / + service: httpbin.default.svc.cluster.local + timeoutMS: 0 +- apiVersion: emissary-ingress.dev/v4alpha1 + kind: Mapping + metadata: + creationTimestamp: "2020-08-11T20:54:13Z" + generation: 1 + name: external-grpc-mapping + namespace: ambassador + resourceVersion: "4462430" + uid: be652a11-10f4-4c72-b4e7-b234cc3c6e93 + spec: + caseSensitive: true + enableIPv4: false + hostRewrite: httpbin.org + idleTimeoutMS: 0 + prefix: /external-grpc/ + service: httpbin.default.svc.cluster.local + timeoutMS: 5000 +- apiVersion: emissary-ingress.dev/v4alpha1 + kind: Mapping + metadata: + creationTimestamp: "2020-08-11T20:54:14Z" + generation: 1 + name: external-http-mapping + namespace: ambassador + resourceVersion: "4462431" + uid: fcb3a3f1-7c91-4eb5-8769-7a83f7bec196 + spec: + enableIPv4: true + enableIPv6: false + hostRewrite: httpbin.org + prefix: /external-http/ + service: httpbin.default.svc.cluster.local + timeoutMS: 5000 + weight: 0 +- apiVersion: emissary-ingress.dev/v4alpha1 + kind: Mapping + metadata: + creationTimestamp: "2020-08-11T20:54:14Z" + generation: 1 + name: invalid-mapping + namespace: ambassador + resourceVersion: "4462434" + uid: 40e2b505-eba8-4798-b9ef-99e83b2cfec0 + spec: + enableIPv6: true + grpc: false + hostRewrite: httpbin.org + prefix: /invalid/ + service: httpbin.default.svc.cluster.local + timeoutMS: 5000 +- apiVersion: emissary-ingress.dev/v4alpha1 + kind: Mapping + metadata: + creationTimestamp: "2020-08-11T20:54:15Z" + generation: 1 + name: jwt-filter-mapping + namespace: ambassador + resourceVersion: "4462442" + uid: 4345821c-9e99-42d2-aa41-6fd78a72967f + spec: + grpc: true + hostRedirect: false + hostRewrite: httpbin.org + prefix: /jwt/ + service: httpbin.default.svc.cluster.local + timeoutMS: 5000 +- apiVersion: emissary-ingress.dev/v4alpha1 + kind: Mapping + metadata: + creationTimestamp: "2020-08-11T20:54:15Z" + generation: 1 + name: oauth2-auth0-nojwt-and-plugin-and-whitelist + namespace: ambassador + resourceVersion: "4462448" + uid: 6ed048d0-e8b3-4eec-a016-27743871d12a + spec: + hostRedirect: true + hostRewrite: httpbin.org + methodRegex: false + prefix: /oauth2-auth0-nojwt-and-plugin-and-whitelist/ + rewrite: / + service: httpbin.default.svc.cluster.local + timeoutMS: 5000 +- apiVersion: emissary-ingress.dev/v4alpha1 + kind: Mapping + metadata: + creationTimestamp: "2020-08-11T20:54:16Z" + generation: 1 + name: oauth2-auth0-nojwt-and-k8ssecret-and-xhrerror + namespace: ambassador + resourceVersion: "4462459" + uid: 117a70a0-b0c2-465d-aa06-d4cd1dae475c + spec: + hostRewrite: httpbin.org + methodRegex: true + prefix: /oauth2-auth0-nojwt-and-k8ssecret-and-xhrerror/ + redirectResponseCode: 0 + rewrite: / + service: httpbin.default.svc.cluster.local + timeoutMS: 5000 +- apiVersion: emissary-ingress.dev/v4alpha1 + kind: Mapping + metadata: + creationTimestamp: "2020-08-11T20:54:17Z" + generation: 1 + name: oauth2-auth0-nojwt-and-anyerror + namespace: ambassador + resourceVersion: "4462463" + uid: 3e4e6047-e30f-4f98-bee2-3f7cb5eac929 + spec: + hostRewrite: httpbin.org + precedence: 0 + prefix: /oauth2-auth0-nojwt-and-anyerror/ + redirectResponseCode: 400 + rewrite: / + service: httpbin.default.svc.cluster.local + timeoutMS: 5000 +- apiVersion: emissary-ingress.dev/v4alpha1 + kind: Mapping + metadata: + creationTimestamp: "2020-08-11T20:54:17Z" + generation: 1 + name: oauth2-auth0-simplejwt + namespace: ambassador + resourceVersion: "4462468" + uid: d8a48a30-012a-4173-ada6-820834a96018 + spec: + hostRewrite: httpbin.org + precedence: 100 + prefix: /oauth2-auth0-simplejwt/ + rewrite: / + service: httpbin.default.svc.cluster.local + shadow: false + timeoutMS: 5000 +- apiVersion: emissary-ingress.dev/v4alpha1 + kind: Mapping + metadata: + creationTimestamp: "2020-08-11T20:54:19Z" + generation: 1 + name: oauth2-auth0-complexjwt + namespace: ambassador + resourceVersion: "4462486" + uid: 0c4e65b7-6193-4e9f-9c65-060b85d8e50d + spec: + hostRewrite: httpbin.org + prefix: /oauth2-auth0-complexjwt/ + rewrite: / + service: httpbin.default.svc.cluster.local + shadow: true + timeoutMS: 5000 + useWebsocket: false +- apiVersion: emissary-ingress.dev/v4alpha1 + kind: Mapping + metadata: + creationTimestamp: "2020-08-11T20:54:19Z" + generation: 1 + name: oauth2-auth0-differingscope-1 + namespace: ambassador + resourceVersion: "4462488" + uid: eb9e5b6a-617b-4e69-a00e-978aa79c8aa2 + spec: + bypassAuth: false + prefix: /differingscope/endpoint1/ + rewrite: / + service: httpbin.default.svc.cluster.local + useWebsocket: true +- apiVersion: emissary-ingress.dev/v4alpha1 + kind: Mapping + metadata: + creationTimestamp: "2020-08-11T20:54:19Z" + generation: 1 + name: oauth2-auth0-differingscope-2 + namespace: ambassador + resourceVersion: "4462489" + uid: 6140233e-0edc-4d55-84dc-4723e69344d6 + spec: + bypassAuth: true + bypassErrorResponseOverrides: false + prefix: /differingscope/endpoint2/ + rewrite: / + service: httpbin.default.svc.cluster.local +- apiVersion: emissary-ingress.dev/v4alpha1 + kind: Mapping + metadata: + creationTimestamp: "2020-08-11T20:54:20Z" + generation: 1 + name: filter-oauth2-azure-header-credentialsmapping + namespace: ambassador + resourceVersion: "4462492" + uid: 39ecb9d6-5703-4d81-9690-5c6445283821 + spec: + bypassErrorResponseOverrides: true + hostRegex: false + hostRewrite: httpbin.org + prefix: /azure-header-credentials/httpbin/ + rewrite: / + service: httpbin.default.svc.cluster.local + timeoutMS: 5000 +- apiVersion: emissary-ingress.dev/v4alpha1 + kind: Mapping + metadata: + creationTimestamp: "2020-08-11T20:54:21Z" + generation: 1 + name: filter-oauth2-azure-mapping + namespace: ambassador + resourceVersion: "4462500" + uid: 6f46fee5-9fb6-4a21-9f6d-d3ea0e2e293e + spec: + docs: {} + hostRegex: true + hostRewrite: httpbin.org + prefix: /azure/httpbin/ + rewrite: / + service: httpbin.default.svc.cluster.local + timeoutMS: 5000 +- apiVersion: emissary-ingress.dev/v4alpha1 + kind: Mapping + metadata: + creationTimestamp: "2020-08-11T20:54:21Z" + generation: 1 + name: filter-oauth2-google-mapping + namespace: ambassador + resourceVersion: "4462511" + uid: 7ad1622b-11cf-47fb-9a46-625238a6021b + spec: + docs: + ignored: false + path: ffs + hostRewrite: httpbin.org + prefix: /google/httpbin/ + rewrite: / + service: httpbin.default.svc.cluster.local + timeoutMS: 5000 +- apiVersion: emissary-ingress.dev/v4alpha1 + kind: Mapping + metadata: + creationTimestamp: "2020-08-11T20:54:22Z" + generation: 1 + name: filter-oauth2-keycloak-mapping + namespace: ambassador + resourceVersion: "4462515" + uid: 7bf6a07d-2b5a-40bb-b047-feadf1801d91 + spec: + docs: + ignored: true + url: ffs + hostRewrite: httpbin.org + prefix: /keycloak/httpbin/ + rewrite: / + service: httpbin.default.svc.cluster.local + timeoutMS: 5000 +- apiVersion: emissary-ingress.dev/v4alpha1 + kind: Mapping + metadata: + creationTimestamp: "2020-08-11T20:54:23Z" + generation: 1 + name: filter-oauth2-okta-client-credentialsmapping + namespace: ambassador + resourceVersion: "4462519" + uid: 71379014-130e-45aa-a49b-5869ba135fad + spec: + hostRewrite: httpbin.org + loadBalancer: {} + prefix: /okta-client-credentials/httpbin/ + rewrite: / + service: httpbin.default.svc.cluster.local + timeoutMS: 5000 +- apiVersion: emissary-ingress.dev/v4alpha1 + kind: Mapping + metadata: + creationTimestamp: "2020-08-11T20:54:23Z" + generation: 1 + name: filter-oauth2-okta-mapping + namespace: ambassador + resourceVersion: "4462523" + uid: 69a04d0c-ca45-4671-b056-ec315b64fae7 + spec: + hostRewrite: httpbin.org + loadBalancer: + sourceIp: false + prefix: /okta/httpbin/ + rewrite: / + service: httpbin.default.svc.cluster.local + timeoutMS: 5000 +- apiVersion: emissary-ingress.dev/v4alpha1 + kind: Mapping + metadata: + creationTimestamp: "2020-08-11T20:54:24Z" + generation: 1 + name: filter-oauth2-uaa-mapping + namespace: ambassador + resourceVersion: "4462528" + uid: 6e1a60ea-6ea0-400a-98b2-218b60aaf514 + spec: + hostRewrite: httpbin.org + loadBalancer: + policy: some_policy + sourceIp: true + prefix: /uaa/httpbin/ + rewrite: / + service: httpbin.default.svc.cluster.local + timeoutMS: 5000 +- apiVersion: emissary-ingress.dev/v4alpha1 + kind: Mapping + metadata: + creationTimestamp: "2020-08-11T20:54:25Z" + generation: 1 + name: filter-oauth2-logout-mapping + namespace: ambassador + resourceVersion: "4462553" + uid: 3b35230c-0c59-4d98-8871-6e13d4cb7f86 + spec: + cors: {} + prefix: /logout + service: filter-oauth2-logout-service.default +- apiVersion: emissary-ingress.dev/v4alpha1 + kind: Mapping + metadata: + creationTimestamp: "2020-08-11T20:54:25Z" + generation: 1 + name: mapping-for-intercepted + namespace: ambassador + resourceVersion: "4462562" + uid: 8727af82-ca1c-4a29-82ad-8ba94bfc3c52 + spec: + cors: + credentials: false + prefix: /intercepted/ + service: intercepted.default +- apiVersion: emissary-ingress.dev/v4alpha1 + kind: Mapping + metadata: + creationTimestamp: "2020-08-11T20:54:27Z" + generation: 1 + name: load-testing-base + namespace: ambassador + resourceVersion: "4462591" + uid: d5ef2932-a6a3-439b-bca8-d80f195cd9f6 + spec: + cors: + credentials: true + origins: + - ffs + - ffs2 + prefix: /load-testing/ + service: load-http-echo.default +- apiVersion: emissary-ingress.dev/v4alpha1 + kind: Mapping + metadata: + creationTimestamp: "2020-08-11T20:54:28Z" + generation: 1 + name: load-testing-rl-minute + namespace: ambassador + resourceVersion: "4462630" + uid: ad827545-4844-4005-90e4-208f4a53fb72 + spec: + labels: + ambassador: + - request_label_group: + - genericKey: + value: minute + prefix: /load-testing/rl-minute/ + service: load-http-echo.default +- apiVersion: emissary-ingress.dev/v4alpha1 + kind: Mapping + metadata: + creationTimestamp: "2020-08-11T20:54:30Z" + generation: 1 + name: load-testing-rl-second + namespace: ambassador + resourceVersion: "4462660" + uid: 143cde54-642b-4069-a03b-033928eab103 + spec: + labels: + ambassador: + - request_label_group: + - genericKey: + value: second + prefix: /load-testing/rl-second/ + service: load-http-echo.default +- apiVersion: emissary-ingress.dev/v4alpha1 + kind: Mapping + metadata: + creationTimestamp: "2020-08-11T20:54:32Z" + generation: 1 + name: rl-test + namespace: ambassador + resourceVersion: "4462685" + uid: 3d0b7b27-7876-4f55-bfbe-9fa1462f60f0 + spec: + labels: + ambassador: + - test_limit: + - sourceCluster: + key: source_cluster + - destinationCluster: + key: destination_cluster + - remoteAddress: + key: remote_address + - genericKey: + value: rltest + prefix: /rl/ + retryPolicy: {} + service: httpbin.default.svc.cluster.local +- apiVersion: emissary-ingress.dev/v4alpha1 + kind: Mapping + metadata: + creationTimestamp: "2021-01-07T20:27:54Z" + generation: 2 + labels: + kat-ambassador-id: consultest + name: a + namespace: default + resourceVersion: "9298" + uid: caf33312-1f60-4aed-9d8d-7a9f37b68da0 + spec: + addResponseHeaders: + Strict-Transport-Security: + value: max-age=31536000 + ambassadorID: + - consultest + labels: + ambassador: + - d0: + - genericKey: + value: a + - requestHeaders: + headerName: X-Ratelimit-Id + key: xratelimitid + omitIfNotPresent: true + - requestHeaders: + headerName: X-Ratelimit-Id2 + key: xratelimitid2 + omitIfNotPresent: false + - requestHeaders: + headerName: X-Ratelimit-Id3 + key: xratelimitid3 + prefix: /api/[^/]+/projects/[^/]+/a(/.*)? + prefixRegex: true + retryPolicy: + numRetries: 15 + retryOn: gateway-error + rewrite: "" + service: https://a + timeoutMS: 10000 +- apiVersion: emissary-ingress.dev/v4alpha1 + kind: Mapping + metadata: + creationTimestamp: "2020-08-11T20:54:33Z" + generation: 1 + name: rl-dual + namespace: ambassador + resourceVersion: "4462691" + uid: 27c54989-78df-433c-97a0-7c516d0bd9f5 + spec: + labels: + ambassador: + - minute_group: + - genericKey: + value: backend + - genericKey: + value: minutely + - hour_group: + - genericKey: + value: backend + - genericKey: + value: hourly + prefix: /backend/ + retryPolicy: + numRetries: 0 + retryOn: gateway-error + service: httpbin.default.svc.cluster.local +- apiVersion: emissary-ingress.dev/v4alpha1 + kind: Mapping + metadata: + creationTimestamp: "2020-08-11T20:54:33Z" + name: rl-dual + spec: + host: example\.com + hostRegex: true + prefix: /demo/ + service: httpbin.default.svc.cluster.local +- apiVersion: emissary-ingress.dev/v4alpha1 kind: Mapping metadata: creationTimestamp: null name: linkerdheadermapping-http-addlinkerdonly spec: - hostname: "*" + addRequestHeaders: {} + hostname: '*' prefix: /target_add_linkerd_header_only/ + removeRequestHeaders: [] service: linkerdheadermapping-http-addlinkerdonly - add_request_headers: {} - remove_request_headers: [] -- apiVersion: getambassador.io/v3alpha1 +- apiVersion: emissary-ingress.dev/v4alpha1 kind: Mapping metadata: creationTimestamp: null - name: errorresponseonstatuscode-invalidservice-empty + name: errorresponseonstatuscode-invalidservice-empty spec: - hostname: "*" + errorResponseOverrides: + - body: + text_format: "" + on_status_code: 503 + hostname: '*' prefix: /target/invalidservice/empty service: errorresponseonstatuscode-invalidservice-empty - error_response_overrides: - - on_status_code: 503 - body: - text_format: '' -- apiVersion: getambassador.io/v3alpha1 +- apiVersion: emissary-ingress.dev/v4alpha1 kind: Mapping metadata: creationTimestamp: null - name: errorresponseonstatuscode-invalidservice-empty + name: errorresponseonstatuscode-invalidservice-empty spec: - hostname: "*" + errorResponseOverrides: + - body: + json_format: {} + on_status_code: 503 + hostname: '*' prefix: /target/invalidservice/empty service: errorresponseonstatuscode-invalidservice-empty - error_response_overrides: - - on_status_code: 503 - body: - json_format: {} -- apiVersion: getambassador.io/v3alpha1 +- apiVersion: emissary-ingress.dev/v4alpha1 kind: Mapping metadata: creationTimestamp: null - name: multiple-headers-shouldnt-duplicate-values + name: multiple-headers-shouldnt-duplicate-values spec: - hostname: "*" - prefix: /backend/ - service: quote - query_parameters: + headers: this-is-a: test1 this-is-a2: test2 this-is-a3: test3 - headers: + hostname: '*' + prefix: /backend/ + queryParameters: this-is-a: test1 this-is-a2: test2 this-is-a3: test3 + service: quote diff --git a/pkg/api/emissary-ingress.dev/v4alpha1/testdata/mappings_v3.yaml b/pkg/api/emissary-ingress.dev/v4alpha1/testdata/mappings_v3.yaml new file mode 100644 index 0000000000..5dcf41414f --- /dev/null +++ b/pkg/api/emissary-ingress.dev/v4alpha1/testdata/mappings_v3.yaml @@ -0,0 +1,628 @@ +- apiVersion: "getambassador.io/v3alpha1" + kind: "Mapping" + metadata: + creationTimestamp: "2020-07-03T02:19:06Z" + generation: 1 + labels: + product: "aes" + name: "ambassador-devportal-api" + namespace: "ambassador" + resourceVersion: "701" + uid: "2fd46b2e-a553-455c-9a67-5b22848c1167" + spec: + prefix: "/openapi/" + auto_host_rewrite: false + prefix_regex: false + rewrite: "" + service: "127.0.0.1:8500" + status: + state: "Running" +- apiVersion: "getambassador.io/v3alpha1" + kind: "Mapping" + metadata: + creationTimestamp: "2020-07-03T02:19:06Z" + generation: 1 + labels: + product: "aes" + name: "ambassador-mapping-with-stats-name" + namespace: "ambassador" + resourceVersion: "701" + uid: "2fd46b2e-a553-455c-9a67-5b22848c1167" + spec: + prefix: "/openapi/" + auto_host_rewrite: false + prefix_regex: false + rewrite: "" + service: "127.0.0.1:8500" + stats_name: "alt-stats-name" + status: + state: "Running" +- apiVersion: "getambassador.io/v3alpha1" + kind: "Mapping" + metadata: + creationTimestamp: "2020-07-03T02:19:06Z" + generation: 1 + labels: + product: "aes" + name: "ambassador-devportal" + namespace: "ambassador" + resourceVersion: "702" + uid: "d19f50c2-ad3c-4b8b-8a90-20263aa7beee" + spec: + prefix: "/docs/" + auto_host_rewrite: true + prefix_regex: false + rewrite: "/docs/" + service: "127.0.0.1:8500" + status: + state: "Running" +- apiVersion: "getambassador.io/v3alpha1" + kind: "Mapping" + metadata: + creationTimestamp: "2020-08-11T20:54:11Z" + generation: 1 + name: "mapping-for-echo" + namespace: "ambassador" + resourceVersion: "4462369" + uid: "486c2af1-70d3-4d7b-9fc8-99bd19fd9107" + spec: + prefix: "/echo/" + prefix_regex: true + prefix_exact: false + service: "echo" +- apiVersion: "getambassador.io/v3alpha1" + kind: "Mapping" + metadata: + creationTimestamp: "2020-08-11T20:54:11Z" + generation: 1 + name: "filter-actions-on-mapping" + namespace: "ambassador" + resourceVersion: "4462382" + uid: "f30549f4-1cf7-4b03-a775-b2dab1e789a0" + spec: + host_rewrite: "httpbin.org" + prefix: "/filter-actions/on/" + prefix_exact: true + add_linkerd_headers: false + rewrite: "/" + service: "httpbin.default.svc.cluster.local" + timeout_ms: 5000 +- apiVersion: "getambassador.io/v3alpha1" + kind: "Mapping" + metadata: + creationTimestamp: "2020-08-11T20:54:12Z" + generation: 1 + name: "filter-actions-if-mapping" + namespace: "ambassador" + resourceVersion: "4462389" + uid: "410db612-dd15-461c-bc08-bf3a5a47f1cc" + spec: + host_rewrite: "httpbin.org" + add_linkerd_headers: true + case_sensitive: false + prefix: "/filter-actions/if/" + rewrite: "/" + service: "httpbin.default.svc.cluster.local" + timeout_ms: 0 +- apiVersion: "getambassador.io/v3alpha1" + kind: "Mapping" + metadata: + creationTimestamp: "2020-08-11T20:54:13Z" + generation: 1 + name: "external-grpc-mapping" + namespace: "ambassador" + resourceVersion: "4462430" + uid: "be652a11-10f4-4c72-b4e7-b234cc3c6e93" + spec: + host_rewrite: "httpbin.org" + prefix: "/external-grpc/" + service: "httpbin.default.svc.cluster.local" + case_sensitive: true + enable_ipv4: false + timeout_ms: 5000 + idle_timeout_ms: 0 +- apiVersion: "getambassador.io/v3alpha1" + kind: "Mapping" + metadata: + creationTimestamp: "2020-08-11T20:54:14Z" + generation: 1 + name: "external-http-mapping" + namespace: "ambassador" + resourceVersion: "4462431" + uid: "fcb3a3f1-7c91-4eb5-8769-7a83f7bec196" + spec: + host_rewrite: "httpbin.org" + prefix: "/external-http/" + service: "httpbin.default.svc.cluster.local" + enable_ipv4: true + enable_ipv6: false + timeout_ms: 5000 + weight: 0 +- apiVersion: "getambassador.io/v3alpha1" + kind: "Mapping" + metadata: + creationTimestamp: "2020-08-11T20:54:14Z" + generation: 1 + name: "invalid-mapping" + namespace: "ambassador" + resourceVersion: "4462434" + uid: "40e2b505-eba8-4798-b9ef-99e83b2cfec0" + spec: + host_rewrite: "httpbin.org" + prefix: "/invalid/" + service: "httpbin.default.svc.cluster.local" + enable_ipv6: true + grpc: false + timeout_ms: 5000 +- apiVersion: "getambassador.io/v3alpha1" + kind: "Mapping" + metadata: + creationTimestamp: "2020-08-11T20:54:15Z" + generation: 1 + name: "jwt-filter-mapping" + namespace: "ambassador" + resourceVersion: "4462442" + uid: "4345821c-9e99-42d2-aa41-6fd78a72967f" + spec: + host_rewrite: "httpbin.org" + prefix: "/jwt/" + service: "httpbin.default.svc.cluster.local" + grpc: true + host_redirect: false + timeout_ms: 5000 +- apiVersion: "getambassador.io/v3alpha1" + kind: "Mapping" + metadata: + creationTimestamp: "2020-08-11T20:54:15Z" + generation: 1 + name: "oauth2-auth0-nojwt-and-plugin-and-whitelist" + namespace: "ambassador" + resourceVersion: "4462448" + uid: "6ed048d0-e8b3-4eec-a016-27743871d12a" + spec: + host_rewrite: "httpbin.org" + prefix: "/oauth2-auth0-nojwt-and-plugin-and-whitelist/" + rewrite: "/" + service: "httpbin.default.svc.cluster.local" + host_redirect: true + method_regex: false + timeout_ms: 5000 +- apiVersion: "getambassador.io/v3alpha1" + kind: "Mapping" + metadata: + creationTimestamp: "2020-08-11T20:54:16Z" + generation: 1 + name: "oauth2-auth0-nojwt-and-k8ssecret-and-xhrerror" + namespace: "ambassador" + resourceVersion: "4462459" + uid: "117a70a0-b0c2-465d-aa06-d4cd1dae475c" + spec: + host_rewrite: "httpbin.org" + prefix: "/oauth2-auth0-nojwt-and-k8ssecret-and-xhrerror/" + rewrite: "/" + service: "httpbin.default.svc.cluster.local" + method_regex: true + redirect_response_code: 0 + timeout_ms: 5000 +- apiVersion: "getambassador.io/v3alpha1" + kind: "Mapping" + metadata: + creationTimestamp: "2020-08-11T20:54:17Z" + generation: 1 + name: "oauth2-auth0-nojwt-and-anyerror" + namespace: "ambassador" + resourceVersion: "4462463" + uid: "3e4e6047-e30f-4f98-bee2-3f7cb5eac929" + spec: + host_rewrite: "httpbin.org" + prefix: "/oauth2-auth0-nojwt-and-anyerror/" + rewrite: "/" + redirect_response_code: 400 + precedence: 0 + service: "httpbin.default.svc.cluster.local" + timeout_ms: 5000 +- apiVersion: "getambassador.io/v3alpha1" + kind: "Mapping" + metadata: + creationTimestamp: "2020-08-11T20:54:17Z" + generation: 1 + name: "oauth2-auth0-simplejwt" + namespace: "ambassador" + resourceVersion: "4462468" + uid: "d8a48a30-012a-4173-ada6-820834a96018" + spec: + host_rewrite: "httpbin.org" + prefix: "/oauth2-auth0-simplejwt/" + rewrite: "/" + service: "httpbin.default.svc.cluster.local" + precedence: 100 + shadow: false + timeout_ms: 5000 +- apiVersion: "getambassador.io/v3alpha1" + kind: "Mapping" + metadata: + creationTimestamp: "2020-08-11T20:54:19Z" + generation: 1 + name: "oauth2-auth0-complexjwt" + namespace: "ambassador" + resourceVersion: "4462486" + uid: "0c4e65b7-6193-4e9f-9c65-060b85d8e50d" + spec: + host_rewrite: "httpbin.org" + prefix: "/oauth2-auth0-complexjwt/" + rewrite: "/" + service: "httpbin.default.svc.cluster.local" + shadow: true + use_websocket: false + timeout_ms: 5000 +- apiVersion: "getambassador.io/v3alpha1" + kind: "Mapping" + metadata: + creationTimestamp: "2020-08-11T20:54:19Z" + generation: 1 + name: "oauth2-auth0-differingscope-1" + namespace: "ambassador" + resourceVersion: "4462488" + uid: "eb9e5b6a-617b-4e69-a00e-978aa79c8aa2" + spec: + prefix: "/differingscope/endpoint1/" + rewrite: "/" + use_websocket: true + bypass_auth: false + service: "httpbin.default.svc.cluster.local" +- apiVersion: "getambassador.io/v3alpha1" + kind: "Mapping" + metadata: + creationTimestamp: "2020-08-11T20:54:19Z" + generation: 1 + name: "oauth2-auth0-differingscope-2" + namespace: "ambassador" + resourceVersion: "4462489" + uid: "6140233e-0edc-4d55-84dc-4723e69344d6" + spec: + prefix: "/differingscope/endpoint2/" + rewrite: "/" + bypass_auth: true + bypass_error_response_overrides: false + service: "httpbin.default.svc.cluster.local" +- apiVersion: "getambassador.io/v3alpha1" + kind: "Mapping" + metadata: + creationTimestamp: "2020-08-11T20:54:20Z" + generation: 1 + name: "filter-oauth2-azure-header-credentialsmapping" + namespace: "ambassador" + resourceVersion: "4462492" + uid: "39ecb9d6-5703-4d81-9690-5c6445283821" + spec: + host_rewrite: "httpbin.org" + prefix: "/azure-header-credentials/httpbin/" + rewrite: "/" + bypass_error_response_overrides: true + host_regex: false + service: "httpbin.default.svc.cluster.local" + timeout_ms: 5000 +- apiVersion: "getambassador.io/v3alpha1" + kind: "Mapping" + metadata: + creationTimestamp: "2020-08-11T20:54:21Z" + generation: 1 + name: "filter-oauth2-azure-mapping" + namespace: "ambassador" + resourceVersion: "4462500" + uid: "6f46fee5-9fb6-4a21-9f6d-d3ea0e2e293e" + spec: + host_rewrite: "httpbin.org" + prefix: "/azure/httpbin/" + rewrite: "/" + service: "httpbin.default.svc.cluster.local" + host_regex: true + timeout_ms: 5000 + docs: {} +- apiVersion: "getambassador.io/v3alpha1" + kind: "Mapping" + metadata: + creationTimestamp: "2020-08-11T20:54:21Z" + generation: 1 + name: "filter-oauth2-google-mapping" + namespace: "ambassador" + resourceVersion: "4462511" + uid: "7ad1622b-11cf-47fb-9a46-625238a6021b" + spec: + host_rewrite: "httpbin.org" + prefix: "/google/httpbin/" + rewrite: "/" + service: "httpbin.default.svc.cluster.local" + timeout_ms: 5000 + docs: + ignored: false + path: "ffs" +- apiVersion: "getambassador.io/v3alpha1" + kind: "Mapping" + metadata: + creationTimestamp: "2020-08-11T20:54:22Z" + generation: 1 + name: "filter-oauth2-keycloak-mapping" + namespace: "ambassador" + resourceVersion: "4462515" + uid: "7bf6a07d-2b5a-40bb-b047-feadf1801d91" + spec: + host_rewrite: "httpbin.org" + prefix: "/keycloak/httpbin/" + rewrite: "/" + service: "httpbin.default.svc.cluster.local" + timeout_ms: 5000 + docs: + ignored: true + url: "ffs" + +- apiVersion: "getambassador.io/v3alpha1" + kind: "Mapping" + metadata: + creationTimestamp: "2020-08-11T20:54:23Z" + generation: 1 + name: "filter-oauth2-okta-client-credentialsmapping" + namespace: "ambassador" + resourceVersion: "4462519" + uid: "71379014-130e-45aa-a49b-5869ba135fad" + spec: + host_rewrite: "httpbin.org" + prefix: "/okta-client-credentials/httpbin/" + rewrite: "/" + service: "httpbin.default.svc.cluster.local" + timeout_ms: 5000 + load_balancer: {} +- apiVersion: "getambassador.io/v3alpha1" + kind: "Mapping" + metadata: + creationTimestamp: "2020-08-11T20:54:23Z" + generation: 1 + name: "filter-oauth2-okta-mapping" + namespace: "ambassador" + resourceVersion: "4462523" + uid: "69a04d0c-ca45-4671-b056-ec315b64fae7" + spec: + host_rewrite: "httpbin.org" + prefix: "/okta/httpbin/" + rewrite: "/" + service: "httpbin.default.svc.cluster.local" + timeout_ms: 5000 + load_balancer: + source_ip: false +- apiVersion: "getambassador.io/v3alpha1" + kind: "Mapping" + metadata: + creationTimestamp: "2020-08-11T20:54:24Z" + generation: 1 + name: "filter-oauth2-uaa-mapping" + namespace: "ambassador" + resourceVersion: "4462528" + uid: "6e1a60ea-6ea0-400a-98b2-218b60aaf514" + spec: + host_rewrite: "httpbin.org" + prefix: "/uaa/httpbin/" + rewrite: "/" + service: "httpbin.default.svc.cluster.local" + timeout_ms: 5000 + load_balancer: + policy: "some_policy" + source_ip: true +- apiVersion: "getambassador.io/v3alpha1" + kind: "Mapping" + metadata: + creationTimestamp: "2020-08-11T20:54:25Z" + generation: 1 + name: "filter-oauth2-logout-mapping" + namespace: "ambassador" + resourceVersion: "4462553" + uid: "3b35230c-0c59-4d98-8871-6e13d4cb7f86" + spec: + prefix: "/logout" + service: "filter-oauth2-logout-service.default" + cors: {} +- apiVersion: "getambassador.io/v3alpha1" + kind: "Mapping" + metadata: + creationTimestamp: "2020-08-11T20:54:25Z" + generation: 1 + name: "mapping-for-intercepted" + namespace: "ambassador" + resourceVersion: "4462562" + uid: "8727af82-ca1c-4a29-82ad-8ba94bfc3c52" + spec: + prefix: "/intercepted/" + service: "intercepted.default" + cors: + credentials: false +- apiVersion: "getambassador.io/v3alpha1" + kind: "Mapping" + metadata: + creationTimestamp: "2020-08-11T20:54:27Z" + generation: 1 + name: "load-testing-base" + namespace: "ambassador" + resourceVersion: "4462591" + uid: "d5ef2932-a6a3-439b-bca8-d80f195cd9f6" + spec: + prefix: "/load-testing/" + service: "load-http-echo.default" + cors: + origins: [ "ffs", "ffs2" ] + credentials: true +- apiVersion: "getambassador.io/v3alpha1" + kind: "Mapping" + metadata: + creationTimestamp: "2020-08-11T20:54:28Z" + generation: 1 + name: "load-testing-rl-minute" + namespace: "ambassador" + resourceVersion: "4462630" + uid: "ad827545-4844-4005-90e4-208f4a53fb72" + spec: + labels: + ambassador: + - request_label_group: + - generic_key: { value: "minute" } + prefix: "/load-testing/rl-minute/" + service: "load-http-echo.default" +- apiVersion: "getambassador.io/v3alpha1" + kind: "Mapping" + metadata: + creationTimestamp: "2020-08-11T20:54:30Z" + generation: 1 + name: "load-testing-rl-second" + namespace: "ambassador" + resourceVersion: "4462660" + uid: "143cde54-642b-4069-a03b-033928eab103" + spec: + labels: + ambassador: + - request_label_group: + - generic_key: { value: "second" } + prefix: "/load-testing/rl-second/" + service: "load-http-echo.default" +- apiVersion: "getambassador.io/v3alpha1" + kind: "Mapping" + metadata: + creationTimestamp: "2020-08-11T20:54:32Z" + generation: 1 + name: "rl-test" + namespace: "ambassador" + resourceVersion: "4462685" + uid: "3d0b7b27-7876-4f55-bfbe-9fa1462f60f0" + spec: + labels: + ambassador: + - test_limit: + - source_cluster: { key: "source_cluster" } + - destination_cluster: { key: "destination_cluster" } + - remote_address: { key: "remote_address" } + - generic_key: { value: "rltest" } + prefix: "/rl/" + service: "httpbin.default.svc.cluster.local" + retry_policy: {} +- apiVersion: "getambassador.io/v3alpha1" + kind: "Mapping" + metadata: + creationTimestamp: "2021-01-07T20:27:54Z" + generation: 2 + labels: + kat-ambassador-id: "consultest" + name: "a" + namespace: "default" + resourceVersion: "9298" + uid: "caf33312-1f60-4aed-9d8d-7a9f37b68da0" + spec: + add_response_headers: + Strict-Transport-Security: { value: "max-age=31536000" } + ambassador_id: [ "consultest" ] + labels: + ambassador: + - d0: + - generic_key: { value: "a" } + - request_headers: + key: xratelimitid + header_name: "X-Ratelimit-Id" + omit_if_not_present: true + - request_headers: + key: xratelimitid2 + header_name: "X-Ratelimit-Id2" + omit_if_not_present: false + - request_headers: + key: xratelimitid3 + header_name: "X-Ratelimit-Id3" + prefix: "/api/[^/]+/projects/[^/]+/a(/.*)?" + prefix_regex: true + retry_policy: + num_retries: 15 + retry_on: "gateway-error" + rewrite: "" + service: "https://a" + timeout_ms: 10000 +- apiVersion: "getambassador.io/v3alpha1" + kind: "Mapping" + metadata: + creationTimestamp: "2020-08-11T20:54:33Z" + generation: 1 + name: "rl-dual" + namespace: "ambassador" + resourceVersion: "4462691" + uid: "27c54989-78df-433c-97a0-7c516d0bd9f5" + spec: + labels: + ambassador: + - minute_group: + - generic_key: { value: "backend" } + - generic_key: { value: "minutely" } + - hour_group: + - generic_key: { value: "backend" } + - generic_key: { value: "hourly" } + prefix: "/backend/" + retry_policy: + num_retries: 0 + retry_on: "gateway-error" + service: "httpbin.default.svc.cluster.local" +- apiVersion: "getambassador.io/v3alpha1" + kind: "Mapping" + metadata: + creationTimestamp: "2020-08-11T20:54:33Z" + name: "rl-dual" + spec: + prefix: "/demo/" + host: "example\\.com" + host_regex: true + service: "httpbin.default.svc.cluster.local" +- apiVersion: getambassador.io/v3alpha1 + kind: Mapping + metadata: + creationTimestamp: null + name: linkerdheadermapping-http-addlinkerdonly + spec: + hostname: "*" + prefix: /target_add_linkerd_header_only/ + service: linkerdheadermapping-http-addlinkerdonly + add_request_headers: {} + remove_request_headers: [] +- apiVersion: getambassador.io/v3alpha1 + kind: Mapping + metadata: + creationTimestamp: null + name: errorresponseonstatuscode-invalidservice-empty + spec: + hostname: "*" + prefix: /target/invalidservice/empty + service: errorresponseonstatuscode-invalidservice-empty + error_response_overrides: + - on_status_code: 503 + body: + text_format: '' +- apiVersion: getambassador.io/v3alpha1 + kind: Mapping + metadata: + creationTimestamp: null + name: errorresponseonstatuscode-invalidservice-empty + spec: + hostname: "*" + prefix: /target/invalidservice/empty + service: errorresponseonstatuscode-invalidservice-empty + error_response_overrides: + - on_status_code: 503 + body: + json_format: {} +- apiVersion: getambassador.io/v3alpha1 + kind: Mapping + metadata: + creationTimestamp: null + name: multiple-headers-shouldnt-duplicate-values + spec: + hostname: "*" + prefix: /backend/ + service: quote + query_parameters: + this-is-a: test1 + this-is-a2: test2 + this-is-a3: test3 + headers: + this-is-a: test1 + this-is-a2: test2 + this-is-a3: test3 diff --git a/pkg/api/emissary-ingress.dev/v4alpha1/testdata/modules.yaml b/pkg/api/emissary-ingress.dev/v4alpha1/testdata/modules.yaml index 5520b13211..9eb630f7bf 100644 --- a/pkg/api/emissary-ingress.dev/v4alpha1/testdata/modules.yaml +++ b/pkg/api/emissary-ingress.dev/v4alpha1/testdata/modules.yaml @@ -1,12 +1,15 @@ -- apiVersion: "getambassador.io/v3alpha1" - kind: "Module" +- apiVersion: emissary-ingress.dev/v4alpha1 + kind: Module metadata: - creationTimestamp: "2020-08-12T12:23:12Z" - generation: 1 - name: "ambassador" - namespace: "ambassador" - resourceVersion: "28330" - uid: "9683c9be-de04-4d1e-b3a4-350acdc70ee4" + creationTimestamp: "2020-08-12T12:23:12Z" + generation: 1 + name: ambassador + namespace: ambassador + resourceVersion: "28330" + uid: 9683c9be-de04-4d1e-b3a4-350acdc70ee4 spec: - config: - lua_scripts: "function envoy_on_request(request_handle)\n request_handle:headers():remove(\"x-token-c-optional-unset-rejected\")\nend\n" + config: + lua_scripts: | + function envoy_on_request(request_handle) + request_handle:headers():remove("x-token-c-optional-unset-rejected") + end diff --git a/pkg/api/emissary-ingress.dev/v4alpha1/testdata/modules_v3.yaml b/pkg/api/emissary-ingress.dev/v4alpha1/testdata/modules_v3.yaml new file mode 100644 index 0000000000..5520b13211 --- /dev/null +++ b/pkg/api/emissary-ingress.dev/v4alpha1/testdata/modules_v3.yaml @@ -0,0 +1,12 @@ +- apiVersion: "getambassador.io/v3alpha1" + kind: "Module" + metadata: + creationTimestamp: "2020-08-12T12:23:12Z" + generation: 1 + name: "ambassador" + namespace: "ambassador" + resourceVersion: "28330" + uid: "9683c9be-de04-4d1e-b3a4-350acdc70ee4" + spec: + config: + lua_scripts: "function envoy_on_request(request_handle)\n request_handle:headers():remove(\"x-token-c-optional-unset-rejected\")\nend\n" diff --git a/pkg/api/emissary-ingress.dev/v4alpha1/testdata/ratelimitsvc.yaml b/pkg/api/emissary-ingress.dev/v4alpha1/testdata/ratelimitsvc.yaml index 287c885c73..83ed52c4c9 100644 --- a/pkg/api/emissary-ingress.dev/v4alpha1/testdata/ratelimitsvc.yaml +++ b/pkg/api/emissary-ingress.dev/v4alpha1/testdata/ratelimitsvc.yaml @@ -1,35 +1,35 @@ -- apiVersion: "getambassador.io/v3alpha1" - kind: "RateLimitService" +- apiVersion: emissary-ingress.dev/v4alpha1 + kind: RateLimitService metadata: - creationTimestamp: "2020-07-03T02:19:06Z" - name: "ratelimitsvc-no-timeout" - namespace: "default" + creationTimestamp: "2020-07-03T02:19:06Z" + name: ratelimitsvc-no-timeout + namespace: default spec: - service: "ratelimitsvc" -- apiVersion: "getambassador.io/v3alpha1" - kind: "RateLimitService" + service: ratelimitsvc +- apiVersion: emissary-ingress.dev/v4alpha1 + kind: RateLimitService metadata: - creationTimestamp: "2020-07-03T02:19:06Z" - name: "ratelimitsvc-with-stats-name" - namespace: "default" + creationTimestamp: "2020-07-03T02:19:06Z" + name: ratelimitsvc-with-stats-name + namespace: default spec: - service: "ratelimitsvc" - stats_name: "alt-stats-name" -- apiVersion: "getambassador.io/v3alpha1" - kind: "RateLimitService" + service: ratelimitsvc + statsName: alt-stats-name +- apiVersion: emissary-ingress.dev/v4alpha1 + kind: RateLimitService metadata: - creationTimestamp: "2020-07-03T02:19:06Z" - name: "ratelimitsvc-timeout" - namespace: "default" + creationTimestamp: "2020-07-03T02:19:06Z" + name: ratelimitsvc-timeout + namespace: default spec: - service: "ratelimitsvc" - timeout_ms: 500 -- apiVersion: "getambassador.io/v3alpha1" - kind: "RateLimitService" + service: ratelimitsvc + timeoutMS: 500 +- apiVersion: emissary-ingress.dev/v4alpha1 + kind: RateLimitService metadata: - creationTimestamp: "2020-07-03T02:19:06Z" - name: "ratelimitsvc-zero-timeout" - namespace: "default" + creationTimestamp: "2020-07-03T02:19:06Z" + name: ratelimitsvc-zero-timeout + namespace: default spec: - service: "ratelimitsvc" - timeout_ms: 0 + service: ratelimitsvc + timeoutMS: 0 diff --git a/pkg/api/emissary-ingress.dev/v4alpha1/testdata/ratelimitsvc_v3.yaml b/pkg/api/emissary-ingress.dev/v4alpha1/testdata/ratelimitsvc_v3.yaml new file mode 100644 index 0000000000..287c885c73 --- /dev/null +++ b/pkg/api/emissary-ingress.dev/v4alpha1/testdata/ratelimitsvc_v3.yaml @@ -0,0 +1,35 @@ +- apiVersion: "getambassador.io/v3alpha1" + kind: "RateLimitService" + metadata: + creationTimestamp: "2020-07-03T02:19:06Z" + name: "ratelimitsvc-no-timeout" + namespace: "default" + spec: + service: "ratelimitsvc" +- apiVersion: "getambassador.io/v3alpha1" + kind: "RateLimitService" + metadata: + creationTimestamp: "2020-07-03T02:19:06Z" + name: "ratelimitsvc-with-stats-name" + namespace: "default" + spec: + service: "ratelimitsvc" + stats_name: "alt-stats-name" +- apiVersion: "getambassador.io/v3alpha1" + kind: "RateLimitService" + metadata: + creationTimestamp: "2020-07-03T02:19:06Z" + name: "ratelimitsvc-timeout" + namespace: "default" + spec: + service: "ratelimitsvc" + timeout_ms: 500 +- apiVersion: "getambassador.io/v3alpha1" + kind: "RateLimitService" + metadata: + creationTimestamp: "2020-07-03T02:19:06Z" + name: "ratelimitsvc-zero-timeout" + namespace: "default" + spec: + service: "ratelimitsvc" + timeout_ms: 0 diff --git a/pkg/api/emissary-ingress.dev/v4alpha1/testdata/tcpmappings.yaml b/pkg/api/emissary-ingress.dev/v4alpha1/testdata/tcpmappings.yaml index cb16707a0b..3ec3c35250 100644 --- a/pkg/api/emissary-ingress.dev/v4alpha1/testdata/tcpmappings.yaml +++ b/pkg/api/emissary-ingress.dev/v4alpha1/testdata/tcpmappings.yaml @@ -1,148 +1,149 @@ -- apiVersion: "getambassador.io/v3alpha1" - kind: "TCPMapping" +- apiVersion: emissary-ingress.dev/v4alpha1 + kind: TCPMapping metadata: - creationTimestamp: "2020-07-03T02:19:06Z" - name: "tcpmapping-base" - namespace: "default" + creationTimestamp: "2020-07-03T02:19:06Z" + name: tcpmapping-base + namespace: default spec: - port: 6789 - service: "tcpmapping-base:80" -- apiVersion: "getambassador.io/v3alpha1" - kind: "TCPMapping" + port: 6789 + service: tcpmapping-base:80 +- apiVersion: emissary-ingress.dev/v4alpha1 + kind: TCPMapping metadata: - creationTimestamp: "2020-07-03T02:19:06Z" - name: "tcpmapping-with-stats-name" - namespace: "default" + creationTimestamp: "2020-07-03T02:19:06Z" + name: tcpmapping-with-stats-name + namespace: default spec: - port: 6789 - service: "tcpmapping-base:80" - stats_name: "alt-stats-name" -- apiVersion: "getambassador.io/v3alpha1" - kind: "TCPMapping" + port: 6789 + service: tcpmapping-base:80 + statsName: alt-stats-name +- apiVersion: emissary-ingress.dev/v4alpha1 + kind: TCPMapping metadata: - creationTimestamp: "2020-07-03T02:19:06Z" - name: "tcpmapping-breakers-defined" - namespace: "default" + creationTimestamp: "2020-07-03T02:19:06Z" + name: tcpmapping-breakers-defined + namespace: default spec: - circuit_breakers: - - max_connections: 1 - max_pending_requests: 1 - priority: "default" - port: 6790 - service: "tcpmapping-breakers-defined" -- apiVersion: "getambassador.io/v3alpha1" - kind: "TCPMapping" + circuitBreakers: + - max_connections: 1 + max_pending_requests: 1 + priority: default + port: 6790 + service: tcpmapping-breakers-defined +- apiVersion: emissary-ingress.dev/v4alpha1 + kind: TCPMapping metadata: - creationTimestamp: "2020-07-03T02:19:06Z" - name: "tcpmapping-absent-breakers" - namespace: "default" + creationTimestamp: "2020-07-03T02:19:06Z" + name: tcpmapping-absent-breakers + namespace: default spec: - circuit_breakers: [ {} ] - port: 6790 - service: "tcpmapping-absent-breakers" -- apiVersion: "getambassador.io/v3alpha1" - kind: "TCPMapping" + circuitBreakers: + - {} + port: 6790 + service: tcpmapping-absent-breakers +- apiVersion: emissary-ingress.dev/v4alpha1 + kind: TCPMapping metadata: - creationTimestamp: "2020-07-03T02:19:06Z" - name: "tcpmapping-some-breakers" - namespace: "default" + creationTimestamp: "2020-07-03T02:19:06Z" + name: tcpmapping-some-breakers + namespace: default spec: - circuit_breakers: - - max_connections: 1 - port: 6790 - service: "tcpmapping-absent-breakers" -- apiVersion: "getambassador.io/v3alpha1" - kind: "TCPMapping" + circuitBreakers: + - max_connections: 1 + port: 6790 + service: tcpmapping-absent-breakers +- apiVersion: emissary-ingress.dev/v4alpha1 + kind: TCPMapping metadata: - creationTimestamp: "2020-07-03T02:19:06Z" - name: "tcpmapping-most-breakers" - namespace: "default" + creationTimestamp: "2020-07-03T02:19:06Z" + name: tcpmapping-most-breakers + namespace: default spec: - circuit_breakers: - - max_pending_requests: 1 - priority: "default" - port: 6790 - service: "tcpmapping-most-breakers" -- apiVersion: "getambassador.io/v3alpha1" - kind: "TCPMapping" + circuitBreakers: + - max_pending_requests: 1 + priority: default + port: 6790 + service: tcpmapping-most-breakers +- apiVersion: emissary-ingress.dev/v4alpha1 + kind: TCPMapping metadata: - creationTimestamp: "2020-07-03T02:19:06Z" - name: "tcpmapping-zero-breakers" - namespace: "default" + creationTimestamp: "2020-07-03T02:19:06Z" + name: tcpmapping-zero-breakers + namespace: default spec: - circuit_breakers: - - max_connections: 0 - max_pending_requests: 0 - priority: "default" - port: 6790 - service: "tcpmapping-zero-breakers" -- apiVersion: "getambassador.io/v3alpha1" - kind: "TCPMapping" + circuitBreakers: + - max_connections: 0 + max_pending_requests: 0 + priority: default + port: 6790 + service: tcpmapping-zero-breakers +- apiVersion: emissary-ingress.dev/v4alpha1 + kind: TCPMapping metadata: - creationTimestamp: "2020-07-03T02:19:06Z" - name: "tcpmapping-weight-present" - namespace: "other-namespace" + creationTimestamp: "2020-07-03T02:19:06Z" + name: tcpmapping-weight-present + namespace: other-namespace spec: - port: 6789 - service: "tcpmapping-weight-present" - weight: 50 -- apiVersion: "getambassador.io/v3alpha1" - kind: "TCPMapping" + port: 6789 + service: tcpmapping-weight-present + weight: 50 +- apiVersion: emissary-ingress.dev/v4alpha1 + kind: TCPMapping metadata: - creationTimestamp: "2020-07-03T02:19:06Z" - name: "tcpmapping-weight-zero" - namespace: "other-namespace" + creationTimestamp: "2020-07-03T02:19:06Z" + name: tcpmapping-weight-zero + namespace: other-namespace spec: - port: 6789 - service: "tcpmapping-weight-zero" - weight: 0 -- apiVersion: "getambassador.io/v3alpha1" - kind: "TCPMapping" + port: 6789 + service: tcpmapping-weight-zero + weight: 0 +- apiVersion: emissary-ingress.dev/v4alpha1 + kind: TCPMapping metadata: - creationTimestamp: "2020-07-03T02:19:06Z" - name: "tcpmapping-v4-v6" - namespace: "tcp-namespace" + creationTimestamp: "2020-07-03T02:19:06Z" + name: tcpmapping-v4-v6 + namespace: tcp-namespace spec: - port: 9876 - service: "tcpmapping-v4-v6" - enable_ipv4: true - enable_ipv6: true -- apiVersion: "getambassador.io/v3alpha1" - kind: "TCPMapping" + enableIPv4: true + enableIPv6: true + port: 9876 + service: tcpmapping-v4-v6 +- apiVersion: emissary-ingress.dev/v4alpha1 + kind: TCPMapping metadata: - creationTimestamp: "2020-07-03T02:19:06Z" - name: "tcpmapping-v4-v6-false" - namespace: "tcp-namespace" + creationTimestamp: "2020-07-03T02:19:06Z" + name: tcpmapping-v4-v6-false + namespace: tcp-namespace spec: - port: 9876 - service: "tcpmapping-v4-v6-false" - enable_ipv4: false - enable_ipv6: false -- apiVersion: "getambassador.io/v3alpha1" - kind: "TCPMapping" + enableIPv4: false + enableIPv6: false + port: 9876 + service: tcpmapping-v4-v6-false +- apiVersion: emissary-ingress.dev/v4alpha1 + kind: TCPMapping metadata: - creationTimestamp: "2020-07-03T02:19:06Z" - name: "tcpmapping-tls-false" - namespace: "tcp-namespace" + creationTimestamp: "2020-07-03T02:19:06Z" + name: tcpmapping-tls-false + namespace: tcp-namespace spec: - port: 9876 - service: "tcpmapping-tls-false" -- apiVersion: "getambassador.io/v3alpha1" - kind: "TCPMapping" + port: 9876 + service: tcpmapping-tls-false +- apiVersion: emissary-ingress.dev/v4alpha1 + kind: TCPMapping metadata: - creationTimestamp: "2020-07-03T02:19:06Z" - name: "tcpmapping-tls-meaningless-true" - namespace: "tcp-namespace" + creationTimestamp: "2020-07-03T02:19:06Z" + name: tcpmapping-tls-meaningless-true + namespace: tcp-namespace spec: - port: 9876 - service: "https://tcpmapping-tls-meaningless-true" -- apiVersion: "getambassador.io/v3alpha1" - kind: "TCPMapping" + port: 9876 + service: https://tcpmapping-tls-meaningless-true +- apiVersion: emissary-ingress.dev/v4alpha1 + kind: TCPMapping metadata: - creationTimestamp: "2020-07-03T02:19:06Z" - name: "tcpmapping-tls-set" - namespace: "tcp-namespace" + creationTimestamp: "2020-07-03T02:19:06Z" + name: tcpmapping-tls-set + namespace: tcp-namespace spec: - port: 9876 - service: "tcpmapping-tls-set" - tls: "tls-secret" + port: 9876 + service: tcpmapping-tls-set + tls: tls-secret diff --git a/pkg/api/emissary-ingress.dev/v4alpha1/testdata/tcpmappings_v3.yaml b/pkg/api/emissary-ingress.dev/v4alpha1/testdata/tcpmappings_v3.yaml new file mode 100644 index 0000000000..cb16707a0b --- /dev/null +++ b/pkg/api/emissary-ingress.dev/v4alpha1/testdata/tcpmappings_v3.yaml @@ -0,0 +1,148 @@ +- apiVersion: "getambassador.io/v3alpha1" + kind: "TCPMapping" + metadata: + creationTimestamp: "2020-07-03T02:19:06Z" + name: "tcpmapping-base" + namespace: "default" + spec: + port: 6789 + service: "tcpmapping-base:80" +- apiVersion: "getambassador.io/v3alpha1" + kind: "TCPMapping" + metadata: + creationTimestamp: "2020-07-03T02:19:06Z" + name: "tcpmapping-with-stats-name" + namespace: "default" + spec: + port: 6789 + service: "tcpmapping-base:80" + stats_name: "alt-stats-name" +- apiVersion: "getambassador.io/v3alpha1" + kind: "TCPMapping" + metadata: + creationTimestamp: "2020-07-03T02:19:06Z" + name: "tcpmapping-breakers-defined" + namespace: "default" + spec: + circuit_breakers: + - max_connections: 1 + max_pending_requests: 1 + priority: "default" + port: 6790 + service: "tcpmapping-breakers-defined" +- apiVersion: "getambassador.io/v3alpha1" + kind: "TCPMapping" + metadata: + creationTimestamp: "2020-07-03T02:19:06Z" + name: "tcpmapping-absent-breakers" + namespace: "default" + spec: + circuit_breakers: [ {} ] + port: 6790 + service: "tcpmapping-absent-breakers" +- apiVersion: "getambassador.io/v3alpha1" + kind: "TCPMapping" + metadata: + creationTimestamp: "2020-07-03T02:19:06Z" + name: "tcpmapping-some-breakers" + namespace: "default" + spec: + circuit_breakers: + - max_connections: 1 + port: 6790 + service: "tcpmapping-absent-breakers" +- apiVersion: "getambassador.io/v3alpha1" + kind: "TCPMapping" + metadata: + creationTimestamp: "2020-07-03T02:19:06Z" + name: "tcpmapping-most-breakers" + namespace: "default" + spec: + circuit_breakers: + - max_pending_requests: 1 + priority: "default" + port: 6790 + service: "tcpmapping-most-breakers" +- apiVersion: "getambassador.io/v3alpha1" + kind: "TCPMapping" + metadata: + creationTimestamp: "2020-07-03T02:19:06Z" + name: "tcpmapping-zero-breakers" + namespace: "default" + spec: + circuit_breakers: + - max_connections: 0 + max_pending_requests: 0 + priority: "default" + port: 6790 + service: "tcpmapping-zero-breakers" +- apiVersion: "getambassador.io/v3alpha1" + kind: "TCPMapping" + metadata: + creationTimestamp: "2020-07-03T02:19:06Z" + name: "tcpmapping-weight-present" + namespace: "other-namespace" + spec: + port: 6789 + service: "tcpmapping-weight-present" + weight: 50 +- apiVersion: "getambassador.io/v3alpha1" + kind: "TCPMapping" + metadata: + creationTimestamp: "2020-07-03T02:19:06Z" + name: "tcpmapping-weight-zero" + namespace: "other-namespace" + spec: + port: 6789 + service: "tcpmapping-weight-zero" + weight: 0 +- apiVersion: "getambassador.io/v3alpha1" + kind: "TCPMapping" + metadata: + creationTimestamp: "2020-07-03T02:19:06Z" + name: "tcpmapping-v4-v6" + namespace: "tcp-namespace" + spec: + port: 9876 + service: "tcpmapping-v4-v6" + enable_ipv4: true + enable_ipv6: true +- apiVersion: "getambassador.io/v3alpha1" + kind: "TCPMapping" + metadata: + creationTimestamp: "2020-07-03T02:19:06Z" + name: "tcpmapping-v4-v6-false" + namespace: "tcp-namespace" + spec: + port: 9876 + service: "tcpmapping-v4-v6-false" + enable_ipv4: false + enable_ipv6: false +- apiVersion: "getambassador.io/v3alpha1" + kind: "TCPMapping" + metadata: + creationTimestamp: "2020-07-03T02:19:06Z" + name: "tcpmapping-tls-false" + namespace: "tcp-namespace" + spec: + port: 9876 + service: "tcpmapping-tls-false" +- apiVersion: "getambassador.io/v3alpha1" + kind: "TCPMapping" + metadata: + creationTimestamp: "2020-07-03T02:19:06Z" + name: "tcpmapping-tls-meaningless-true" + namespace: "tcp-namespace" + spec: + port: 9876 + service: "https://tcpmapping-tls-meaningless-true" +- apiVersion: "getambassador.io/v3alpha1" + kind: "TCPMapping" + metadata: + creationTimestamp: "2020-07-03T02:19:06Z" + name: "tcpmapping-tls-set" + namespace: "tcp-namespace" + spec: + port: 9876 + service: "tcpmapping-tls-set" + tls: "tls-secret" diff --git a/pkg/api/emissary-ingress.dev/v4alpha1/testdata/tlscontexts.yaml b/pkg/api/emissary-ingress.dev/v4alpha1/testdata/tlscontexts.yaml index 8d47694cbd..ada9866ff3 100644 --- a/pkg/api/emissary-ingress.dev/v4alpha1/testdata/tlscontexts.yaml +++ b/pkg/api/emissary-ingress.dev/v4alpha1/testdata/tlscontexts.yaml @@ -1,54 +1,54 @@ -- apiVersion: "getambassador.io/v3alpha1" - kind: "TLSContext" +- apiVersion: emissary-ingress.dev/v4alpha1 + kind: TLSContext metadata: - creationTimestamp: "2020-07-03T02:19:06Z" - name: "tlscontext-base" - namespace: "default" + creationTimestamp: "2020-07-03T02:19:06Z" + name: tlscontext-base + namespace: default spec: - secret: "tlscontext-base" -- apiVersion: "getambassador.io/v3alpha1" - kind: "TLSContext" + secret: tlscontext-base +- apiVersion: emissary-ingress.dev/v4alpha1 + kind: TLSContext metadata: - creationTimestamp: "2020-07-03T02:19:06Z" - name: "tlscontext-secretnamespacing-false" - namespace: "default" + creationTimestamp: "2020-07-03T02:19:06Z" + name: tlscontext-secretnamespacing-false + namespace: default spec: - secret: "tlscontext-secretnamespacing-false" - secret_namespacing: false -- apiVersion: "getambassador.io/v3alpha1" - kind: "TLSContext" + secret: tlscontext-secretnamespacing-false + secretNamespacing: false +- apiVersion: emissary-ingress.dev/v4alpha1 + kind: TLSContext metadata: - creationTimestamp: "2020-07-03T02:19:06Z" - name: "tlscontext-secretnamespacing-true" - namespace: "default" + creationTimestamp: "2020-07-03T02:19:06Z" + name: tlscontext-secretnamespacing-true + namespace: default spec: - secret: "tlscontext-secretnamespacing-true" - secret_namespacing: true -- apiVersion: "getambassador.io/v3alpha1" - kind: "TLSContext" + secret: tlscontext-secretnamespacing-true + secretNamespacing: true +- apiVersion: emissary-ingress.dev/v4alpha1 + kind: TLSContext metadata: - creationTimestamp: "2020-07-03T02:19:06Z" - name: "tlscontext-certrequired-false" - namespace: "default" + creationTimestamp: "2020-07-03T02:19:06Z" + name: tlscontext-certrequired-false + namespace: default spec: - secret: "tlscontext-certrequired-false" - cert_required: false -- apiVersion: "getambassador.io/v3alpha1" - kind: "TLSContext" + certRequired: false + secret: tlscontext-certrequired-false +- apiVersion: emissary-ingress.dev/v4alpha1 + kind: TLSContext metadata: - creationTimestamp: "2020-07-03T02:19:06Z" - name: "tlscontext-rcf-0" - namespace: "default" + creationTimestamp: "2020-07-03T02:19:06Z" + name: tlscontext-rcf-0 + namespace: default spec: - secret: "tlscontext-rcf-0" - redirect_cleartext_from: 0 -- apiVersion: "getambassador.io/v3alpha1" - kind: "TLSContext" + redirectCleartextFrom: 0 + secret: tlscontext-rcf-0 +- apiVersion: emissary-ingress.dev/v4alpha1 + kind: TLSContext metadata: - creationTimestamp: "2020-07-03T02:19:06Z" - name: "tlscontext-certreq-rcf-set" - namespace: "default" + creationTimestamp: "2020-07-03T02:19:06Z" + name: tlscontext-certreq-rcf-set + namespace: default spec: - secret: "tlscontext-certreq-rcf-set" - cert_required: true - redirect_cleartext_from: 8080 + certRequired: true + redirectCleartextFrom: 8080 + secret: tlscontext-certreq-rcf-set diff --git a/pkg/api/emissary-ingress.dev/v4alpha1/testdata/tlscontexts_v3.yaml b/pkg/api/emissary-ingress.dev/v4alpha1/testdata/tlscontexts_v3.yaml new file mode 100644 index 0000000000..8d47694cbd --- /dev/null +++ b/pkg/api/emissary-ingress.dev/v4alpha1/testdata/tlscontexts_v3.yaml @@ -0,0 +1,54 @@ +- apiVersion: "getambassador.io/v3alpha1" + kind: "TLSContext" + metadata: + creationTimestamp: "2020-07-03T02:19:06Z" + name: "tlscontext-base" + namespace: "default" + spec: + secret: "tlscontext-base" +- apiVersion: "getambassador.io/v3alpha1" + kind: "TLSContext" + metadata: + creationTimestamp: "2020-07-03T02:19:06Z" + name: "tlscontext-secretnamespacing-false" + namespace: "default" + spec: + secret: "tlscontext-secretnamespacing-false" + secret_namespacing: false +- apiVersion: "getambassador.io/v3alpha1" + kind: "TLSContext" + metadata: + creationTimestamp: "2020-07-03T02:19:06Z" + name: "tlscontext-secretnamespacing-true" + namespace: "default" + spec: + secret: "tlscontext-secretnamespacing-true" + secret_namespacing: true +- apiVersion: "getambassador.io/v3alpha1" + kind: "TLSContext" + metadata: + creationTimestamp: "2020-07-03T02:19:06Z" + name: "tlscontext-certrequired-false" + namespace: "default" + spec: + secret: "tlscontext-certrequired-false" + cert_required: false +- apiVersion: "getambassador.io/v3alpha1" + kind: "TLSContext" + metadata: + creationTimestamp: "2020-07-03T02:19:06Z" + name: "tlscontext-rcf-0" + namespace: "default" + spec: + secret: "tlscontext-rcf-0" + redirect_cleartext_from: 0 +- apiVersion: "getambassador.io/v3alpha1" + kind: "TLSContext" + metadata: + creationTimestamp: "2020-07-03T02:19:06Z" + name: "tlscontext-certreq-rcf-set" + namespace: "default" + spec: + secret: "tlscontext-certreq-rcf-set" + cert_required: true + redirect_cleartext_from: 8080 diff --git a/pkg/api/emissary-ingress.dev/v4alpha1/testdata/tracingsvc.yaml b/pkg/api/emissary-ingress.dev/v4alpha1/testdata/tracingsvc.yaml index 16b37cf83b..463558e85c 100644 --- a/pkg/api/emissary-ingress.dev/v4alpha1/testdata/tracingsvc.yaml +++ b/pkg/api/emissary-ingress.dev/v4alpha1/testdata/tracingsvc.yaml @@ -1,102 +1,102 @@ -- apiVersion: "getambassador.io/v3alpha1" - kind: "TracingService" +- apiVersion: emissary-ingress.dev/v4alpha1 + kind: TracingService metadata: - creationTimestamp: "2020-07-03T02:19:06Z" - name: "tracingsvc-no-sampling" - namespace: "default" + creationTimestamp: "2020-07-03T02:19:06Z" + name: tracingsvc-no-sampling + namespace: default spec: - driver: "zipkin" - service: "zipkin-65:9411" - config: - trace_id_128bit: false -- apiVersion: "getambassador.io/v3alpha1" - kind: "TracingService" + config: + traceID128bit: false + driver: zipkin + service: zipkin-65:9411 +- apiVersion: emissary-ingress.dev/v4alpha1 + kind: TracingService metadata: - creationTimestamp: "2020-07-03T02:19:06Z" - name: "tracingsvc-with-stats-name" - namespace: "default" + creationTimestamp: "2020-07-03T02:19:06Z" + name: tracingsvc-with-stats-name + namespace: default spec: - driver: "zipkin" - service: "zipkin-65:9411" - config: - trace_id_128bit: false - stats_name: "alt-stats-name" -- apiVersion: "getambassador.io/v3alpha1" - kind: "TracingService" + config: + traceID128bit: false + driver: zipkin + service: zipkin-65:9411 + statsName: alt-stats-name +- apiVersion: emissary-ingress.dev/v4alpha1 + kind: TracingService metadata: - creationTimestamp: "2020-07-03T02:19:06Z" - name: "tracingsvc-empty-sampling" - namespace: "default" + creationTimestamp: "2020-07-03T02:19:06Z" + name: tracingsvc-empty-sampling + namespace: default spec: - driver: "zipkin" - sampling: {} - service: "zipkin-65:9411" - config: - shared_span_context: false -- apiVersion: "getambassador.io/v3alpha1" - kind: "TracingService" + config: + sharedSpanContext: false + driver: zipkin + sampling: {} + service: zipkin-65:9411 +- apiVersion: emissary-ingress.dev/v4alpha1 + kind: TracingService metadata: - creationTimestamp: "2020-07-03T02:19:06Z" - name: "tracingsvc-client-sampling" - namespace: "default" + creationTimestamp: "2020-07-03T02:19:06Z" + name: tracingsvc-client-sampling + namespace: default spec: - driver: "zipkin" - sampling: - client: 10 - service: "zipkin-65:9411" - config: {} -- apiVersion: "getambassador.io/v3alpha1" - kind: "TracingService" + config: {} + driver: zipkin + sampling: + client: 10 + service: zipkin-65:9411 +- apiVersion: emissary-ingress.dev/v4alpha1 + kind: TracingService metadata: - creationTimestamp: "2020-07-03T02:19:06Z" - name: "tracingsvc-random-sampling" - namespace: "default" + creationTimestamp: "2020-07-03T02:19:06Z" + name: tracingsvc-random-sampling + namespace: default spec: - driver: "zipkin" - sampling: - random: 10 - service: "zipkin-65:9411" - config: - trace_id_128bit: true - shared_span_context: true -- apiVersion: "getambassador.io/v3alpha1" - kind: "TracingService" + config: + sharedSpanContext: true + traceID128bit: true + driver: zipkin + sampling: + random: 10 + service: zipkin-65:9411 +- apiVersion: emissary-ingress.dev/v4alpha1 + kind: TracingService metadata: - creationTimestamp: "2020-07-03T02:19:06Z" - name: "tracingsvc-overall-sampling" - namespace: "default" + creationTimestamp: "2020-07-03T02:19:06Z" + name: tracingsvc-overall-sampling + namespace: default spec: - driver: "zipkin" - sampling: - overall: 10 - service: "zipkin-65:9411" -- apiVersion: "getambassador.io/v3alpha1" - kind: "TracingService" + driver: zipkin + sampling: + overall: 10 + service: zipkin-65:9411 +- apiVersion: emissary-ingress.dev/v4alpha1 + kind: TracingService metadata: - creationTimestamp: "2020-07-03T02:19:06Z" - name: "tracingsvc-sampling" - namespace: "default" + creationTimestamp: "2020-07-03T02:19:06Z" + name: tracingsvc-sampling + namespace: default spec: - driver: "zipkin" - sampling: - client: 10 - overall: 10 - random: 10 - service: "zipkin-65:9411" -- apiVersion: "getambassador.io/v3alpha1" - kind: "TracingService" + driver: zipkin + sampling: + client: 10 + overall: 10 + random: 10 + service: zipkin-65:9411 +- apiVersion: emissary-ingress.dev/v4alpha1 + kind: TracingService metadata: - creationTimestamp: "2020-07-03T02:19:06Z" - name: "tracingsvc-zero-sampling" - namespace: "default" + creationTimestamp: "2020-07-03T02:19:06Z" + name: tracingsvc-zero-sampling + namespace: default spec: - driver: "zipkin" - sampling: - client: 0 - overall: 0 - random: 0 - service: "zipkin-65:9411" - custom_tags: - - request_header: - name: hola - tag: hola + customTags: + - requestHeader: + name: hola + tag: hola + driver: zipkin + sampling: + client: 0 + overall: 0 + random: 0 + service: zipkin-65:9411 diff --git a/pkg/api/emissary-ingress.dev/v4alpha1/testdata/tracingsvc_v3.yaml b/pkg/api/emissary-ingress.dev/v4alpha1/testdata/tracingsvc_v3.yaml new file mode 100644 index 0000000000..16b37cf83b --- /dev/null +++ b/pkg/api/emissary-ingress.dev/v4alpha1/testdata/tracingsvc_v3.yaml @@ -0,0 +1,102 @@ +- apiVersion: "getambassador.io/v3alpha1" + kind: "TracingService" + metadata: + creationTimestamp: "2020-07-03T02:19:06Z" + name: "tracingsvc-no-sampling" + namespace: "default" + spec: + driver: "zipkin" + service: "zipkin-65:9411" + config: + trace_id_128bit: false +- apiVersion: "getambassador.io/v3alpha1" + kind: "TracingService" + metadata: + creationTimestamp: "2020-07-03T02:19:06Z" + name: "tracingsvc-with-stats-name" + namespace: "default" + spec: + driver: "zipkin" + service: "zipkin-65:9411" + config: + trace_id_128bit: false + stats_name: "alt-stats-name" +- apiVersion: "getambassador.io/v3alpha1" + kind: "TracingService" + metadata: + creationTimestamp: "2020-07-03T02:19:06Z" + name: "tracingsvc-empty-sampling" + namespace: "default" + spec: + driver: "zipkin" + sampling: {} + service: "zipkin-65:9411" + config: + shared_span_context: false +- apiVersion: "getambassador.io/v3alpha1" + kind: "TracingService" + metadata: + creationTimestamp: "2020-07-03T02:19:06Z" + name: "tracingsvc-client-sampling" + namespace: "default" + spec: + driver: "zipkin" + sampling: + client: 10 + service: "zipkin-65:9411" + config: {} +- apiVersion: "getambassador.io/v3alpha1" + kind: "TracingService" + metadata: + creationTimestamp: "2020-07-03T02:19:06Z" + name: "tracingsvc-random-sampling" + namespace: "default" + spec: + driver: "zipkin" + sampling: + random: 10 + service: "zipkin-65:9411" + config: + trace_id_128bit: true + shared_span_context: true +- apiVersion: "getambassador.io/v3alpha1" + kind: "TracingService" + metadata: + creationTimestamp: "2020-07-03T02:19:06Z" + name: "tracingsvc-overall-sampling" + namespace: "default" + spec: + driver: "zipkin" + sampling: + overall: 10 + service: "zipkin-65:9411" +- apiVersion: "getambassador.io/v3alpha1" + kind: "TracingService" + metadata: + creationTimestamp: "2020-07-03T02:19:06Z" + name: "tracingsvc-sampling" + namespace: "default" + spec: + driver: "zipkin" + sampling: + client: 10 + overall: 10 + random: 10 + service: "zipkin-65:9411" +- apiVersion: "getambassador.io/v3alpha1" + kind: "TracingService" + metadata: + creationTimestamp: "2020-07-03T02:19:06Z" + name: "tracingsvc-zero-sampling" + namespace: "default" + spec: + driver: "zipkin" + sampling: + client: 0 + overall: 0 + random: 0 + service: "zipkin-65:9411" + custom_tags: + - request_header: + name: hola + tag: hola