修改项目名称

This commit is contained in:
Aaron3S
2021-09-03 18:55:51 +08:00
parent 25881a2f10
commit 44bad28921
42 changed files with 165 additions and 165 deletions

View File

@@ -16,7 +16,7 @@ jobs:
- name: Prepare
id: prepare
run: |
DOCKER_IMAGE=kubeoperator/ekko-server
DOCKER_IMAGE=KubeOperator/kubepi-server
DOCKER_PLATFORMS=linux/amd64
TAG_NAME=${GITHUB_REF#refs/*/}
DOCKER_IMAGE_TAGS="--tag ${DOCKER_IMAGE}:${TAG_NAME} --tag ${DOCKER_IMAGE}:latest"

View File

@@ -32,4 +32,4 @@ build_bin:
build_all: build_web build_bin
build_docker:
docker build -t kubeoperator/ekko-server:master .
docker build -t KubeOperator/kubepi-server:master .

View File

@@ -3,8 +3,8 @@ package main
import (
"embed"
"github.com/KubeOperator/ekko/internal/route"
"github.com/KubeOperator/ekko/internal/server"
"github.com/KubeOperator/kubepi/internal/route"
"github.com/KubeOperator/kubepi/internal/server"
"github.com/spf13/cobra"
)

View File

@@ -40,7 +40,7 @@ spec:
spec:
containers:
- name: ekko
image: kubeoperator/ekko-server:latest
image: KubeOperator/kubepi-server:latest
imagePullPolicy: IfNotPresent
ports:
- containerPort: 2019

2
go.mod
View File

@@ -1,4 +1,4 @@
module github.com/KubeOperator/ekko
module github.com/KubeOperator/kubepi
go 1.16

View File

@@ -2,8 +2,8 @@ package cluster
import (
"fmt"
"github.com/KubeOperator/ekko/internal/service/v1/common"
"github.com/KubeOperator/ekko/pkg/kubernetes"
"github.com/KubeOperator/kubepi/internal/service/v1/common"
"github.com/KubeOperator/kubepi/pkg/kubernetes"
"github.com/kataras/iris/v12"
"github.com/kataras/iris/v12/context"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"

View File

@@ -4,16 +4,16 @@ import (
goContext "context"
"errors"
"fmt"
"github.com/KubeOperator/ekko/internal/api/v1/session"
v1 "github.com/KubeOperator/ekko/internal/model/v1"
v1Cluster "github.com/KubeOperator/ekko/internal/model/v1/cluster"
"github.com/KubeOperator/ekko/internal/server"
"github.com/KubeOperator/ekko/internal/service/v1/cluster"
"github.com/KubeOperator/ekko/internal/service/v1/clusterbinding"
"github.com/KubeOperator/ekko/internal/service/v1/common"
pkgV1 "github.com/KubeOperator/ekko/pkg/api/v1"
"github.com/KubeOperator/ekko/pkg/certificate"
"github.com/KubeOperator/ekko/pkg/kubernetes"
"github.com/KubeOperator/kubepi/internal/api/v1/session"
v1 "github.com/KubeOperator/kubepi/internal/model/v1"
v1Cluster "github.com/KubeOperator/kubepi/internal/model/v1/cluster"
"github.com/KubeOperator/kubepi/internal/server"
"github.com/KubeOperator/kubepi/internal/service/v1/cluster"
"github.com/KubeOperator/kubepi/internal/service/v1/clusterbinding"
"github.com/KubeOperator/kubepi/internal/service/v1/common"
pkgV1 "github.com/KubeOperator/kubepi/pkg/api/v1"
"github.com/KubeOperator/kubepi/pkg/certificate"
"github.com/KubeOperator/kubepi/pkg/kubernetes"
"github.com/asdine/storm/v3"
"github.com/kataras/iris/v12"
"github.com/kataras/iris/v12/context"

View File

@@ -3,8 +3,8 @@ package cluster
import (
goContext "context"
"fmt"
"github.com/KubeOperator/ekko/internal/service/v1/common"
"github.com/KubeOperator/ekko/pkg/kubernetes"
"github.com/KubeOperator/kubepi/internal/service/v1/common"
"github.com/KubeOperator/kubepi/pkg/kubernetes"
"github.com/kataras/iris/v12"
"github.com/kataras/iris/v12/context"
rbacV1 "k8s.io/api/rbac/v1"
@@ -105,7 +105,7 @@ func (h *Handler) CreateClusterRole() iris.Handler {
}
req.Annotations["builtin"] = "false"
req.Annotations["created-at"] = time.Now().Format("2006-01-02 15:04:05")
req.Labels[kubernetes.LabelManageKey] = "ekko"
req.Labels[kubernetes.LabelManageKey] = "kubepi"
resp, err := client.RbacV1().ClusterRoles().Create(goContext.TODO(), &req, metav1.CreateOptions{})
if err != nil {
ctx.StatusCode(iris.StatusInternalServerError)
@@ -175,7 +175,7 @@ func (h *Handler) ListClusterRoles() iris.Handler {
return
}
labels := []string{
fmt.Sprintf("%s=%s", kubernetes.LabelManageKey, "ekko"),
fmt.Sprintf("%s=%s", kubernetes.LabelManageKey, "kubepi"),
}
if scope != "" {
labels = append(labels, fmt.Sprintf("%s=%s", "kubeoperator.io/role-type", scope))

View File

@@ -1,9 +1,9 @@
package cluster
import (
"github.com/KubeOperator/ekko/internal/service/v1/common"
"github.com/KubeOperator/ekko/pkg/kubernetes"
"github.com/KubeOperator/ekko/pkg/logging"
"github.com/KubeOperator/kubepi/internal/service/v1/common"
"github.com/KubeOperator/kubepi/pkg/kubernetes"
"github.com/KubeOperator/kubepi/pkg/logging"
"github.com/kataras/iris/v12"
"github.com/kataras/iris/v12/context"
)

View File

@@ -4,13 +4,13 @@ import (
goContext "context"
"errors"
"fmt"
"github.com/KubeOperator/ekko/internal/api/v1/session"
v1 "github.com/KubeOperator/ekko/internal/model/v1"
v1Cluster "github.com/KubeOperator/ekko/internal/model/v1/cluster"
"github.com/KubeOperator/ekko/internal/server"
"github.com/KubeOperator/ekko/internal/service/v1/common"
"github.com/KubeOperator/ekko/pkg/collectons"
"github.com/KubeOperator/ekko/pkg/kubernetes"
"github.com/KubeOperator/kubepi/internal/api/v1/session"
v1 "github.com/KubeOperator/kubepi/internal/model/v1"
v1Cluster "github.com/KubeOperator/kubepi/internal/model/v1/cluster"
"github.com/KubeOperator/kubepi/internal/server"
"github.com/KubeOperator/kubepi/internal/service/v1/common"
"github.com/KubeOperator/kubepi/pkg/collectons"
"github.com/KubeOperator/kubepi/pkg/kubernetes"
"github.com/asdine/storm/v3"
"github.com/kataras/iris/v12"
"github.com/kataras/iris/v12/context"
@@ -66,7 +66,7 @@ func (h *Handler) UpdateClusterMember() iris.Handler {
Namespace: req.NamespaceRoles[i].Namespace,
Name: fmt.Sprintf("%s-%s-%s", name, req.Name, req.NamespaceRoles[i].Roles[j]),
Labels: map[string]string{
kubernetes.LabelManageKey: "ekko",
kubernetes.LabelManageKey: "kubepi",
kubernetes.LabelClusterId: c.UUID,
kubernetes.LabelUsername: req.Name,
},
@@ -99,7 +99,7 @@ func (h *Handler) UpdateClusterMember() iris.Handler {
ObjectMeta: metav1.ObjectMeta{
Name: fmt.Sprintf("%s-%s-%s", name, req.Name, req.ClusterRoles[i]),
Labels: map[string]string{
kubernetes.LabelManageKey: "ekko",
kubernetes.LabelManageKey: "kubepi",
kubernetes.LabelClusterId: c.UUID,
kubernetes.LabelUsername: req.Name,
},
@@ -156,7 +156,7 @@ func (h *Handler) GetClusterMember() iris.Handler {
return
}
labels := []string{
fmt.Sprintf("%s=%s", kubernetes.LabelManageKey, "ekko"),
fmt.Sprintf("%s=%s", kubernetes.LabelManageKey, "kubepi"),
fmt.Sprintf("%s=%s", kubernetes.LabelClusterId, c.UUID),
fmt.Sprintf("%s=%s", kubernetes.LabelUsername, binding.UserRef),
}

View File

@@ -3,8 +3,8 @@ package cluster
import (
goContext "context"
"fmt"
"github.com/KubeOperator/ekko/internal/service/v1/common"
"github.com/KubeOperator/ekko/pkg/kubernetes"
"github.com/KubeOperator/kubepi/internal/service/v1/common"
"github.com/KubeOperator/kubepi/pkg/kubernetes"
"github.com/kataras/iris/v12"
"github.com/kataras/iris/v12/context"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

View File

@@ -1,9 +1,9 @@
package cluster
import (
"github.com/KubeOperator/ekko/internal/service/v1/common"
"github.com/KubeOperator/ekko/pkg/kubernetes"
"github.com/KubeOperator/ekko/pkg/terminal"
"github.com/KubeOperator/kubepi/internal/service/v1/common"
"github.com/KubeOperator/kubepi/pkg/kubernetes"
"github.com/KubeOperator/kubepi/pkg/terminal"
"github.com/kataras/iris/v12"
"github.com/kataras/iris/v12/context"
"k8s.io/client-go/tools/remotecommand"

View File

@@ -1,7 +1,7 @@
package cluster
import (
v1Cluster "github.com/KubeOperator/ekko/internal/model/v1/cluster"
v1Cluster "github.com/KubeOperator/kubepi/internal/model/v1/cluster"
"time"
)

View File

@@ -11,13 +11,13 @@ import (
"strings"
"sync"
"github.com/KubeOperator/ekko/internal/api/v1/session"
v1Cluster "github.com/KubeOperator/ekko/internal/model/v1/cluster"
"github.com/KubeOperator/ekko/internal/service/v1/cluster"
"github.com/KubeOperator/ekko/internal/service/v1/clusterbinding"
"github.com/KubeOperator/ekko/internal/service/v1/common"
pkgV1 "github.com/KubeOperator/ekko/pkg/api/v1"
"github.com/KubeOperator/ekko/pkg/kubernetes"
"github.com/KubeOperator/kubepi/internal/api/v1/session"
v1Cluster "github.com/KubeOperator/kubepi/internal/model/v1/cluster"
"github.com/KubeOperator/kubepi/internal/service/v1/cluster"
"github.com/KubeOperator/kubepi/internal/service/v1/clusterbinding"
"github.com/KubeOperator/kubepi/internal/service/v1/common"
pkgV1 "github.com/KubeOperator/kubepi/pkg/api/v1"
"github.com/KubeOperator/kubepi/pkg/kubernetes"
"github.com/kataras/iris/v12"
"github.com/kataras/iris/v12/context"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

View File

@@ -3,13 +3,13 @@ package role
import (
"errors"
"fmt"
"github.com/KubeOperator/ekko/internal/api/v1/session"
v1Role "github.com/KubeOperator/ekko/internal/model/v1/role"
"github.com/KubeOperator/ekko/internal/server"
"github.com/KubeOperator/ekko/internal/service/v1/common"
"github.com/KubeOperator/ekko/internal/service/v1/role"
"github.com/KubeOperator/ekko/internal/service/v1/rolebinding"
pkgV1 "github.com/KubeOperator/ekko/pkg/api/v1"
"github.com/KubeOperator/kubepi/internal/api/v1/session"
v1Role "github.com/KubeOperator/kubepi/internal/model/v1/role"
"github.com/KubeOperator/kubepi/internal/server"
"github.com/KubeOperator/kubepi/internal/service/v1/common"
"github.com/KubeOperator/kubepi/internal/service/v1/role"
"github.com/KubeOperator/kubepi/internal/service/v1/rolebinding"
pkgV1 "github.com/KubeOperator/kubepi/pkg/api/v1"
"github.com/asdine/storm/v3"
"github.com/kataras/iris/v12"
"github.com/kataras/iris/v12/context"

View File

@@ -1,7 +1,7 @@
package session
import (
"github.com/KubeOperator/ekko/internal/service/v1/common"
"github.com/KubeOperator/kubepi/internal/service/v1/common"
"github.com/kataras/iris/v12"
"github.com/kataras/iris/v12/context"
"github.com/kataras/iris/v12/sessions"

View File

@@ -4,14 +4,14 @@ import (
goContext "context"
"errors"
"fmt"
v1Role "github.com/KubeOperator/ekko/internal/model/v1/role"
"github.com/KubeOperator/ekko/internal/service/v1/cluster"
"github.com/KubeOperator/ekko/internal/service/v1/common"
"github.com/KubeOperator/ekko/internal/service/v1/role"
"github.com/KubeOperator/ekko/internal/service/v1/rolebinding"
"github.com/KubeOperator/ekko/internal/service/v1/user"
"github.com/KubeOperator/ekko/pkg/collectons"
"github.com/KubeOperator/ekko/pkg/kubernetes"
v1Role "github.com/KubeOperator/kubepi/internal/model/v1/role"
"github.com/KubeOperator/kubepi/internal/service/v1/cluster"
"github.com/KubeOperator/kubepi/internal/service/v1/common"
"github.com/KubeOperator/kubepi/internal/service/v1/role"
"github.com/KubeOperator/kubepi/internal/service/v1/rolebinding"
"github.com/KubeOperator/kubepi/internal/service/v1/user"
"github.com/KubeOperator/kubepi/pkg/collectons"
"github.com/KubeOperator/kubepi/pkg/kubernetes"
"github.com/asdine/storm/v3"
"github.com/kataras/iris/v12"
"github.com/kataras/iris/v12/context"
@@ -259,7 +259,7 @@ func (h *Handler) GetClusterProfile() iris.Handler {
}
labels := []string{
fmt.Sprintf("%s=%s", kubernetes.LabelManageKey, "ekko"),
fmt.Sprintf("%s=%s", kubernetes.LabelManageKey, "kubepi"),
fmt.Sprintf("%s=%s", kubernetes.LabelClusterId, c.UUID),
fmt.Sprintf("%s=%s", kubernetes.LabelUsername, profile.Name),
}

View File

@@ -1,6 +1,6 @@
package user
import v1User "github.com/KubeOperator/ekko/internal/model/v1/user"
import v1User "github.com/KubeOperator/kubepi/internal/model/v1/user"
type User struct {
v1User.User

View File

@@ -3,16 +3,16 @@ package user
import (
"errors"
"fmt"
"github.com/KubeOperator/ekko/internal/api/v1/session"
v1 "github.com/KubeOperator/ekko/internal/model/v1"
v1Role "github.com/KubeOperator/ekko/internal/model/v1/role"
"github.com/KubeOperator/ekko/internal/server"
"github.com/KubeOperator/ekko/internal/service/v1/clusterbinding"
"github.com/KubeOperator/ekko/internal/service/v1/common"
"github.com/KubeOperator/ekko/internal/service/v1/rolebinding"
"github.com/KubeOperator/ekko/internal/service/v1/user"
pkgV1 "github.com/KubeOperator/ekko/pkg/api/v1"
"github.com/KubeOperator/ekko/pkg/collectons"
"github.com/KubeOperator/kubepi/internal/api/v1/session"
v1 "github.com/KubeOperator/kubepi/internal/model/v1"
v1Role "github.com/KubeOperator/kubepi/internal/model/v1/role"
"github.com/KubeOperator/kubepi/internal/server"
"github.com/KubeOperator/kubepi/internal/service/v1/clusterbinding"
"github.com/KubeOperator/kubepi/internal/service/v1/common"
"github.com/KubeOperator/kubepi/internal/service/v1/rolebinding"
"github.com/KubeOperator/kubepi/internal/service/v1/user"
pkgV1 "github.com/KubeOperator/kubepi/pkg/api/v1"
"github.com/KubeOperator/kubepi/pkg/collectons"
"github.com/asdine/storm/v3"
"github.com/kataras/iris/v12"
"github.com/kataras/iris/v12/context"

View File

@@ -3,19 +3,19 @@ package v1
import (
"errors"
"fmt"
"github.com/KubeOperator/ekko/internal/api/v1/cluster"
"github.com/KubeOperator/ekko/internal/api/v1/proxy"
"github.com/KubeOperator/ekko/internal/api/v1/role"
"github.com/KubeOperator/ekko/internal/api/v1/session"
"github.com/KubeOperator/ekko/internal/api/v1/user"
"github.com/KubeOperator/ekko/internal/api/v1/ws"
v1Role "github.com/KubeOperator/ekko/internal/model/v1/role"
"github.com/KubeOperator/ekko/internal/service/v1/common"
v1RoleService "github.com/KubeOperator/ekko/internal/service/v1/role"
v1RoleBindingService "github.com/KubeOperator/ekko/internal/service/v1/rolebinding"
pkgV1 "github.com/KubeOperator/ekko/pkg/api/v1"
"github.com/KubeOperator/ekko/pkg/collectons"
"github.com/KubeOperator/ekko/pkg/i18n"
"github.com/KubeOperator/kubepi/internal/api/v1/cluster"
"github.com/KubeOperator/kubepi/internal/api/v1/proxy"
"github.com/KubeOperator/kubepi/internal/api/v1/role"
"github.com/KubeOperator/kubepi/internal/api/v1/session"
"github.com/KubeOperator/kubepi/internal/api/v1/user"
"github.com/KubeOperator/kubepi/internal/api/v1/ws"
v1Role "github.com/KubeOperator/kubepi/internal/model/v1/role"
"github.com/KubeOperator/kubepi/internal/service/v1/common"
v1RoleService "github.com/KubeOperator/kubepi/internal/service/v1/role"
v1RoleBindingService "github.com/KubeOperator/kubepi/internal/service/v1/rolebinding"
pkgV1 "github.com/KubeOperator/kubepi/pkg/api/v1"
"github.com/KubeOperator/kubepi/pkg/collectons"
"github.com/KubeOperator/kubepi/pkg/i18n"
"github.com/asdine/storm/v3"
"github.com/kataras/iris/v12"
"github.com/kataras/iris/v12/context"

View File

@@ -1,8 +1,8 @@
package ws
import (
"github.com/KubeOperator/ekko/pkg/logging"
"github.com/KubeOperator/ekko/pkg/terminal"
"github.com/KubeOperator/kubepi/pkg/logging"
"github.com/KubeOperator/kubepi/pkg/terminal"
"github.com/kataras/iris/v12"
"github.com/kataras/iris/v12/context"
)

View File

@@ -3,9 +3,9 @@ package config
import (
"encoding/json"
"fmt"
v1 "github.com/KubeOperator/ekko/internal/model/v1"
"github.com/KubeOperator/ekko/internal/model/v1/config"
"github.com/KubeOperator/ekko/pkg/file"
v1 "github.com/KubeOperator/kubepi/internal/model/v1"
"github.com/KubeOperator/kubepi/internal/model/v1/config"
"github.com/KubeOperator/kubepi/pkg/file"
"github.com/coreos/etcd/pkg/fileutil"
"github.com/spf13/viper"
)
@@ -15,7 +15,7 @@ const configReadErr = "can not read config file %s ,%s"
const configMergeErr = "can not merge config file, %s"
var configFilePaths = []string{
"~/.ekko/conf",
"/etc/kubepi",
}
func ReadConfig(path ...string) (config.Config, error) {
@@ -77,7 +77,7 @@ func defaultConfig() config.Config {
},
},
DB: config.DBConfig{
Path: "~/.ekko/db",
Path: "/var/lib/kubepi/db",
},
Logger: config.LoggerConfig{Level: "debug"},
},

View File

@@ -1,6 +1,6 @@
package cluster
import v1 "github.com/KubeOperator/ekko/internal/model/v1"
import v1 "github.com/KubeOperator/kubepi/internal/model/v1"
type Binding struct {
v1.BaseModel `storm:"inline"`

View File

@@ -1,7 +1,7 @@
package cluster
import (
v1 "github.com/KubeOperator/ekko/internal/model/v1"
v1 "github.com/KubeOperator/kubepi/internal/model/v1"
)
type Cluster struct {

View File

@@ -1,6 +1,6 @@
package config
import v1 "github.com/KubeOperator/ekko/internal/model/v1"
import v1 "github.com/KubeOperator/kubepi/internal/model/v1"
type Config struct {
v1.BaseModel

View File

@@ -1,6 +1,6 @@
package project
import v1 "github.com/KubeOperator/ekko/internal/model/v1"
import v1 "github.com/KubeOperator/kubepi/internal/model/v1"
type Project struct {
v1.BaseModel `storm:"inline"`

View File

@@ -1,6 +1,6 @@
package role
import v1 "github.com/KubeOperator/ekko/internal/model/v1"
import v1 "github.com/KubeOperator/kubepi/internal/model/v1"
type PolicyRule struct {
Resource []string `json:"resource"`

View File

@@ -1,6 +1,6 @@
package user
import v1 "github.com/KubeOperator/ekko/internal/model/v1"
import v1 "github.com/KubeOperator/kubepi/internal/model/v1"
type User struct {
v1.BaseModel `storm:"inline"`

View File

@@ -1,7 +1,7 @@
package route
import (
v1 "github.com/KubeOperator/ekko/internal/api/v1"
v1 "github.com/KubeOperator/kubepi/internal/api/v1"
"github.com/kataras/iris/v12"
)

View File

@@ -1,7 +1,7 @@
package terminal
//import (
// shell "github.com/KubeOperator/ekko/internal/terminal"
// shell "github.com/KubeOperator/kubepi/internal/terminal"
// "github.com/kataras/iris/v12"
//)
//

View File

@@ -1,7 +1,7 @@
package ws
//import (
// shell "github.com/KubeOperator/ekko/internal/terminal"
// shell "github.com/KubeOperator/kubepi/internal/terminal"
// "github.com/kataras/iris/v12"
// "github.com/kataras/iris/v12/context"
//)

View File

@@ -3,11 +3,11 @@ package server
import (
"embed"
"fmt"
"github.com/KubeOperator/ekko/internal/config"
v1Config "github.com/KubeOperator/ekko/internal/model/v1/config"
"github.com/KubeOperator/ekko/migrate"
"github.com/KubeOperator/ekko/pkg/file"
"github.com/KubeOperator/ekko/pkg/i18n"
"github.com/KubeOperator/kubepi/internal/config"
v1Config "github.com/KubeOperator/kubepi/internal/model/v1/config"
"github.com/KubeOperator/kubepi/migrate"
"github.com/KubeOperator/kubepi/pkg/file"
"github.com/KubeOperator/kubepi/pkg/i18n"
"github.com/asdine/storm/v3"
"github.com/coreos/etcd/pkg/fileutil"
"github.com/kataras/iris/v12"

View File

@@ -1,9 +1,9 @@
package cluster
import (
v1Cluster "github.com/KubeOperator/ekko/internal/model/v1/cluster"
"github.com/KubeOperator/ekko/internal/service/v1/common"
"github.com/KubeOperator/ekko/pkg/storm"
v1Cluster "github.com/KubeOperator/kubepi/internal/model/v1/cluster"
"github.com/KubeOperator/kubepi/internal/service/v1/common"
"github.com/KubeOperator/kubepi/pkg/storm"
storm2 "github.com/asdine/storm/v3"
"github.com/google/uuid"
"time"

View File

@@ -2,8 +2,8 @@ package clusterbinding
import (
"errors"
v1Cluster "github.com/KubeOperator/ekko/internal/model/v1/cluster"
"github.com/KubeOperator/ekko/internal/service/v1/common"
v1Cluster "github.com/KubeOperator/kubepi/internal/model/v1/cluster"
"github.com/KubeOperator/kubepi/internal/service/v1/common"
"github.com/asdine/storm/v3/q"
"github.com/google/uuid"
"time"

View File

@@ -1,7 +1,7 @@
package common
import (
"github.com/KubeOperator/ekko/internal/server"
"github.com/KubeOperator/kubepi/internal/server"
"github.com/asdine/storm/v3"
)

View File

@@ -2,9 +2,9 @@ package role
import (
"errors"
v1Role "github.com/KubeOperator/ekko/internal/model/v1/role"
"github.com/KubeOperator/ekko/internal/service/v1/common"
costomStorm "github.com/KubeOperator/ekko/pkg/storm"
v1Role "github.com/KubeOperator/kubepi/internal/model/v1/role"
"github.com/KubeOperator/kubepi/internal/service/v1/common"
costomStorm "github.com/KubeOperator/kubepi/pkg/storm"
"github.com/asdine/storm/v3"
"github.com/asdine/storm/v3/q"
"github.com/google/uuid"

View File

@@ -2,8 +2,8 @@ package rolebinding
import (
"errors"
v1Role "github.com/KubeOperator/ekko/internal/model/v1/role"
"github.com/KubeOperator/ekko/internal/service/v1/common"
v1Role "github.com/KubeOperator/kubepi/internal/model/v1/role"
"github.com/KubeOperator/kubepi/internal/service/v1/common"
"github.com/asdine/storm/v3/q"
"github.com/google/uuid"
"time"

View File

@@ -2,11 +2,11 @@ package user
import (
"errors"
v1User "github.com/KubeOperator/ekko/internal/model/v1/user"
"github.com/KubeOperator/ekko/internal/service/v1/common"
"github.com/KubeOperator/ekko/internal/service/v1/role"
"github.com/KubeOperator/ekko/internal/service/v1/rolebinding"
costomStorm "github.com/KubeOperator/ekko/pkg/storm"
v1User "github.com/KubeOperator/kubepi/internal/model/v1/user"
"github.com/KubeOperator/kubepi/internal/service/v1/common"
"github.com/KubeOperator/kubepi/internal/service/v1/role"
"github.com/KubeOperator/kubepi/internal/service/v1/rolebinding"
costomStorm "github.com/KubeOperator/kubepi/pkg/storm"
"github.com/asdine/storm/v3"
"github.com/asdine/storm/v3/q"
"github.com/google/uuid"

View File

@@ -2,8 +2,8 @@ package migrate
import (
"errors"
"github.com/KubeOperator/ekko/migrate/migrations"
v1 "github.com/KubeOperator/ekko/migrate/v1"
"github.com/KubeOperator/kubepi/migrate/migrations"
v1 "github.com/KubeOperator/kubepi/migrate/v1"
"github.com/asdine/storm/v3"
"github.com/sirupsen/logrus"
"os"

View File

@@ -1,10 +1,10 @@
package v1
import (
v1 "github.com/KubeOperator/ekko/internal/model/v1"
v1Role "github.com/KubeOperator/ekko/internal/model/v1/role"
v1User "github.com/KubeOperator/ekko/internal/model/v1/user"
"github.com/KubeOperator/ekko/migrate/migrations"
v1 "github.com/KubeOperator/kubepi/internal/model/v1"
v1Role "github.com/KubeOperator/kubepi/internal/model/v1/role"
v1User "github.com/KubeOperator/kubepi/internal/model/v1/user"
"github.com/KubeOperator/kubepi/migrate/migrations"
"github.com/asdine/storm/v3"
"github.com/google/uuid"
"golang.org/x/crypto/bcrypt"

View File

@@ -26,7 +26,7 @@ var initClusterRoles = []rbacV1.ClusterRole{
"created-at": time.Now().Format("2006-01-02 15:04:05"),
},
Labels: map[string]string{
LabelManageKey: "ekko",
LabelManageKey: "kubepi",
LabelRoleTypeKey: RoleTypeCluster,
},
},
@@ -47,7 +47,7 @@ var initClusterRoles = []rbacV1.ClusterRole{
"created-at": time.Now().Format("2006-01-02 15:04:05"),
},
Labels: map[string]string{
LabelManageKey: "ekko",
LabelManageKey: "kubepi",
LabelRoleTypeKey: RoleTypeCluster},
},
Rules: []rbacV1.PolicyRule{
@@ -67,7 +67,7 @@ var initClusterRoles = []rbacV1.ClusterRole{
"created-at": time.Now().Format("2006-01-02 15:04:05"),
},
Labels: map[string]string{
LabelManageKey: "ekko",
LabelManageKey: "kubepi",
LabelRoleTypeKey: RoleTypeCluster},
},
Rules: []rbacV1.PolicyRule{
@@ -87,7 +87,7 @@ var initClusterRoles = []rbacV1.ClusterRole{
"created-at": time.Now().Format("2006-01-02 15:04:05"),
},
Labels: map[string]string{
LabelManageKey: "ekko",
LabelManageKey: "kubepi",
LabelRoleTypeKey: RoleTypeCluster},
},
Rules: []rbacV1.PolicyRule{
@@ -107,7 +107,7 @@ var initClusterRoles = []rbacV1.ClusterRole{
"created-at": time.Now().Format("2006-01-02 15:04:05"),
},
Labels: map[string]string{
LabelManageKey: "ekko",
LabelManageKey: "kubepi",
LabelRoleTypeKey: RoleTypeCluster},
},
Rules: []rbacV1.PolicyRule{
@@ -127,7 +127,7 @@ var initClusterRoles = []rbacV1.ClusterRole{
"created-at": time.Now().Format("2006-01-02 15:04:05"),
},
Labels: map[string]string{
LabelManageKey: "ekko",
LabelManageKey: "kubepi",
LabelRoleTypeKey: RoleTypeCluster},
},
Rules: []rbacV1.PolicyRule{
@@ -147,7 +147,7 @@ var initClusterRoles = []rbacV1.ClusterRole{
"created-at": time.Now().Format("2006-01-02 15:04:05"),
},
Labels: map[string]string{
LabelManageKey: "ekko",
LabelManageKey: "kubepi",
LabelRoleTypeKey: RoleTypeCluster},
},
Rules: []rbacV1.PolicyRule{
@@ -167,7 +167,7 @@ var initClusterRoles = []rbacV1.ClusterRole{
"created-at": time.Now().Format("2006-01-02 15:04:05"),
},
Labels: map[string]string{
LabelManageKey: "ekko",
LabelManageKey: "kubepi",
LabelRoleTypeKey: RoleTypeCluster},
},
Rules: []rbacV1.PolicyRule{
@@ -187,7 +187,7 @@ var initClusterRoles = []rbacV1.ClusterRole{
"created-at": time.Now().Format("2006-01-02 15:04:05"),
},
Labels: map[string]string{
LabelManageKey: "ekko",
LabelManageKey: "kubepi",
LabelRoleTypeKey: RoleTypeCluster},
},
Rules: []rbacV1.PolicyRule{
@@ -212,7 +212,7 @@ var initClusterRoles = []rbacV1.ClusterRole{
"created-at": time.Now().Format("2006-01-02 15:04:05"),
},
Labels: map[string]string{
LabelManageKey: "ekko",
LabelManageKey: "kubepi",
LabelRoleTypeKey: RoleTypeCluster},
},
Rules: []rbacV1.PolicyRule{
@@ -237,7 +237,7 @@ var initClusterRoles = []rbacV1.ClusterRole{
"created-at": time.Now().Format("2006-01-02 15:04:05"),
},
Labels: map[string]string{
LabelManageKey: "ekko",
LabelManageKey: "kubepi",
LabelRoleTypeKey: RoleTypeNamespace,
},
},
@@ -263,7 +263,7 @@ var initClusterRoles = []rbacV1.ClusterRole{
"created-at": time.Now().Format("2006-01-02 15:04:05"),
},
Labels: map[string]string{
LabelManageKey: "ekko",
LabelManageKey: "kubepi",
LabelRoleTypeKey: RoleTypeNamespace},
},
Rules: []rbacV1.PolicyRule{
@@ -288,7 +288,7 @@ var initClusterRoles = []rbacV1.ClusterRole{
"created-at": time.Now().Format("2006-01-02 15:04:05"),
},
Labels: map[string]string{
LabelManageKey: "ekko",
LabelManageKey: "kubepi",
LabelRoleTypeKey: RoleTypeNamespace},
},
Rules: []rbacV1.PolicyRule{
@@ -318,7 +318,7 @@ var initClusterRoles = []rbacV1.ClusterRole{
"created-at": time.Now().Format("2006-01-02 15:04:05"),
},
Labels: map[string]string{
LabelManageKey: "ekko",
LabelManageKey: "kubepi",
LabelRoleTypeKey: RoleTypeNamespace},
},
Rules: []rbacV1.PolicyRule{
@@ -348,7 +348,7 @@ var initClusterRoles = []rbacV1.ClusterRole{
"created-at": time.Now().Format("2006-01-02 15:04:05"),
},
Labels: map[string]string{
LabelManageKey: "ekko",
LabelManageKey: "kubepi",
LabelRoleTypeKey: RoleTypeNamespace,
},
},
@@ -369,7 +369,7 @@ var initClusterRoles = []rbacV1.ClusterRole{
"created-at": time.Now().Format("2006-01-02 15:04:05"),
},
Labels: map[string]string{
LabelManageKey: "ekko",
LabelManageKey: "kubepi",
LabelRoleTypeKey: RoleTypeNamespace,
},
},
@@ -390,7 +390,7 @@ var initClusterRoles = []rbacV1.ClusterRole{
"created-at": time.Now().Format("2006-01-02 15:04:05"),
},
Labels: map[string]string{
LabelManageKey: "ekko",
LabelManageKey: "kubepi",
LabelRoleTypeKey: RoleTypeNamespace,
},
},
@@ -421,7 +421,7 @@ var initClusterRoles = []rbacV1.ClusterRole{
"created-at": time.Now().Format("2006-01-02 15:04:05"),
},
Labels: map[string]string{
LabelManageKey: "ekko",
LabelManageKey: "kubepi",
LabelRoleTypeKey: RoleTypeNamespace,
},
},
@@ -452,7 +452,7 @@ var initClusterRoles = []rbacV1.ClusterRole{
"created-at": time.Now().Format("2006-01-02 15:04:05"),
},
Labels: map[string]string{
LabelManageKey: "ekko",
LabelManageKey: "kubepi",
LabelRoleTypeKey: RoleTypeNamespace,
},
},
@@ -488,7 +488,7 @@ var initClusterRoles = []rbacV1.ClusterRole{
"created-at": time.Now().Format("2006-01-02 15:04:05"),
},
Labels: map[string]string{
LabelManageKey: "ekko",
LabelManageKey: "kubepi",
LabelRoleTypeKey: RoleTypeNamespace,
},
},
@@ -519,7 +519,7 @@ var initClusterRoles = []rbacV1.ClusterRole{
"created-at": time.Now().Format("2006-01-02 15:04:05"),
},
Labels: map[string]string{
LabelManageKey: "ekko",
LabelManageKey: "kubepi",
LabelRoleTypeKey: RoleTypeNamespace,
},
},
@@ -540,7 +540,7 @@ var initClusterRoles = []rbacV1.ClusterRole{
"created-at": time.Now().Format("2006-01-02 15:04:05"),
},
Labels: map[string]string{
LabelManageKey: "ekko",
LabelManageKey: "kubepi",
LabelRoleTypeKey: RoleTypeNamespace,
},
},

View File

@@ -4,9 +4,9 @@ import (
"context"
"errors"
"fmt"
v1Cluster "github.com/KubeOperator/ekko/internal/model/v1/cluster"
"github.com/KubeOperator/ekko/pkg/certificate"
"github.com/KubeOperator/ekko/pkg/collectons"
v1Cluster "github.com/KubeOperator/kubepi/internal/model/v1/cluster"
"github.com/KubeOperator/kubepi/pkg/certificate"
"github.com/KubeOperator/kubepi/pkg/collectons"
v1 "k8s.io/api/authorization/v1"
certv1 "k8s.io/api/certificates/v1"
certv1beta1 "k8s.io/api/certificates/v1beta1"
@@ -62,7 +62,7 @@ func (k *Kubernetes) CreateOrUpdateClusterRoleBinding(clusterRoleName string, us
}
name := fmt.Sprintf("%s:%s:%s", username, clusterRoleName, k.UUID)
labels := map[string]string{
LabelManageKey: "ekko",
LabelManageKey: "kubepi",
LabelClusterId: k.UUID,
LabelUsername: username,
}
@@ -113,7 +113,7 @@ func (k *Kubernetes) CreateOrUpdateRolebinding(namespace string, clusterRoleName
return err
}
labels := map[string]string{
LabelManageKey: "ekko",
LabelManageKey: "kubepi",
LabelClusterId: k.UUID,
LabelUsername: username,
}
@@ -167,7 +167,7 @@ func (k *Kubernetes) CleanManagedClusterRole() error {
}
labels := []string{
fmt.Sprintf("%s=%s", LabelManageKey, "ekko"),
fmt.Sprintf("%s=%s", LabelManageKey, "kubepi"),
fmt.Sprintf("%s=%s", LabelClusterId, k.UUID),
}
return client.RbacV1().ClusterRoles().DeleteCollection(context.TODO(), metav1.DeleteOptions{}, metav1.ListOptions{
@@ -181,7 +181,7 @@ func (k *Kubernetes) CleanManagedClusterRoleBinding(username string) error {
return err
}
labels := []string{
fmt.Sprintf("%s=%s", LabelManageKey, "ekko"),
fmt.Sprintf("%s=%s", LabelManageKey, "kubepi"),
fmt.Sprintf("%s=%s", LabelClusterId, k.UUID),
}
if username != "" {
@@ -202,7 +202,7 @@ func (k *Kubernetes) CleanManagedRoleBinding(username string) error {
return err
}
labels := []string{
fmt.Sprintf("%s=%s", LabelManageKey, "ekko"),
fmt.Sprintf("%s=%s", LabelManageKey, "kubepi"),
fmt.Sprintf("%s=%s", LabelClusterId, k.UUID),
}
if username != "" {
@@ -239,7 +239,7 @@ func (k *Kubernetes) CanVisitAllNamespace(username string) (bool, error) {
}
roleSet := collectons.NewStringSet()
labels := []string{
fmt.Sprintf("%s=%s", LabelManageKey, "ekko"),
fmt.Sprintf("%s=%s", LabelManageKey, "kubepi"),
fmt.Sprintf("%s=%s", LabelClusterId, k.UUID),
fmt.Sprintf("%s=%s", LabelUsername, username),
}
@@ -386,7 +386,7 @@ func (k *Kubernetes) CreateCommonUser(commonName string) ([]byte, error) {
if minor > 18 {
csr := certv1.CertificateSigningRequest{
ObjectMeta: metav1.ObjectMeta{
Name: fmt.Sprintf("%s-%s-%d", commonName, "ekko", time.Now().Unix()),
Name: fmt.Sprintf("%s-%s-%d", commonName, "kubepi", time.Now().Unix()),
},
Spec: certv1.CertificateSigningRequestSpec{
SignerName: "kubernetes.io/kube-apiserver-client",
@@ -434,7 +434,7 @@ func (k *Kubernetes) CreateCommonUser(commonName string) ([]byte, error) {
name := "kubernetes.io/kube-apiserver-client"
csr := certv1beta1.CertificateSigningRequest{
ObjectMeta: metav1.ObjectMeta{
Name: fmt.Sprintf("%s-%s-%d", commonName, "ekko", time.Now().Unix()),
Name: fmt.Sprintf("%s-%s-%d", commonName, "kubepi", time.Now().Unix()),
},
Spec: certv1beta1.CertificateSigningRequestSpec{
SignerName: &name,