Skip to content

Commit a4a639c

Browse files
authored
Remove all deprecated network spec fields (#948)
* Remove all deprecated network spec fields * make manifests
1 parent 0f5f77f commit a4a639c

6 files changed

+2
-116
lines changed

api/v1beta1/network_disruption.go

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -95,25 +95,14 @@ type NetworkDisruptionSpec struct {
9595
// +kubebuilder:validation:Minimum=0
9696
// +ddmark:validation:Minimum=0
9797
BandwidthLimit int `json:"bandwidthLimit,omitempty"`
98-
// +kubebuilder:validation:Minimum=0
99-
// +kubebuilder:validation:Maximum=65535
100-
// +ddmark:validation:Minimum=0
101-
// +ddmark:validation:Maximum=65535
102-
// +nullable
103-
DeprecatedPort *int `json:"port,omitempty"`
104-
// +kubebuilder:validation:Enum=egress;ingress
105-
// +ddmark:validation:Enum=egress;ingress
106-
DeprecatedFlow string `json:"flow,omitempty"`
10798
// +nullable
10899
HTTP *NetworkHTTPFilters `json:"http,omitempty"`
109100
}
110101

111102
// NetworkHTTPFilters contains http filters
112103
type NetworkHTTPFilters struct {
113-
DeprecatedMethod string `json:"method,omitempty"`
114-
DeprecatedPath HTTPPath `json:"path,omitempty"`
115-
Methods HTTPMethods `json:"methods,omitempty"`
116-
Paths HTTPPaths `json:"paths,omitempty"`
104+
Methods HTTPMethods `json:"methods,omitempty"`
105+
Paths HTTPPaths `json:"paths,omitempty"`
117106
}
118107

119108
type NetworkDisruptionHostSpec struct {
@@ -202,14 +191,6 @@ func (h HTTPMethods) isNotEmpty() bool {
202191

203192
// validate validates args for the given http filters.
204193
func (s *NetworkHTTPFilters) validate() (retErr error) {
205-
if s.DeprecatedPath != "" {
206-
retErr = multierror.Append(retErr, fmt.Errorf("the Path specification at the HTTP network disruption level is no longer supported; use Paths HTTP field instead"))
207-
}
208-
209-
if s.DeprecatedMethod != "" {
210-
retErr = multierror.Append(retErr, fmt.Errorf("the Method specification at the HTTP network disruption level is no longer supported; use Methods HTTP field instead"))
211-
}
212-
213194
retErr = s.validatePaths(retErr)
214195

215196
retErr = s.validateMethods(retErr)
@@ -331,15 +312,6 @@ func (s *NetworkDisruptionSpec) Validate() (retErr error) {
331312
}
332313
}
333314

334-
// ensure deprecated fields are not used
335-
if s.DeprecatedPort != nil {
336-
retErr = multierror.Append(retErr, fmt.Errorf("the port specification at the network disruption level is deprecated; apply to network disruption hosts instead"))
337-
}
338-
339-
if s.DeprecatedFlow != "" {
340-
retErr = multierror.Append(retErr, fmt.Errorf("the flow specification at the network disruption level is deprecated; apply to network disruption hosts instead"))
341-
}
342-
343315
if s.HTTP != nil {
344316
if err := s.HTTP.validate(); err != nil {
345317
retErr = multierror.Append(retErr, err)

api/v1beta1/network_disruption_test.go

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -302,45 +302,6 @@ var _ = Describe("NetworkDisruptionSpec", func() {
302302
})
303303
})
304304

305-
Describe("test deprecated fields cases", func() {
306-
port := 8080
307-
DescribeTable("with deprecated field defined",
308-
func(invalidDisruptionSpec NetworkDisruptionSpec, expectedErrorMessage string) {
309-
// Action
310-
err := invalidDisruptionSpec.Validate()
311-
312-
// Assert
313-
Expect(err).Should(HaveOccurred())
314-
errorMessage := err.Error()
315-
Expect(strings.Count(errorMessage, expectedErrorMessage)).To(Equal(1))
316-
},
317-
Entry("When the DeprecatedPort is defined",
318-
NetworkDisruptionSpec{DeprecatedPort: &port},
319-
"the port specification at the network disruption level is deprecated; apply to network disruption hosts instead",
320-
),
321-
Entry("When the DeprecatedFlow is defined",
322-
NetworkDisruptionSpec{DeprecatedFlow: "lorem"},
323-
"the flow specification at the network disruption level is deprecated; apply to network disruption hosts instead",
324-
),
325-
Entry("When the DeprecatedMethod is defined",
326-
NetworkDisruptionSpec{
327-
HTTP: &NetworkHTTPFilters{
328-
DeprecatedMethod: "ALL",
329-
},
330-
},
331-
"the Method specification at the HTTP network disruption level is no longer supported; use Methods HTTP field instead",
332-
),
333-
Entry("When the DeprecatedPath is defined",
334-
NetworkDisruptionSpec{
335-
HTTP: &NetworkHTTPFilters{
336-
DeprecatedPath: DefaultHTTPPathFilter,
337-
},
338-
},
339-
"the Path specification at the HTTP network disruption level is no longer supported; use Paths HTTP field instead",
340-
),
341-
)
342-
})
343-
344305
Describe("test Methods field cases", func() {
345306
DescribeTable("with valid methods",
346307
func(methods HTTPMethods) {

api/v1beta1/zz_generated.deepcopy.go

Lines changed: 0 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

chart/templates/generated/chaos.datadoghq.com_disruptioncrons.yaml

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -415,11 +415,6 @@ spec:
415415
maximum: 100
416416
minimum: 0
417417
type: integer
418-
flow:
419-
enum:
420-
- egress
421-
- ingress
422-
type: string
423418
hosts:
424419
items:
425420
properties:
@@ -454,24 +449,15 @@ spec:
454449
description: NetworkHTTPFilters contains http filters
455450
nullable: true
456451
properties:
457-
method:
458-
type: string
459452
methods:
460453
items:
461454
type: string
462455
type: array
463-
path:
464-
type: string
465456
paths:
466457
items:
467458
type: string
468459
type: array
469460
type: object
470-
port:
471-
maximum: 65535
472-
minimum: 0
473-
nullable: true
474-
type: integer
475461
services:
476462
items:
477463
properties:

chart/templates/generated/chaos.datadoghq.com_disruptionrollouts.yaml

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -416,11 +416,6 @@ spec:
416416
maximum: 100
417417
minimum: 0
418418
type: integer
419-
flow:
420-
enum:
421-
- egress
422-
- ingress
423-
type: string
424419
hosts:
425420
items:
426421
properties:
@@ -455,24 +450,15 @@ spec:
455450
description: NetworkHTTPFilters contains http filters
456451
nullable: true
457452
properties:
458-
method:
459-
type: string
460453
methods:
461454
items:
462455
type: string
463456
type: array
464-
path:
465-
type: string
466457
paths:
467458
items:
468459
type: string
469460
type: array
470461
type: object
471-
port:
472-
maximum: 65535
473-
minimum: 0
474-
nullable: true
475-
type: integer
476462
services:
477463
items:
478464
properties:

chart/templates/generated/chaos.datadoghq.com_disruptions.yaml

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -406,11 +406,6 @@ spec:
406406
maximum: 100
407407
minimum: 0
408408
type: integer
409-
flow:
410-
enum:
411-
- egress
412-
- ingress
413-
type: string
414409
hosts:
415410
items:
416411
properties:
@@ -445,24 +440,15 @@ spec:
445440
description: NetworkHTTPFilters contains http filters
446441
nullable: true
447442
properties:
448-
method:
449-
type: string
450443
methods:
451444
items:
452445
type: string
453446
type: array
454-
path:
455-
type: string
456447
paths:
457448
items:
458449
type: string
459450
type: array
460451
type: object
461-
port:
462-
maximum: 65535
463-
minimum: 0
464-
nullable: true
465-
type: integer
466452
services:
467453
items:
468454
properties:

0 commit comments

Comments
 (0)