forked from sonic-net/sonic-buildimage
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add k8s master table yang model (sonic-net#12331)
* Add k8s master table yang model Signed-off-by: Yun Li <yunli1@microsoft.com>
- Loading branch information
1 parent
094646c
commit 51eac0b
Showing
6 changed files
with
195 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
src/sonic-yang-models/tests/yang_model_tests/tests/kubernetes_master.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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"] | ||
} | ||
} |
74 changes: 74 additions & 0 deletions
74
src/sonic-yang-models/tests/yang_model_tests/tests_config/kubernetes_master.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" | ||
} | ||
} | ||
} | ||
} | ||
} |
62 changes: 62 additions & 0 deletions
62
src/sonic-yang-models/yang-models/sonic-kubernetes_master.yang
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 */ |