Skip to content

Instantly share code, notes, and snippets.

@dougbtv
Created March 23, 2022 20:26
Show Gist options
  • Save dougbtv/b84c5dec4953f4b85048d16ddcf72c15 to your computer and use it in GitHub Desktop.
Save dougbtv/b84c5dec4953f4b85048d16ddcf72c15 to your computer and use it in GitHub Desktop.
Verifying that Whereabouts ip-reconciler includes the -timeout flag

First, change the the openshift-multus namespace

oc project openshift-multus

Go ahead and make a modified cronjob that's based on the existing one

This edits the yaml and adds a line for a -timeout flag.

oc get cronjob ip-reconciler -o yaml | grep -vP "creationTimestamp|\- apiVersion|ownerReferences|blockOwnerDeletion|controller|kind\: Network|name\: cluster|uid\:|resourceVersion" | sed 's/name: ip-reconciler/name: test-reconciler/' | sed '/            - -log-level=verbose/a \ \ \ \ \ \ \ \ \ \ \ \ - -timeout=invalid' > /tmp/reconcile.yml

Then create this additional cronjob from the generated file

oc create -f /tmp/reconcile.yml

Now, kick off an instance of this cronjob

oc create job --from=cronjob/test-reconciler -n openshift-multus testrun-ip-reconciler

Now list the testrun job

oc get pods | grep testrun

This pod should be erroring out and the error message should look like:

$ oc get pods | grep testrun
testrun-ip-reconciler-28mfg           0/1     Error     0          13s

$ oc logs testrun-ip-reconciler-28mfg
invalid value "invalid" for flag -timeout: parse error
Usage of /ip-reconciler:
  -kubeconfig string
      the path to the Kubernetes configuration file
  -log-level ip-reconciler
      the logging level for the ip-reconciler app. Valid values are: "debug", "verbose", "error", and "panic". (default "error")
  -timeout int
      the value for a request timeout in seconds. (default 30)

We want to see the error in this case. This lets us know that it's read the flag that we're looking for.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment