-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(job): Add upper limit for forceSearchIndex
- Loading branch information
Showing
2 changed files
with
10 additions
and
7 deletions.
There are no files selected for viewing
7 changes: 6 additions & 1 deletion
7
k8s/jobs/forceSearchIndexFrom.sh → k8s/jobs/forceSearchIndexFromTo.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,22 @@ | ||
|
||
# WBS_FORCE_SEARCH_INDEX_FROM should be set to time to reindex from (exclusive) in YYYY-mm-ddTHH:mm:ssZ format | ||
# WBS_FORCE_SEARCH_INDEX_TO should be set to time to reindex to (exclusive) in YYYY-mm-ddTHH:mm:ssZ format | ||
# WBS_DOMAIN should be set to the domain to reindex | ||
|
||
WBS_FORCE_SEARCH_INDEX_FROM=${WBS_FORCE_SEARCH_INDEX_FROM:-1970-01-01T00:00:00Z} | ||
WBS_FORCE_SEARCH_INDEX_TO=${WBS_FORCE_SEARCH_INDEX_TO:-2042-00-00T00:00:00Z} | ||
|
||
tmp_file=$(mktemp --suffix=.json) | ||
|
||
MW_POD=$(kubectl get pods --field-selector='status.phase=Running' -l app.kubernetes.io/name=mediawiki,app.kubernetes.io/component=app-backend -o jsonpath="{.items[0].metadata.name}") | ||
MW_POD_JSON=$(kubectl get pods $MW_POD -o=json) | ||
echo ${MW_POD_JSON} > $tmp_file | ||
|
||
kubectl create -f forceSearchIndexFrom.yaml -o=json --dry-run=client |\ | ||
kubectl create -f forceSearchIndexFromTo.yaml -o=json --dry-run=client |\ | ||
jq -s ".[0].spec.template.spec.containers[0].image = .[1].spec.containers[0].image" - $tmp_file |\ | ||
jq ".[0].spec.template.spec.containers[0].env = .[1].spec.containers[0].env" |\ | ||
jq ".[0]" |\ | ||
jq ".spec.template.spec.containers[0].env += [{\"name\": \"WBS_DOMAIN\", \"value\": \"${WBS_DOMAIN}\"}]" |\ | ||
jq ".spec.template.spec.containers[0].env += [{\"name\": \"WBS_FORCE_SEARCH_INDEX_FROM\", \"value\": \"${WBS_FORCE_SEARCH_INDEX_FROM}\"}]" |\ | ||
jq ".spec.template.spec.containers[0].env += [{\"name\": \"WBS_FORCE_SEARCH_INDEX_TO\", \"value\": \"${WBS_FORCE_SEARCH_INDEX_TO}\"}]"|\ | ||
kubectl create -f - |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters