diff --git a/api/v1alpha1/staticroute_types.go b/api/v1alpha1/staticroute_types.go index 5ccac3abd..ed0641ad0 100644 --- a/api/v1alpha1/staticroute_types.go +++ b/api/v1alpha1/staticroute_types.go @@ -64,7 +64,7 @@ func (spec *StaticRouteSpec) GetOptionsFromSpec() (*options.StaticOptions, error Paths: paths, Auth: spec.Auth, Hosts: spec.Hosts, - Upstream: spec.Upstream, + Upstream: *spec.Upstream, } if err := opts.Validate(); err != nil { return nil, fmt.Errorf("failed to validate options: %w", err) diff --git a/cmd/kusk/cmd/manifest_data.go b/cmd/kusk/cmd/manifest_data.go index 5450da491..d62d9e05a 100644 --- a/cmd/kusk/cmd/manifest_data.go +++ b/cmd/kusk/cmd/manifest_data.go @@ -982,7 +982,7 @@ func cmdKuskManifestsDashboard_envoyfleetYaml() (*asset, error) { return a, nil } -var _cmdKuskManifestsDashboard_staticrouteYaml = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x84\x91\xd1\x6e\xb3\x30\x0c\x85\xef\xf3\x14\x56\x2e\x7f\x89\xf6\xef\xdd\x94\xc7\xd8\xa4\xdd\xbb\xe0\x41\x44\x48\x22\xdb\xa1\xe2\xed\xa7\x14\xba\xad\x0c\x69\xbe\x41\xf6\xf9\xf0\xb1\x4e\x30\xfb\x77\x62\xf1\x29\x3a\xe8\x51\xe9\x86\xcb\x69\x2c\x32\x9e\x7c\x3a\xcf\x17\x0c\x79\xc0\x8b\x19\x7d\xec\x1c\xbc\x29\xaa\x6f\x5f\x53\x51\x32\x13\x29\x76\xa8\xe8\x0c\x40\xc4\x89\x1c\xd4\x9f\x9a\x6d\x43\xd3\xa1\x0c\xd7\x84\xdc\x6d\xb2\x64\x6c\x1f\x8c\x2c\xa2\x34\x19\x80\x80\x57\x0a\x52\x37\xc0\xaa\x4c\x18\xb1\xa7\xce\x81\x55\x2e\x64\x8d\x64\x6a\xab\xfc\x11\x88\x74\xe5\x0e\xbc\x32\xfb\x19\x95\x1a\x8a\x73\x5a\x9a\x3b\xfb\x85\x1e\xfa\x0e\x49\x74\xb3\x6d\x20\xa4\x16\x43\x9d\x6c\xbd\xfd\x67\x0d\x40\x46\x1d\x36\xe4\xbc\x7e\x00\xfa\xc7\x0d\xb5\xb8\xa6\xf0\xdd\x02\x94\x2c\xca\x84\xd3\xcf\x19\x00\xd3\x8d\xfd\x33\x58\x2b\xa3\x2a\x71\x74\x60\xed\x4e\x91\x72\x15\xf5\x5a\xf4\xfe\x20\x3b\x59\x88\x67\xdf\xfe\xda\xf6\x47\xfe\x7b\xf4\x30\x93\xa7\xeb\x12\xab\x83\x97\xff\xe6\x33\x00\x00\xff\xff\x74\xeb\xd3\x6c\x1c\x02\x00\x00") +var _cmdKuskManifestsDashboard_staticrouteYaml = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x84\x8f\xbd\x6e\xec\x20\x10\x85\x7b\x9e\x62\xe4\xf2\x4a\xec\xcd\x76\x11\x8f\x91\x48\xe9\xcf\xc2\x64\x8d\xcc\x9f\x98\xb1\x23\xbf\x7d\x44\xec\xed\x56\x09\xdd\xe1\x7c\x7c\xcc\xa0\xc5\x0f\xee\x12\x6b\x71\x74\x87\xf2\x17\xf6\xcb\xb2\xca\x72\x89\xf5\xff\x76\x45\x6a\x33\xae\x66\x89\x25\x38\x7a\x57\x68\xf4\x6f\x75\x55\x36\x99\x15\x01\x0a\x67\x88\x0a\x32\x3b\x1a\x8f\xec\x69\xb0\x01\x32\xdf\x2a\x7a\x38\x6b\x69\xf0\x0f\x46\x76\x51\xce\x86\x28\xe1\xc6\x49\x86\x81\x8e\x26\xa3\xe0\xce\xc1\xd1\xa4\x7d\xe5\xc9\x48\x63\x3f\xea\xb5\x89\x76\x46\x3e\x50\xe1\xbe\x45\xcf\x47\xf8\xf3\xf7\x07\xf2\x74\x82\x71\x5a\xed\xea\xe8\xf5\xc5\x10\x7d\x26\x66\x3d\xbc\x4f\xac\xad\xc7\x0d\xca\x96\xcb\x56\x77\xfb\xc3\x9a\x5f\xed\x73\x15\x3d\xd7\xb3\x94\xaa\x47\x1a\x37\x67\x9e\xfe\x4d\xe6\x3b\x00\x00\xff\xff\x69\x58\x09\x14\x7c\x01\x00\x00") func cmdKuskManifestsDashboard_staticrouteYamlBytes() ([]byte, error) { return bindataRead( @@ -997,7 +997,7 @@ func cmdKuskManifestsDashboard_staticrouteYaml() (*asset, error) { return nil, err } - info := bindataFileInfo{name: "cmd/kusk/manifests/dashboard_staticroute.yaml", size: 540, mode: os.FileMode(420), modTime: time.Unix(1, 0)} + info := bindataFileInfo{name: "cmd/kusk/manifests/dashboard_staticroute.yaml", size: 380, mode: os.FileMode(420), modTime: time.Unix(1, 0)} a := &asset{bytes: bytes, info: info} return a, nil } diff --git a/cmd/kusk/manifests/dashboard_staticroute.yaml b/cmd/kusk/manifests/dashboard_staticroute.yaml index 729b2c157..3e097f650 100644 --- a/cmd/kusk/manifests/dashboard_staticroute.yaml +++ b/cmd/kusk/manifests/dashboard_staticroute.yaml @@ -6,21 +6,14 @@ metadata: labels: kusk-managed: "true" spec: + upstream: + service: + name: kusk-gateway-dashboard + namespace: kusk-system + port: 80 fleet: name: kusk-gateway-private-envoy-fleet namespace: kusk-system hosts: - localhost - "*" - paths: - /: - get: - route: - upstream: - rewrite: - pattern: "" - substitution: "" - service: - name: kusk-gateway-dashboard - namespace: kusk-system - port: 80 diff --git a/internal/controllers/staticroute_utils.go b/internal/controllers/staticroute_utils.go index 7f8d2591c..3835958b8 100644 --- a/internal/controllers/staticroute_utils.go +++ b/internal/controllers/staticroute_utils.go @@ -63,7 +63,7 @@ func staticRouteAppendRootPath(logger logr.Logger, opts *options.StaticOptions) // `upstream` should be defined at the `spec` level. opts.Paths[pathRoute][method] = &options.SubOptions{ - Upstream: opts.Upstream, + Upstream: &opts.Upstream, } logger.Info( diff --git a/pkg/options/static_options.go b/pkg/options/static_options.go index 4f988e2d4..d660ae210 100644 --- a/pkg/options/static_options.go +++ b/pkg/options/static_options.go @@ -63,7 +63,7 @@ type StaticOptions struct { // It should just contain the route path, "/". Paths map[string]StaticOperationSubOptions `yaml:"paths,omitempty" json:"paths,omitempty"` // Upstream is a set of options of a target service to receive traffic. - Upstream *UpstreamOptions `json:"upstream,omitempty" yaml:"upstream,omitempty"` + Upstream UpstreamOptions `json:"upstream" yaml:"upstream"` } func (o *StaticOptions) fillDefaults() {