Skip to content

Conversation

ewolinetz
Copy link
Contributor

@ewolinetz ewolinetz commented Mar 18, 2021

Description

In anticipation for the ability to store json in Elasticsearch, we need to be able to rollover and delete any json specific write alias based on the policy for either app, infra, or audit (json indices/aliases will follow the pattern <app|infra|audit>-<json-schema-name>-<write|xxxxxx>)

Also cleaned up output of the delete and rollover scripts for ease of use:

========================
Index management delete process starting for infra-json

deleting indices: infra-json-000055
Done!
========================
Index management delete process starting for infra

deleting indices: infra-000074
Done!
========================
Index management rollover process starting for infra-json

Current write index for infra-json-write: infra-json-000057
Checking results from _rollover call
Next write index for infra-json-write: infra-json-000057
Checking if infra-json-000057 exists
Checking if infra-json-000057 is the write index for infra-json-write
Done!
========================
Index management rollover process starting for infra

Current write index for infra-write: infra-000076
Checking results from _rollover call
Next write index for infra-write: infra-000076
Checking if infra-000076 exists
Checking if infra-000076 is the write index for infra-write
Done!

========================
Index management delete process starting for infra-json

No indices to delete
========================
Index management delete process starting for infra

No indices to delete
========================
Index management rollover process starting for infra-json

Current write index for infra-json-write: infra-json-000037
Checking results from _rollover call
Next write index for infra-json-write: infra-json-000037
Checking if infra-json-000037 exists
Checking if infra-json-000037 is the write index for infra-json-write
Done!
========================
Index management rollover process starting for infra

Current write index for infra-write: infra-000056
Checking results from _rollover call
Next write index for infra-write: infra-000056
Checking if infra-000056 exists
Checking if infra-000056 is the write index for infra-write
Done!

/cc @blockloop @periklis

Links

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 18, 2021
@blockloop
Copy link
Contributor

blockloop commented Mar 19, 2021

I think you can eliminate a lot of the copy/pasta if you create a curl function
that calls the ES service with curl with all of the standard flags like this:

function httpES() {
	url="${1}"
	shift
	curl -s "$ES_SERVICE/${1}" \
	    --cacert /etc/indexmanagement/keys/admin-ca \
	    --connect-timeout "${CONNECT_TIMEOUT}" \
	    -H"Authorization: Bearer $(cat /var/run/secrets/kubernetes.io/serviceaccount/token)" \
	    -HContent-Type:application/json \
	    --retry 5 \
	    --retry-delay 5 "$@"
}

function delete() {
	httpES /my/url/here --extra-curl-flag=asdf --another-curl-flag=1234
}

@ewolinetz
Copy link
Contributor Author

/retest

Copy link
Contributor

@blockloop blockloop left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Mar 24, 2021
@openshift-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: blockloop, ewolinetz

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-robot openshift-merge-robot merged commit 0b9d1b2 into openshift:master Mar 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants