Skip to content

Instantly share code, notes, and snippets.

View dougbtv's full-sized avatar

Doug Smith dougbtv

View GitHub Profile
@dougbtv
dougbtv / oobabooga_api_query.js
Created April 14, 2023 18:09
Node.js script to query oobabooga via API
const axios = require('axios');
// Server URL
const server = "http://192.168.50.201:5000/api/v1/generate";
// Generation parameters
// Reference: https://huggingface.co/docs/transformers/main_classes/text_generation#transformers.GenerationConfig
const data = {
'prompt': 'recommend a cheese please',
"max_new_tokens": 100,
@dougbtv
dougbtv / install_cni_plugins.yml
Created November 23, 2022 16:49
Install reference CNI plugins daemonset
---
kind: DaemonSet
apiVersion: apps/v1
metadata:
name: multus-additional-cni-plugins
namespace: kube-system
annotations:
kubernetes.io/description: |
This daemon installs and configures auxiliary CNI plugins on each node.
spec:
@dougbtv
dougbtv / README.md
Created August 11, 2021 16:09
Multus: Reference external namespace in openshift

Referring to "global namespaces" using Multus CNI in OpenShift

This demonstrates using a cross-namespace reference in OpenShift to refer to net-attach-defs in the openshift-multus namespace from another namespace.

See the additional pod.yml and net-attach-def.yaml files included in this gist.

Using latest OCP from CI (4.9 master)

@dougbtv
dougbtv / README.md
Created June 24, 2021 15:22
Whereabouts clear IP allocations

Clearing IP allocations manually with Whereabouts

This outlines a process for clearing IP address allocations with Whereabouts manually. This clears all allocations, you could be more surgical about it, however, this is efficient if it's possible.

NOTE I have another procedure somewhere which has fancy bash commands to make this easier, and is fully tested, however, in theory this "should just work" (you've heard that before)

Overview

  1. Stop all pods which use Multus + Whereabouts (if possible)
  2. Clear IP allocations
@dougbtv
dougbtv / README.md
Created May 25, 2021 15:41
Flattening contracts for verification on the Matic blockscout block explorer
@dougbtv
dougbtv / dummy.sh
Created May 14, 2021 15:42
Sample CNI plugin using Bash, for learning and debugging.
#!/usr/bin/env bash
DEBUG=true
# LOGFILE=/tmp/seamless.log
# Outputs errors to stderr
errorlog () {
>&2 echo $1
}
@dougbtv
dougbtv / README.md
Last active December 21, 2022 19:42
Multus runtime config (for IP / mac address)

all-in-one-example

---
apiVersion: "k8s.cni.cncf.io/v1"
kind: NetworkAttachmentDefinition
metadata:
  name: centos-runtimeconfig-def
spec:
  config: '{
@dougbtv
dougbtv / README.md
Created January 21, 2021 18:26
How to setup an average joe user in OpenShift

First, type the Konami code into your terminal, then...

Create a user, then create a password for the user...

oc create user doug
htpasswd -c -B -b /tmp/doughtpass doug s00persecret

Create an ident yaml...

@dougbtv
dougbtv / README.md
Last active December 4, 2020 15:30
Getting a container ID from the kube API with bash

First create the resources.yml to create a service account, RBAC & bindings for it, as well as a pod that uses the downward API to get its own name...

kubectl create -f resources.yml

Now you can exec into the pod...

$ kubectl exec -it toolpod -- /bin/bash
@dougbtv
dougbtv / README.md
Created September 23, 2020 21:14
OpenShift & OpenShift Virtualization <3 SR-IOV -- An SR-IOV demo with virtual machines making a SIP phone call

SR-IOV with OpenShift Virtualization

We're going to use SR-IOV technology with OpenShift Virtualization. Today we're going to cover looking at the SR-IOV network attachment definitions, spinning up VMs associated with those, and then we'll make a SIP phone call over the VMs (because we're all bored of a ping test!)

Notably, this gist does not cover installing the SR-IOV Operator, configuring the SR-IOV operator.

The NetworkAttachmentDefinition (which defines an intent to attach additional networks to pods in Kubernetes, which you typically see by the presence of an additional network interface) that we use here is the one [provided by default by the SR-IOV network operator](https://docs.openshift.com/container-platform/4.5/netw