mirror of https://github.com/k3s-io/k3s
Add proctitle package with linux and windows constraints
Signed-off-by: galal-hussein <hussein.galal.ahmed.11@gmail.com>pull/10063/head
parent
81171095b8
commit
48ff3bcddb
2
go.mod
2
go.mod
|
@ -4,7 +4,7 @@ go 1.22.2
|
||||||
|
|
||||||
replace (
|
replace (
|
||||||
github.com/Microsoft/hcsshim => github.com/Microsoft/hcsshim v0.11.0
|
github.com/Microsoft/hcsshim => github.com/Microsoft/hcsshim v0.11.0
|
||||||
github.com/Mirantis/cri-dockerd => github.com/k3s-io/cri-dockerd v0.3.12-k3s1.30-2 // k3s/release-1.30
|
github.com/Mirantis/cri-dockerd => github.com/k3s-io/cri-dockerd v0.3.12-k3s1.30-3 // k3s/release-1.30
|
||||||
github.com/cloudnativelabs/kube-router/v2 => github.com/k3s-io/kube-router/v2 v2.1.0
|
github.com/cloudnativelabs/kube-router/v2 => github.com/k3s-io/kube-router/v2 v2.1.0
|
||||||
github.com/containerd/containerd => github.com/k3s-io/containerd v1.7.15-k3s1
|
github.com/containerd/containerd => github.com/k3s-io/containerd v1.7.15-k3s1
|
||||||
github.com/docker/distribution => github.com/docker/distribution v2.8.3+incompatible
|
github.com/docker/distribution => github.com/docker/distribution v2.8.3+incompatible
|
||||||
|
|
|
@ -9,12 +9,12 @@ import (
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"runtime"
|
"runtime"
|
||||||
|
|
||||||
"github.com/erikdubbelboer/gspt"
|
|
||||||
"github.com/gorilla/mux"
|
"github.com/gorilla/mux"
|
||||||
"github.com/k3s-io/k3s/pkg/agent"
|
"github.com/k3s-io/k3s/pkg/agent"
|
||||||
"github.com/k3s-io/k3s/pkg/authenticator"
|
"github.com/k3s-io/k3s/pkg/authenticator"
|
||||||
"github.com/k3s-io/k3s/pkg/cli/cmds"
|
"github.com/k3s-io/k3s/pkg/cli/cmds"
|
||||||
"github.com/k3s-io/k3s/pkg/datadir"
|
"github.com/k3s-io/k3s/pkg/datadir"
|
||||||
|
"github.com/k3s-io/k3s/pkg/proctitle"
|
||||||
"github.com/k3s-io/k3s/pkg/spegel"
|
"github.com/k3s-io/k3s/pkg/spegel"
|
||||||
"github.com/k3s-io/k3s/pkg/util"
|
"github.com/k3s-io/k3s/pkg/util"
|
||||||
"github.com/k3s-io/k3s/pkg/version"
|
"github.com/k3s-io/k3s/pkg/version"
|
||||||
|
@ -31,7 +31,7 @@ func Run(ctx *cli.Context) error {
|
||||||
|
|
||||||
// hide process arguments from ps output, since they may contain
|
// hide process arguments from ps output, since they may contain
|
||||||
// database credentials or other secrets.
|
// database credentials or other secrets.
|
||||||
gspt.SetProcTitle(os.Args[0] + " agent")
|
proctitle.SetProcTitle(os.Args[0] + " agent")
|
||||||
|
|
||||||
// Evacuate cgroup v2 before doing anything else that may fork.
|
// Evacuate cgroup v2 before doing anything else that may fork.
|
||||||
if err := cmds.EvacuateCgroup2(); err != nil {
|
if err := cmds.EvacuateCgroup2(); err != nil {
|
||||||
|
|
|
@ -8,7 +8,6 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/erikdubbelboer/gspt"
|
|
||||||
"github.com/k3s-io/k3s/pkg/agent/util"
|
"github.com/k3s-io/k3s/pkg/agent/util"
|
||||||
"github.com/k3s-io/k3s/pkg/bootstrap"
|
"github.com/k3s-io/k3s/pkg/bootstrap"
|
||||||
"github.com/k3s-io/k3s/pkg/cli/cmds"
|
"github.com/k3s-io/k3s/pkg/cli/cmds"
|
||||||
|
@ -16,6 +15,7 @@ import (
|
||||||
"github.com/k3s-io/k3s/pkg/daemons/config"
|
"github.com/k3s-io/k3s/pkg/daemons/config"
|
||||||
"github.com/k3s-io/k3s/pkg/daemons/control/deps"
|
"github.com/k3s-io/k3s/pkg/daemons/control/deps"
|
||||||
"github.com/k3s-io/k3s/pkg/datadir"
|
"github.com/k3s-io/k3s/pkg/datadir"
|
||||||
|
"github.com/k3s-io/k3s/pkg/proctitle"
|
||||||
"github.com/k3s-io/k3s/pkg/server"
|
"github.com/k3s-io/k3s/pkg/server"
|
||||||
"github.com/k3s-io/k3s/pkg/util/services"
|
"github.com/k3s-io/k3s/pkg/util/services"
|
||||||
"github.com/k3s-io/k3s/pkg/version"
|
"github.com/k3s-io/k3s/pkg/version"
|
||||||
|
@ -27,7 +27,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func commandSetup(app *cli.Context, cfg *cmds.Server, sc *server.Config) (string, error) {
|
func commandSetup(app *cli.Context, cfg *cmds.Server, sc *server.Config) (string, error) {
|
||||||
gspt.SetProcTitle(os.Args[0])
|
proctitle.SetProcTitle(os.Args[0])
|
||||||
|
|
||||||
dataDir, err := datadir.Resolve(cfg.DataDir)
|
dataDir, err := datadir.Resolve(cfg.DataDir)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -11,7 +11,7 @@ import (
|
||||||
"syscall"
|
"syscall"
|
||||||
|
|
||||||
systemd "github.com/coreos/go-systemd/v22/daemon"
|
systemd "github.com/coreos/go-systemd/v22/daemon"
|
||||||
"github.com/erikdubbelboer/gspt"
|
"github.com/k3s-io/k3s/pkg/proctitle"
|
||||||
"github.com/k3s-io/k3s/pkg/version"
|
"github.com/k3s-io/k3s/pkg/version"
|
||||||
"github.com/natefinch/lumberjack"
|
"github.com/natefinch/lumberjack"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
|
@ -42,7 +42,7 @@ func forkIfLoggingOrReaping() error {
|
||||||
}
|
}
|
||||||
|
|
||||||
if enableLogRedirect || enableReaping {
|
if enableLogRedirect || enableReaping {
|
||||||
gspt.SetProcTitle(os.Args[0] + " init")
|
proctitle.SetProcTitle(os.Args[0] + " init")
|
||||||
|
|
||||||
pwd, err := os.Getwd()
|
pwd, err := os.Getwd()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -11,12 +11,12 @@ import (
|
||||||
"text/tabwriter"
|
"text/tabwriter"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/erikdubbelboer/gspt"
|
|
||||||
k3s "github.com/k3s-io/k3s/pkg/apis/k3s.cattle.io/v1"
|
k3s "github.com/k3s-io/k3s/pkg/apis/k3s.cattle.io/v1"
|
||||||
"github.com/k3s-io/k3s/pkg/cli/cmds"
|
"github.com/k3s-io/k3s/pkg/cli/cmds"
|
||||||
"github.com/k3s-io/k3s/pkg/clientaccess"
|
"github.com/k3s-io/k3s/pkg/clientaccess"
|
||||||
"github.com/k3s-io/k3s/pkg/cluster/managed"
|
"github.com/k3s-io/k3s/pkg/cluster/managed"
|
||||||
"github.com/k3s-io/k3s/pkg/etcd"
|
"github.com/k3s-io/k3s/pkg/etcd"
|
||||||
|
"github.com/k3s-io/k3s/pkg/proctitle"
|
||||||
"github.com/k3s-io/k3s/pkg/server"
|
"github.com/k3s-io/k3s/pkg/server"
|
||||||
util2 "github.com/k3s-io/k3s/pkg/util"
|
util2 "github.com/k3s-io/k3s/pkg/util"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
|
@ -31,7 +31,7 @@ import (
|
||||||
func commandSetup(app *cli.Context, cfg *cmds.Server) (*etcd.SnapshotRequest, *clientaccess.Info, error) {
|
func commandSetup(app *cli.Context, cfg *cmds.Server) (*etcd.SnapshotRequest, *clientaccess.Info, error) {
|
||||||
// hide process arguments from ps output, since they may contain
|
// hide process arguments from ps output, since they may contain
|
||||||
// database credentials or other secrets.
|
// database credentials or other secrets.
|
||||||
gspt.SetProcTitle(os.Args[0] + " etcd-snapshot")
|
proctitle.SetProcTitle(os.Args[0] + " etcd-snapshot")
|
||||||
|
|
||||||
sr := &etcd.SnapshotRequest{}
|
sr := &etcd.SnapshotRequest{}
|
||||||
// Operation and name are set by the command handler.
|
// Operation and name are set by the command handler.
|
||||||
|
|
|
@ -10,9 +10,9 @@ import (
|
||||||
"text/tabwriter"
|
"text/tabwriter"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/erikdubbelboer/gspt"
|
|
||||||
"github.com/k3s-io/k3s/pkg/cli/cmds"
|
"github.com/k3s-io/k3s/pkg/cli/cmds"
|
||||||
"github.com/k3s-io/k3s/pkg/clientaccess"
|
"github.com/k3s-io/k3s/pkg/clientaccess"
|
||||||
|
"github.com/k3s-io/k3s/pkg/proctitle"
|
||||||
"github.com/k3s-io/k3s/pkg/secretsencrypt"
|
"github.com/k3s-io/k3s/pkg/secretsencrypt"
|
||||||
"github.com/k3s-io/k3s/pkg/server"
|
"github.com/k3s-io/k3s/pkg/server"
|
||||||
"github.com/k3s-io/k3s/pkg/version"
|
"github.com/k3s-io/k3s/pkg/version"
|
||||||
|
@ -24,7 +24,7 @@ import (
|
||||||
func commandPrep(cfg *cmds.Server) (*clientaccess.Info, error) {
|
func commandPrep(cfg *cmds.Server) (*clientaccess.Info, error) {
|
||||||
// hide process arguments from ps output, since they may contain
|
// hide process arguments from ps output, since they may contain
|
||||||
// database credentials or other secrets.
|
// database credentials or other secrets.
|
||||||
gspt.SetProcTitle(os.Args[0] + " secrets-encrypt")
|
proctitle.SetProcTitle(os.Args[0] + " secrets-encrypt")
|
||||||
|
|
||||||
dataDir, err := server.ResolveDataDir(cfg.DataDir)
|
dataDir, err := server.ResolveDataDir(cfg.DataDir)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -10,7 +10,6 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
systemd "github.com/coreos/go-systemd/v22/daemon"
|
systemd "github.com/coreos/go-systemd/v22/daemon"
|
||||||
"github.com/erikdubbelboer/gspt"
|
|
||||||
"github.com/gorilla/mux"
|
"github.com/gorilla/mux"
|
||||||
"github.com/k3s-io/k3s/pkg/agent"
|
"github.com/k3s-io/k3s/pkg/agent"
|
||||||
"github.com/k3s-io/k3s/pkg/agent/loadbalancer"
|
"github.com/k3s-io/k3s/pkg/agent/loadbalancer"
|
||||||
|
@ -19,6 +18,7 @@ import (
|
||||||
"github.com/k3s-io/k3s/pkg/daemons/config"
|
"github.com/k3s-io/k3s/pkg/daemons/config"
|
||||||
"github.com/k3s-io/k3s/pkg/datadir"
|
"github.com/k3s-io/k3s/pkg/datadir"
|
||||||
"github.com/k3s-io/k3s/pkg/etcd"
|
"github.com/k3s-io/k3s/pkg/etcd"
|
||||||
|
"github.com/k3s-io/k3s/pkg/proctitle"
|
||||||
"github.com/k3s-io/k3s/pkg/rootless"
|
"github.com/k3s-io/k3s/pkg/rootless"
|
||||||
"github.com/k3s-io/k3s/pkg/server"
|
"github.com/k3s-io/k3s/pkg/server"
|
||||||
"github.com/k3s-io/k3s/pkg/spegel"
|
"github.com/k3s-io/k3s/pkg/spegel"
|
||||||
|
@ -55,7 +55,7 @@ func run(app *cli.Context, cfg *cmds.Server, leaderControllers server.CustomCont
|
||||||
|
|
||||||
// hide process arguments from ps output, since they may contain
|
// hide process arguments from ps output, since they may contain
|
||||||
// database credentials or other secrets.
|
// database credentials or other secrets.
|
||||||
gspt.SetProcTitle(os.Args[0] + " server")
|
proctitle.SetProcTitle(os.Args[0] + " server")
|
||||||
|
|
||||||
// If the agent is enabled, evacuate cgroup v2 before doing anything else that may fork.
|
// If the agent is enabled, evacuate cgroup v2 before doing anything else that may fork.
|
||||||
// If the agent is disabled, we don't need to bother doing this as it is only the kubelet
|
// If the agent is disabled, we don't need to bother doing this as it is only the kubelet
|
||||||
|
|
|
@ -11,10 +11,10 @@ import (
|
||||||
"text/tabwriter"
|
"text/tabwriter"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/erikdubbelboer/gspt"
|
|
||||||
"github.com/k3s-io/k3s/pkg/cli/cmds"
|
"github.com/k3s-io/k3s/pkg/cli/cmds"
|
||||||
"github.com/k3s-io/k3s/pkg/clientaccess"
|
"github.com/k3s-io/k3s/pkg/clientaccess"
|
||||||
"github.com/k3s-io/k3s/pkg/kubeadm"
|
"github.com/k3s-io/k3s/pkg/kubeadm"
|
||||||
|
"github.com/k3s-io/k3s/pkg/proctitle"
|
||||||
"github.com/k3s-io/k3s/pkg/server"
|
"github.com/k3s-io/k3s/pkg/server"
|
||||||
"github.com/k3s-io/k3s/pkg/util"
|
"github.com/k3s-io/k3s/pkg/util"
|
||||||
"github.com/k3s-io/k3s/pkg/version"
|
"github.com/k3s-io/k3s/pkg/version"
|
||||||
|
@ -171,7 +171,7 @@ func Rotate(app *cli.Context) error {
|
||||||
|
|
||||||
func serverAccess(cfg *cmds.Token) (*clientaccess.Info, error) {
|
func serverAccess(cfg *cmds.Token) (*clientaccess.Info, error) {
|
||||||
// hide process arguments from ps output, since they likely contain tokens.
|
// hide process arguments from ps output, since they likely contain tokens.
|
||||||
gspt.SetProcTitle(os.Args[0] + " token")
|
proctitle.SetProcTitle(os.Args[0] + " token")
|
||||||
|
|
||||||
dataDir, err := server.ResolveDataDir("")
|
dataDir, err := server.ResolveDataDir("")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
//go:build linux
|
||||||
|
// +build linux
|
||||||
|
|
||||||
|
package proctitle
|
||||||
|
|
||||||
|
import (
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"github.com/erikdubbelboer/gspt"
|
||||||
|
)
|
||||||
|
|
||||||
|
func SetProcTitle(cmd string) {
|
||||||
|
gspt.SetProcTitle(os.Args[0] + " agent")
|
||||||
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
//go:build windows
|
||||||
|
// +build windows
|
||||||
|
|
||||||
|
package proctitle
|
||||||
|
|
||||||
|
func SetProcTitle(cmd string) {}
|
Loading…
Reference in New Issue