This file contains 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 "fmt" | |
// fibonacci 函数会返回一个返回 int 的函数。 | |
func fibonacci() func() int { | |
var x, y int = -1, 1 | |
return func() int { | |
x, y = y, x + y | |
return y |
This file contains 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 ( | |
"fmt" | |
"time" | |
) | |
type MyError struct { | |
When time.Time | |
What string |
This file contains 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 ( | |
"fmt" | |
"net/http" | |
) | |
type String string | |
type Struct struct { | |
Greeting string |
This file contains 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 ( | |
"fmt" | |
"tour/tree" | |
) | |
// Walk walks the tree t sending all values | |
// from the tree to the channel ch. | |
func Walk(t *tree.Tree, ch chan int) { |
This file contains 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 org.cloudfoundry.client.lib.CloudCredentials; | |
import org.cloudfoundry.client.lib.CloudFoundryClient; | |
import org.cloudfoundry.client.lib.domain.CloudApplication; | |
import org.cloudfoundry.client.lib.domain.CloudService; | |
import org.cloudfoundry.client.lib.domain.CloudSpace; | |
import java.net.MalformedURLException; | |
import java.net.URI; | |
import java.net.URL; |
This file contains 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
#include <stdint.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <stdio.h> | |
#define QSZ (1 << 10) | |
#define QMSK (QSZ - 1) | |
struct queue { | |
volatile uint32_t head; |
This file contains 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
dog | bird | cat | |
----|------|---- | |
foo | foo | foo | |
bar | bar | bar | |
baz | baz | baz |
This file contains 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
//A simplest case to call a independently running remote container runtime (e.g. sever.go). | |
func (r *runtime) GetContainerLogs(pod *api.Pod, containerID kubecontainer.ContainerID, logOptions *api.PodLogOptions, stdout, stderr io.Writer) error { | |
args := &Args{Pod: pod, ContainerID: containerID, LogOptions: logOptions} | |
url := "http://localhost:1234/logs" | |
message, err := json.Marshal(args) | |
if err != nil { | |
log.Fatalf("Fail to marshal args %v", err) | |
} |
This file contains 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
apiVersion: v1 | |
kind: Pod | |
metadata: | |
name: javaweb-2 | |
spec: | |
initContainers: | |
- name: war | |
image: resouer/sample:v2 | |
command: ["cp", "/sample.war", "/app"] | |
volumeMounts: |
This file contains 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
cri-o中infra container的处理,都在server/sandbox.go里。 | |
infra container即pod/sandbox,名字是:sandbox.name + "-infra" | |
infra container的管理逻辑是由kubelet控制的,调用crio的sandbox方法,比如下面的: | |
RunPodSandbox | |
负责hold network namespace of pod,所以需要处理: | |
1. set DNS option | |
2. mount /etc/resolv.conf |
OlderNewer