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
// 根据宿主机目录中的文件找到具体容器运行时 | |
detectRuntime("/var/run") | |
func detectRuntime(varRunPath string) []runtimeConfig { | |
var err error | |
var cfgs []runtimeConfig | |
// pouch | |
{ | |
_, err1 := os.Stat(fmt.Sprintf("%s/pouchd.sock", varRunPath)) |
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 ( | |
"context" | |
"flag" | |
"fmt" | |
"gopkg.in/yaml.v2" | |
"io/ioutil" | |
v1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1" | |
apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset" |
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
func main() { | |
s := time.Now() | |
args := os.Args[1:] | |
if len(args) != 6 { // for format LogExtractor.exe -f "From Time" -t "To Time" -i "Log file directory location" | |
fmt.Println("Please give proper command line arguments") | |
return | |
} | |
startTimeArg := args[1] | |
finishTimeArg := args[3] |
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 ( | |
"context" | |
"flag" | |
"fmt" | |
corev1 "k8s.io/api/core/v1" | |
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | |
"k8s.io/apimachinery/pkg/labels" | |
k8sruntime "k8s.io/apimachinery/pkg/runtime" |
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 ( | |
"context" | |
"flag" | |
"fmt" | |
corev1 "k8s.io/api/core/v1" | |
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | |
"k8s.io/apimachinery/pkg/labels" | |
k8sruntime "k8s.io/apimachinery/pkg/runtime" |
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
FROM golang:1.14.0-alpine3.11 as build-env | |
ADD . /src/github.com/${project} | |
# UFS cache | |
RUN apk update | |
WORKDIR /src/github.com/${project} | |
RUN GOARCH=amd64 CGO_ENABLED=0 go build -mod vendor -o ${app} github.com/${project} | |
# use the second image to minimize the size of the docker image | |
FROM alpine:3.11 | |
COPY --from=build-env /src/github.com/${project}/${app} /app/${app} |
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 ( | |
"context" | |
"fmt" | |
"runtime" | |
"sync" | |
"time" | |
) |
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 org.zeusro; | |
import com.google.gson.Gson; | |
import org.slf4j.Logger; | |
import org.slf4j.LoggerFactory; | |
import org.zeusro.util.SQLHelper; | |
import java.sql.Connection; | |
import java.sql.DriverManager; | |
import java.sql.ResultSet; |
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
signalChan := make(chan os.Signal) | |
// When using 'docker stop' to stop Container,'docker stop' will send SIGTERM to Container main process | |
// After 10 seconds,if container is still alive,Docker Damon will send SIGKILL to Kill Container | |
signal.Notify(signalChan, syscall.SIGTERM, syscall.SIGINT, syscall.SIGKILL) | |
go func() { | |
// do what you want | |
}() | |
<-signalChan |
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" | |
"io/ioutil" | |
"log" | |
"regexp" | |
"strings" | |
) |
NewerOlder