Skip to content

Commit

Permalink
feat: use json.Number instead of float64s
Browse files Browse the repository at this point in the history
Convert the Upstream health threshold and Target createdat values from
float64 to json.Number

Use of float64 prevents controller-gen from automatically generating
maifests from these types:
kubernetes-sigs/controller-tools#245
  • Loading branch information
Travis Raines committed Feb 8, 2021
1 parent 4bee72f commit 5ca5a70
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 18 deletions.
30 changes: 15 additions & 15 deletions kong/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ type PassiveHealthcheck struct {
type Healthcheck struct {
Active *ActiveHealthcheck `json:"active,omitempty" yaml:"active,omitempty"`
Passive *PassiveHealthcheck `json:"passive,omitempty" yaml:"passive,omitempty"`
Threshold *float64 `json:"threshold,omitempty" yaml:"threshold,omitempty"`
Threshold *json.Number `json:"threshold,omitempty" yaml:"threshold,omitempty"`
}

// HealthDataAddress represents the health data address of a target
Expand Down Expand Up @@ -191,14 +191,14 @@ type HealthData struct {
// UpstreamNodeHealth represents the node health of a upstream
// +k8s:deepcopy-gen=true
type UpstreamNodeHealth struct {
ID *string `json:"id,omitempty" yaml:"id,omitempty"`
CreatedAt *float64 `json:"created_at,omitempty" yaml:"created_at,omitempty"`
Data *HealthData `json:"data,omitempty" yaml:"data,omitempty"`
Health *string `json:"health,omitempty" yaml:"data,omitempty"`
Target *string `json:"target,omitempty" yaml:"target,omitempty"`
Upstream *Upstream `json:"upstream,omitempty" yaml:"upstream,omitempty"`
Weight *int `json:"weight,omitempty" yaml:"weight,omitempty"`
Tags []*string `json:"tags,omitempty" yaml:"tags,omitempty"`
ID *string `json:"id,omitempty" yaml:"id,omitempty"`
CreatedAt *json.Number `json:"created_at,omitempty" yaml:"created_at,omitempty"`
Data *HealthData `json:"data,omitempty" yaml:"data,omitempty"`
Health *string `json:"health,omitempty" yaml:"data,omitempty"`
Target *string `json:"target,omitempty" yaml:"target,omitempty"`
Upstream *Upstream `json:"upstream,omitempty" yaml:"upstream,omitempty"`
Weight *int `json:"weight,omitempty" yaml:"weight,omitempty"`
Tags []*string `json:"tags,omitempty" yaml:"tags,omitempty"`
}

// Upstream represents an Upstream in Kong.
Expand All @@ -224,12 +224,12 @@ type Upstream struct {
// Target represents a Target in Kong.
// +k8s:deepcopy-gen=true
type Target struct {
CreatedAt *float64 `json:"created_at,omitempty" yaml:"created_at,omitempty"`
ID *string `json:"id,omitempty" yaml:"id,omitempty"`
Target *string `json:"target,omitempty" yaml:"target,omitempty"`
Upstream *Upstream `json:"upstream,omitempty" yaml:"upstream,omitempty"`
Weight *int `json:"weight,omitempty" yaml:"weight,omitempty"`
Tags []*string `json:"tags,omitempty" yaml:"tags,omitempty"`
CreatedAt *json.Number `json:"created_at,omitempty" yaml:"created_at,omitempty"`
ID *string `json:"id,omitempty" yaml:"id,omitempty"`
Target *string `json:"target,omitempty" yaml:"target,omitempty"`
Upstream *Upstream `json:"upstream,omitempty" yaml:"upstream,omitempty"`
Weight *int `json:"weight,omitempty" yaml:"weight,omitempty"`
Tags []*string `json:"tags,omitempty" yaml:"tags,omitempty"`
}

// Configuration represents a config of a plugin in Kong.
Expand Down
10 changes: 7 additions & 3 deletions kong/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 5ca5a70

Please sign in to comment.