Skip to content

Instantly share code, notes, and snippets.

View lukas-vlcek's full-sized avatar

Lukáš Vlček lukas-vlcek

View GitHub Profile
@lukas-vlcek
lukas-vlcek / How-To.md
Created February 10, 2023 16:27
Run testing OpenSearch cluster with a core plugin

The run task

OpenSearch has a built in gradle task run to spin up a testcluster.

This is a very useful feature for plugin authors expecially if they use the plugin template (which defines its own modification of run task). It gives author easy way how to spin up a new testcluster with their plugin deployed.

However, when it comes to "core" plugins (that is plugins in plugins folder) then the run task does not seem to be setup correctly to spin up a clus

oc exec <es_pod> -c elasticsearch -- es_util --query=_cluster/settings?flat_settings=true -X PUT -d \
'{
"transient": {
"logger": {
"org.elasticsearch.ingest.openshift": "TRACE",
"org.elasticsearch.action": "DEBUG"
}
}
}'
{
"aliases": {
".all": {
}
},
"index_patterns": [
"app*"
],
"mappings": {
@lukas-vlcek
lukas-vlcek / gist:a61aea97ebe4c2bf22651c3694e76c71
Last active August 9, 2019 12:03
Dots in fields problem when upgrading from ES2 to ES5
# Start fresh ES 2.4.6 with dots in field names enabled
$ ES_JAVA_OPTS="-Dmapper.allow_dots_in_name=true" ./bin/elasticsearch
# Index two documents with conflisting mappings (conflisting from the ES5 perspective)
# See: https://www.elastic.co/guide/en/elasticsearch/reference/2.4/dots-in-names.html#_upgrading_fields_with_dots_to_5_x
$ curl -X POST localhost:9200/test/type -d '{"foo.bar":1}'
{"_index":"test","_type":"type","_id":"AWx2N0zkYS6E_SuIWEKX","_version":1,"_shards":{"total":2,"successful":1,"failed":0},"created":true}
$ curl -X POST localhost:9200/test/type2 -d '{"foo":1}'
@lukas-vlcek
lukas-vlcek / gist:f659ad6157e185d6d869770fc660bccd
Created June 24, 2019 13:55
Example of "oc describe <pod>"
$ oc describe po ruby-ex-1-r72kx
Name: ruby-ex-1-r72kx
Namespace: lvlcek
Priority: 0
PriorityClassName: <none>
Node: ip-10-0-155-48.us-east-2.compute.internal/10.0.155.48
Start Time: Mon, 24 Jun 2019 14:58:56 +0200
Labels: app=ruby-ex
deployment=ruby-ex-1
deploymentconfig=ruby-ex
@lukas-vlcek
lukas-vlcek / gist:7a19dd6e66e3366e869114c58223e771
Last active January 22, 2019 13:29
5.x release tags of Prometheus ES plugin
Tag Correct hash Wrong hash Should have been Note
master, 5.x master, 5.x 5.x
5.6.14.0 0d0b738 c5794ed
5.6.13.1 1c24705 15d9cb3
5.6.13.0 9367988 2dafc5e
5.6.12.0 f50587e ce171c7
5.6.11.0 a4a149f 112bb35
5.6.10.0 89f9cb2 a08fdbf
5.6.9.1 ab155c7 27b1f30
$ gradle clean
FAILURE: Build failed with an exception.
* What went wrong:
A problem occurred configuring root project 'prometheus-exporter'.
> Could not resolve all artifacts for configuration ':classpath'.
> Could not download build-tools.jar (org.elasticsearch.gradle:build-tools:6.5.3)
> Could not get resource 'https://repo.maven.apache.org/maven2/org/elasticsearch/gradle/build-tools/6.5.3/build-tools-6.5.3.jar'.
> Could not GET 'https://repo.maven.apache.org/maven2/org/elasticsearch/gradle/build-tools/6.5.3/build-tools-6.5.3.jar'. Received status code 403 from server: Forbidden
$ uname -a
Darwin Lukass-MacBook-Pro-2.local 17.6.0 Darwin Kernel Version 17.6.0: Tue May 8 15:22:16 PDT 2018; root:xnu-4570.61.1~1/RELEASE_X86_64 x86_64
$ git remote -v
origin https://github.com/kubernetes-monitoring/kubernetes-mixin.git (fetch)
origin https://github.com/kubernetes-monitoring/kubernetes-mixin.git (push)
$ git status
On branch master
Your branch is up to date with 'origin/master'.
@lukas-vlcek
lukas-vlcek / gist:376be10b65e1491271bafa9c688a2b25
Last active June 14, 2018 11:31
kubernetes-mixin on Fedora
$ uname -a
Linux dhcp-2-178.brq.redhat.com 4.15.17-200.fc26.x86_64 #1 SMP Thu Apr 12 18:28:26 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
$ git remote -v
origin https://github.com/kubernetes-monitoring/kubernetes-mixin.git (fetch)
origin https://github.com/kubernetes-monitoring/kubernetes-mixin.git (push)
$ git status
On branch master
Your branch is up-to-date with 'origin/master'.
[lvlcek@dhcp-2-178 test-deploy]$ make WHAT=lvlcek sh
cd "gcp-dev"/ && ../../bin/ansible.sh
Activated service account credentials for: [aos-serviceaccount@openshift-gce-devel.iam.gserviceaccount.com]
bash-4.2$ pwd
/usr/share/ansible/openshift-ansible
bash-4.2$ ansible-playbook -i inventory playbooks/openshift-grafana/config.yml
[WARNING]: * Failed to parse /usr/share/ansible/openshift-ansible/inventory/dynamic/gcp/hosts.py with script plugin: Inventory script (/usr/share/ansible/openshift-
ansible/inventory/dynamic/gcp/hosts.py) had an execution error: Traceback (most recent call last): File "/usr/share/ansible/openshift-