Skip to content

Instantly share code, notes, and snippets.

@amy
amy / test
Created April 20, 2020 18:06
package main
import (
"fmt"
yaml "gopkg.in/yaml.v2"
apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
meta "k8s.io/apimachinery/pkg/api/meta"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
list, err := c.K8sClientset.CoreV1().Namespaces().List(metav1.ListOptions{})
if err != nil {
logrus.Errorf("err1: %v", err)
return err
}
logrus.Infoln(list)
req := c.K8sClientset.RESTClient().Post().
Resource("pods").
Namespace("default").
2017-08-18 21:32:05,473 INFO [main] [ConsoleStatus] Starting [90/90]: project.template.reload
time="2017-08-18T21:32:05Z" level=info msg="Downloading key from http://localhost:8081/v1/scripts/api.crt"
2017-08-18 21:32:05,703 INFO [main] [ConsoleStatus] [DONE ] [55516ms] Startup Succeeded, Listening on port 8081
time="2017-08-18T21:32:05Z" level=info msg="Starting go-machine-service..." gitcommit=v0.39.0 service=gms
time="2017-08-18T21:32:05Z" level=info msg="Waiting for handler registration (1/2)" service=gms
time="2017-08-18T21:32:05Z" level=fatal msg="Exiting go-machine-service: Get http://localhost:8080/v2-beta: dial tcp 127.0.0.1:8080: getsockopt: connection refused" service=gms
time="2017-08-18T21:32:06Z" level=fatal msg="Failed to configure cattle client: Get http://localhost:8080/v2-beta: dial tcp 127.0.0.1:8080: getsockopt: connection refused"
time="2017-08-18T21:32:06Z" level=info msg="Starting websocket proxy. Listening on [:8080], Proxying to cattle API at [localhost:8081], Monitoring
2017-08-18 21:25:30,175 INFO [main] [ConsoleStatus] [DONE ] [43666ms] Startup Succeeded, Listening on port 8081
time="2017-08-18T21:25:30Z" level=error msg="Failed to update existing repo cache: exit status 128"
time="2017-08-18T21:25:30Z" level=info msg="Downloading key from http://localhost:8081/v1/scripts/api.crt"
time="2017-08-18T21:25:30Z" level=info msg="Starting websocket proxy. Listening on [:8080], Proxying to cattle API at [localhost:8081], Monitoring parent pid [10]."
time="2017-08-18T21:25:30Z" level=info msg="Configured http API filter"
time="2017-08-18T21:25:30Z" level=info msg="Configured authTokenValidator API filter"
time="2017-08-18T21:25:30Z" level=info msg="Master config file: master.conf"
time="2017-08-18T21:25:31Z" level=info msg="Downloading certificate from http://localhost:8081/v1/credentials/1c1/certificate"
time="2017-08-18T21:25:31Z" level=info msg="Starting go-machine-service..." gitcommit=v0.39.0 service=gms
time="2017-08-18T21:25:31Z" level=info msg="Waiting for hand
Failure Stack:
// docker-compose.yml
version: '2'
services:
amy-test:
image: nginx
scale: 1
health_check:
port: 80
request_line: GET /fail HTTP/1.0
@amy
amy / Implemented
Created August 10, 2017 22:50
test.md
~ --add-host Add a custom host-to-IP mapping (host:ip)~
--attach, -a Attach to STDIN, STDOUT or STDERR
--blkio-weight Block IO (relative weight), between 10 and 1000, or 0 to disable (default 0)
--blkio-weight-device Block IO weight (relative device weight)
--cgroup-parent Optional parent cgroup for the container
--cidfile Write the container ID to the file
--cpu-period Limit CPU CFS (Completely Fair Scheduler) period
--cpu-quota Limit CPU CFS (Completely Fair Scheduler) quota
--cpu-rt-period Limit CPU real-time period in microseconds
--cpu-rt-runtime Limit CPU real-time runtime in microseconds
{
"catalogs": {
"library": {
"branch": "master",
"url": "<IP-of-your-server>"
},
"community": {
"branch": "master",
"url": "<IP-of-your-server>"
}
cmd := exec.Command("git", "log", "-n1", "--oneline", "--format=format:%H", fmt.Sprintf("-- /some/path/to/git/repo/%s", relativePath))
output, err := cmd.Output()
fmt.Printf("Wut: %q %v %v %v\n", relativePath, cmd.Args, err, output)
Learn the basics of Kubernetes from the perspective of creating a Helm Chart from scratch!
The Kubernetes cluster will be launched from Rancher, an open source container management software.
At the end of this workshop, you will have a functional understanding of pods, services, deployments,
Helm, Rancher, and more!
Why learn Kubernetes with Helm Charts?
Much of today's beginner educational content for Kubernetes uses the Kubernetes CLI tool. This can
make it hard to visualize the relationship between each command and debug your cluster. Learning how
to incrementally build Helm Charts provides a bigger picture of your cluster and is more reproducible.
@amy
amy / urg
Last active April 27, 2017 00:59
Goal: map result of query onto foo.
Issue: Only one of the structs is in the array.
I'm using gorm as an ORM.
type Bar struct {
test1 string
test2 string
}