Skip to content

Commit

Permalink
change to nested
Browse files Browse the repository at this point in the history
  • Loading branch information
EItanya committed Dec 3, 2024
1 parent baa2302 commit 3739005
Show file tree
Hide file tree
Showing 5 changed files with 117 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1110,26 +1110,56 @@ Resource Types:
</tr>
</thead>
<tbody><tr>
<td><b><a href="#gatewayparametersspeckubeaiextensiontracinggrpc">grpc</a></b></td>
<td>object</td>
<td>
<br/>
</td>
<td>false</td>
</tr><tr>
<td><b>insecure</b></td>
<td>boolean</td>
<td>
<br/>
</td>
<td>false</td>
</tr><tr>
<td><b>otlpGRPCEndpoint</b></td>
</tr></tbody>
</table>


### GatewayParameters.spec.kube.aiExtension.tracing.grpc
<sup><sup>[↩ Parent](#gatewayparametersspeckubeaiextensiontracing)</sup></sup>





<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
<th>Required</th>
</tr>
</thead>
<tbody><tr>
<td><b>host</b></td>
<td>string</td>
<td>
<br/>
</td>
<td>false</td>
<td>true</td>
</tr><tr>
<td><b>otlpHTTPEndpoint</b></td>
<td>string</td>
<td><b>port</b></td>
<td>integer</td>
<td>
<br/>
<br/>
<i>Format</i>: int32<br/>
<i>Minimum</i>: 1<br/>
</td>
<td>false</td>
<td>true</td>
</tr></tbody>
</table>

Expand Down
17 changes: 13 additions & 4 deletions install/helm/gloo/crds/gateway.gloo.solo.io_gatewayparameters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -269,12 +269,21 @@ spec:
type: object
tracing:
properties:
grpc:
properties:
host:
minLength: 1
type: string
port:
format: int32
minimum: 1
type: integer
required:
- host
- port
type: object
insecure:
type: boolean
otlpGRPCEndpoint:
type: string
otlpHTTPEndpoint:
type: string
type: object
type: object
deployment:
Expand Down
36 changes: 30 additions & 6 deletions projects/gateway2/api/v1alpha1/gateway_parameters_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -744,22 +744,22 @@ func (in *AiExtension) GetTracing() *AIExtensionTracing {
}

type AIExtensionTracing struct {
// gRPC endpoint for the OTLP collector.
// Set this to the gRPC endpoint of the OTLP collector.
// gRPC Config for the OTLP collector.
// Set this to use gRPC streaming of traces to the OTLP collector.
// +optional
OTLPGrpcEndpoint string `json:"otlpGRPCEndpoint,omitempty"`
Grpc *AIExtensionTracingGrpc `json:"grpc,omitempty"`

// Whether to use insecure connection to the OTLP endpoint.
// This will be false by defautl as HTTPS is recommended.
// +optional
Insecure bool `json:"insecure,omitempty"`
}

func (in *AIExtensionTracing) GetOTLPGrpcEndpoint() string {
func (in *AIExtensionTracing) GetGrpc() *AIExtensionTracingGrpc {
if in == nil {
return ""
return nil
}
return in.OTLPGrpcEndpoint
return in.Grpc
}

func (in *AIExtensionTracing) GetInsecure() bool {
Expand All @@ -769,6 +769,30 @@ func (in *AIExtensionTracing) GetInsecure() bool {
return in.Insecure
}

type AIExtensionTracingGrpc struct {
// The gRPC endpoint for the OTLP collector.
// +kubebuilder:validation:MinLength=1
Host string `json:"host"`

// The port for the OTLP collector.
// +kubebuilder:validation:Minimum=1
Port uint32 `json:"port"`
}

func (in *AIExtensionTracingGrpc) GetHost() string {
if in == nil {
return ""
}
return in.Host
}

func (in *AIExtensionTracingGrpc) GetPort() uint32 {
if in == nil {
return 0
}
return in.Port
}

func init() {
SchemeBuilder.Register(&GatewayParameters{}, &GatewayParametersList{})
}
22 changes: 21 additions & 1 deletion projects/gateway2/api/v1alpha1/zz_generated.deepcopy.go

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

18 changes: 17 additions & 1 deletion projects/gateway2/deployer/merge.go
Original file line number Diff line number Diff line change
Expand Up @@ -750,8 +750,24 @@ func deepMergeAiExtensionTracing(dst, src *v1alpha1.AIExtensionTracing) *v1alpha
return src
}

dst.OTLPGrpcEndpoint = mergeComparable(dst.GetOTLPGrpcEndpoint(), src.GetOTLPGrpcEndpoint())
dst.Grpc = deepMergeAiExtensionTracingGrpc(dst.GetGrpc(), src.GetGrpc())
dst.Insecure = mergeComparable(dst.GetInsecure(), src.GetInsecure())

return dst
}

func deepMergeAiExtensionTracingGrpc(dst, src *v1alpha1.AIExtensionTracingGrpc) *v1alpha1.AIExtensionTracingGrpc {
// nil src override means just use dst
if src == nil {
return dst
}

if dst == nil {
return src
}

dst.Host = mergeComparable(dst.GetHost(), src.GetHost())
dst.Port = mergeComparable(dst.GetPort(), src.GetPort())

return dst
}

0 comments on commit 3739005

Please sign in to comment.