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
- Basic structure | |
- oc <verb> <noun> [name] | |
- There are some exceptions, like `oc help` or `oc logs <pod>` or `oc exec` | |
- Most commands support `oc <command> --help` | |
- Common resources (nouns) | |
- Pods | |
- Deployments | |
- Services | |
- Routes | |
- ConfigMaps |
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
from elasticsearch import Elasticsearch | |
from elasticsearch import helpers | |
class ESmanager(): | |
def __init__(self, host, port): | |
self._host = host | |
self._port = port | |
self.__elasticsearch = Elasticsearch([{'host': self._host, 'port': self._port}]) | |
self._connectES() |
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
import json | |
import sys | |
from time import sleep | |
from datetime import datetime | |
from elasticsearch import Elasticsearch, helpers | |
es = Elasticsearch("localhost:9200") | |
def create_index(index): | |
es.indices.create(index=index, ignore=400) |
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
import bitdotio | |
import pandas as pd | |
# This is to provide a reproducible csv, | |
# you can ignore and use your own csv | |
df_test = pd.DataFrame( | |
data=[[0, 1, 2], [3, 4, 5]], | |
columns=['a', 'b', 'c']) | |
df_test.to_csv('test.csv', index=False) |
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
#!/bin/bash | |
# set -x | |
echo "INFO: start putting the cluster into an imbalanced state" | |
# target workloads to rebalance | |
TARGET_PODS="alertmanager-main|prometheus-k8s|prometheus-adapter|splunkforwarder-deployment" | |
# check all the target pods on each infra node | |
for NODE in $(oc get node -l node-role.kubernetes.io/infra= --no-headers | awk '{print $1}'); do |
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
#!/usr/bin/env bash | |
# Versoin one | |
oc get $(oc api-resources --namspaced=true | tail -n+2 | awk '{ print $1 }' | xargs | sed -e 's/\s/,/g') | |
# Version two (from https://access.redhat.com/solutions/4165791) | |
oc api-resources --verbs=list --namespaced -o name | xargs -n 1 oc get --show-kind --ignore-not-found -n $PROJECT_NAME |
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
### Step 1 | |
oc delete pod <podsname> -n myproject --grace-period=0 --force | |
### Step 2 | |
oc edit pod <podsname> | |
#Remove deletionTimestamp | |
#Before: deletionTimestamp: 2019-12-31T11:40:28Z | |
#After: deletionTimestamp: null | |
#Remove Finalizers | |
#Before |
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
curl -k "https://basic-ocp-demo-basic-ocp-demo-project.apps.cluster1.example.com/healthz" | |
# or build the curl URL programmatically! | |
curl -k "https://$(oc get route basic-ocp-demo -o jsonpath="{.spec.host}")/healthz" |