-
Notifications
You must be signed in to change notification settings - Fork 127
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Extended support for customizing whereabouts ip-reconciler cron schedule #392
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -70,6 +70,19 @@ rules: | |
- patch | ||
- update | ||
- get | ||
|
||
--- | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: cron-scheduler-configmap | ||
namespace: kube-system | ||
annotations: | ||
kubernetes.io/description: | | ||
Configmap containing user customizable cronjob schedule | ||
data: | ||
reconciler_cron_file: "30 4 * * *" # Default schedule is once per day at 4:30am. Users may configure this value to their liking. | ||
|
||
--- | ||
apiVersion: apps/v1 | ||
kind: DaemonSet | ||
|
@@ -130,10 +143,16 @@ spec: | |
mountPath: /host/opt/cni/bin | ||
- name: cni-net-dir | ||
mountPath: /host/etc/cni/net.d | ||
- name: cron-scheduler-configmap | ||
mountPath: /cron-schedule | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. wrong indentation. I guess this is why the daemonset does not start in e2e tests |
||
volumes: | ||
- name: cnibin | ||
hostPath: | ||
path: /opt/cni/bin | ||
- name: cni-net-dir | ||
hostPath: | ||
path: /etc/cni/net.d | ||
- name: cron-scheduler-configmap | ||
configMap: | ||
name: "cron-scheduler-configmap" | ||
defaultMode: 0744 |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -134,16 +134,33 @@ spec: | |
|
||
You'll note that in the `ipam` section there's a lot less parameters than are used in the previous examples. | ||
|
||
### Reconciler Cron Expression Configuration (optional) | ||
## Reconciler Cron Expression configuration for clusters via flatfile (optional) | ||
|
||
You may want to provide a cron expression to configure how frequently the ip-reconciler runs. This is done via the flatfile. | ||
*NOTE: configuring cron expression prior to cluster launch will only work for **non-Openshift** Kubernetes clusters, such as a vanilla Kubernetes cluster. Skip to the next section if you have an Openshift cluster or a cluster that has already launched.* | ||
|
||
Yuki~ do we even need to support configuring via flatfile? Leaving it for now, but hey, food for thought. | ||
|
||
You may want to provide a cron expression to configure how frequently the ip-reconciler runs. For clusters that have not yet been launched, this can be configured via the flatfile. | ||
|
||
You can speficy the `WHEREABOUTS_RECONCILER_CRON` environment variable in your daemonset definition file to override the default cron expression: | ||
```yaml | ||
env: | ||
- name: WHEREABOUTS_RECONCILER_CRON | ||
value: 30 * * * * | ||
``` | ||
|
||
## Reconciler Cron Expression Configuration for live clusters via configmap (optional) | ||
|
||
Yuki~ README: this section may belong in the CNO since the steps outlined are not technically part of whereabouts. I'm not sure, and suggestions are welcome. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. let's remove this line. |
||
|
||
You may want to provide a cron expression to configure how frequently the ip-reconciler runs. For **Openshift** Kubernetes clusters, this is done via updating the cron-scheduler-configmap. | ||
|
||
You can check that the cron-scheduler-configmap is present by running `oc get configmaps` in the openshift-multus namespace. | ||
|
||
To update the cron-scheduler-configmap, run `oc edit configmap cron-scheduler-configmap` and adjust the value to a valid cron expression of your liking. Shortly after, the reconciler schedule will update. | ||
|
||
If you are using a non-Openshift cluster, you can do the same steps, but you will need to look for the configmap in the kube-system namespace. | ||
|
||
## Installing etcd. (optional) | ||
|
||
etcd installation is optional. By default, we recommend the custom resource backend (given in the first example configuration). | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,7 +19,7 @@ WHEREABOUTS_RECONCILER_CRON=${WHEREABOUTS_RECONCILER_CRON:-30 4 * * *} | |
|
||
mkdir -p $CNI_CONF_DIR/whereabouts.d | ||
WHEREABOUTS_KUBECONFIG=$CNI_CONF_DIR/whereabouts.d/whereabouts.kubeconfig | ||
WHEREABOUTS_FLATFILE=$CNI_CONF_DIR/whereabouts.d/whereabouts.conf | ||
WHEREABOUTS_FLATFILE=$CNI_CONF_DIR/whereabouts.d/whereabouts.conf # Yuki~ Nikhil's note: imo we should remove "flatfile" from whereabouts vocabulary and call this "WHEREABOUTS_CONF_FILE" instead. Flatfile may be the format but it's confusing naming. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. +1 on the naming. |
||
WHEREABOUTS_KUBECONFIG_LITERAL=$(echo "$WHEREABOUTS_KUBECONFIG" | sed -e s'|/host||') | ||
|
||
# ------------------------------- Generate a "kube-config" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hm, I think you still need to react to updates to the cron expression; meaning, this will only occur when the process starts.
Either you use an higher lib - like fsnotify - or implement something like that using a goroutine that checks if the file's contents have changed, and if so, restart the scheduler.
I guess even exiting the process could be good enough (but worse than reloading the config), since the pod would restart.