Skip to content

Commit

Permalink
Fix: remove ingress trait parameter ingressClassName, use k8s default…
Browse files Browse the repository at this point in the history
… class (#110)

Signed-off-by: xingcan-ltc <[email protected]>
  • Loading branch information
xingcan-hu authored May 31, 2024
1 parent c64da64 commit 83a893e
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 19 deletions.
5 changes: 0 additions & 5 deletions catalog/flink/x-definitions/app-streampark.cue
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,6 @@ template: {
},
{
properties: {
ingressClassName: parameter.ingressClassName
stickySession: true
service: {
ports: [
Expand Down Expand Up @@ -370,10 +369,6 @@ template: {
}
}

// +ui:description=配置访问 Ingress 地址的 IngressClass, 如果您不清楚IngressClass,请勿随意更改
// +ui:order=4
ingressClassName: *"kong" | string

// +ui:description=镜像版本
// +ui:options={"disabled": true}
// +ui:order=5
Expand Down
5 changes: 0 additions & 5 deletions catalog/hue/x-definitions/app-hue.cue
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,6 @@ template: {

{
properties: {
ingressClassName: parameter.ingressClassName
stickySession: true
service: {
ports: [
Expand Down Expand Up @@ -444,10 +443,6 @@ template: {
}
}

// +ui:description=配置访问 Ingress 地址的 IngressClass, 如果您不清楚IngressClass,请勿随意更改
// +ui:order=4
ingressClassName: *"kong" | string

// +ui:description=容器镜像
// +ui:options={"disabled": true}
// +ui:order=5
Expand Down
21 changes: 13 additions & 8 deletions infra/kdp-core/definitions/trait-bdos-ingress.cue
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import "strings"
template: {
import ("strings")

// could be "kong" or "nginx" ...
_ingressClassName: ""
// declare _ingressName
_ingressName: string
if parameter.ingressName != _|_ {
Expand Down Expand Up @@ -77,7 +79,9 @@ template: {
}

spec: {
ingressClassName: parameter.ingressClassName
if _ingressClassName != _|_ && _ingressClassName != "" {
ingressClassName: _ingressClassName
}
rules: [
for v in parameter.rules {
_rule_domain: *v.host | string
Expand Down Expand Up @@ -138,11 +142,13 @@ template: {
"\(k)": v
}
}

// KongIngress CR
if parameter.stickySession && parameter.ingressClassName == "kong"{
if parameter.stickySession && _ingressClassName == "kong"
// nginxIngress CR
{
"konghq.com/override": context.name + "-sticky-session"
}
// nginxIngress CR
}
metalabels: {
"app": context.name
Expand All @@ -169,10 +175,11 @@ template: {

}


outputs: {
// KongIngress CR
if parameter.stickySession && parameter.ingressClassName == "kong"{
if parameter.stickySession && _ingressClassName == "kong"
// nginxIngress CR
{
"kongIngress": {
apiVersion: "configuration.konghq.com/v1"
kind: "KongIngress"
Expand All @@ -189,16 +196,14 @@ template: {
}
}
}
// nginxIngress CR
}

parameter: {
namespace?: *"default" | string
ingressName?: string
gateway?: [string]: string
annotations?: [string]: string
ingressClassName: *"kong" | string
stickySession: *false | bool
stickySession: *false | bool
service?: {
serviceName?: string
annotations?: [string]: string
Expand Down
4 changes: 3 additions & 1 deletion infra/kong/template.cue
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ _kong: {
repository: "\(parameter.registry)/kong/kubernetes-ingress-controller"
tag: "2.12"
ingressClass: "kong"
ingressClassAnnotations: {}
ingressClassAnnotations: {
"ingressclass.kubernetes.io/is-default-class": "true"
}
}
waitImage: {
enabled: true
Expand Down

0 comments on commit 83a893e

Please sign in to comment.