Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Addon] Allow velaux use traefik ingress #659

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions addons/velaux/parameter.cue
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ parameter: {
secretName?: string
// +usage=Specify the gateway type.
gatewayDriver: *"nginx" | "traefik"
chivalryq marked this conversation as resolved.
Show resolved Hide resolved
trafficType: *"ingress"| "gateway"
// +usage=Specify the serviceAccountName for apiserver
serviceAccountName: *"kubevela-ux" | string
// +usage=Specify the service type.
Expand All @@ -27,4 +28,5 @@ parameter: {
nodePort: *30000 | int
// +usage=Enable impersonation means impersonating the login user to request the KubeAPI.
enableImpersonation: true | *false

}
24 changes: 19 additions & 5 deletions addons/velaux/resources/velaux.cue
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ velaux: {
]
}
}
_nginxTrait: *[
if parameter["domain"] != _|_ && parameter["gatewayDriver"] == "nginx" {
_nginxIngressTrait: *[
if parameter["domain"] != _|_ && parameter["gatewayDriver"] == "nginx" && parameter["trafficType"] == "ingress" {
{
type: "gateway"
properties: {
Expand All @@ -66,8 +66,8 @@ velaux: {
}
},
] | []
_traefikTrait: *[
if parameter["domain"] != _|_ && parameter["gatewayDriver"] == "traefik" {
_traefikGatewayTrait: *[
if parameter["domain"] != _|_ && parameter["gatewayDriver"] == "traefik" && parameter["trafficType"] == "gateway" {
{
type: "http-route"
properties: {
Expand All @@ -77,6 +77,20 @@ velaux: {
}
},
] | []
_traefikIngressTrait: *[
if parameter["domain"] != _|_ && parameter["gatewayDriver"] == "traefik" && parameter["trafficType"] == "ingress" {
{
type: "ingress"
properties: {
domain: parameter["domain"]
http: {
"/": 80
}
class: "traefik"
}
}
},
] | []
_httpsTrait: *[ if parameter["secretName"] != _|_ && parameter["domain"] != _|_ && parameter["gatewayDriver"] == "traefik" {
type: "https-route"
properties: {
Expand All @@ -89,6 +103,6 @@ velaux: {
_scalerTraits: [
{type: "scaler", properties: replicas: parameter["replicas"]},
]
traits: _nginxTrait + _traefikTrait + _httpsTrait + _scalerTraits
traits: _nginxIngressTrait + _traefikIngressTrait +_traefikGatewayTrait + _httpsTrait + _scalerTraits
dependsOn: ["apiserver"]
}