Commit 8a43bd62 authored by Saad Ali's avatar Saad Ali

Merge pull request #12745 from eparis/even-less-dash-false-positive

verify-flags-underscore.py: Even fewer dash false positives
parents 49a569a4 ca310ffd
......@@ -30,7 +30,7 @@
# Unless given a specific directive, disable registration for the kubelet
# running on the master.
{% if grains.kubelet_api_servers is defined -%}
{% set api_servers_with_port = "--api_servers=https://" + grains.kubelet_api_servers -%}
{% set api_servers_with_port = "--api-servers=https://" + grains.kubelet_api_servers -%}
{% else -%}
{% set api_servers_with_port = "" -%}
{% endif -%}
......
......@@ -34,13 +34,13 @@ In this case, if there are problems launching a replacement scheduler process th
##### Command Line Arguments
- `--ha` is required to enable scheduler HA and multi-scheduler leader election.
- `--km_path` or else (`--executor_path` and `--proxy_path`) should reference non-local-file URI's and must be identical across schedulers.
- `--km-path` or else (`--executor-path` and `--proxy-path`) should reference non-local-file URI's and must be identical across schedulers.
If you have HDFS installed on your slaves then you can specify HDFS URI locations for the binaries:
```shell
$ hdfs dfs -put -f bin/km hdfs:///km
$ ./bin/km scheduler ... --mesos_master=zk://zk1:2181,zk2:2181/mesos --ha --km_path=hdfs:///km
$ ./bin/km scheduler ... --mesos-master=zk://zk1:2181,zk2:2181/mesos --ha --km-path=hdfs:///km
```
**IMPORTANT:** some command line parameters specified for the scheduler process are passed to the Kubelet-executor and so are subject to compatibility tests:
......@@ -54,11 +54,11 @@ The command line parameters that affect the hash calculation are listed below.
- `--allow-privileged`
- `--api-servers`
- `--auth_path`
- `--auth-path`
- `--cluster_*`
- `--executor_*`
- `--kubelet_*`
- `--km_path`
- `--km-path`
- `--profiling`
- `--proxy_path`
......
......@@ -79,7 +79,7 @@ support all the features you expect.
## How do I turn on an admission control plug-in?
The Kubernetes API server supports a flag, `admission_control` that takes a comma-delimited,
The Kubernetes API server supports a flag, `admission-control` that takes a comma-delimited,
ordered list of admission control choices to invoke prior to modifying objects in the cluster.
## What does each plug-in do?
......
......@@ -134,7 +134,7 @@ Update your PATH to more easily run the Kubernetes-Mesos binaries:
export PATH="$(pwd)/_output/local/go/bin:$PATH"
```
Identify your Mesos master: depending on your Mesos installation this is either a `host:port` like `mesos_master:5050` or a ZooKeeper URL like `zk://zookeeper:2181/mesos`.
Identify your Mesos master: depending on your Mesos installation this is either a `host:port` like `mesos-master:5050` or a ZooKeeper URL like `zk://zookeeper:2181/mesos`.
In order to let Kubernetes survive Mesos master changes, the ZooKeeper URL is recommended for production environments.
```bash
......@@ -210,7 +210,7 @@ kubernetes component=apiserver,provider=kubernetes <none> 10.10.10.1
```
Lastly, look for Kubernetes in the Mesos web GUI by pointing your browser to
`http://<mesos_master_ip:port>`. Make sure you have an active VPN connection.
`http://<mesos-master-ip:port>`. Make sure you have an active VPN connection.
Go to the Frameworks tab, and look for an active framework named "Kubernetes".
## Spin up a pod
......
......@@ -95,8 +95,23 @@ def normalize_files(rootdir, files):
def line_has_bad_flag(line, flagre):
results = flagre.findall(line)
for result in results:
if "_" in result:
return True
if not "_" in result:
return False
# this should exclude many cases where jinja2 templates use kube flags
# as variables, except it uses _ for the variable name
if "{% set" + result + "= \"" in line:
return False
if "pillar[" + result + "]" in line:
return False
if "grains" + result in line:
return False
# These are usually yaml definitions
if result.endswith(":"):
return False
# something common in juju variables...
if "template_data[" + result + "]" in line:
return False
return True
return False
# The list of files might not be the whole repo. If someone only changed a
......@@ -148,10 +163,12 @@ def get_flags(rootdir, files):
if len(new_excluded_flags) != 0:
print("Found a flag declared with an _ but which is not explicitly listed as a valid flag name in hack/verify-flags/excluded-flags.txt")
print("Are you certain this flag should not have been declared with an - instead?")
new_excluded_flags.sort()
print("%s" % "\n".join(new_excluded_flags))
sys.exit(1)
if len(new_flags) != 0:
print("Found flags in golang files not in the list of known flags. Please add these to hack/verify-flags/known-flags.txt")
new_flags.sort()
print("%s" % "\n".join(new_flags))
sys.exit(1)
return list(flags)
......@@ -164,7 +181,7 @@ def flags_to_re(flags):
# turn all flag names into regexs which will find both types
newre = dashRE.sub('[-_]', flag)
# only match if there is not a leading or trailing alphanumeric character
flagREs.append("[^\w]" + newre + "[^\w]")
flagREs.append("[^\w${]" + newre + "[^\w]")
# turn that list of regex strings into a single large RE
flagRE = "|".join(flagREs)
flagRE = re.compile(flagRE)
......@@ -214,7 +231,8 @@ def main():
if len(bad_lines) != 0:
if not args.skip_exceptions:
print("Found illegal 'flag' usage. If this is a false positive add the following line(s) to hack/verify-flags/exceptions.txt:")
print("Found illegal 'flag' usage. If these are false positives you should running `hack/verify-flags-underscore.py -e > hack/verify-flags/exceptions.txt` to update the list.")
bad_lines.sort()
for (relname, line) in bad_lines:
print("%s:%s" % (relname, line))
......
......@@ -9,7 +9,6 @@ gke_context
host_port_endpoints
kubecfg_file
kube_master_url
log_flush_frequency
max_in_flight
max_par
new_file_0644
......
......@@ -125,6 +125,7 @@ kube-master
label-columns
last-release-pr
legacy-userspace-proxy
log-flush-frequency
long-running-request-regexp
low-diskspace-threshold-mb
manifest-url
......
......@@ -25,8 +25,7 @@ import (
"github.com/spf13/pflag"
)
// Uses _ instead of - to better align with glog flags.
var logFlushFreq = pflag.Duration("log_flush_frequency", 5*time.Second, "Maximum number of seconds between log flushes")
var logFlushFreq = pflag.Duration("log-flush-frequency", 5*time.Second, "Maximum number of seconds between log flushes")
// TODO(thockin): This is temporary until we agree on log dirs and put those into each cmd.
func init() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment