Skip to content

Commit c68f9f6

Browse files
committed
Issue #4422 - Allow installer to set interval for cluster agent cronjob
Signed-off-by: zhangl <[email protected]>
1 parent 463d88e commit c68f9f6

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

agent-install/agent-install.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ Additional Edge Cluster Variables (in environment or config file):
164164
AGENT_DEPLOYMENT_STATUS_TIMEOUT_SECONDS: Maximum seconds to wait for the agent deployment rollout status to be successful. Default: 300
165165
AGENT_K8S_IMAGE_TAR_FILE: the file name of the edge cluster agent docker image in tar.gz format. Default: \${ARCH}$DEFAULT_AGENT_K8S_IMAGE_TAR_FILE
166166
CRONJOB_AUTO_UPGRADE_K8S_TAR_FILE: the file name of the edge cluster auto-upgrade-cronjob cronjob docker image in tar.gz format. Default: \${ARCH}$DEFAULT_CRONJOB_AUTO_UPGRADE_K8S_TAR_FILE
167+
CRONJOB_INTERVAL: The number of minutes between each cronjob
167168
AGENT_NAMESPACE: The cluster namespace that the agent will be installed in
168169
NAMESPACE_SCOPED: specify this value if the edge cluster agent is namespace-scoped agent
169170
EndOfMessage
@@ -1278,6 +1279,7 @@ function get_all_variables() {
12781279
get_variable USE_EDGE_CLUSTER_REGISTRY 'true'
12791280
get_variable AGENT_DEPLOYMENT_STATUS_TIMEOUT_SECONDS '300'
12801281
get_variable ENABLE_AUTO_UPGRADE_CRONJOB 'true'
1282+
get_variable CRONJOB_INTERVAL '1'
12811283

12821284
local image_arch=$(get_cluster_image_arch)
12831285
check_support "${SUPPORTED_EDGE_CLUSTER_ARCH[*]}" "${image_arch}" 'kubernetes edge cluster architectures'
@@ -4016,7 +4018,7 @@ function prepare_k8s_auto_upgrade_cronjob_file() {
40164018
kubernetes_api="batch/v1"
40174019
fi
40184020

4019-
sed -e "s#__KubernetesApi__#${kubernetes_api}#g" -e "s#__ServiceAccount__#\"${SERVICE_ACCOUNT_NAME}\"#g" -e "s#__AgentNameSpace__#\"${AGENT_NAMESPACE}\"#g" auto-upgrade-cronjob-template.yml > auto-upgrade-cronjob.yml
4021+
sed -e "s#__KubernetesApi__#${kubernetes_api}#g" -e "s#__ServiceAccount__#\"${SERVICE_ACCOUNT_NAME}\"#g" -e "s#__AgentNameSpace__#\"${AGENT_NAMESPACE}\"#g" -e "s#__cronjobInterval__#${CRONJOB_INTERVAL}#g" auto-upgrade-cronjob-template.yml > auto-upgrade-cronjob.yml
40204022
chk $? 'creating auto-upgrade-cronjob.yml'
40214023

40224024
if [[ "$USE_EDGE_CLUSTER_REGISTRY" == "true" ]]; then

agent-install/k8s/auto-upgrade-cronjob-template.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,11 @@ metadata:
77
openhorizon.org/component: agent
88
type: auto-upgrade-cronjob
99
spec:
10-
schedule: '*/1 * * * *'
10+
schedule: '*/__cronjobInterval__ * * * *' # '*/1 * * * *'
1111
concurrencyPolicy: Forbid
1212
failedJobsHistoryLimit: 0
1313
successfulJobsHistoryLimit: 0
14+
startingDeadlineSeconds: 120
1415
jobTemplate:
1516
spec:
1617
backoffLimit: 0

0 commit comments

Comments
 (0)