Skip to content

Commit bc789c9

Browse files
committed
feat(k8s/amour): add gateway class and basic gateway
1 parent 84680bd commit bc789c9

File tree

10 files changed

+96
-32
lines changed

10 files changed

+96
-32
lines changed

BUILD.bazel

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
load("@com_github_tnarg_rules_cue//cue:cue.bzl", "cue_export")
21
load("@bazel_gazelle//:def.bzl", "DEFAULT_LANGUAGES", "gazelle", "gazelle_binary")
32
load("@com_github_bazelbuild_buildtools//buildifier:def.bzl", "buildifier")
43

@@ -26,15 +25,3 @@ gazelle(
2625
)
2726

2827
buildifier(name = "buildifier")
29-
30-
cue_export(
31-
name = "cilium_1_14_0",
32-
src = "cilium-1.14.0.cue",
33-
visibility = ["//visibility:public"],
34-
)
35-
36-
cue_export(
37-
name = "cilium_1_16_1",
38-
src = "cilium-1.16.1.cue",
39-
visibility = ["//visibility:public"],
40-
)

cue.mod/gen/net/lookup_go_gen.cue

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44

55
package net
66

7-
import "context"
8-
97
_#maxProtoLength: int & 25
108

119
_#maxPortBufSize: int & 25
@@ -33,5 +31,5 @@ _#maxPortBufSize: int & 25
3331
// onlyValuesCtx is a context that uses an underlying context
3432
// for value lookup if the underlying context hasn't yet expired.
3533
_#onlyValuesCtx: {
36-
Context: context.#Context
34+
Context: _
3735
}

cue.mod/gen/reflect/type_go_gen.cue

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515
// https://golang.org/doc/articles/laws_of_reflection.html
1616
package reflect
1717

18-
import "internal/abi"
19-
2018
// Type is the representation of a Go type.
2119
//
2220
// Not all methods apply to all kinds of types. Restrictions,
@@ -129,18 +127,18 @@ import "internal/abi"
129127
// (if T is a defined type, the uncommonTypes for T and *T have methods).
130128
// Using a pointer to this struct reduces the overall size required
131129
// to describe a non-defined type with no methods.
132-
_#uncommonType: abi.#UncommonType
130+
_#uncommonType: _
133131

134132
// Embed this type to get common/uncommon
135133
_#common: {
136-
Type: abi.#Type
134+
Type: _
137135
}
138136

139-
_#aNameOff: abi.#NameOff
137+
_#aNameOff: _
140138

141-
_#aTypeOff: abi.#TypeOff
139+
_#aTypeOff: _
142140

143-
_#aTextOff: abi.#TextOff
141+
_#aTextOff: _
144142

145143
// ChanDir represents a channel type's direction.
146144
#ChanDir: int // #enumChanDir
@@ -161,10 +159,10 @@ _#aTextOff: abi.#TextOff
161159
#BothDir: #ChanDir & 3
162160

163161
// arrayType represents a fixed array type.
164-
_#arrayType: abi.#ArrayType
162+
_#arrayType: _
165163

166164
// chanType represents a channel type.
167-
_#chanType: abi.#ChanType
165+
_#chanType: _
168166

169167
// funcType represents a function type.
170168
//
@@ -177,34 +175,34 @@ _#chanType: abi.#ChanType
177175
// uncommonType
178176
// [2]*rtype // [0] is in, [1] is out
179177
// }
180-
_#funcType: abi.#FuncType
178+
_#funcType: _
181179

182180
// interfaceType represents an interface type.
183181
_#interfaceType: {
184-
InterfaceType: abi.#InterfaceType
182+
InterfaceType: _
185183
}
186184

187185
// mapType represents a map type.
188186
_#mapType: {
189-
MapType: abi.#MapType
187+
MapType: _
190188
}
191189

192190
// ptrType represents a pointer type.
193191
_#ptrType: {
194-
PtrType: abi.#PtrType
192+
PtrType: _
195193
}
196194

197195
// sliceType represents a slice type.
198196
_#sliceType: {
199-
SliceType: abi.#SliceType
197+
SliceType: _
200198
}
201199

202200
// Struct field
203-
_#structField: abi.#StructField
201+
_#structField: _
204202

205203
// structType represents a struct type.
206204
_#structType: {
207-
StructType: abi.#StructType
205+
StructType: _
208206
}
209207

210208
// Method represents a single method.

