Skip to content

Instantly share code, notes, and snippets.

View LalatenduMohanty's full-sized avatar

Lalatendu Mohanty LalatenduMohanty

View GitHub Profile
curl --silent --header 'Accept:application/json' 'https://api.openshift.com/api/upgrades_info/v1/graph?arch=amd64&channel=candidate-4.8' | jq '. as $graph | $graph.nodes | map(.version == "4.8.7") | index(true) as $orig | $graph.edges | map(select(.[0] == $orig)[1]) | map($graph.nodes[.])'
[
{
"version": "4.8.28",
"payload": "quay.io/openshift-release-dev/ocp-release@sha256:ba1299680b542e46744307afc7effc15957a20592d88de4651610b52ed8be9a8",
"metadata": {
"io.openshift.upgrades.graph.release.channels": "eus-4.10,candidate-4.8,eus-4.8,fast-4.8,stable-4.8,candidate-4.9,fast-4.9,stable-4.9",
"io.openshift.upgrades.graph.release.manifestref": "sha256:ba1299680b542e46744307afc7effc15957a20592d88de4651610b52ed8be9a8",
"url": "https://access.redhat.com/errata/RHBA-2022:0172"
}
@LalatenduMohanty
LalatenduMohanty / replace-cluster-cvo.sh
Created October 27, 2022 20:30 — forked from petr-muller/replace-cluster-cvo.sh
Hotswap CVO in a running cluster
#!/bin/bash
set -eu
root="$(dirname "${BASH_SOURCE[0]}")/.."
customCvoPullspec=quay.io/petr-muller/cluster-version-operator:"$(git branch --show-current)"
payload="$(oc get -n openshift-cluster-version clusterversion version -o jsonpath='{.status.desired.image}')"
podman pull "$payload"
$ oc get nodes -o yaml
apiVersion: v1
items:
- apiVersion: v1
kind: Node
metadata:
annotations:
csi.volume.kubernetes.io/nodeid: '{"pd.csi.storage.gke.io":"projects/openshift-gce-devel-ci/zones/us-central1-a/instances/ci-ln-sbbj2q2-f76d1-bh8mc-master-0"}'
machine.openshift.io/machine: openshift-machine-api/ci-ln-sbbj2q2-f76d1-bh8mc-master-0
machineconfiguration.openshift.io/currentConfig: rendered-master-d9ead9f63bf2dbd577f8508f4a7df772
I0701 11:41:49.366756 398972 config.go:128] looking for config.json at /home/lmohanty/.docker/config.json
I0701 11:41:49.366850 398972 config.go:136] found valid config.json at /home/lmohanty/.docker/config.json
I0701 11:41:49.367006 398972 round_trippers.go:425] curl -k -v -XGET 'https://quay.io/v2/'
I0701 11:41:49.580915 398972 round_trippers.go:445] GET https://quay.io/v2/ 401 Unauthorized in 213 milliseconds
I0701 11:41:49.580948 398972 round_trippers.go:451] Response Headers:
I0701 11:41:49.580957 398972 round_trippers.go:454] Www-Authenticate: Bearer realm="https://quay.io/v2/auth",service="quay.io"
I0701 11:41:49.580971 398972 round_trippers.go:454] Server: nginx/1.12.1
I0701 11:41:49.580978 398972 round_trippers.go:454] Date: Thu, 01 Jul 2021 15:41:49 GMT
I0701 11:41:49.580987 398972 round_trippers.go:454] Content-Type: text/html; charset=utf-8
I0701 11:41:49.580996 398972 round_trippers.go:454] Content-Length: 4
apiVersion: machineconfiguration.openshift.io/v1
kind: MachineConfigPool
metadata:
creationTimestamp: "2021-06-25T18:32:03Z"
generation: 2
managedFields:
- apiVersion: machineconfiguration.openshift.io/v1
fieldsType: FieldsV1
fieldsV1:
f:spec:
@LalatenduMohanty
LalatenduMohanty / pr.md
Created June 15, 2021 16:14 — forked from piscisaureus/pr.md
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

$ make func-test
Deploying Update Service operator
hack/deploy.sh
namespace/openshift-updateservice created
serviceaccount/updateservice-operator created
clusterrole.rbac.authorization.k8s.io/updateservice-operator created
rolebinding.rbac.authorization.k8s.io/updateservice-operator created
clusterrolebinding.rbac.authorization.k8s.io/updateservice-operator created
service/updateservice-operator-metrics created
2021-04-19T15:00:26.018Z INFO cmd Operator Version: 777fadbe-dirty
2021-04-19T15:00:26.018Z INFO cmd Go Version: go1.15.7
2021-04-19T15:00:26.018Z INFO cmd Go OS/Arch: linux/amd64
I0419 15:00:27.069591 1 request.go:645] Throttling request took 1.036656648s, request: GET:https://172.30.0.1:443/apis/machine.openshift.io/v1beta1?timeout=32s
2021-04-19T15:00:28.438Z INFO controller-runtime.metrics metrics server is starting to listen {"addr": ":8080"}
2021-04-19T15:00:28.438Z INFO cmd Starting the Cmd.
2021-04-19T15:00:28.439Z INFO controller-runtime.manager starting metrics server {"path": "/metrics"}
2021-04-19T15:00:28.439Z INFO controller Starting EventSource {"reconcilerGroup": "updateservice.operator.openshift.io", "reconcilerKind": "UpdateService", "controller": "updateservice", "source": "kind source: /, Kind="}
2021-04-19T15:00:28.539Z INFO controller Starting EventSource {"reconcilerGroup": "updateservice.operator.openshift.io", "reconcilerKind": "UpdateService", "controller": "updateservice", "so
$ oc image mirror -a /home/lmohanty/.test-pull-secret --from-dir=/home/lmohanty/kubeconfigs/mirror 'file://openshift/release:4.4.9*' ${HOST}/openshift4/449 --insecure=true
default-route-openshift-image-registry.apps.ci-ln-ld72j1b-f76d1.origin-ci-int-gce.dev.openshift.com/
openshift4/449
blobs:
file://openshift/release sha256:0fde0c48992fdbf90eb90e2cdd1f91bd03b913f0c512a2e8eaf2d51de4356d
export RELEASE="4.4.9-x86_64"
export PROJECT="mirror-openshift-release-dev"
$ oc adm release mirror -a /home/lmohanty/.test-pull-secret --from "quay.io/openshift-release-dev/ocp-release:${RELEASE}" --to ${HOST}/${PROJECT}/ocp-content --to-release-image ${HOST}/${PROJECT}/ocp-release:${RELEASE} --insecure=true
info: Mirroring 109 images to default-route-openshift-image-registry.apps.ci-ln-gnxs83k-f76d1.origin-ci-int-gce.dev.openshift.com/mirror-openshift-release-dev/ocp-content ...
default-route-openshift-image-registry.apps.ci-ln-gnxs83k-f76d1.origin-ci-int-gce.dev.openshift.com/
mirror-openshift-relea