Skip to content

Commit

Permalink
fix json tags and duration type
Browse files Browse the repository at this point in the history
  • Loading branch information
Maliz committed Apr 18, 2023
1 parent 45be443 commit cf9f0af
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 13 deletions.
2 changes: 2 additions & 0 deletions acceptance/tests/fixtures/bases/crds-oss/servicedefaults.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ spec:
interval: 1s
maxFailures: 10
enforcing_consecutive_5xx: 60
maxEjectionPercent: 100
baseEjectionTime: 20s
- name: "bar"
limits:
maxConnections: 5
Expand Down
12 changes: 5 additions & 7 deletions control-plane/api/v1alpha1/servicedefaults_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@ package v1alpha1

import (
"fmt"
"net"
"strings"
"time"

"github.com/google/go-cmp/cmp"
"github.com/google/go-cmp/cmp/cmpopts"
"github.com/hashicorp/consul-k8s/control-plane/api/common"
Expand All @@ -16,6 +12,8 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/util/validation/field"
"net"
"strings"
)

const (
Expand Down Expand Up @@ -181,11 +179,11 @@ type PassiveHealthCheck struct {
EnforcingConsecutive5xx *uint32 `json:"enforcing_consecutive_5xx,omitempty"`
// The maximum % of an upstream cluster that can be ejected due to outlier detection.
// Defaults to 10% but will eject at least one host regardless of the value.
MaxEjectionPercent *uint32 `json:",omitempty" alias:"maxEjectionPercent"`
MaxEjectionPercent *uint32 `json:"maxEjectionPercent,omitempty"`
// The base time that a host is ejected for. The real time is equal to the base time
// multiplied by the number of times the host has been ejected and is capped by
// max_ejection_time (Default 300s). Defaults to 30000ms or 30s.
BaseEjectionTime *time.Duration `json:",omitempty" alias:"baseEjectionTime"`
BaseEjectionTime *metav1.Duration `json:"baseEjectionTime,omitempty"`
}

type ServiceDefaultsDestination struct {
Expand Down Expand Up @@ -435,7 +433,7 @@ func (in *PassiveHealthCheck) toConsul() *capi.PassiveHealthCheck {
MaxFailures: in.MaxFailures,
EnforcingConsecutive5xx: in.EnforcingConsecutive5xx,
MaxEjectionPercent: in.MaxEjectionPercent,
BaseEjectionTime: in.BaseEjectionTime,
BaseEjectionTime: &in.BaseEjectionTime.Duration,
}
}

Expand Down
7 changes: 1 addition & 6 deletions control-plane/api/v1alpha1/zz_generated.deepcopy.go

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

0 comments on commit cf9f0af

Please sign in to comment.