Skip to content

Instantly share code, notes, and snippets.

View k82cn's full-sized avatar
💭
Go! Go! Go!

Klaus Ma k82cn

💭
Go! Go! Go!
View GitHub Profile
@k82cn
k82cn / k8s_ut.md
Last active September 24, 2016 07:57
Kubernetes unit test

Run special unit test

make test WHAT="contrib/mesos/pkg/offers" KUBE_TEST_ARGS="-run TestOfferStorage" GOFLAGS=-v

@k82cn
k82cn / mesos_test_with_log.md
Created October 7, 2016 06:37
Run Mesos test with logs.

GLOG_v=2 ./bin/mesos-tests.sh --verbose

I1019 02:34:06.461675 47 handlers.go:105] POST /api/v1/namespaces/kube-system/events: (16.381817ms) 201 [[km/v0.0.0 (linux/amd64) kubernetes/$Format] 172.1.56.3:40294]
I1019 02:34:06.521698 47 handlers.go:105] POST /api/v1/namespaces/kube-system/events: (27.260335ms) 201 [[km/v0.0.0 (linux/amd64) kubernetes/$Format] 172.1.56.3:40294]
I1019 02:34:07.023125 47 trace.go:61] Trace "Get /api/v1/namespaces/default/services/k8sm-scheduler" (started 2016-10-19 02:33:57.071670013 +0000 UTC):
[9.951430179s] [9.951430179s] END
I1019 02:34:07.023365 47 handlers.go:105] GET /api/v1/namespaces/default/services/k8sm-scheduler: (9.951881226s) 200 [[km/v0.0.0 (linux/amd64) kubernetes/$Format] 172.1.56.9:40628]
I1019 02:34:13.965784 47 logs.go:41] http: TLS handshake error from 172.1.56.2:44130: EOF
I1019 02:34:19.674879 47 trace.go:61] Trace "Get /api/v1/nodes/172.1.56.7" (started 2016-10-19 02:34:18.067345019 +0000 UTC):
[1.607379765s] [1.607379765s] END
I1019 02:34:19.675471 47 handlers.go
@k82cn
k82cn / go_json.go
Created April 7, 2017 04:52
An example of json in golang.
package main
import (
"encoding/json"
"fmt"
)
func main() {
var jsonBlob = []byte(`[
{"Name": "Platypus", "Order": "Monotremata"},
@k82cn
k82cn / k8s-45122.diff
Last active April 30, 2017 02:52
k8s-45122.diff
diff --git a/plugin/pkg/scheduler/api/types.go b/plugin/pkg/scheduler/api/types.go
index 90d671e8ee..55ce39f874 100644
--- a/plugin/pkg/scheduler/api/types.go
+++ b/plugin/pkg/scheduler/api/types.go
@@ -24,6 +24,15 @@ import (
"k8s.io/kubernetes/pkg/api/v1"
)
+const (
+ maxUint = ^uint(0)
diff --git a/pkg/controller/daemon/daemoncontroller.go b/pkg/controller/daemon/daemoncontroller.go
index c45e17ab30..d5781a1d3d 100644
--- a/pkg/controller/daemon/daemoncontroller.go
+++ b/pkg/controller/daemon/daemoncontroller.go
@@ -1122,6 +1122,8 @@ func (dsc *DaemonSetsController) nodeShouldRunDaemonPod(node *v1.Node, ds *exten
// ignore pods that belong to the daemonset when taking into account whether
// a daemonset should bind to a node.
if controllerRef := controller.GetControllerOf(pod); controllerRef != nil && controllerRef.UID == ds.UID {
+ // Keep this pods's phase for toleration/taints check.
+ newPods.Status.Phase = pod.Status.Phase
@k82cn
k82cn / gist:143c7fcde2b25ad6856094c831541320
Created February 27, 2024 01:16
crictl inspectp 7299d5e37b42a
{
"status": {
"id": "7299d5e37b42a5e5139d8deb9190e9108d9cd791385aa451ec9cd49b296eaf30",
"metadata": {
"attempt": 0,
"name": "nginx",
"namespace": "default",
"uid": "1f7e5b49-10ca-4c05-8af2-b816b2933ad7"
},
"state": "SANDBOX_NOTREADY",