Add k8s master table yang model (#12331)

* Add k8s master table yang model

Signed-off-by: Yun Li <yunli1@microsoft.com>
This commit is contained in:
lixiaoyuner 2022-10-17 15:58:09 +08:00 committed by GitHub
parent 094646c6bc
commit 51eac0b335
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 195 additions and 0 deletions

View File

@ -28,6 +28,7 @@ Table of Contents
* [DSCP_TO_TC_MAP](#dscp_to_tc_map)
* [FLEX_COUNTER_TABLE](#flex_counter_table)
* [KDUMP](#kdump)
* [Kubernetes Master](#kubernetes-master)
* [L2 Neighbors](#l2-neighbors)
* [Loopback Interface](#loopback-interface)
* [LOSSLESS_TRAFFIC_PATTERN](#LOSSLESS_TRAFFIC_PATTERN)
@ -936,6 +937,27 @@ instance is supported in SONiC.
```
### Kubernetes Master
Kubernetes Master related configurations are stored in
**KUBERNETES_MASTER** table. These configurations are used mainly
for CTRMGR service. CTRMGR service will interactive with
kubernetes master according to these configurations.
```
{
"KUBERNETES_MASTER": {
"SERVER": {
"disable": "False",
"insecure": "True",
"ip": "k8s.apiserver.com",
"port": "6443"
}
}
}
```
### L2 Neighbors
The L2 neighbor and connection information can be configured in

View File

@ -112,6 +112,7 @@ setup(
'./yang-models/sonic-system-defaults.yang',
'./yang-models/sonic-interface.yang',
'./yang-models/sonic-kdump.yang',
'./yang-models/sonic-kubernetes_master.yang',
'./yang-models/sonic-loopback-interface.yang',
'./yang-models/sonic-lossless-traffic-pattern.yang',
'./yang-models/sonic-mgmt_interface.yang',
@ -185,6 +186,7 @@ setup(
'./cvlyang-models/sonic-system-defaults.yang',
'./cvlyang-models/sonic-interface.yang',
'./cvlyang-models/sonic-kdump.yang',
'./cvlyang-models/sonic-kubernetes_master.yang',
'./cvlyang-models/sonic-loopback-interface.yang',
'./cvlyang-models/sonic-mgmt_interface.yang',
'./cvlyang-models/sonic-mgmt_port.yang',

View File

@ -2062,6 +2062,14 @@
"nexthop": "10.184.229.212",
"nexthop-vrf": "default"
}
},
"KUBERNETES_MASTER": {
"SERVER": {
"disable": "True",
"insecure": "False",
"ip": "kubernetes.apiserver.com",
"port": "6443"
}
}
},
"SAMPLE_CONFIG_DB_UNKNOWN": {

View File

@ -0,0 +1,27 @@
{
"KUBERNETES_MASTER_WITH_CORRECT_VALUES_IP": {
"desc": "CONFIG KUBERNETES_MASTER TABLE WITH ALL THE CORRECT VALUES"
},
"KUBERNETES_MASTER_WITH_CORRECT_VALUES_DNS": {
"desc": "CONFIG KUBERNETES_MASTER TABLE WITH ALL THE CORRECT VALUES"
},
"KUBERNETES_MASTER_WITH_INVALID_BOOLEAN_TYPE" : {
"desc": "Referring invalid kubernetes_master boolean types.",
"eStrKey": "Pattern",
"eStr": ["false|true|False|True"]
},
"KUBERNETES_MASTER_INVALID_PORT": {
"desc": "Configure invalid PORT in kubernetes_master.",
"eStrKey": "InvalidValue"
},
"KUBERNETES_MASTER_INVALID_IP" : {
"desc": "Configure invalid IP in kubernetes_master.",
"eStrKey": "InvalidValue",
"eStr": ["ip"]
},
"KUBERNETES_MASTER_INVALID_DNS" : {
"desc": "Configure invalid DNS in kubernetes_master.",
"eStrKey": "InvalidValue",
"eStr": ["ip"]
}
}

View File

@ -0,0 +1,74 @@
{
"KUBERNETES_MASTER_WITH_CORRECT_VALUES_IP": {
"sonic-kubernetes_master:sonic-kubernetes_master": {
"sonic-kubernetes_master:KUBERNETES_MASTER": {
"sonic-kubernetes_master:SERVER": {
"ip": "192.168.122.11",
"port": "6443",
"disable": "False",
"insecure": "True"
}
}
}
},
"KUBERNETES_MASTER_WITH_CORRECT_VALUES_DNS": {
"sonic-kubernetes_master:sonic-kubernetes_master": {
"sonic-kubernetes_master:KUBERNETES_MASTER": {
"sonic-kubernetes_master:SERVER": {
"ip": "k8s.apiserver.com",
"port": "6443",
"disable": "False",
"insecure": "True"
}
}
}
},
"KUBERNETES_MASTER_WITH_INVALID_BOOLEAN_TYPE": {
"sonic-kubernetes_master:sonic-kubernetes_master": {
"sonic-kubernetes_master:KUBERNETES_MASTER": {
"sonic-kubernetes_master:SERVER": {
"ip": "192.168.122.11",
"port": "6443",
"disable": "FAlse",
"insecure": "True"
}
}
}
},
"KUBERNETES_MASTER_INVALID_PORT": {
"sonic-kubernetes_master:sonic-kubernetes_master": {
"sonic-kubernetes_master:KUBERNETES_MASTER": {
"sonic-kubernetes_master:SERVER": {
"ip": "192.168.122.11",
"port": "65536",
"disable": "False",
"insecure": "True"
}
}
}
},
"KUBERNETES_MASTER_INVALID_IP": {
"sonic-kubernetes_master:sonic-kubernetes_master": {
"sonic-kubernetes_master:KUBERNETES_MASTER": {
"sonic-kubernetes_master:SERVER": {
"ip": "2001:aa:aa:aa",
"port": "6443",
"disable": "False",
"insecure": "True"
}
}
}
},
"KUBERNETES_MASTER_INVALID_DNS": {
"sonic-kubernetes_master:sonic-kubernetes_master": {
"sonic-kubernetes_master:KUBERNETES_MASTER": {
"sonic-kubernetes_master:SERVER": {
"ip": "k8s@.apiserver.com",
"port": "6443",
"disable": "False",
"insecure": "True"
}
}
}
}
}

View File

@ -0,0 +1,62 @@
module sonic-kubernetes_master {
yang-version 1.1;
namespace "http://github.com/Azure/sonic-kubernetes_master";
prefix kubernetes_master;
import ietf-inet-types {
prefix inet;
}
import sonic-types {
prefix stypes;
}
description "KUBERNETES_MASTER YANG Module for SONiC OS";
revision 2022-10-09 {
description "First Revision";
}
container sonic-kubernetes_master {
container KUBERNETES_MASTER {
description "KUBERNETES_MASTER part of config_db.json";
container SERVER {
leaf ip {
description "Kubernetes api server endpoint(an IP address or a DNS
domain name.)";
type inet:host;
}
leaf port {
description "Kubernetes api server port";
type inet:port-number;
default 6443;
}
leaf disable {
description "This configuration identicates whether disable kubernetes";
type stypes:boolean_type;
default "false";
}
leaf insecure {
description "This configuration identicates it will download kubernetes
CA by http other than https";
type stypes:boolean_type;
default "true";
}
}
/* end of container SERVER */
}
/* end of container KUBERNETES_MASTER */
}
/* end of top level container */
}
/* end of module sonic-kubernetes_master */