...
 
Commits (10)
[user]
email = hh@ii.coop
name = Hippie Hacker
[alias]
lol = log --graph --decorate --pretty=oneline --abbrev-commit --all
create-pull-request = !sh -c 'stash pull-request /bin/bash'
lg = log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit
[gitlab "gitlab.ii.coop/api/v4"]
user = hh
[github]
user = hh
# Co-Authored-By: Zach! <zz@ii.coop>
# Co-Authored-By: Devan Carpenter <devan@ii.coop>
# Co-Authored-By: Stephen Heywood <stephen@ii.coop>
This diff is collapsed.
This diff is collapsed.
#+TITLE: Setup kubetest / kind on packet
#+AUTHOR: Stephen Heywood
#+EMAIL: stephen@ii.coop
#+CREATOR: ii.coop
#+DATE: 12th April, 2019
#+PROPERTY: header-args:bash+ :tangle ./setup-kubetest.sh
#+NOPROPERTY: header-args:bash+ :dir (symbol-value 'ssh-tramp-dir)
#+NOPROPERTY: header-args:shell+ :dir (symbol-value 'ssh-tramp-dir)
#+PROPERTY: header-args:tmate+ :session ii:packet
#+STARTUP: showeverything
* Objective
By the end of this document, we should havekubetest working with kind on a server located on packet infrastucture.
We will be starting from scratch, and so by moving through this document we will:
- ssh into our packet box
- Install Docker and Go and any other necessary dependencies
- Install kind
- Setup a kubernetes cluster on kind
- Once built, get the cluster's info to verify it works.
- Cheer and celebrate.
* Prerequisites
This document assumes you are:
- reading it from within iimacs, and so have both target and tmate sessions open.
- have a packet box ready.
To learn about how to setup a machine on packet, [[file:installing-the-packet-cli.org][Read our Guide on Installing the Packet-CLI]]
To be able to execute all the code you see here directly onto that box, you just need to add the ip address [[*Footnotes][into our Footnotes.]] In the footnotes you will see a variable like so:
#+BEGIN_EXAMPLE
# eval: (setq-local ssh-host "147.75.80.39")
#+END_EXAMPLE
Simply replace the ip address in quotations with your own.
Now let's get STARTED!
* Connect to fresh ubuntu 18.04 box as root
:PROPERTIES:
:header-args:shell+: :dir (symbol-value 'ssh-tramp-dir)
:header-args:bash+: :dir (file-name-directory buffer-file-name)
:END:
We want to establish the ssh user and packet host, you don't need to worry about these two code blocks, as they're just used to make the rest of the doc easier.
** ssh-user
#+BEGIN_SRC elisp :results output value
(concat ssh-user)
#+END_SRC
#+RESULTS:
#+BEGIN_SRC elisp
"root"
#+END_SRC
** packet-host
#+NAME: packet-host
#+BEGIN_SRC elisp :results output value
(concat ssh-host)
#+END_SRC
#+RESULTS: packet-host
#+BEGIN_SRC elisp
"147.75.80.39"
#+END_SRC
#+RESULTS:
#+BEGIN_SRC elisp
"147.75.80.39"
#+END_SRC
** ssh
Now let's ssh into the machine. You should see a login in your target window.
#+BEGIN_SRC tmate
ssh root@<<packet-host()>>
#+END_SRC
All *shell* code blocks refer to your packet box, but print the results into this org file. So by executing the below code, you will see your own unique results below.
#+BEGIN_SRC shell
hostname
date
#+END_SRC
#+RESULTS:
#+BEGIN_EXAMPLE
zpair
Wed May 22 10:13:24 UTC 2019
#+END_EXAMPLE
#+BEGIN_SRC bash
hostname
date
#+END_SRC
#+RESULTS:
#+BEGIN_EXAMPLE
zolarizo
Wed May 22 22:13:28 NZST 2019
#+END_EXAMPLE
* Install Dependencies
** Install Docker
#+BEGIN_SRC tmate
export TIME_START=$(date)
apt-get update
apt-get install -y \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | apt-key add -
add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) \
stable"
apt-get install -y docker-ce docker-ce-cli containerd.io
#+END_SRC
** Install git & gcc
#+BEGIN_SRC tmate
apt-get install -y git gcc
#+END_SRC
** Install go
#+BEGIN_SRC tmate
curl -L https://dl.google.com/go/go1.12.4.linux-amd64.tar.gz | sudo tar -C /usr/local -xzf -
export GOROOT=/usr/local/go/
export GOPATH=~/go
export PATH=$PATH:/usr/local/go/bin:$GOPATH/bin
go version
#+END_SRC
#+RESULTS:
#+begin_EXAMPLE
go version go1.12.3 linux/amd64
#+end_EXAMPLE
** Install kubectl
#+BEGIN_SRC tmate
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
echo "deb https://apt.kubernetes.io/ kubernetes-xenial main" | tee -a /etc/apt/sources.list.d/kubernetes.list
sudo apt-get update
sudo apt-get install -y kubectl
#+END_SRC
* Get Kubernetes, kubetest & KIND
:PROPERTIES:
:header-args:shell+: :dir (symbol-value 'ssh-tramp-dir)
:header-args:bash+: :dir (file-name-directory buffer-file-name)
:END:
- Following feedback from [[https://kubernetes.slack.com/messages/CEKK1KTN2/convo/CEKK1KTN2-1555018633.255400/?thread_ts=1555018633.255400][@neolit123 on kubernetes.slack.com #kind]]
#+BEGIN_SRC tmate
echo "Getting Kubernetes..."
go get k8s.io/kubernetes
echo "Getting Kubetest..."
go get k8s.io/test-infra/kubetest
#+END_SRC
I ran into errors trying to build kind from master...
#+BEGIN_SRC tmate
echo "Getting Kind..."
go get sigs.k8s.io/kind
#+END_SRC
Try building from tag v0.3.0
#+BEGIN_SRC tmate
cd ~/go/src/sigs.k8s.io/kind
git checkout v0.3.0
git branch v0.3.0
make
mkdir -p /root/go/bin
make install
export PATH=/root/go/bin:$PATH
#+END_SRC
** Build kubetest
#+BEGIN_SRC tmate
echo "Build kubetest"
cd ~/go/src/k8s.io/test-infra/kubetest
go build
cp kubetest ../../kubernetes
cd ../../kubernetes
echo "Getting a cluster up with Kind..."
./kubetest --deployment=kind --kind-binary-version=build --provider=skeleton --build --up
#+END_SRC
** Check on Docker
#+BEGIN_SRC shell
docker ps -a
#+END_SRC
#+RESULTS:
#+BEGIN_EXAMPLE
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
c679f00d5586 kube-build:build-2aa32e7d50-5-v1.12.5-1 "chown -R 0:0 /go/sr…" 6 seconds ago Up 5 seconds kube-build-data-2aa32e7d50-5-v1.12.5-1
#+END_EXAMPLE
#+BEGIN_SRC shell
docker images
#+END_SRC
#+RESULTS:
#+BEGIN_EXAMPLE
REPOSITORY TAG IMAGE ID CREATED SIZE
golang 1.12.5 7ced090ee82e 2 weeks ago 774MB
#+END_EXAMPLE
** Check Cluster State
#+BEGIN_SRC shell
ln -sf ~/.kube/kind-config-kind-kubetest ~/.kube/config
kubectl version
#+END_SRC
#+RESULTS:
#+begin_EXAMPLE
Client Version: version.Info{Major:"1", Minor:"14", GitVersion:"v1.14.2", GitCommit:"66049e3b21efe110454d67df4fa62b08ea79a19b", GitTreeState:"clean", BuildDate:"2019-05-16T16:23:09Z", GoVersion:"go1.12.5", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"16+", GitVersion:"v1.16.0-alpha.0.303+1c100619671dfa-dirty", GitCommit:"1c100619671dfaffe09f555a67bd9c43099f12ed", GitTreeState:"dirty", BuildDate:"2019-05-22T06:31:38Z", GoVersion:"go1.12.5", Compiler:"gc", Platform:"linux/amd64"}
#+end_EXAMPLE
#+BEGIN_SRC shell
kubectl get nodes
#+END_SRC
#+RESULTS:
#+begin_EXAMPLE
NAME STATUS ROLES AGE VERSION
kind-kubetest-control-plane Ready master 16m v1.16.0-alpha.0.303+1c100619671dfa-dirty
#+end_EXAMPLE
#+BEGIN_SRC shell
kubectl get pods --all-namespaces
#+END_SRC
#+RESULTS:
#+begin_EXAMPLE
NAMESPACE NAME READY STATUS RESTARTS AGE
kube-system coredns-65546fffc9-4fvnp 1/1 Running 0 16m
kube-system coredns-65546fffc9-qz99l 1/1 Running 0 16m
kube-system etcd-kind-kubetest-control-plane 1/1 Running 0 15m
kube-system ip-masq-agent-tsfzc 1/1 Running 0 16m
kube-system kindnet-psnd6 1/1 Running 1 16m
kube-system kube-apiserver-kind-kubetest-control-plane 1/1 Running 0 15m
kube-system kube-controller-manager-kind-kubetest-control-plane 1/1 Running 0 15m
kube-system kube-proxy-vz4jp 1/1 Running 0 16m
kube-system kube-scheduler-kind-kubetest-control-plane 1/1 Running 0 15m
#+end_EXAMPLE
* References
#+BEGIN_SRC bash :tangle test-noweb-ref.sh
<<Install Docker>>
#+END_SRC
* Footnotes
#+BEGIN_SRC shell
hostname
#+END_SRC
#+RESULTS:
#+begin_EXAMPLE
p70
#+end_EXAMPLE
# Local Variables:
# eval: (set (make-local-variable 'ssh-user) "root")
# eval: (setq-local ssh-host "147.75.80.39")
# eval: (set (make-local-variable 'ssh-dir) "~")
# eval: (set (make-local-variable 'ssh-tramp-dir) (concat "/ssh:" ssh-user "@" ssh-host ":" ssh-dir))
# End:
#!/bin/bash
set -x
orgfile=$1
BASE=$(basename $orgfile)
tmate -S /tmp/${USER}.${BASE}.iisocket new-session \
-A -s $USER -n emacs \
"tmate wait tmate-ready \
&& TMATE_CONNECT=\
\$(tmate display -p '#{tmate_ssh} # ${USER}.${BASE} # $(date) # #{tmate_web}') \
; echo \$TMATE_CONNECT \
; (echo \$TMATE_CONNECT | xclip -i -sel p -f | xclip -i -sel c )2>/dev/null \
; echo Share the above with your friends and hit enter here when done? \
; read ; \
emacs -nw $1"
......@@ -4,7 +4,7 @@
(org-mode
(org-babel-tmate-session-prefix . "")
(org-babel-tmate-default-window-name . "main")
(org-confirm-babel-evaluate . t)
(org-confirm-babel-evaluate . nil)
(org-use-property-inheritance . t)
(org-file-dir . (file-name-directory buffer-file-name))
(eval
......@@ -40,12 +40,14 @@
(list
(cons 'header-args:tmate
(concat
" :noweb yes"
":noweb yes"
" :noweb-ref " item-str
" :comments org"
" :eval no-export"
" :results silent "
" :session (concat user-login-name \":\" " item-str ")"
" :session (concat user-login-name \":main\" )"
;; " :session (concat user-login-name \":\" " "main" ")"
;; " :session (concat user-login-name \":\" " item-str ")"
" :socket " socket
" :window " user-login-name
" :terminal sakura"
......@@ -56,7 +58,7 @@
))
(cons 'header-args:emacs-lisp
(concat
" :noweb yes"
":noweb yes"
" :noweb-ref " item-str
" :comments org"
" :eval no-export"
......@@ -65,7 +67,7 @@
))
(cons 'header-args:elisp
(concat
" :noweb yes"
":noweb yes"
" :noweb-ref " item-str
" :comments org"
" :eval no-export"
......@@ -74,7 +76,7 @@
))
(cons 'header-args:bash
(concat
" :noweb yes"
":noweb yes"
" :noweb-ref " item-str
" :comments org"
" :eval no-export"
......@@ -97,7 +99,7 @@
))
(cons 'header-args:shell
(concat
" :noweb yes"
":noweb yes"
" :noweb-ref " item-str
" :comments org"
" :eval no-export"
......@@ -107,14 +109,14 @@
))
(cons 'header-args:json
(concat
" :noweb yes"
":noweb yes"
" :comments org"
" :noweb-ref " item-str
" :exports both"
))
(cons 'header-args:yaml
(concat
" :noweb yes"
":noweb yes"
" :comments org"
" :noweb-ref " item-str
" :exports both"
......@@ -123,6 +125,11 @@
)
(set (make-local-variable 'select-enable-clipboard) t)
(set (make-local-variable 'select-enable-primary) t)
(defun ii-org-confirm-babel-evaluate (lang body)
nil ;; allow everything for now
;;(not (string= lang "ditaa")) ;don't ask for ditaa
)
(set (make-local-variable 'org-confirm-babel-evaluate) #'ii-org-confirm-babel-evaluate)
(set (make-local-variable 'start-tmate-command)
(concat
"tmate -S "
......@@ -319,6 +326,15 @@
(defun help/double-gc-cons-threshold () "Double `gc-cons-threshold'." (help/set-gc-cons-threshold 2))
(add-hook 'org-babel-pre-tangle-hook #'help/double-gc-cons-threshold)
(add-hook 'org-babel-post-tangle-hook #'help/set-gc-cons-threshold)
;; info:org#Conflicts for org 9 and very recent yas
(defun yas/org-very-safe-expand ()
(let ((yas/fallback-behavior 'return-nil)) (yas/expand)))
(yas/expand)
(make-variable-buffer-local 'yas/trigger-key)
(setq yas/trigger-key [tab])
(add-to-list 'org-tab-first-hook 'yas/org-very-safe-expand)
(define-key yas/keymap [tab] 'yas/next-field)
;; (gui-select-text (concat "rm -fi " socket "; ssh -tAX " ssh-user "@" ssh-host " -L " socket ":" socket " " start-tmate-over-ssh-command))
;; (edebug-trace "TRACING socket:%S" socket)
;; (edebug-trace "TRACING org-babel-header-args:tmate %S" org-babel-header-args:emacs-lisp)
......
* how might we approach behaviors
Generating a yaml file
What is the approach we might want to use in general.
How do we define the behaivours that might be conforming.
The tooling being able to cennect them back to tests.
Currently wrt test
we write
We promote
But what % of behavoursl that we want to cover does that actually cover.
They are somewhat defined
in schema, docs, blogs etc etc
Most are actually in the docs
The schema has a few, should be able to use the schema to boostrap
or a portiono of a list.
Wee need someway to know, when a tset covers it.
- 1 Labels?
- 2 Field Introspection
There is just one place whete they are structured.
The kep is trying to structure them so
-1 we can agree on the list (what it is we will covered)
-2 so we can see if they are tested ( what it is we have covered)
Pod REadyness check.... Does it fire, produce anything useful? It's a more
complex test.... whet you change the readiness delay, from 60 to 240 seconds...
does that actually happen.^
The test itself has to have some logic...
Is it tweaking.
* what we might trying
- [ ] identify three markdown docs that describe important behaviors
- [ ] update them to include the test setup PodSpec interisting
- [ ] new doc style auto defines behavour
* show what ii is currently doing wrt living docs
* Issues
https://github.com/99designs/gqlgen/issues/714
#+BEGIN_SRC
#+END_SRC
* checkout code
#+BEGIN_SRC elisp :results none
(setq-local src-dir "~/src/gqlgen")
(setq-local src-repo "git@github.com:hh/gqlgen.git")
#+END_SRC
#+BEGIN_SRC elisp :results none
(delete-directory src-dir t)
#+END_SRC
Clone the repository!
Might be nice to be notified when it's finished cloning and open magit-status
#+BEGIN_SRC elisp :results none
(progn
(magit-clone-regular src-repo src-dir "--progress")
(display-buffer "magit-process: org")
;; might be nice to delay here until the clone is done
(loop
(when (file-directory-p src-dir)
(return
(display-buffer (magit-status-setup-buffer src-dir)))
)
)
)
#+END_SRC
#+BEGIN_SRC elisp
(defun ii/magit-branch-and-checkout (branch start-point)
"Create and checkout BRANCH at branch or revision START-POINT."
(if (string-match-p "^stash@{[0-9]+}$" start-point)
(magit-run-git "stash" "branch" branch start-point)
(magit-call-git "checkout" "-b" branch start-point)
(magit-branch-maybe-adjust-upstream branch start-point)
(magit-refresh)))
(with-current-buffer (get-buffer "magit: gqlgen")
(ii/magit-branch-and-checkout "fix-docs" "master")
;; (magit-branch-and-checkout "fix-docs" "master")
;; (magit-svn-create-branch "fix-docs")
)
#+END_SRC
#+RESULTS:
#+BEGIN_SRC elisp
nil
#+END_SRC
This hack borrowed from:
[[file:~/.emacs.d/elpa/26.2/develop/projectile-20190416.1458/projectile.el::(defun%20projectile-switch-project-by-name%20(project-to-switch%20&optional%20arg)][projectile.el::switch-project-by-name]]
#+BEGIN_SRC elisp :results silent
(setq-local project-to-switch src-dir)
(let ((default-directory project-to-switch))
(with-temp-buffer
(hack-dir-local-variables-non-file-buffer))
(let (
(projectile-project-name
(funcall projectile-project-name-function
project-to-switch)))
(funcall 'projectile-find-file)))
#+END_SRC
* FIxing
- [x] Noted in fix in https://github.com/99designs/gqlgen/issues/714
- [x] Fixed in our branch
- [x] Submitted PR https://github.com/99designs/gqlgen/pull/718
......@@ -116,7 +116,7 @@ go run github.com/99designs/gqlgen
)
type Resolver struct {
todos []Todo
todos []*Todo
}
func (r *Resolver) Mutation() MutationResolver {
......@@ -137,13 +137,13 @@ go run github.com/99designs/gqlgen
ID: fmt.Sprintf("T%d", rand.Int()),
UserID: input.UserID,
}
r.todos = append(r.todos, *todo)
r.todos = append(r.todos, todo)
return todo, nil
}
type queryResolver struct{ *Resolver }
func (r *queryResolver) Todos(ctx context.Context) ([]Todo, error) {
func (r *queryResolver) Todos(ctx context.Context) ([]*Todo, error) {
return r.todos, nil
}
......
#+STARTUP: content
#+STARTUP: showeverything
* [[https://www.howtographql.com/graphql-js/1-getting-started/][Getting Started]]
:PROPERTIES:
:header-args:tmate+: :session session:graphql
:header-args:tmate+: :noweb yes
:header-args:js+: :session skewer-mode:"*skewer-repl*"
:END:
** reset existance
#+BEGIN_SRC tmate
cd ~/
rm -rfi <<default-directory()>>
#+END_SRC
** prerequisites
Here we create an empty folder to start our project:
#+BEGIN_SRC tmate :dir ~/ :noweb yes
mkdir -p <<default-directory()>>
cd <<default-directory()>>
#+END_SRC
** Creating the project
#+BEGIN_SRC tmate
npm init -y
#+END_SRC
** Creating a raw GraphQL server
#+BEGIN_SRC tmate
mkdir -p src
touch src/index.js
node src/index.js
#+END_SRC
#+BEGIN_SRC tmate
npm install graphql-yoga
#+END_SRC
;; "SRC json"
;;#+BEGIN_SRC shell :wrap "EXAMPLE"
#+BEGIN_SRC shell :wrap "SRC json"
cat package.json
#+END_SRC
#+RESULTS:
#+begin_SRC json
{
"name": "hackernews-node",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"graphql-yoga": "^1.17.4"
}
}
#+end_SRC
*** src/index.js
Save this as src/index.js
#+BEGIN_SRC javascript :tangle src/index.js
const { GraphQLServer } = require('graphql-yoga')
//1
const typeDefs = `
type Query {
info: String!
}
`
// 2
const resolvers = {
Query: {
info: () => `This is the API of a Hackernews Clone`
}
}
// 3
const server = new GraphQLServer({
typeDefs,
resolvers,
})
server.start(() => console.log(`Server is running on http://localhost:4000`))
#+END_SRC
#+BEGIN_SRC elisp :results none
(run-skewer) ;; launches a browser
#+END_SRC
#+BEGIN_SRC elisp :results none
(compile "node src/index.js" t)
(sleep-for 2)
(display-buffer "*compilation*")
(browse-url-chromium "http:localhost:4000")
#+END_SRC
#+BEGIN_SRC js :session "*skewer-repl*"
alert("Hello from iiMacs")
;; console.log("Hello from iiMacs")
#+END_SRC
** prerequisites
* My Environment
** default-directory
#+NAME: default-directory
#+BEGIN_SRC elisp
(symbol-value 'default-directory)
#+END_SRC
** github-user
#+NAME: github-user
#+BEGIN_SRC elisp :results scalar
(princ (symbol-value 'github-user))
#+END_SRC
** skewer-research
(spacemacs/load-yasnippet)
#+BEGIN_SRC js :session "*skewer-repl*"
//alert("AOEU")
console.log("AOEU")
#+END_SRC
#+BEGIN_SRC tmate
#+END_SRC
#+BEGIN_SRC tmate
#+END_SRC
#+BEGIN_SRC
#+END_SRC
# Local Variables:
# eval: (setq-local target-directory (expand-file-name "~/hackernews-node"))
# eval: (make-directory target-directory t)
# eval: (setq-local default-directory (symbol-value 'target-directory))
# compile-command: "node src/index.js"
# github-user: "hh"
# End:
* checkout code
#+BEGIN_SRC elisp :results none
(setq-local src-dir "~/src/k8s")
(setq-local src-repo "git@github.com:kubernetes/kubernetes.git")
......
This diff is collapsed.
This diff is collapsed.
......@@ -27,3 +27,27 @@ L => (Info-history)
Some help formatting
* re-builder
#+BEGIN_SRC elisp
(re-builder)
#+END_SRC
To quit run ~reb-quit~ or C-c C-q
* debug-on-X
** message
To identify the message, switch to *messages* and run re-builder
I couln't get this to fire.
#+BEGIN_SRC elisp
(setq debug-on-message "File local-variables.*")
(setq debug-on-message "if: Invalid function:.*")
#+END_SRC
** error
#+BEGIN_SRC elisp
(setq debug-on-error t)
(setq debug-on-error nil)
#+END_SRC
- [kube-config.yaml pulled from artifacts](#sec-1)
- [kubeadm config pulled from logs](#sec-2)
- [error has occured](#sec-3)
- [failed to start control plane](#sec-4)
# kube-config.yaml pulled from artifacts<a id="sec-1"></a>
```shell
curl https://storage.googleapis.com\
/kubernetes-jenkins/pr-logs/pull/sigs.k8s.io_kind/457\
/pull-kind-conformance-parallel/1127097770943975426\
/artifacts/kind-config.yaml
```
```yaml
# config for 1 control plane node and 2 workers
# necessary for conformance
kind: Cluster
apiVersion: kind.sigs.k8s.io/v1alpha3
nodes:
# the control plane node / apiservers
- role: control-plane
- role: worker
- role: worker
extraMounts:
- hostPath: /tmp/audit-policy.yaml
containerPath: /etc/kubernetes/audit-policy.yaml
- hostPath: "/workspace/_artifacts/apiserver-audit.log"
containerPath: /var/log/apiserver-audit.log
kubeadmConfigPatches:
- |
# v1beta1 works for 1.14+
apiVersion: kubeadm.k8s.io/v1beta1
kind: ClusterConfiguration
metadata:
name: config
apiServer:
extraArgs:
audit-log-path: /var/log/apiserver-audit.log
audit-policy-file: /etc/kubernetes/audit-policy.yaml
extraVolumes:
- name: auditpolicy
pathType: File
readOnly: true
hostPath: /etc/kubernetes/audit-policy.yaml
mountPath: /etc/kubernetes/audit-policy.yaml
- name: auditlog
pathType: File
readOnly: false
hostPath: /var/log/apiserver-audit.log
mountPath: /var/log/apiserver-audit.log
```
# kubeadm config pulled from logs<a id="sec-2"></a>
```shell
# The prow url only works while the job is active in the cluster
#curl 'https://prow.k8s.io/log?job=pull-kind-conformance-parallel&id=1127097770943975426' \
curl https://storage.googleapis.com\
/kubernetes-jenkins/pr-logs/pull/sigs.k8s.io_kind/457\
/pull-kind-conformance-parallel/1127097770943975426\
/build-log.txt \
| grep 06:37:29.307 \
| awk -F\" '{print $4,$5,$6}' \
| sed 's:.*msg=\"::g' \
| sed 's:\\n:\n:g' \
| grep -v 'Using kubeadm config:' \
| cat
```
```yaml
apiServer:
certSANs:
- localhost
extraArgs:
audit-log-path: /var/log/apiserver-audit.log
audit-policy-file: /etc/kubernetes/audit-policy.yaml
extraVolumes:
- hostPath: /etc/kubernetes/audit-policy.yaml
mountPath: /etc/kubernetes/audit-policy.yaml
name: auditpolicy
pathType: File
readOnly: true
- hostPath: /var/log/apiserver-audit.log
mountPath: /var/log/apiserver-audit.log
name: auditlog
pathType: File
readOnly: false
apiVersion: kubeadm.k8s.io/v1beta1
clusterName: kind
controllerManager:
extraArgs:
enable-hostpath-provisioner: \ true\
kind: ClusterConfiguration
kubernetesVersion: v1.15.0-alpha.3.238+b4d2cb0001cc27
name: config
---
apiVersion: kubeadm.k8s.io/v1beta1
bootstrapTokens:
- token: abcdef.0123456789abcdef
kind: InitConfiguration
localAPIEndpoint:
bindPort: 6443
nodeRegistration:
criSocket: /run/containerd/containerd.sock
---
apiVersion: kubeadm.k8s.io/v1beta1
kind: JoinConfiguration
nodeRegistration:
criSocket: /run/containerd/containerd.sock
---
apiVersion: kubelet.config.k8s.io/v1beta1
evictionHard:
imagefs.available: 0%
nodefs.available: 0%
nodefs.inodesFree: 0%
imageGCHighThresholdPercent: 100
kind: KubeletConfiguration
---
apiVersion: kubeproxy.config.k8s.io/v1alpha1
kind: KubeProxyConfiguration
```
<https://gubernator.k8s.io/build/kubernetes-jenkins/pr-logs/pull/sigs.k8s.io_kind/457/pull-kind-conformance-parallel/1127097770943975426>
# error has occured<a id="sec-3"></a>
```shell
curl https://storage.googleapis.com\
/kubernetes-jenkins/pr-logs/pull/sigs.k8s.io_kind/457\
/pull-kind-conformance-parallel/1127097770943975426\
/build-log.txt \
| grep 'Unfortunately, an error has occurred' \
| sed 's:.*msg=\"::g' \
| sed 's:\\n:\n:g' \
| grep -A20 'Unfortunately, an error has occurred' \
| sed 's:\\t: :g' \
| cat
```
```yaml
Unfortunately, an error has occurred:
timed out waiting for the condition
This error is likely caused by:
- The kubelet is not running
- The kubelet is unhealthy due to a misconfiguration of the node in some way (required cgroups disabled)
If you are on a systemd-powered system, you can try to troubleshoot the error with the following commands:
- 'systemctl status kubelet'
- 'journalctl -xeu kubelet'
Additionally, a control plane component may have crashed or exited when started by the container runtime.
To troubleshoot, list all containers using your preferred container runtimes CLI, e.g. docker.
Here is one example how you may list all Kubernetes containers running in docker:
- 'docker ps -a | grep kube | grep -v pause'
Once you have found the failing container, you can inspect its logs with:
- 'docker logs CONTAINERID'
error execution phase wait-control-plane: couldn't initialize a Kubernetes cluster"
```
# failed to start control plane<a id="sec-4"></a>
```shell
curl https://storage.googleapis.com/kubernetes-jenkins/pr-logs/pull/sigs.k8s.io_kind/457/pull-kind-conformance-parallel/1127097770943975426/build-log.txt \
| grep '06:41:38' \
| sed 's:.*msg=\"::g' \
| sed 's:\\n:\n:g' \
| sed 's:\\t: :g' \
| grep '06:41:38.417\|06:41:38.518' \
| cat
```
```yaml
I0511 06:41:38.417] ✗ Starting control-plane 🕹️
W0511 06:41:38.518] Error: failed to create cluster: failed to init node with kubeadm: exit status 1
W0511 06:41:38.518] + cleanup
W0511 06:41:38.518] + kind export logs /workspace/_artifacts/logs
```
......@@ -97,19 +97,25 @@ Exactly how is the non-default header-arg calculated?
#+END_SRC
#+RESULTS:
#+BEGIN_SRC elisp
#+begin_src elisp
("elisp"
((:results . "code")
(:exports . "")
(:noweb-ref . "PROPERTY-ELISP"))
(:exports . "both")
(:eval . "no-export")
(:comments . "org")
(:noweb-ref . "org-babel-get-src breakdown")
(noweb . "yes"))
"" nil "(ref:%s)")
#+END_SRC
#+end_src
#+BEGIN_SRC elisp
(org-src-coderef-format (org-element-context))
#+END_SRC
#+RESULTS:
: aoeu
#+begin_src elisp
"(ref:%s)"
#+end_src
#+BEGIN_SRC elisp :results code
......@@ -117,9 +123,9 @@ Exactly how is the non-default header-arg calculated?
#+END_SRC
#+RESULTS:
#+BEGIN_SRC elisp
#+begin_src elisp
((:lexical . "no"))
#+END_SRC
#+end_src
#+BEGIN_SRC elisp
......@@ -127,33 +133,36 @@ Exactly how is the non-default header-arg calculated?
#+END_SRC
#+RESULTS:
#+BEGIN_SRC elisp
"/tmp/hippie.org-babel.iisocket"
#+END_SRC
#+begin_src elisp
"/tmp/hippie.org-babel.target.iisocket"
#+end_src
#+BEGIN_SRC emacs-lisp :results code :item-param (concat "ITEM" "-PARAM")
(org-babel-get-src-block-info)
#+END_SRC
#+RESULTS:
#+BEGIN_SRC emacs-lisp
#+begin_src emacs-lisp
("emacs-lisp" "(org-babel-get-src-block-info)"
((:colname-names)
(:rowname-names)
(:result-params "code" "replace")
(:result-type . value)
(:results . "code replace")
(:exports . "code")
(:exports . "both")
(:item-param . "ITEM-PARAM")
(:file-prop . "FILE-PROPERTY")
(:dir-default concat "DIR" "-ELISP")
(:eval . "no-export")
(:comments . "org")
(:noweb-ref . "org-babel-get-src breakdown")
(noweb . "yes")
(:lexical . "no")
(:tangle . "no")
(:hlines . "no")
(:noweb . "no")
(:cache . "no")
(:session . "none"))
"" nil 3415 "(ref:%s)")
#+END_SRC
"" nil 3542 "(ref:%s)")
#+end_src
* debugging
:PROPERTIES:
......
......@@ -18,6 +18,19 @@ Name, Email, Comment towards bottom
Supported Keys: https://docs.puri.sm/Librem_Key/Getting_Started/User_Manual.html#technical-specs
#+BEGIN_SRC shell :async yes
sleep 1
date
sleep 3
date
#+END_SRC
#+RESULTS:
#+begin_EXAMPLE
Tue May 21 12:54:24 CEST 2019
Tue May 21 12:54:27 CEST 2019
#+end_EXAMPLE
#+BEGIN_SRC tmate

gpg --expert --full-generate-key
......
This diff is collapsed.
* aoeu
aoeu
* snth
snth
#+BEGIN_SRC elisp
(set (make-local-variable 'start-tmate-for-togetherly-client)
(let (
(togetherly-socket (make-temp-file (concat "/tmp/" user-buffer "-")))
)
(concat
"tmate -S "
togetherly-socket
" new-session -A -s "
user-login-name
" -n main "
"\"tmate wait tmate-ready "
"&& TMATE_CONNECT=\\$("
"tmate display -p '#{tmate_ssh} # "
user-buffer
"."
togetherly-socket
".TOGETHERLY # "
;; would like this to be shorter
(concat
(format-time-string "%Y-%m-%d %T")
(funcall (lambda ($x) (format "%s:%s" (substring $x 0 3) (substring $x 3 5))) (format-time-string "%z")))
" # #{tmate_web} ') "
"; echo \\$TMATE_CONNECT "
"; (echo \\$TMATE_CONNECT | xclip -i -sel p -f | xclip -i -sel c ) 2>/dev/null "
"; echo Share this url with someone both be able to togethrly the same buffer. "
"; read "
"; emacs -nw --eval '\(togetherly-client-quick-start \"" (number-to-string togetherly-port) "\")'\""
)
)
)
#+END_SRC
#+RESULTS:
#+BEGIN_SRC elisp
"tmate -S /tmp/hippie.togetherly-x0Tcrh new-session -A -s hippie -n main \"tmate wait tmate-ready && TMATE_CONNECT=\\$(tmate display -p '#{tmate_ssh} # hippie.togetherly./tmp/hippie.togetherly-x0Tcrh.TOGETHERLY # 2019-05-13 13:14:54+12:00 # #{tmate_web} ') ; echo \\$TMATE_CONNECT ; (echo \\$TMATE_CONNECT | xclip -i -sel p -f | xclip -i -sel c ) 2>/dev/null ; echo Share this url with someone both be able to togethrly the same buffer. ; read ; emacs -nw --eval '(togetherly-client-quick-start 7045\")'\""
#+END_SRC
#+BEGIN_SRC tmate
id
#+END_SRC
* I olso have ideas
* apisnoop stuff
We'd like to explore some temporary work around [[https://apisnoop.cncf.io][APISnoop]] which hase some code at[[https://github.com/cncf/apisnoop]]
#+BEGIN_SRC shell
date
echo hhii!!
#+END_SRC
#+RESULTS:
#+begin_EXAMPLE
Tue May 21 10:46:21 CEST 2019
hhii!!
#+end_EXAMPLE
......@@ -6,7 +6,7 @@ tmate -S /tmp/${USER}.${BASE}.iisocket new-session \
-A -s $USER -n emacs \
"tmate wait tmate-ready \
&& TMATE_CONNECT=\
\$(tmate display gp '#{tmate_ssh} # ${USER}.${BASE} # $(date) # #{tmate_web}') \
\$(tmate display -p '#{tmate_ssh} # ${USER}.${BASE} # $(date) # #{tmate_web}') \
; echo \$TMATE_CONNECT \
; (echo \$TMATE_CONNECT | xclip -i -sel p -f | xclip -i -sel c )2>/dev/null \
; echo Share the above with your friends and hit enter here when done? \
......