ALIYUN::SAE::Ingress

Updated at:

ALIYUN::SAE::Ingress类型用于创建一条路由规则。

语法

{
  "Type": "ALIYUN::SAE::Ingress",
  "Properties": {
    "DefaultRule": Map,
    "Description": String,
    "ListenerPort": Integer,
    "NamespaceId": String,
    "Rules": List,
    "SlbId": String,
    "CertIds": List,
    "CertId": String,
    "LoadBalanceType": String,
    "ListenerProtocol": String
  }
}

属性

属性名称

类型

必须

允许更新

描述

约束

DefaultRule

Map

是

是

默认转发规则。

按照IP地址,通过指定端口转发流量到指定应用。

详情参考DefaultRule属性。

说明

所有未匹配或不满足转发规则的请求都会转到该指定应用。

Description

String

是

是

路由规则名称。

无

ListenerPort

Integer

是

是

SLB监听端口。

该端口不能被占用。

NamespaceId

String

是

否

应用所在命名空间ID。

目前不支持跨命名空间的应用。

Rules

List

是

是

转发规则。

按照域名和请求路径,通过指定端口转发流量到指定应用。

详情参考Rules属性。

SlbId

String

是

否

路由规则所使用的SLB。

无

CertIds

List

否

是

ALB多证书ID。

取值说明如下:

  • LoadBalanceType为alb时,使用该字段来配置HTTPS监听多证书,多个证书ID之间使用逗号分割。

  • ALB使用的SSL证书ID需要从数字证书产品获取。例如配置756***-cn-hangzhou,756***为产品页获取的证书ID,-cn-hangzhou为固定后缀。更多信息,请参见管理证书。

CertId

String

否

是

CLB证书ID。

取值说明如下:

  • LoadBalanceType为clb时,使用该字段来配置HTTPS监听证书。

CLB使用SSL证书ID的更多信息,请参见概述。

LoadBalanceType

String

否

否

负载均衡SLB的类型。

取决于创建路由规则时填写的类型,更新时不可变更。取值说明如下:

  • clb:传统型负载均衡CLB(原SLB)。

  • alb:应用型负载均衡ALB。

ListenerProtocol

String

否

是

请求转发协议。

取值说明如下:

  • HTTP:适用于需要对数据内容进行识别的应用。

  • HTTPS:适用于需要加密传输的应用。

DefaultRule语法

"DefaultRule": {
  "BackendProtocol": String,
  "AppId": String,
  "ContainerPort": Integer
}

DefaultRule属性

属性名称

类型

必须

允许更新

描述

约束

AppId

String

是

是

应用ID。

无

ContainerPort

Integer

是

是

应用实例端口。

取值范围:

0~65535。

BackendProtocol

String

否

是

后端服务协议,

取值:

  • http

  • https

  • grpc

Rules语法

"Rules": [
  {
    "Path": String,
    "BackendProtocol": String,
    "AppId": String,
    "RewritePath": String,
    "ContainerPort": Integer,
    "Domain": String
  }
]

Rules属性

属性名称

类型

必须

允许更新

描述

约束

AppId

String

是

是

应用ID。

无

ContainerPort

Integer

是

是

应用实例端口。

取值范围:

0~65535。

Domain

String

是

是

域名。

无

Path

String

是

是

请求路径。

无

BackendProtocol

String

否

是

后端服务协议,

取值:

  • http

  • https

  • grpc

RewritePath

String

否

否

重写路径。

无

返回值

Fn::GetAtt

IngressId:路由规则ID。

