Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import types from v1.2.2 #2

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 15 additions & 14 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,39 +3,39 @@ module github.com/argoproj/argo-rollouts
go 1.19

require (
github.com/go-openapi/spec v0.19.3
github.com/stretchr/testify v1.7.0
k8s.io/api v0.18.0-alpha.2
k8s.io/apimachinery v0.18.0-alpha.2
k8s.io/client-go v0.18.0-alpha.2
k8s.io/kube-openapi v0.0.0-20210216185858-15cd8face8d6
github.com/go-openapi/spec v0.20.8
github.com/stretchr/testify v1.8.1
k8s.io/api v0.26.1
k8s.io/apimachinery v0.26.1
k8s.io/client-go v0.26.1
k8s.io/kube-openapi v0.0.0-20230210211930-4b0756abdef5
)

require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/emicklei/go-restful v0.0.0-20170410110728-ff4f55a20633 // indirect
github.com/emicklei/go-restful/v3 v3.9.0 // indirect
github.com/evanphx/json-patch v5.6.0+incompatible // indirect
github.com/go-logr/logr v1.2.3 // indirect
github.com/go-openapi/jsonpointer v0.19.5 // indirect
github.com/go-openapi/jsonreference v0.20.0 // indirect
github.com/go-openapi/swag v0.19.15 // indirect
github.com/go-openapi/jsonpointer v0.19.6 // indirect
github.com/go-openapi/jsonreference v0.20.1 // indirect
github.com/go-openapi/swag v0.22.3 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/gnostic v0.5.7-v3refs // indirect
github.com/google/go-cmp v0.5.9 // indirect
github.com/google/gofuzz v1.0.0 // indirect
github.com/googleapis/gnostic v0.4.1 // indirect
github.com/hashicorp/golang-lru v0.5.1 // indirect
github.com/google/gofuzz v1.1.0 // indirect
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0 // indirect
golang.org/x/net v0.4.0 // indirect
golang.org/x/oauth2 v0.3.0 // indirect
golang.org/x/sys v0.3.0 // indirect
golang.org/x/term v0.3.0 // indirect
golang.org/x/text v0.5.0 // indirect
golang.org/x/time v0.0.0-20220609170525-579cf78fd858 // indirect
google.golang.org/appengine v1.6.7 // indirect
Expand All @@ -45,6 +45,7 @@ require (
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/klog/v2 v2.80.1 // indirect
k8s.io/utils v0.0.0-20230209194617-a36077c30491 // indirect
sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
sigs.k8s.io/yaml v1.3.0 // indirect
)
380 changes: 44 additions & 336 deletions go.sum

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions pkg/apis/api-rules/violation_exceptions.list
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
API rule violation: list_type_missing,github.com/argoproj/argo-rollouts/pkg/apis/rollouts/v1alpha1,AmbassadorTrafficRouting,Mappings
API rule violation: list_type_missing,github.com/argoproj/argo-rollouts/pkg/apis/rollouts/v1alpha1,AnalysisRunSpec,Args
API rule violation: list_type_missing,github.com/argoproj/argo-rollouts/pkg/apis/rollouts/v1alpha1,AnalysisRunSpec,DryRun
API rule violation: list_type_missing,github.com/argoproj/argo-rollouts/pkg/apis/rollouts/v1alpha1,AnalysisRunSpec,MeasurementRetention
API rule violation: list_type_missing,github.com/argoproj/argo-rollouts/pkg/apis/rollouts/v1alpha1,AnalysisRunSpec,Metrics
API rule violation: list_type_missing,github.com/argoproj/argo-rollouts/pkg/apis/rollouts/v1alpha1,AnalysisRunStatus,MetricResults
API rule violation: list_type_missing,github.com/argoproj/argo-rollouts/pkg/apis/rollouts/v1alpha1,AnalysisTemplateSpec,Args
API rule violation: list_type_missing,github.com/argoproj/argo-rollouts/pkg/apis/rollouts/v1alpha1,AnalysisTemplateSpec,DryRun
API rule violation: list_type_missing,github.com/argoproj/argo-rollouts/pkg/apis/rollouts/v1alpha1,AnalysisTemplateSpec,MeasurementRetention
API rule violation: list_type_missing,github.com/argoproj/argo-rollouts/pkg/apis/rollouts/v1alpha1,AnalysisTemplateSpec,Metrics
API rule violation: list_type_missing,github.com/argoproj/argo-rollouts/pkg/apis/rollouts/v1alpha1,AppMeshVirtualService,Routes
API rule violation: list_type_missing,github.com/argoproj/argo-rollouts/pkg/apis/rollouts/v1alpha1,CanaryStrategy,Steps
API rule violation: list_type_missing,github.com/argoproj/argo-rollouts/pkg/apis/rollouts/v1alpha1,CloudWatchMetric,MetricDataQueries
API rule violation: list_type_missing,github.com/argoproj/argo-rollouts/pkg/apis/rollouts/v1alpha1,CloudWatchMetricStatMetric,Dimensions
API rule violation: list_type_missing,github.com/argoproj/argo-rollouts/pkg/apis/rollouts/v1alpha1,ExperimentAnalysisTemplateRef,Args
API rule violation: list_type_missing,github.com/argoproj/argo-rollouts/pkg/apis/rollouts/v1alpha1,ExperimentSpec,Analyses
API rule violation: list_type_missing,github.com/argoproj/argo-rollouts/pkg/apis/rollouts/v1alpha1,ExperimentSpec,DryRun
API rule violation: list_type_missing,github.com/argoproj/argo-rollouts/pkg/apis/rollouts/v1alpha1,ExperimentSpec,MeasurementRetention
API rule violation: list_type_missing,github.com/argoproj/argo-rollouts/pkg/apis/rollouts/v1alpha1,ExperimentSpec,Templates
API rule violation: list_type_missing,github.com/argoproj/argo-rollouts/pkg/apis/rollouts/v1alpha1,ExperimentStatus,AnalysisRuns
API rule violation: list_type_missing,github.com/argoproj/argo-rollouts/pkg/apis/rollouts/v1alpha1,ExperimentStatus,Conditions
Expand All @@ -19,6 +26,8 @@ API rule violation: list_type_missing,github.com/argoproj/argo-rollouts/pkg/apis
API rule violation: list_type_missing,github.com/argoproj/argo-rollouts/pkg/apis/rollouts/v1alpha1,KayentaMetric,Scopes
API rule violation: list_type_missing,github.com/argoproj/argo-rollouts/pkg/apis/rollouts/v1alpha1,MetricResult,Measurements
API rule violation: list_type_missing,github.com/argoproj/argo-rollouts/pkg/apis/rollouts/v1alpha1,RolloutAnalysis,Args
API rule violation: list_type_missing,github.com/argoproj/argo-rollouts/pkg/apis/rollouts/v1alpha1,RolloutAnalysis,DryRun
API rule violation: list_type_missing,github.com/argoproj/argo-rollouts/pkg/apis/rollouts/v1alpha1,RolloutAnalysis,MeasurementRetention
API rule violation: list_type_missing,github.com/argoproj/argo-rollouts/pkg/apis/rollouts/v1alpha1,RolloutAnalysis,Templates
API rule violation: list_type_missing,github.com/argoproj/argo-rollouts/pkg/apis/rollouts/v1alpha1,RolloutExperimentStep,Analyses
API rule violation: list_type_missing,github.com/argoproj/argo-rollouts/pkg/apis/rollouts/v1alpha1,RolloutExperimentStep,Templates
Expand Down
86 changes: 81 additions & 5 deletions pkg/apis/rollouts/v1alpha1/analysis_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
// +genclient:nonNamespaced
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +kubebuilder:resource:path=clusteranalysistemplates,shortName=cat
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp",description="Time since resource was created"
type ClusterAnalysisTemplate struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
Expand All @@ -33,6 +34,7 @@ type ClusterAnalysisTemplateList struct {
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +kubebuilder:resource:path=analysistemplates,shortName=at
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp",description="Time since resource was created"
type AnalysisTemplate struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
Expand All @@ -59,6 +61,16 @@ type AnalysisTemplateSpec struct {
// +patchStrategy=merge
// +optional
Args []Argument `json:"args,omitempty" patchStrategy:"merge" patchMergeKey:"name" protobuf:"bytes,2,rep,name=args"`
// DryRun object contains the settings for running the analysis in Dry-Run mode
// +patchMergeKey=metricName
// +patchStrategy=merge
// +optional
DryRun []DryRun `json:"dryRun,omitempty" patchStrategy:"merge" patchMergeKey:"metricName" protobuf:"bytes,3,rep,name=dryRun"`
// MeasurementRetention object contains the settings for retaining the number of measurements during the analysis
// +patchMergeKey=metricName
// +patchStrategy=merge
// +optional
MeasurementRetention []MeasurementRetention `json:"measurementRetention,omitempty" patchStrategy:"merge" patchMergeKey:"metricName" protobuf:"bytes,4,rep,name=measurementRetention"`
}

// DurationString is a string representing a duration (e.g. 30s, 5m, 1h)
Expand Down Expand Up @@ -106,6 +118,21 @@ type Metric struct {
Provider MetricProvider `json:"provider" protobuf:"bytes,10,opt,name=provider"`
}

// DryRun defines the settings for running the analysis in Dry-Run mode.
type DryRun struct {
// Name of the metric which needs to be evaluated in the Dry-Run mode. Wildcard '*' is supported and denotes all
// the available metrics.
MetricName string `json:"metricName" protobuf:"bytes,1,opt,name=metricName"`
}

// MeasurementRetention defines the settings for retaining the number of measurements during the analysis.
type MeasurementRetention struct {
// MetricName is the name of the metric on which this retention policy should be applied.
MetricName string `json:"metricName" protobuf:"bytes,1,opt,name=metricName"`
// Limit is the maximum number of measurements to be retained for this given metric.
Limit int32 `json:"limit" protobuf:"varint,2,opt,name=limit"`
}

// EffectiveCount is the effective count based on whether or not count/interval is specified
// If neither count or interval is specified, the effective count is 1
// If only interval is specified, metric runs indefinitely and there is no effective count (nil)
Expand Down Expand Up @@ -244,6 +271,7 @@ type CloudWatchMetricStatMetricDimension struct {
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +kubebuilder:resource:path=analysisruns, shortName=ar
// +kubebuilder:printcolumn:name="Status",type="string",JSONPath=".status.phase",description="AnalysisRun status"
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp",description="Time since resource was created"
type AnalysisRun struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
Expand Down Expand Up @@ -272,6 +300,16 @@ type AnalysisRunSpec struct {
Args []Argument `json:"args,omitempty" patchStrategy:"merge" patchMergeKey:"name" protobuf:"bytes,2,rep,name=args"`
// Terminate is used to prematurely stop the run (e.g. rollout completed and analysis is no longer desired)
Terminate bool `json:"terminate,omitempty" protobuf:"varint,3,opt,name=terminate"`
// DryRun object contains the settings for running the analysis in Dry-Run mode
// +patchMergeKey=metricName
// +patchStrategy=merge
// +optional
DryRun []DryRun `json:"dryRun,omitempty" patchStrategy:"merge" patchMergeKey:"metricName" protobuf:"bytes,4,rep,name=dryRun"`
// MeasurementRetention object contains the settings for retaining the number of measurements during the analysis
// +patchMergeKey=metricName
// +patchStrategy=merge
// +optional
MeasurementRetention []MeasurementRetention `json:"measurementRetention,omitempty" patchStrategy:"merge" patchMergeKey:"metricName" protobuf:"bytes,5,rep,name=measurementRetention"`
}

// Argument is an argument to an AnalysisRun
Expand Down Expand Up @@ -313,6 +351,24 @@ type AnalysisRunStatus struct {
MetricResults []MetricResult `json:"metricResults,omitempty" protobuf:"bytes,3,rep,name=metricResults"`
// StartedAt indicates when the analysisRun first started
StartedAt *metav1.Time `json:"startedAt,omitempty" protobuf:"bytes,4,opt,name=startedAt"`
// RunSummary contains the final results from the metric executions
RunSummary RunSummary `json:"runSummary,omitempty" protobuf:"bytes,5,opt,name=runSummary"`
// DryRunSummary contains the final results from the metric executions in the dry-run mode
DryRunSummary *RunSummary `json:"dryRunSummary,omitempty" protobuf:"bytes,6,opt,name=dryRunSummary"`
}

// RunSummary contains the final results from the metric executions
type RunSummary struct {
// This is equal to the sum of Successful, Failed, Inconclusive
Count int32 `json:"count,omitempty" protobuf:"varint,1,opt,name=count"`
// Successful is the number of times the metric was measured Successful
Successful int32 `json:"successful,omitempty" protobuf:"varint,2,opt,name=successful"`
// Failed is the number of times the metric was measured Failed
Failed int32 `json:"failed,omitempty" protobuf:"varint,3,opt,name=failed"`
// Inconclusive is the number of times the metric was measured Inconclusive
Inconclusive int32 `json:"inconclusive,omitempty" protobuf:"varint,4,opt,name=inconclusive"`
// Error is the number of times an error was encountered during measurement
Error int32 `json:"error,omitempty" protobuf:"varint,5,opt,name=error"`
}

// MetricResult contain a list of the most recent measurements for a single metric along with
Expand Down Expand Up @@ -340,6 +396,12 @@ type MetricResult struct {
// ConsecutiveError is the number of times an error was encountered during measurement in succession
// Resets to zero when non-errors are encountered
ConsecutiveError int32 `json:"consecutiveError,omitempty" protobuf:"varint,10,opt,name=consecutiveError"`
// DryRun indicates whether this metric is running in a dry-run mode or not
DryRun bool `json:"dryRun,omitempty" protobuf:"varint,11,opt,name=dryRun"`
// Metadata stores additional metadata about this metric. It is used by different providers to store
// the final state which gets used while taking measurements. For example, Prometheus uses this field
// to store the final resolved query after substituting the template arguments.
Metadata map[string]string `json:"metadata,omitempty" protobuf:"bytes,12,rep,name=metadata"`
}

// Measurement is a point in time result value of a single metric, and the time it was measured
Expand Down Expand Up @@ -397,20 +459,34 @@ type ScopeDetail struct {
}

type WebMetric struct {
// Method is the method of the web metric (empty defaults to GET)
Method WebMetricMethod `json:"method,omitempty" protobuf:"bytes,1,opt,name=method"`
// URL is the address of the web metric
URL string `json:"url" protobuf:"bytes,1,opt,name=url"`
URL string `json:"url" protobuf:"bytes,2,opt,name=url"`
// +patchMergeKey=key
// +patchStrategy=merge
// Headers are optional HTTP headers to use in the request
Headers []WebMetricHeader `json:"headers,omitempty" patchStrategy:"merge" patchMergeKey:"key" protobuf:"bytes,2,rep,name=headers"`
Headers []WebMetricHeader `json:"headers,omitempty" patchStrategy:"merge" patchMergeKey:"key" protobuf:"bytes,3,rep,name=headers"`
// Body is the body of the we metric (must be POST/PUT)
Body string `json:"body,omitempty" protobuf:"bytes,4,opt,name=body"`
// TimeoutSeconds is the timeout for the request in seconds (default: 10)
TimeoutSeconds int64 `json:"timeoutSeconds,omitempty" protobuf:"varint,3,opt,name=timeoutSeconds"`
TimeoutSeconds int64 `json:"timeoutSeconds,omitempty" protobuf:"varint,5,opt,name=timeoutSeconds"`
// JSONPath is a JSON Path to use as the result variable (default: "{$}")
JSONPath string `json:"jsonPath,omitempty" protobuf:"bytes,4,opt,name=jsonPath"`
JSONPath string `json:"jsonPath,omitempty" protobuf:"bytes,6,opt,name=jsonPath"`
// Insecure skips host TLS verification
Insecure bool `json:"insecure,omitempty" protobuf:"varint,5,opt,name=insecure"`
Insecure bool `json:"insecure,omitempty" protobuf:"varint,7,opt,name=insecure"`
}

// WebMetricMethod is the available HTTP methods
type WebMetricMethod string

// Possible HTTP method values
const (
WebMetricMethodGet WebMetricMethod = "GET"
WebMetricMethodPost WebMetricMethod = "POST"
WebMetricMethodPut WebMetricMethod = "PUT"
)

type WebMetricHeader struct {
Key string `json:"key" protobuf:"bytes,1,opt,name=key"`
Value string `json:"value" protobuf:"bytes,2,opt,name=value"`
Expand Down
11 changes: 11 additions & 0 deletions pkg/apis/rollouts/v1alpha1/experiment_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const (
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +kubebuilder:resource:path=experiments,shortName=exp
// +kubebuilder:printcolumn:name="Status",type="string",JSONPath=".status.phase",description="Experiment status"
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp",description="Time since resource was created"
type Experiment struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
Expand Down Expand Up @@ -54,6 +55,16 @@ type ExperimentSpec struct {
// more information
// +optional
ScaleDownDelaySeconds *int32 `json:"scaleDownDelaySeconds,omitempty" protobuf:"varint,6,opt,name=scaleDownDelaySeconds"`
// DryRun object contains the settings for running the analysis in Dry-Run mode
// +patchMergeKey=metricName
// +patchStrategy=merge
// +optional
DryRun []DryRun `json:"dryRun,omitempty" patchStrategy:"merge" patchMergeKey:"metricName" protobuf:"bytes,7,rep,name=dryRun"`
// MeasurementRetention object contains the settings for retaining the number of measurements during the analysis
// +patchMergeKey=metricName
// +patchStrategy=merge
// +optional
MeasurementRetention []MeasurementRetention `json:"measurementRetention,omitempty" patchStrategy:"merge" patchMergeKey:"metricName" protobuf:"bytes,8,rep,name=measurementRetention"`
}

type TemplateSpec struct {
Expand Down
Loading