Skip to content

Commit

Permalink
add protobuf and crd of timeout attribute
Browse files Browse the repository at this point in the history
Signed-off-by: AhmedGrati <[email protected]>
  • Loading branch information
TessaIO committed Jul 23, 2023
1 parent af6439a commit 070bf61
Show file tree
Hide file tree
Showing 12 changed files with 578 additions and 514 deletions.
9 changes: 9 additions & 0 deletions docs/features/kustomize/rollout_cr_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -4280,6 +4280,9 @@
},
"query": {
"type": "string"
},
"timeout": {
"type": "integer"
}
},
"type": "object"
Expand Down Expand Up @@ -8670,6 +8673,9 @@
},
"query": {
"type": "string"
},
"timeout": {
"type": "integer"
}
},
"type": "object"
Expand Down Expand Up @@ -13060,6 +13066,9 @@
},
"query": {
"type": "string"
},
"timeout": {
"type": "integer"
}
},
"type": "object"
Expand Down
2 changes: 2 additions & 0 deletions manifests/crds/analysis-run-crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2779,6 +2779,8 @@ spec:
type: object
query:
type: string
timeout:
type: integer
type: object
skywalking:
properties:
Expand Down
2 changes: 2 additions & 0 deletions manifests/crds/analysis-template-crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2775,6 +2775,8 @@ spec:
type: object
query:
type: string
timeout:
type: integer
type: object
skywalking:
properties:
Expand Down
2 changes: 2 additions & 0 deletions manifests/crds/cluster-analysis-template-crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2775,6 +2775,8 @@ spec:
type: object
query:
type: string
timeout:
type: integer
type: object
skywalking:
properties:
Expand Down
6 changes: 6 additions & 0 deletions manifests/install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2780,6 +2780,8 @@ spec:
type: object
query:
type: string
timeout:
type: integer
type: object
skywalking:
properties:
Expand Down Expand Up @@ -5739,6 +5741,8 @@ spec:
type: object
query:
type: string
timeout:
type: integer
type: object
skywalking:
properties:
Expand Down Expand Up @@ -8584,6 +8588,8 @@ spec:
type: object
query:
type: string
timeout:
type: integer
type: object
skywalking:
properties:
Expand Down
2 changes: 1 addition & 1 deletion metricproviders/prometheus/prometheus.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ func NewPrometheusProvider(api v1.API, logCtx log.Entry, metric v1alpha1.Metric)
return nil, errors.New("prometheus timeout should not be negative")
}

provider.Timeout = time.Duration(*metricTimeout * int(time.Second))
provider.Timeout = time.Duration(*metricTimeout * int64(time.Second))
return provider, nil
}

Expand Down
4 changes: 2 additions & 2 deletions metricproviders/prometheus/prometheus_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func TestType(t *testing.T) {
mock := mockAPI{
value: newScalar(10),
}
timeout := 5
timeout := int64(5)
metric := v1alpha1.Metric{
Name: "foo",
SuccessCondition: "result == 10",
Expand All @@ -46,7 +46,7 @@ func TestType(t *testing.T) {
p, err := NewPrometheusProvider(mock, e, metric)
assert.NoError(t, err)
assert.Equal(t, ProviderType, p.Type())
assert.Equal(t, p.Timeout, time.Duration(timeout*int(time.Second)))
assert.Equal(t, p.Timeout, time.Duration(timeout*int64(time.Second)))
}

func TestRunSuccessfully(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion pkg/apis/rollouts/v1alpha1/analysis_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ type PrometheusMetric struct {
Authentication PrometheusAuth `json:"authentication,omitempty" protobuf:"bytes,3,opt,name=authentication"`
// Timeout represents the duration within which a prometheus query should complete. It is expressed in seconds.
// +optional
Timeout *int `json:"timeout,omitempty" protobuf:"bytes,4,opt,name=timeout"`
Timeout *int64 `json:"timeout,omitempty" protobuf:"bytes,4,opt,name=timeout"`
}

// PrometheusMetric defines the prometheus query to perform canary analysis
Expand Down
Loading

0 comments on commit 070bf61

Please sign in to comment.