示例

  • YAML格式

    ROSTemplateFormatVersion: '2015-09-01'
    Parameters:
      DefaultRule:
        AssociationPropertyMetadata:
          Parameters:
            BackendProtocol:
              Type: String
              Description:
                en: The protocol of the application.
              AllowedValues:
                - http
                - https
                - grpc
              Required: false
            AppId:
              Type: String
              Description:
                en: The application ID
              Required: true
            ContainerPort:
              Type: Number
              Description:
                en: The container port of the application.
              Required: true
              MinValue: 0
              MaxValue: 65535
        Type: Json
        Description:
          en: 'The default forwarding rule. You can specify a port and an application in the default forwarding rule to forward traffic based on the IP address of the application. '
        Required: true
      SlbId:
        Type: String
        AssociationProperty: ALIYUN::SLB::LoadBalancer::LoadBalancerId
        Description:
          en: The Server Load Balancer (SLB) instance that is used by the routing rule.
        Required: true
      ListenerPort:
        Type: Number
        Description:
          en: The listener port of the SLB instance. You must specify a vacant port.
        Required: true
        MinValue: 0
        MaxValue: 65535
      Description:
        AssociationProperty: TextArea
        Type: String
        Description:
          en: The name of the routing rule.
        AllowedPattern: ^[a-z0-9]([a-z0-9.-]{0,61}[a-z0-9])?$
        Required: true
      NamespaceId:
        Type: String
        Description:
          en: The ID of the namespace to which the application belongs. You can specify only one namespace ID each time you call this operation.
        Required: true
      Rules:
        AssociationPropertyMetadata:
          Parameters:
            Path:
              Type: String
              Description:
                en: The request path.
              Required: true
            BackendProtocol:
              Type: String
              Description:
                en: The protocol of the application.
              AllowedValues:
                - http
                - https
                - grpc
              Required: false
            AppId:
              Type: String
              Description:
                en: The application ID
              Required: true
            RewritePath:
              Type: String
              Description:
                en: The rewrite path.
              Required: false
            ContainerPort:
              Type: Number
              Description:
                en: The container port of the application.
              Required: true
              MinValue: 0
              MaxValue: 65535
            Domain:
              Type: String
              Description:
                en: The domain name.
              Required: true
        AssociationProperty: List[Parameters]
        Type: Json
        Description:
          en: The forwarding rules. You can specify a port and an application in a forwarding rule to forward traffic based on the specified domain name and request path.
        Required: true
        MinLength: 1
        MaxLength: 10
    Resources:
      Ingress:
        Type: ALIYUN::SAE::Ingress
        Properties:
          DefaultRule:
            Ref: DefaultRule
          SlbId:
            Ref: SlbId
          ListenerPort:
            Ref: ListenerPort
          Description:
            Ref: Description
          NamespaceId:
            Ref: NamespaceId
          Rules:
            Ref: Rules
    Outputs:
      IngressId:
        Description: The ID of the routing rule.
        Value:
          Fn::GetAtt:
            - Ingress
            - IngressId
    
  • JSON格式

    {
      "ROSTemplateFormatVersion": "2015-09-01",
      "Parameters": {
        "DefaultRule": {
          "AssociationPropertyMetadata": {
            "Parameters": {
              "BackendProtocol": {
                "Type": "String",
                "Description": {
                  "en": "The protocol of the application."
                },
                "AllowedValues": [
                  "http",
                  "https",
                  "grpc"
                ],
                "Required": false
              },
              "AppId": {
                "Type": "String",
                "Description": {
                  "en": "The application ID"
                },
                "Required": true
              },
              "ContainerPort": {
                "Type": "Number",
                "Description": {
                  "en": "The container port of the application."
                },
                "Required": true,
                "MinValue": 0,
                "MaxValue": 65535
              }
            }
          },
          "Type": "Json",
          "Description": {
            "en": "The default forwarding rule. You can specify a port and an application in the default forwarding rule to forward traffic based on the IP address of the application. "
          },
          "Required": true
        },
        "SlbId": {
          "Type": "String",
          "AssociationProperty": "ALIYUN::SLB::LoadBalancer::LoadBalancerId",
          "Description": {
            "en": "The Server Load Balancer (SLB) instance that is used by the routing rule."
          },
          "Required": true
        },
        "ListenerPort": {
          "Type": "Number",
          "Description": {
            "en": "The listener port of the SLB instance. You must specify a vacant port."
          },
          "Required": true,
          "MinValue": 0,
          "MaxValue": 65535
        },
        "Description": {
          "AssociationProperty": "TextArea",
          "Type": "String",
          "Description": {
            "en": "The name of the routing rule."
          },
          "AllowedPattern": "^[a-z0-9]([a-z0-9.-]{0,61}[a-z0-9])?$",
          "Required": true
        },
        "NamespaceId": {
          "Type": "String",
          "Description": {
            "en": "The ID of the namespace to which the application belongs. You can specify only one namespace ID each time you call this operation."
          },
          "Required": true
        },
        "Rules": {
          "AssociationPropertyMetadata": {
            "Parameters": {
              "Path": {
                "Type": "String",
                "Description": {
                  "en": "The request path."
                },
                "Required": true
              },
              "BackendProtocol": {
                "Type": "String",
                "Description": {
                  "en": "The protocol of the application."
                },
                "AllowedValues": [
                  "http",
                  "https",
                  "grpc"
                ],
                "Required": false
              },
              "AppId": {
                "Type": "String",
                "Description": {
                  "en": "The application ID"
                },
                "Required": true
              },
              "RewritePath": {
                "Type": "String",
                "Description": {
                  "en": "The rewrite path."
                },
                "Required": false
              },
              "ContainerPort": {
                "Type": "Number",
                "Description": {
                  "en": "The container port of the application."
                },
                "Required": true,
                "MinValue": 0,
                "MaxValue": 65535
              },
              "Domain": {
                "Type": "String",
                "Description": {
                  "en": "The domain name."
                },
                "Required": true
              }
            }
          },
          "AssociationProperty": "List[Parameters]",
          "Type": "Json",
          "Description": {
            "en": "The forwarding rules. You can specify a port and an application in a forwarding rule to forward traffic based on the specified domain name and request path."
          },
          "Required": true,
          "MinLength": 1,
          "MaxLength": 10
        }
      },
      "Resources": {
        "Ingress": {
          "Type": "ALIYUN::SAE::Ingress",
          "Properties": {
            "DefaultRule": {
              "Ref": "DefaultRule"
            },
            "SlbId": {
              "Ref": "SlbId"
            },
            "ListenerPort": {
              "Ref": "ListenerPort"
            },
            "Description": {
              "Ref": "Description"
            },
            "NamespaceId": {
              "Ref": "NamespaceId"
            },
            "Rules": {
              "Ref": "Rules"
            }
          }
        }
      },
      "Outputs": {
        "IngressId": {
          "Description": "The ID of the routing rule.",
          "Value": {
            "Fn::GetAtt": [
              "Ingress",
              "IngressId"
            ]
          }
        }
      }
    }