• Alexander Campbell's avatar
    cmd: fix deprecation warning bug · 9e7f29c3
    Alexander Campbell authored
    Some kubectl commands were deprecated but would fail to print the
    correct warning message when a flag was given before the command name.
    
    	# Correctly prints the warning that "resize" is deprecated and
    	# "scale" is now preferred.
    	kubectl scale [...]
    
    	# Should print the same warning but no warning is printed.
    	kubectl --v=1 scale [...]
    
    This was due to a fragile check on os.Args[1].
    
    This commit implements a new function deprecatedCmd() that is used to
    construct new "passthrough" commands which are marked as deprecated and
    hidden.
    
    Note that there is an existing "filters" system that may be preferable
    to the system created in this commit. I'm not sure why the "filters"
    array was not used for all deprecated commands in the first place.
    9e7f29c3
apiversions.go 1.82 KB