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 all commits
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
3 changes: 2 additions & 1 deletion addons/velaux/parameter.cue
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ parameter: {
// +usage=Specify the name of the certificate cecret, if set, means enable the HTTPs.
secretName?: string
// +usage=Specify the gateway type.
gatewayDriver: *"nginx" | "traefik"
gatewayDriver: "nginx" | "traefik-gateway" | "traefik-ingress"
// +usage=Specify the serviceAccountName for apiserver
serviceAccountName: *"kubevela-ux" | string
// +usage=Specify the service type.
Expand All @@ -27,4 +27,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" {
{
type: "gateway"
properties: {
Expand All @@ -66,8 +66,8 @@ velaux: {
}
},
] | []
_traefikTrait: *[
if parameter["domain"] != _|_ && parameter["gatewayDriver"] == "traefik" {
_traefikGatewayTrait: *[
if parameter["domain"] != _|_ && parameter["gatewayDriver"] == "traefik-gateway" {
{
type: "http-route"
properties: {
Expand All @@ -77,6 +77,20 @@ velaux: {
}
},
] | []
_traefikIngressTrait: *[
if parameter["domain"] != _|_ && parameter["gatewayDriver"] == "traefik-ingress" {
{
type: "gateway"
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"]
}