Skip to content

Commit

Permalink
Add k8s master table yang model
Browse files Browse the repository at this point in the history
Signed-off-by: Yun Li <yunli1@microsoft.com>
  • Loading branch information
lixiaoyuner committed Oct 10, 2022
1 parent 62692f4 commit c7798f9
Show file tree
Hide file tree
Showing 5 changed files with 137 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/sonic-yang-models/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ def run(self):
'./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',
Expand Down Expand Up @@ -181,6 +182,7 @@ def run(self):
'./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',
Expand Down
8 changes: 8 additions & 0 deletions src/sonic-yang-models/tests/files/sample_config_db.json
Original file line number Diff line number Diff line change
Expand Up @@ -2026,6 +2026,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": {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"KUBERNETES_MASTER_WITH_CORRECT_VALUES": {
"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."
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"KUBERNETES_MASTER_WITH_CORRECT_VALUES": {
"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_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": 10,
"port": "6443",
"disable": "False",
"insecure": "True"
}
}
}
}
}
60 changes: 60 additions & 0 deletions src/sonic-yang-models/yang-models/sonic-kubernetes_master.yang
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
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";
type string;
}

leaf port {
description "Kubernetes api server port";
type inet:port-number;
}

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 */

0 comments on commit c7798f9

Please sign in to comment.