Skip to content
This repository was archived by the owner on Jun 11, 2025. It is now read-only.

Commit fc7be10

Browse files
committed
feat: router spec and app-controller controller updates
1 parent f03add4 commit fc7be10

17 files changed

Lines changed: 234 additions & 388 deletions

File tree

apis/crds/v1/app_webhook.go

Lines changed: 0 additions & 60 deletions
This file was deleted.

apis/crds/v1/router_types.go

Lines changed: 10 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,17 @@
11
package v1
22

33
import (
4-
"strings"
5-
64
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
75

8-
"github.com/kloudlite/operator/pkg/constants"
96
"github.com/kloudlite/operator/toolkit/reconciler"
107
)
118

129
type Route struct {
13-
App string `json:"app"`
14-
// Lambda string `json:"lambda,omitempty"`
15-
Path string `json:"path"`
16-
Port uint16 `json:"port"`
10+
Host string `json:"host"`
11+
Service string `json:"service"`
12+
Path string `json:"path"`
13+
Port uint16 `json:"port"`
14+
1715
// +kubebuilder:default=false
1816
Rewrite bool `json:"rewrite,omitempty"`
1917
}
@@ -50,21 +48,18 @@ type RouterSpec struct {
5048
IngressClass string `json:"ingressClass,omitempty"`
5149
BackendProtocol *string `json:"backendProtocol,omitempty"`
5250
Https *Https `json:"https,omitempty"`
53-
// +kubebuilder:validation:Optional
5451

5552
RateLimit *RateLimit `json:"rateLimit,omitempty"`
5653
MaxBodySizeInMB *int `json:"maxBodySizeInMB,omitempty"`
57-
Domains []string `json:"domains"`
58-
59-
// Routes is a map of [domain name] to the corresponding []Route
60-
// Routes map[string][]Route `json:"routes"`
6154

62-
Routes []Route `json:"routes,omitempty"`
6355
BasicAuth *BasicAuth `json:"basicAuth,omitempty"`
6456
Cors *Cors `json:"cors,omitempty"`
6557

6658
// NginxIngressAnnotations is additional list of annotations on ingress resource
59+
// INFO: must be used when router does not have direct support for it
6760
NginxIngressAnnotations map[string]string `json:"nginxIngressAnnotations,omitempty"`
61+
62+
Routes []Route `json:"routes,omitempty"`
6863
}
6964

7065
// +kubebuilder:object:root=true
@@ -98,17 +93,11 @@ func (r *Router) GetStatus() *reconciler.Status {
9893
}
9994

10095
func (r *Router) GetEnsuredLabels() map[string]string {
101-
return map[string]string{
102-
constants.RouterNameKey: r.Name,
103-
}
96+
return map[string]string{}
10497
}
10598

10699
func (m *Router) GetEnsuredAnnotations() map[string]string {
107-
return map[string]string{
108-
// "kloudlite.io/router.domains": strings.Join(fn.MapKeys(m.Spec.Routes), ","),
109-
"kloudlite.io/router.domains": strings.Join(m.Spec.Domains, ","),
110-
"kloudlite.io/router.ingress-class": m.Spec.IngressClass,
111-
}
100+
return map[string]string{}
112101
}
113102

114103
// +kubebuilder:object:root=true

apis/crds/v1/zz_generated.deepcopy.go

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

cmd/platform-operator/main.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ import (
2323

2424
serviceIntercept "github.com/kloudlite/operator/operators/service-intercept/controller"
2525
workspace "github.com/kloudlite/operator/operators/workspace/register"
26-
pluginMongoDB "github.com/kloudlite/plugin-mongodb/kloudlite"
26+
pluginK3sCluster "github.com/kloudlite/plugin-k3s-cluster/kloudlite"
27+
// pluginMongoDB "github.com/kloudlite/plugin-mongodb/kloudlite"
2728
)
2829

2930
func main() {
@@ -52,7 +53,8 @@ func main() {
5253
// wireguard.RegisterInto(mgr) // MIGRATE
5354
// networkingv0.RegisterInto(mgr) // MIGRATE
5455

55-
pluginMongoDB.RegisterInto(mgr)
56+
// pluginMongoDB.RegisterInto(mgr)
57+
pluginK3sCluster.RegisterInto(mgr)
5658
workspace.RegisterInto(mgr)
5759

5860
mgr.Start()

config/crd/bases/crds.kloudlite.io_apps.yaml

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -343,10 +343,6 @@ spec:
343343
type: string
344344
type: array
345345
type: object
346-
domains:
347-
items:
348-
type: string
349-
type: array
350346
https:
351347
properties:
352348
clusterIssuer:
@@ -366,8 +362,9 @@ spec:
366362
nginxIngressAnnotations:
367363
additionalProperties:
368364
type: string
369-
description: NginxIngressAnnotations is additional list of annotations
370-
on ingress resource
365+
description: |-
366+
NginxIngressAnnotations is additional list of annotations on ingress resource
367+
INFO: must be used when router does not have direct support for it
371368
type: object
372369
rateLimit:
373370
properties:
@@ -383,24 +380,24 @@ spec:
383380
routes:
384381
items:
385382
properties:
386-
app:
383+
host:
387384
type: string
388385
path:
389-
description: Lambda string `json:"lambda,omitempty"`
390386
type: string
391387
port:
392388
type: integer
393389
rewrite:
394390
default: false
395391
type: boolean
392+
service:
393+
type: string
396394
required:
397-
- app
395+
- host
398396
- path
399397
- port
398+
- service
400399
type: object
401400
type: array
402-
required:
403-
- domains
404401
type: object
405402
serviceAccount:
406403
type: string

config/crd/bases/crds.kloudlite.io_blueprints.yaml

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -348,10 +348,6 @@ spec:
348348
type: string
349349
type: array
350350
type: object
351-
domains:
352-
items:
353-
type: string
354-
type: array
355351
https:
356352
properties:
357353
clusterIssuer:
@@ -371,8 +367,9 @@ spec:
371367
nginxIngressAnnotations:
372368
additionalProperties:
373369
type: string
374-
description: NginxIngressAnnotations is additional list
375-
of annotations on ingress resource
370+
description: |-
371+
NginxIngressAnnotations is additional list of annotations on ingress resource
372+
INFO: must be used when router does not have direct support for it
376373
type: object
377374
rateLimit:
378375
properties:
@@ -388,24 +385,24 @@ spec:
388385
routes:
389386
items:
390387
properties:
391-
app:
388+
host:
392389
type: string
393390
path:
394-
description: Lambda string `json:"lambda,omitempty"`
395391
type: string
396392
port:
397393
type: integer
398394
rewrite:
399395
default: false
400396
type: boolean
397+
service:
398+
type: string
401399
required:
402-
- app
400+
- host
403401
- path
404402
- port
403+
- service
405404
type: object
406405
type: array
407-
required:
408-
- domains
409406
type: object
410407
serviceAccount:
411408
type: string

config/crd/bases/crds.kloudlite.io_routers.yaml

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,6 @@ spec:
8686
type: string
8787
type: array
8888
type: object
89-
domains:
90-
items:
91-
type: string
92-
type: array
9389
https:
9490
properties:
9591
clusterIssuer:
@@ -109,8 +105,9 @@ spec:
109105
nginxIngressAnnotations:
110106
additionalProperties:
111107
type: string
112-
description: NginxIngressAnnotations is additional list of annotations
113-
on ingress resource
108+
description: |-
109+
NginxIngressAnnotations is additional list of annotations on ingress resource
110+
INFO: must be used when router does not have direct support for it
114111
type: object
115112
rateLimit:
116113
properties:
@@ -126,24 +123,24 @@ spec:
126123
routes:
127124
items:
128125
properties:
129-
app:
126+
host:
130127
type: string
131128
path:
132-
description: Lambda string `json:"lambda,omitempty"`
133129
type: string
134130
port:
135131
type: integer
136132
rewrite:
137133
default: false
138134
type: boolean
135+
service:
136+
type: string
139137
required:
140-
- app
138+
- host
141139
- path
142140
- port
141+
- service
143142
type: object
144143
type: array
145-
required:
146-
- domains
147144
type: object
148145
status:
149146
properties:

go.mod

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,17 @@ require (
1212
github.com/cert-manager/cert-manager v1.16.2
1313
github.com/charmbracelet/log v0.4.0
1414
github.com/codingconcepts/env v0.0.0-20240618133406-5b0845441187
15-
github.com/evanphx/json-patch/v5 v5.9.0
15+
github.com/evanphx/json-patch/v5 v5.9.11
1616
github.com/fatih/color v1.18.0
1717
github.com/go-chi/chi/v5 v5.2.0
1818
github.com/go-redis/redis/v8 v8.11.5
1919
github.com/go-sql-driver/mysql v1.8.1
2020
github.com/gobuffalo/flect v1.0.3
2121
github.com/goombaio/namegenerator v0.0.0-20181006234301-989e774b106e
2222
github.com/influxdata/influxdb-client-go/v2 v2.14.0
23-
github.com/kloudlite/operator/toolkit v0.0.0-20250316093242-493e9b587c10
23+
github.com/kloudlite/operator/toolkit v0.0.0-20250323044516-4d91d0b9477a
2424
github.com/kloudlite/plugin-helm-chart v0.0.0-20250317052100-fef043b111a2
25+
github.com/kloudlite/plugin-k3s-cluster v0.0.0-20250420192843-f0fae9cd7d36
2526
github.com/kloudlite/plugin-mongodb v0.0.0-20250316175205-312ba86d8873
2627
github.com/matoous/go-nanoid/v2 v2.1.0
2728
github.com/miekg/dns v1.1.62
@@ -46,13 +47,13 @@ require (
4647
google.golang.org/grpc v1.69.2
4748
google.golang.org/protobuf v1.36.0
4849
helm.sh/helm/v3 v3.16.4
49-
k8s.io/api v0.32.0
50-
k8s.io/apiextensions-apiserver v0.32.0
51-
k8s.io/apimachinery v0.32.0
52-
k8s.io/client-go v0.32.0
50+
k8s.io/api v0.32.1
51+
k8s.io/apiextensions-apiserver v0.32.1
52+
k8s.io/apimachinery v0.32.1
53+
k8s.io/client-go v0.32.1
5354
k8s.io/kubernetes v1.32.0
5455
k8s.io/utils v0.0.0-20241210054802-24370beab758
55-
sigs.k8s.io/controller-runtime v0.19.3
56+
sigs.k8s.io/controller-runtime v0.20.2
5657
sigs.k8s.io/yaml v1.4.0
5758
)
5859

@@ -225,9 +226,9 @@ require (
225226
google.golang.org/genproto/googleapis/rpc v0.0.0-20241216192217-9240e9c98484 // indirect
226227
gopkg.in/inf.v0 v0.9.1 // indirect
227228
gopkg.in/yaml.v3 v3.0.1 // indirect
228-
k8s.io/apiserver v0.32.0 // indirect
229+
k8s.io/apiserver v0.32.1 // indirect
229230
k8s.io/cli-runtime v0.32.0 // indirect
230-
k8s.io/component-base v0.32.0 // indirect
231+
k8s.io/component-base v0.32.1 // indirect
231232
k8s.io/klog/v2 v2.130.1 // indirect
232233
k8s.io/kube-openapi v0.0.0-20241212222426-2c72e554b1e7 // indirect
233234
k8s.io/kubectl v0.32.0 // indirect

0 commit comments

Comments
 (0)