Skip to content

Instantly share code, notes, and snippets.

View miminar's full-sized avatar

Michal Minář miminar

  • ETH Zürich
  • Switzerland
  • 10:59 (UTC +02:00)
View GitHub Profile
@miminar
miminar / hd-set-state.sh
Created February 1, 2022 13:27
Manipulate SAP DI HelmDeployment's state
#!/usr/bin/env bash
set -euo pipefail
scriptName="$(basename "${BASH_SOURCE[0]}")"
usage="$scriptName [options] NAME STATE
Switch state of HelmDeployment/NAME to the STATE. Allowed state values are \"deployed\" and
\"failed\".
@miminar
miminar / README.md
Last active November 11, 2021 17:19
PoC for Single Node OpenShift plus Worker
@miminar
miminar / README.md
Created September 23, 2020 13:21
Remove network.openshift.io/mtu-too-small taint from nodes

Remove network.openshift.io/mtu-too-small taint from nodes

The pod monitors nodes and removes network.openshift.io/mtu-too-small taint whenever openshift-sdn pod taints the node with network.openshift.io/mtu-too-small

See https://bugzilla.redhat.com/show_bug.cgi?id=1879077 for more details.

Usage

oc new-project infra

oc create -f sa.yaml

@miminar
miminar / awsmkmachineset.sh
Last active March 24, 2020 10:17
OCP 4 create a new machineset in AWS based on existing.
#!/usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'
AWS_INSTANCE_TYPE="p2.xlarge"
REPLICAS=1
DRY_RUN=0
USAGE="$(basename "${BASH_SOURCE[0]}") [options]
@miminar
miminar / README.md
Last active March 17, 2020 15:04
AWS Metadata Proxy
@miminar
miminar / README.md
Last active May 22, 2020 06:38
Wrong HOME directory in /etc/passwd on OCP 4.2

Wrong HOME directory in /etc/passwd on OCP 4.2

Update on 22.5.2020: cannot reproduce anymore on vSphere with OCP 4.2 of version:

oc version
Client Version: openshift-clients-4.2.24-202003130432
Server Version: 4.2.33
Kubernetes Version: v1.14.6-152-g117ba1f

Cri-o on OCP 4.2 does not respect HOME environment directory set on image. It creates /etc/passwd in a container with / as HOME directory for the running user.

@miminar
miminar / main.tf
Created January 17, 2020 10:59
Terraform AWS example
provider "aws" {
region = "us-east-1"
}
data "aws_ami" "rhel8" {
most_recent = true
filter {
name = "name"
values = ["rhel8-fips-dev"]
@miminar
miminar / local-pv-7b884bb4.yaml
Last active January 16, 2020 13:27
LSO PVC pending when beta sc annotation used
apiVersion: v1
kind: PersistentVolume
metadata:
annotations:
pv.kubernetes.io/provisioned-by: local-volume-provisioner-sdh-worker2-08169257-217d-11ea-a062-005056123203
creationTimestamp: "2020-01-16T11:05:23Z"
finalizers:
- kubernetes.io/pv-protection
labels:
storage.openshift.com/local-volume-owner-name: local-disks
@miminar
miminar / README.md
Created March 15, 2019 09:26
OpenShift CLI snippets

Useful snippets for OpenShift

Get a table of pods/scc/owners

Where the owners are determined recursively. Limitation: only parents of replicasets are recursively evaluated.

$ oc get -o json pod  | jq -r '.items[] | . as $i |
        "\(.metadata.name):\(.metadata.annotations["openshift.io/scc"]):"
            + ([.metadata.ownerReferences[] | "\(.kind | ascii_downcase)/\(.name)"] |

join(","))' | while IFS= read -r l; do

@miminar
miminar / README.md
Created February 27, 2019 09:23
OpenShift heketi-cli helper

OpenShift heketi-cli helper

Purpose

To control OCS from inside of heketi-storage container running in an OpenShift cluster.

Prerequisites

  • OCP deployed
  • OCS deployed on top of it (converged or independent mode) ideally using the