- NOTE - if control changes IPs, code will need updates (for api, currently not ENV or file)
- On a machine with Docker
git clone http://github.com/ronaldpetty/scheduler.git
(derived from kelseyhightower/scheduler)cd ~/scheduler
git checkout tls_healthz
- build image -
sudo docker build -t k8s.gcr.io/kube-scheduler:v1.22.4 --no-cache .
- extract image -
sudo docker save k8s.gcr.io/kube-scheduler:v1.22.4 -o hightower.tar
This file contains hidden or 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
 | |
``` | |
~$ pip install SQLAlchemy | |
Defaulting to user installation because normal site-packages is not writeable | |
Collecting SQLAlchemy | |
Downloading SQLAlchemy-1.4.39-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (1.6 MB) | |
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.6/1.6 MB 8.5 MB/s eta 0:00:00 |
This file contains hidden or 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 threading | |
import time | |
class X: | |
def __init__(self): | |
self.a = 1 | |
self.b = 2 | |
self.lock = threading.RLock() | |
def changeA(self): |
This file contains hidden or 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
* `docker container run --rm -d --name mdb mongo` | |
* `docker container inspect mdb | grep IPA` # to get IP for code unless this is the only container | |
* `python3 -m venv faster` | |
* cd `faster` | |
* `source ./bin/activate` | |
* `python3 -m pip install pymongo | |
To run the code: | |
* `python3 code.py #writers #readers #docs` |
This file contains hidden or 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 multiprocessing import Pool | |
from pymongo import MongoClient | |
import datetime | |
import sys | |
def insert(x): | |
print("insert") | |
print(f"instance {x}") | |
client = MongoClient('172.17.0.2', 27017) | |
db = client.test_database |
This file contains hidden or 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
/game-of-life# cat pom.xml | |
<?xml version="1.0" encoding="UTF-8"?> | |
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | |
<modelVersion>4.0.0</modelVersion> | |
<groupId>com.wakaleo.gameoflife</groupId> | |
<artifactId>gameoflife</artifactId> | |
<version>1.0-SNAPSHOT</version> | |
<packaging>pom</packaging> | |
<name>gameoflife</name> | |
<url>https://github.com/wakaleo/game-of-life</url> |
ronaldpetty@Ronalds-MBP src % pwd
/Users/ronaldpetty/go/src
ronaldpetty@Ronalds-MBP src % tree pc
pc
└── driver.go
0 directories, 1 file
ronaldpetty@Ronalds-MBP src % cat pc/driver.go
package main
This file contains hidden or 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
package main | |
import ( | |
"strconv" | |
"time" | |
) | |
func main() { | |
c := make(chan string) | |
w := make(chan struct{}) |
This file contains hidden or 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
package main | |
import ( | |
"context" | |
"time" | |
) | |
func one(ctx context.Context) { | |
print("one create\n") | |
ctx5, _ := context.WithTimeout(ctx, time.Second*5) |
Convert:
kubectl run curler --image giantswarm/tiny-tools --serviceaccount app-sa --command -- /usr/bin/tail -f /dev/null
Since --serviceaccount is deprecated. One alternative is using kustomize. Its more work, but a good technique you can reuse for other deprecated options or automation.
kubectl --dry-run=client -o yaml run curler --image giantswarm/tiny-tools --command -- /usr/bin/tail -f /dev/null > curler.yaml
cat < addsa.yaml