Skip to content

Commit

Permalink
Kubernetes support commands update (#1133)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
renukamanavalan authored Dec 21, 2020
1 parent aad2c38 commit becf5b5
Show file tree
Hide file tree
Showing 11 changed files with 834 additions and 404 deletions.
32 changes: 32 additions & 0 deletions config/feature.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,38 @@ def feature():
"""Configure features"""
pass

def _update_field(db, name, fld, val):
tbl = db.cfgdb.get_table('FEATURE')
if name not in tbl:
click.echo("Unable to retrieve {} from FEATURE table".format(name))
sys.exit(1)
db.cfgdb.mod_entry('FEATURE', name, { fld: val })


#
# 'owner' command ('config feature owner ...')
#
@feature.command('owner', short_help="set owner for a feature")
@click.argument('name', metavar='<feature-name>', required=True)
@click.argument('owner', metavar='<owner>', required=True, type=click.Choice(["local", "kube"]))
@pass_db
def feature_owner(db, name, owner):
"""Set owner for the feature"""
_update_field(db, name, "set_owner", owner)


#
# 'fallback' command ('config feature fallback ...')
#
@feature.command('fallback', short_help="set fallback for a feature")
@click.argument('name', metavar='<feature-name>', required=True)
@click.argument('fallback', metavar='<fallback>', required=True, type=click.Choice(["on", "off"]))
@pass_db
def feature_fallback(db, name, fallback):
"""Set fallback for the feature"""
_update_field(db, name, "no_fallback_to_local", "false" if fallback == "on" else "true")


#
# 'state' command ('config feature state ...')
#
Expand Down
Loading

0 comments on commit becf5b5

Please sign in to comment.