Skip to content

Commit becf5b5

Browse files
Kubernetes support commands update (#1133)
1) Upgrade Feature commands in both config & show to adopt the kube updates 2) kube join/reset upgraded to call kube_label command to add/remove label, which would trigger join/reset 3) few minor updates in kube code. New/update to commands. `sudo config feature owner <kube/local>` To update owner `sudo config feature fallback <on/off>` To enable/disable fallback `show feature status` Shows the status of the feature. Extended to include kube-support related fields `show feature config` New command to show the current config info `show kube server` Extended to show config & status of server
1 parent aad2c38 commit becf5b5

File tree

11 files changed

+834
-404
lines changed

11 files changed

+834
-404
lines changed

config/feature.py

+32
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,38 @@ def feature():
1111
"""Configure features"""
1212
pass
1313

14+
def _update_field(db, name, fld, val):
15+
tbl = db.cfgdb.get_table('FEATURE')
16+
if name not in tbl:
17+
click.echo("Unable to retrieve {} from FEATURE table".format(name))
18+
sys.exit(1)
19+
db.cfgdb.mod_entry('FEATURE', name, { fld: val })
20+
21+
22+
#
23+
# 'owner' command ('config feature owner ...')
24+
#
25+
@feature.command('owner', short_help="set owner for a feature")
26+
@click.argument('name', metavar='<feature-name>', required=True)
27+
@click.argument('owner', metavar='<owner>', required=True, type=click.Choice(["local", "kube"]))
28+
@pass_db
29+
def feature_owner(db, name, owner):
30+
"""Set owner for the feature"""
31+
_update_field(db, name, "set_owner", owner)
32+
33+
34+
#
35+
# 'fallback' command ('config feature fallback ...')
36+
#
37+
@feature.command('fallback', short_help="set fallback for a feature")
38+
@click.argument('name', metavar='<feature-name>', required=True)
39+
@click.argument('fallback', metavar='<fallback>', required=True, type=click.Choice(["on", "off"]))
40+
@pass_db
41+
def feature_fallback(db, name, fallback):
42+
"""Set fallback for the feature"""
43+
_update_field(db, name, "no_fallback_to_local", "false" if fallback == "on" else "true")
44+
45+
1446
#
1547
# 'state' command ('config feature state ...')
1648
#

0 commit comments

Comments
 (0)