...

Source file src/github.com/emissary-ingress/emissary/v3/pkg/api/getambassador.io/v3alpha1/crd_tracingservice.go

Documentation: github.com/emissary-ingress/emissary/v3/pkg/api/getambassador.io/v3alpha1

     1  // Copyright 2020 Datawire.  All rights reserved
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //     http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  ///////////////////////////////////////////////////////////////////////////
    16  // Important: Run "make generate-fast" to regenerate code after modifying
    17  // this file.
    18  ///////////////////////////////////////////////////////////////////////////
    19  
    20  package v3alpha1
    21  
    22  import (
    23  	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
    24  )
    25  
    26  type TraceSampling struct {
    27  	Client  *int `json:"client,omitempty"`
    28  	Random  *int `json:"random,omitempty"`
    29  	Overall *int `json:"overall,omitempty"`
    30  }
    31  
    32  // +kubebuilder:validation:Enum=ENVOY;LIGHTSTEP;B3;TRACE_CONTEXT
    33  type PropagationMode string
    34  
    35  type TraceConfig struct {
    36  	AccessTokenFile   string `json:"access_token_file,omitempty"`
    37  	CollectorCluster  string `json:"collector_cluster,omitempty"`
    38  	CollectorEndpoint string `json:"collector_endpoint,omitempty"`
    39  	// +kubebuilder:validation:Enum=HTTP_JSON_V1;HTTP_JSON;HTTP_PROTO
    40  	CollectorEndpointVersion string            `json:"collector_endpoint_version,omitempty"`
    41  	CollectorHostname        string            `json:"collector_hostname,omitempty"`
    42  	PropagationModes         []PropagationMode `json:"propagation_modes,omitempty"`
    43  	TraceID128Bit            *bool             `json:"trace_id_128bit,omitempty"`
    44  	SharedSpanContext        *bool             `json:"shared_span_context,omitempty"`
    45  	ServiceName              string            `json:"service_name,omitempty"`
    46  }
    47  
    48  // TracingCustomTagTypeLiteral provides a data structure for capturing envoy's `type.tracing.v3.CustomTag.Literal`
    49  type TracingCustomTagTypeLiteral struct {
    50  	// +kubebuilder:validation:Required
    51  	Value string `json:"value"`
    52  }
    53  
    54  // TracingCustomTagTypeEnvironment provides a data structure for capturing envoy's `type.tracing.v3.CustomTag.Environment`
    55  type TracingCustomTagTypeEnvironment struct {
    56  	// +kubebuilder:validation:Required
    57  	Name         string  `json:"name"`
    58  	DefaultValue *string `json:"default_value,omitempty"`
    59  }
    60  
    61  // TracingCustomTagTypeRequestHeader provides a data structure for capturing envoy's `type.tracing.v3.CustomTag.Header`
    62  type TracingCustomTagTypeRequestHeader struct {
    63  	// +kubebuilder:validation:Required
    64  	Name         string  `json:"name"`
    65  	DefaultValue *string `json:"default_value,omitempty"`
    66  }
    67  
    68  // TracingCustomTag provides a data structure for capturing envoy's `type.tracing.v3.CustomTag`
    69  type TracingCustomTag struct {
    70  	// +kubebuilder:validation:Required
    71  	Tag string `json:"tag"`
    72  
    73  	// There is no oneOf support in kubebuilder https://github.com/kubernetes-sigs/controller-tools/issues/461
    74  
    75  	// Literal explicitly specifies the protocol stack to set up. Exactly one of Literal,
    76  	// Environment or Header must be supplied.
    77  	Literal *TracingCustomTagTypeLiteral `json:"literal,omitempty"`
    78  	// Environment explicitly specifies the protocol stack to set up. Exactly one of Literal,
    79  	// Environment or Header must be supplied.
    80  	Environment *TracingCustomTagTypeEnvironment `json:"environment,omitempty"`
    81  	// Header explicitly specifies the protocol stack to set up. Exactly one of Literal,
    82  	// Environment or Header must be supplied.
    83  	Header *TracingCustomTagTypeRequestHeader `json:"request_header,omitempty"`
    84  }
    85  
    86  // TracingServiceSpec defines the desired state of TracingService
    87  type TracingServiceSpec struct {
    88  	AmbassadorID AmbassadorID `json:"ambassador_id,omitempty"`
    89  
    90  	// +kubebuilder:validation:Enum={"lightstep","zipkin","datadog","opentelemetry"}
    91  	// +kubebuilder:validation:Required
    92  	Driver string `json:"driver,omitempty"`
    93  	// +kubebuilder:validation:Required
    94  	Service  string         `json:"service,omitempty"`
    95  	Sampling *TraceSampling `json:"sampling,omitempty"`
    96  	// Deprecated: tag_headers is deprecated. Use custom_tags instead.
    97  	// `tag_headers: ["header"]` can be defined as `custom_tags: [{"request_header": {"name": "header"}}]`.
    98  	DeprecatedTagHeaders []string           `json:"tag_headers,omitempty"`
    99  	CustomTags           []TracingCustomTag `json:"custom_tags,omitempty"`
   100  	Config               *TraceConfig       `json:"config,omitempty"`
   101  	StatsName            string             `json:"stats_name,omitempty"`
   102  }
   103  
   104  // TracingService is the Schema for the tracingservices API
   105  //
   106  // +kubebuilder:object:root=true
   107  type TracingService struct {
   108  	metav1.TypeMeta   `json:""`
   109  	metav1.ObjectMeta `json:"metadata,omitempty"`
   110  
   111  	Spec TracingServiceSpec `json:"spec,omitempty"`
   112  }
   113  
   114  // TracingServiceList contains a list of TracingServices.
   115  //
   116  // +kubebuilder:object:root=true
   117  type TracingServiceList struct {
   118  	metav1.TypeMeta `json:""`
   119  	metav1.ListMeta `json:"metadata,omitempty"`
   120  	Items           []TracingService `json:"items"`
   121  }
   122  
   123  func init() {
   124  	SchemeBuilder.Register(&TracingService{}, &TracingServiceList{})
   125  }
   126  

View as plain text