forked from kosmos-io/kosmos
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request kosmos-io#466 from yuleichun-striving/main
add codes for the creating of virtual cluster for tenants
- Loading branch information
Showing
54 changed files
with
3,498 additions
and
151 deletions.
There are no files selected for viewing
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
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
File renamed without changes.
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
name: virtual-cluster-operator | ||
namespace: kosmos-system | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRole | ||
metadata: | ||
name: virtual-cluster-operator | ||
rules: | ||
- apiGroups: ['*'] | ||
resources: ['*'] | ||
verbs: ["*"] | ||
- nonResourceURLs: ['*'] | ||
verbs: ["get"] | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRoleBinding | ||
metadata: | ||
name: virtual-cluster-operator | ||
roleRef: | ||
apiGroup: rbac.authorization.k8s.io | ||
kind: ClusterRole | ||
name: virtual-cluster-operator | ||
subjects: | ||
- kind: ServiceAccount | ||
name: virtual-cluster-operator | ||
namespace: kosmos-system | ||
--- | ||
apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
name: virtual-cluster-operator | ||
namespace: kosmos-system | ||
type: Opaque | ||
data: | ||
kubeconfig: __kubeconfig__ | ||
|
||
--- | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: virtual-cluster-operator | ||
namespace: kosmos-system | ||
labels: | ||
app: virtual-cluster-operator | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: virtual-cluster-operator | ||
template: | ||
metadata: | ||
labels: | ||
app: virtual-cluster-operator | ||
spec: | ||
serviceAccountName: virtual-cluster-operator | ||
containers: | ||
- name: virtual-cluster-operator | ||
image: repo1-cn-beijing.cr.volces.com/virtualcluster/virtualcluter/virtual-cluster-operator:ee1bcd33-dirty | ||
imagePullPolicy: IfNotPresent | ||
env: | ||
- name: IMAGE_REPOSITIRY | ||
value: repo1-cn-beijing.cr.volces.com/virtualcluster/virtualcluter | ||
volumeMounts: | ||
- name: credentials | ||
mountPath: /etc/virtual-cluster-operator | ||
readOnly: true | ||
command: | ||
- virtual-cluster-operator | ||
- --kubeconfig=/etc/virtual-cluster-operator/kubeconfig | ||
- --v=4 | ||
volumes: | ||
- name: credentials | ||
secret: | ||
secretName: virtual-cluster-operator |
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
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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
package constants | ||
|
||
import "time" | ||
|
||
const ( | ||
InitControllerName = "virtual-cluster-init-controller" | ||
KosmosJoinControllerName = "kosmos-join-controller" | ||
SystemNs = "kube-system" | ||
DefauleImageRepositoryEnv = "IMAGE_REPOSITIRY" | ||
DefauleImageVersionEnv = "IMAGE_VERSION" | ||
VirtualClusterStatusCompleted = "Completed" | ||
VirtualClusterFinalizerName = "kosmos.io/virtual-cluster-finalizer" | ||
ServiceType = "NodePort" | ||
EtcdServiceType = "ClusterIP" | ||
DisableCascadingDeletionLabel = "operator.virtualcluster.io/disable-cascading-deletion" | ||
ControllerFinalizerName = "operator.virtualcluster.io/finalizer" | ||
DefaultKubeconfigPath = "/etc/cluster-tree/cert" | ||
Label = "virtualCluster-app" | ||
ComponentBeReadyTimeout = 120 * time.Second | ||
|
||
// CertificateBlockType is a possible value for pem.Block.Type. | ||
CertificateBlockType = "CERTIFICATE" | ||
RsaKeySize = 2048 | ||
KeyExtension = ".key" | ||
CertExtension = ".crt" | ||
CertificateValidity = time.Hour * 24 * 365 | ||
CaCertAndKeyName = "ca" | ||
VirtualClusterCertAndKeyName = "virtualCluster" | ||
VirtualClusterSystemNamespace = "virtualCluster-system" | ||
ApiserverCertAndKeyName = "apiserver" | ||
EtcdCaCertAndKeyName = "etcd-ca" | ||
EtcdServerCertAndKeyName = "etcd-server" | ||
EtcdClientCertAndKeyName = "etcd-client" | ||
FrontProxyCaCertAndKeyName = "front-proxy-ca" | ||
FrontProxyClientCertAndKeyName = "front-proxy-client" | ||
|
||
//controlplane apiserver | ||
ApiServer = "apiserver" | ||
ApiServerReplicas = 1 | ||
ApiServerServiceSubnet = "10.237.6.18/29" | ||
ApiServerEtcdListenClientPort = 2379 | ||
ApiServerServiceType = "NodePort" | ||
// APICallRetryInterval defines how long kubeadm should wait before retrying a failed API operation | ||
ApiServerCallRetryInterval = 100 * time.Millisecond | ||
|
||
//controlplane etcd | ||
Etcd = "etcd" | ||
EtcdReplicas = 3 | ||
EtcdDataVolumeName = "etcd-data" | ||
EtcdListenClientPort = 2379 | ||
EtcdListenPeerPort = 2380 | ||
|
||
//controlplane kube-controller | ||
KubeControllerReplicas = 1 | ||
KubeControllerManagerComponent = "KubeControllerManager" | ||
KubeControllerManager = "kube-controller-manager" | ||
|
||
//controlplane scheduler | ||
VirtualClusterSchedulerReplicas = 1 | ||
VirtualClusterSchedulerComponent = "VirtualClusterScheduler" | ||
VirtualClusterSchedulerComponentConfigMap = "scheduler-config" | ||
VirtualClusterScheduler = "virtualCluster-scheduler" | ||
|
||
//controlplane auth | ||
AdminConfig = "admin-config" | ||
KubeConfig = "kubeconfig" | ||
|
||
//controlplane upload | ||
VirtualClusterLabelKeyName = "app.kubernetes.io/managed-by" | ||
VirtualClusterController = "virtual-cluster-controller" | ||
ClusterName = "virtualCluster-apiserver" | ||
UserName = "virtualCluster-admin" | ||
|
||
// InitAction represents init virtual cluster instance | ||
InitAction Action = "init" | ||
// DeInitAction represents delete virtual cluster instance | ||
DeInitAction Action = "deInit" | ||
) | ||
|
||
type Action string |
Oops, something went wrong.