Skip to content

Commit

Permalink
Adding flags to known flags.
Browse files Browse the repository at this point in the history
  • Loading branch information
Q-Lee committed Mar 11, 2016
1 parent 1656912 commit ef6a292
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
22 changes: 11 additions & 11 deletions addon-resizer/nanny/main/pod_nanny.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,24 +30,24 @@ import (
"k8s.io/kubernetes/pkg/client/restclient"
)

const NoValue = "MISSING"
const noValue = "MISSING"

var (
// Flags to define the resource requirements.
baseCPU = flag.String("cpu", NoValue, "The base CPU resource requirement.")
cpuPerNode = flag.String("extra_cpu", "0", "The amount of CPU to add per node.")
baseMemory = flag.String("memory", NoValue, "The base memory resource requirement.")
memoryPerNode = flag.String("extra_memory", "0Mi", "The amount of memory to add per node.")
baseStorage = flag.String("storage", NoValue, "The base storage resource requirement.")
storagePerNode = flag.String("extra_storage", "0Gi", "The amount of storage to add per node.")
baseCPU = flag.String("cpu", noValue, "The base CPU resource requirement.")
cpuPerNode = flag.String("extra-cpu", "0", "The amount of CPU to add per node.")
baseMemory = flag.String("memory", noValue, "The base memory resource requirement.")
memoryPerNode = flag.String("extra-memory", "0Mi", "The amount of memory to add per node.")
baseStorage = flag.String("storage", noValue, "The base storage resource requirement.")
storagePerNode = flag.String("extra-storage", "0Gi", "The amount of storage to add per node.")
threshold = flag.Int("threshold", 0, "A number between 0-100. The dependent's resources are rewritten when they deviate from expected by more than threshold.")
// Flags to identify the container to nanny.
podNamespace = flag.String("namespace", os.Getenv("MY_POD_NAMESPACE"), "The namespace of the ward. This defaults to the nanny pod's own namespace.")
deployment = flag.String("deployment", "", "The name of the deployment being monitored. This is required.")
podName = flag.String("pod", os.Getenv("MY_POD_NAME"), "The name of the pod to watch. This defaults to the nanny's own pod.")
containerName = flag.String("container", "pod-nanny", "The name of the container to watch. This defaults to the nanny itself.")
// Flags to control runtime behavior.
pollPeriod = time.Millisecond * time.Duration(*flag.Int("poll_period", 10000, "The time, in milliseconds, to poll the dependent container."))
pollPeriod = time.Millisecond * time.Duration(*flag.Int("poll-period", 10000, "The time, in milliseconds, to poll the dependent container."))
)

func main() {
Expand Down Expand Up @@ -82,23 +82,23 @@ func main() {
var resources []nanny.Resource

// Monitor only the resources specified.
if *baseCPU != NoValue {
if *baseCPU != noValue {
resources = append(resources, nanny.Resource{
Base: resource.MustParse(*baseCPU),
ExtraPerNode: resource.MustParse(*cpuPerNode),
Name: "cpu",
})
}

if *baseMemory != NoValue {
if *baseMemory != noValue {
resources = append(resources, nanny.Resource{
Base: resource.MustParse(*baseMemory),
ExtraPerNode: resource.MustParse(*memoryPerNode),
Name: "memory",
})
}

if *baseStorage != NoValue {
if *baseStorage != noValue {
resources = append(resources, nanny.Resource{
Base: resource.MustParse(*baseStorage),
ExtraPerNode: resource.MustParse(*memoryPerNode),
Expand Down
3 changes: 3 additions & 0 deletions hack/verify-flags/known-flags.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ error-page
etcd-prefix
etcd-server
etcd-servers
extra-cpu
extra-memory
extra-storage
forward-services
generated-files-config
health-check-path
Expand Down

0 comments on commit ef6a292

Please sign in to comment.