k8s/amour/BUILD.bazel

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,14 @@ cue_library(
7272
"apply_set_list.cue",
7373
"cluster_secret_store_list.cue",
7474
"custom_resource_definition_list.cue",
75+
"gateway_class_list.cue",
7576
],
7677
importpath = "github.com/uhthomas/automata/k8s/amour",
7778
visibility = ["//visibility:public"],
7879
deps = [
7980
"//cue.mod/gen/github.com/external-secrets/external-secrets/apis/externalsecrets/v1beta1:cue_v1beta1_library",
8081
"//cue.mod/gen/k8s.io/api/core/v1:cue_v1_library",
8182
"//cue.mod/gen/k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1:cue_v1_library",
83+
"//cue.mod/gen/sigs.k8s.io/gateway-api/apis/v1:cue_v1_library",
8284
],
8385
)

k8s/amour/gateway_class_list.cue

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package amour
2+
3+
import gatewayv1 "sigs.k8s.io/gateway-api/apis/v1"
4+
5+
#GatewayClassList: gatewayv1.#GatewayClassList & {
6+
apiVersion: "gateway.networking.k8s.io/v1"
7+
kind: "GatewayClassList"
8+
items: [...{
9+
apiVersion: "gateway.networking.k8s.io/v1"
10+
kind: "GatewayClass"
11+
}]
12+
}
13+
14+
#GatewayClassList: items: [{
15+
metadata: name: "cilium"
16+
spec: {
17+
controllerName: "io.cilium/gateway-controller"
18+
description: "The default Cilium GatewayClass"
19+
}
20+
}]

k8s/amour/grafana/BUILD.bazel

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,10 @@ cue_library(
55
srcs = [
66
"config_map_list.cue",
77
"external_secret_list.cue",
8+
"gateway_list.cue",
89
"grafana_dashboard_list.cue",
910
"grafana_list.cue",
11+
"http_route_list.cue",
1012
"ingress_list.cue",
1113
"list.cue",
1214
"namespace_list.cue",
@@ -24,5 +26,6 @@ cue_library(
2426
"//cue.mod/gen/k8s.io/api/apps/v1:cue_v1_library",
2527
"//cue.mod/gen/k8s.io/api/core/v1:cue_v1_library",
2628
"//cue.mod/gen/k8s.io/api/networking/v1:cue_v1_library",
29+
"//cue.mod/gen/sigs.k8s.io/gateway-api/apis/v1:cue_v1_library",
2730
],
2831
)

k8s/amour/grafana/gateway_list.cue

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
package grafana
2+
3+
import gatewayv1 "sigs.k8s.io/gateway-api/apis/v1"
4+
5+
#GatewayList: gatewayv1.#GatewayList & {
6+
apiVersion: "gateway.networking.k8s.io/v1"
7+
kind: "GatewayList"
8+
items: [...{
9+
apiVersion: "gateway.networking.k8s.io/v1"
10+
kind: "Gateway"
11+
}]
12+
}
13+
14+
#GatewayList: items: [{
15+
spec: {
16+
gatewayClassName: "cilium"
17+
listeners: [{
18+
name: "http"
19+
port: 80
20+
protocol: gatewayv1.#HTTPProtocolType
21+
}]
22+
}
23+
}]

k8s/amour/grafana/http_route_list.cue

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package grafana
2+
3+
import gatewayv1 "sigs.k8s.io/gateway-api/apis/v1"
4+
5+
#HTTPRouteList: gatewayv1.#HTTPRouteList & {
6+
apiVersion: "gateway.networking.k8s.io/v1"
7+
kind: "HTTPRouteList"
8+
items: [...{
9+
apiVersion: "gateway.networking.k8s.io/v1"
10+
kind: "HTTPRoute"
11+
}]
12+
}
13+
14+
#HTTPRouteList: items: [{
15+
spec: {
16+
parentRefs: [{name: #Name}]
17+
rules: [{
18+
matches: [{
19+
path: {
20+
type: gatewayv1.#PathMatchPathPrefix
21+
value: "/"
22+
}
23+
}]
24+
backendRefs: [{
25+
name: #Name
26+
port: 80
27+
}]
28+
}]
29+
}
30+
}]

k8s/amour/grafana/list.cue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,10 @@ import (
3232
_items: [
3333
#ConfigMapList.items,
3434
#ExternalSecretList.items,
35+
#GatewayList.items,
3536
#GrafanaDashboardList.items,
3637
#GrafanaList.items,
38+
#HTTPRouteList.items,
3739
#IngressList.items,
3840
#NamespaceList.items,
3941
#ServiceList.items,

k8s/amour/list.cue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ _items: [
7373
amour.#ApplySetList.items,
7474
amour.#ClusterSecretStoreList.items,
7575
amour.#CustomResourceDefinitionList.items,
76+
amour.#GatewayClassList.items,
7677
backup.#List.items,
7778
cert_manager_csi_driver.#List.items,
7879
cert_manager.#List.items,

0 commit comments

Comments
 (0)