Documentation ¶
Index ¶
- Constants
- Variables
- type GoClient
- func (c *GoClient) AppendClusterRoleBinding(name, role, toServiceAccount, toServiceAccountNs string) error
- func (c *GoClient) AppendRoleBinding(name, namespace, role, toServiceAccount, toServiceAccountNs string) error
- func (c *GoClient) Apply(object interface{}) (*unstructured.Unstructured, error)
- func (c *GoClient) ApplyForce(object interface{}) (*unstructured.Unstructured, error)
- func (c *GoClient) CheckIstio() (bool, error)
- func (c *GoClient) CreateClusterRole(name string, rule []rbacv1.PolicyRule) (bool, error)
- func (c *GoClient) CreateClusterRoleBinding(name, namespace, role, toServiceAccount string) (bool, error)
- func (c *GoClient) CreateConfigMap(namespace string, configmap *corev1.ConfigMap) (*corev1.ConfigMap, error)
- func (c *GoClient) CreateConfigMapWithValue(name, namespace, key, value string) (bool, error)
- func (c *GoClient) CreateDeployment(namespace string, deployment *v1.Deployment) (*v1.Deployment, error)
- func (c *GoClient) CreateLimitRange(name, namespace, reqMem, limitsMem, reqCpu, limitsCpu, ephemeralStorage string) (bool, error)
- func (c *GoClient) CreateNS(namespace string, labels map[string]string) (bool, error)
- func (c *GoClient) CreateNocalhostPriorityClass() error
- func (c *GoClient) CreateResourceQuota(...) (bool, error)
- func (c *GoClient) CreateRole(name, namespace string) (bool, error)
- func (c *GoClient) CreateRoleBinding(name, namespace, role, toServiceAccount string) (bool, error)
- func (c *GoClient) CreateSecret(namespace string, secret *corev1.Secret) (*corev1.Secret, error)
- func (c *GoClient) CreateService(namespace string, service *corev1.Service) (*corev1.Service, error)
- func (c *GoClient) CreateServiceAccount(name, namespace string) (bool, error)
- func (c *GoClient) CreateVirtualService(namespace string, vs *v1alpha3.VirtualService) (*v1alpha3.VirtualService, error)
- func (c *GoClient) Delete(object interface{}) error
- func (c *GoClient) DeleteConfigMap(namespace string, configmap *corev1.ConfigMap) (*corev1.ConfigMap, error)
- func (c *GoClient) DeleteDeployment(namespace, name string) error
- func (c *GoClient) DeleteJob(namespace, name string) error
- func (c *GoClient) DeleteLimitRange(name, namespace string) (bool, error)
- func (c *GoClient) DeleteNS(namespace string) (bool, error)
- func (c *GoClient) DeletePod(namespace, name string) error
- func (c *GoClient) DeleteResourceQuota(name, namespace string) (bool, error)
- func (c *GoClient) DeleteSecret(namespace string, name string) error
- func (c *GoClient) DeleteService(namespace, name string) error
- func (c *GoClient) DeleteServiceAccount(name, namespace string) error
- func (c *GoClient) DeleteVirtualService(namespace, name string) error
- func (c *GoClient) DeployNocalhostDep(namespace, serviceAccount, tag string) (bool, error)
- func (c *GoClient) DeployPrePullImages(images []string, namespace string) (bool, error)
- func (c *GoClient) ExistClusterRoleBinding(roleBinding string) (bool, *rbacv1.ClusterRoleBinding)
- func (c *GoClient) ExistDeployment(namespace, deployment string) (bool, *apiappsV1.Deployment)
- func (c *GoClient) ExistNs(namespace string) (bool, *corev1.Namespace)
- func (c *GoClient) ExistPriorityClass(name string) (bool, *schedulingv1.PriorityClass)
- func (c *GoClient) ExistServiceAccount(namespace, name string) (bool, *corev1.ServiceAccount)
- func (c *GoClient) GenerateNsName(userId uint64) string
- func (c *GoClient) GetClientSet() *kubernetes.Clientset
- func (c *GoClient) GetClusterNode() (*corev1.NodeList, error)
- func (c *GoClient) GetClusterRoleBinding(name string) (*rbacv1.ClusterRoleBinding, error)
- func (c *GoClient) GetClusterVersion() (*version.Info, error)
- func (c *GoClient) GetConfigMap(namespace, name string) (*corev1.ConfigMap, error)
- func (c *GoClient) GetConfigMapList(namespace string) (*corev1.ConfigMapList, error)
- func (c *GoClient) GetDepDeploymentStatus() error
- func (c *GoClient) GetDeployment(namespace, name string) (*v1.Deployment, error)
- func (c *GoClient) GetDeploymentList(namespace string) (*v1.DeploymentList, error)
- func (c *GoClient) GetDiscoveryClient() (*discovery.DiscoveryClient, error)
- func (c *GoClient) GetDiscoveryRESTMapper() (*restmapper.DeferredDiscoveryRESTMapper, error)
- func (c *GoClient) GetNamespace(namespace string) (*corev1.Namespace, error)
- func (c *GoClient) GetRestClient() (*restclient.RESTClient, error)
- func (c *GoClient) GetSecret(namespace, name string) (*corev1.Secret, error)
- func (c *GoClient) GetSecretList(namespace string) (*corev1.SecretList, error)
- func (c *GoClient) GetSecretListByType(namespace string, secretType string) (*corev1.SecretList, error)
- func (c *GoClient) GetService(namespace, name string) (*corev1.Service, error)
- func (c *GoClient) GetServiceAccount(name, namespace string) (*corev1.ServiceAccount, error)
- func (c *GoClient) GetServiceList(namespace string) (*corev1.ServiceList, error)
- func (c *GoClient) GetStorageClassList() (*storagev1.StorageClassList, error)
- func (c *GoClient) GetVirtualService(namespace, name string) (*v1alpha3.VirtualService, error)
- func (c *GoClient) GetVirtualServiceList(namespace string) (*v1alpha3.VirtualServiceList, error)
- func (c *GoClient) IfNocalhostNameSpaceExist() (bool, error)
- func (c *GoClient) IsAdmin() (bool, error)
- func (c *GoClient) IsNamespaceExist(ns string) (bool, error)
- func (c *GoClient) ListClusterRoleBindingByLabel(label string) (*rbacv1.ClusterRoleBindingList, error)
- func (c *GoClient) ListJobs(namespace string) (*batchv1.JobList, error)
- func (c *GoClient) ListPods(namespace string) (*corev1.PodList, error)
- func (c *GoClient) MatchedArtifactVersion(artifact, tags string) string
- func (c *GoClient) RefreshServiceAccount(name, namespace string)
- func (c *GoClient) RemoveClusterRoleBinding(name, toServiceAccount, toServiceAccountNs string) error
- func (c *GoClient) RemoveRoleBinding(name, namespace, toServiceAccount, toServiceAccountNs string) error
- func (c *GoClient) UpdateClusterRole(name string, rbacRule []rbacv1.PolicyRule) error
- func (c *GoClient) UpdateClusterRoleBindingForNocalhostLabel(name string) error
- func (c *GoClient) UpdateConfigMap(namespace string, configmap *corev1.ConfigMap) (*corev1.ConfigMap, error)
- func (c *GoClient) UpdateDeployment(namespace string, deployment *v1.Deployment) (*v1.Deployment, error)
- func (c *GoClient) UpdateRole(name, namespace string, rbacRule []rbacv1.PolicyRule) error
- func (c *GoClient) UpdateRoleBindingForNocalhostLabel(name, namespace string) error
- func (c *GoClient) UpdateSecret(namespace string, secret *corev1.Secret) (*corev1.Secret, error)
- func (c *GoClient) UpdateService(namespace string, service *corev1.Service) (*corev1.Service, error)
- func (c *GoClient) UpdateVirtualService(namespace string, vs *v1alpha3.VirtualService) (*v1alpha3.VirtualService, error)
- func (c *GoClient) WatchServiceAccount(name, namespace string) (*corev1.ServiceAccount, error)
- type InitResult
Constants ¶
const ( DepInstaller = "dep-installer-job" Dep = "nocalhost-dep" NocalhostLabel = "nocalhost-managed" Api = "nocalhost-api" )
Variables ¶
var LimitedRules = &rbacv1.PolicyRule{ Verbs: []string{"get", "list"}, Resources: []string{"resourcequotas", "roles"}, APIGroups: []string{"*"}, }
Functions ¶
This section is empty.
Types ¶
type GoClient ¶
type GoClient struct { DynamicClient dynamic.Interface Config []byte // contains filtered or unexported fields }
func NewAdminGoClient ¶
new client with time out
func NewGoClient ¶
func (*GoClient) AppendClusterRoleBinding ¶
func (c *GoClient) AppendClusterRoleBinding(name, role, toServiceAccount, toServiceAccountNs string) error
create roleBinding role=admin
func (*GoClient) AppendRoleBinding ¶
func (c *GoClient) AppendRoleBinding(name, namespace, role, toServiceAccount, toServiceAccountNs string) error
create roleBinding role=admin
func (*GoClient) Apply ¶
func (c *GoClient) Apply(object interface{}) (*unstructured.Unstructured, error)
func (*GoClient) ApplyForce ¶
func (c *GoClient) ApplyForce(object interface{}) (*unstructured.Unstructured, error)
func (*GoClient) CheckIstio ¶
func (*GoClient) CreateClusterRole ¶
cluster admin role for nocalhost
func (*GoClient) CreateClusterRoleBinding ¶
func (c *GoClient) CreateClusterRoleBinding(name, namespace, role, toServiceAccount string) (bool, error)
create clusterRoleBinding role=admin
func (*GoClient) CreateConfigMap ¶
func (*GoClient) CreateConfigMapWithValue ¶
Initial admin kubeconfig in cluster for admission webhook
func (*GoClient) CreateDeployment ¶
func (c *GoClient) CreateDeployment(namespace string, deployment *v1.Deployment) (*v1.Deployment, error)
func (*GoClient) CreateLimitRange ¶
func (c *GoClient) CreateLimitRange(name, namespace, reqMem, limitsMem, reqCpu, limitsCpu, ephemeralStorage string) ( bool, error, )
CreateLimitRange create default resource quota for container
func (*GoClient) CreateNS ¶
When create sub namespace for developer, label should set "nocalhost" for nocalhost-dep admission webhook muting when create nocalhost-reserved namesapce, label should set "nocalhost-reserved"
func (*GoClient) CreateNocalhostPriorityClass ¶
deploy priorityclass
func (*GoClient) CreateResourceQuota ¶
func (c *GoClient) CreateResourceQuota( name, namespace, reqMem, reqCpu, limitsMem, limitsCpu, storageCapacity, ephemeralStorage, pvcCount, lbCount string, ) ( bool, error, )
CreateResourceQuota Initial resource quota for namespace
func (*GoClient) CreateRole ¶
create user role for single namespace name default nocalhost-role
default create every developer can access all resource for he's namespace
func (*GoClient) CreateRoleBinding ¶
CreateRoleBinding bind roles for serviceAccount this use for given default serviceAccount default:view case by initContainer need use kubectl get pods....(clusterRole=view) and this will use for bind developer serviceAccount roles(clusterRole=nocalhost-roles)
func (*GoClient) CreateSecret ¶
func (*GoClient) CreateService ¶
func (*GoClient) CreateServiceAccount ¶
CreateServiceAccount for namespace(Authorization cluster for developer)
func (*GoClient) CreateVirtualService ¶
func (c *GoClient) CreateVirtualService(namespace string, vs *v1alpha3.VirtualService) (*v1alpha3.VirtualService, error)
func (*GoClient) DeleteConfigMap ¶
func (*GoClient) DeleteDeployment ¶
func (*GoClient) DeleteLimitRange ¶
func (*GoClient) DeleteResourceQuota ¶
func (*GoClient) DeleteSecret ¶
func (*GoClient) DeleteService ¶
func (*GoClient) DeleteServiceAccount ¶
func (*GoClient) DeleteVirtualService ¶
func (*GoClient) DeployNocalhostDep ¶
deploy nocalhost-dep now all value has set by default TODO this might better read from database manifest
func (*GoClient) DeployPrePullImages ¶
deploy pre pull images use DaemonSet InitContainer make sure every Node pull images https://kubernetes.io/zh/docs/concepts/workloads/controllers/daemonset/ when started it should kill himself
func (*GoClient) ExistClusterRoleBinding ¶
func (c *GoClient) ExistClusterRoleBinding(roleBinding string) (bool, *rbacv1.ClusterRoleBinding)
func (*GoClient) ExistDeployment ¶
func (c *GoClient) ExistDeployment(namespace, deployment string) (bool, *apiappsV1.Deployment)
func (*GoClient) ExistPriorityClass ¶
func (c *GoClient) ExistPriorityClass(name string) (bool, *schedulingv1.PriorityClass)
func (*GoClient) ExistServiceAccount ¶
func (c *GoClient) ExistServiceAccount(namespace, name string) (bool, *corev1.ServiceAccount)
func (*GoClient) GenerateNsName ¶
nocalhost create namespace use the rule: nocal+userId+4 random word, exp: nocal4esac namespace rules must match DNS-1123 label, capital doesn't allow
func (*GoClient) GetClientSet ¶
func (c *GoClient) GetClientSet() *kubernetes.Clientset
func (*GoClient) GetClusterNode ¶
Get cluster node
func (*GoClient) GetClusterRoleBinding ¶
func (c *GoClient) GetClusterRoleBinding(name string) (*rbacv1.ClusterRoleBinding, error)
func (*GoClient) GetClusterVersion ¶
Get cluster version
func (*GoClient) GetConfigMap ¶
func (*GoClient) GetConfigMapList ¶
func (c *GoClient) GetConfigMapList(namespace string) (*corev1.ConfigMapList, error)
GetConfigMapList get a list of configmaps.
func (*GoClient) GetDepDeploymentStatus ¶
get deployment
func (*GoClient) GetDeployment ¶
func (c *GoClient) GetDeployment(namespace, name string) (*v1.Deployment, error)
func (*GoClient) GetDeploymentList ¶
func (c *GoClient) GetDeploymentList(namespace string) (*v1.DeploymentList, error)
GetDeploymentList get a list of deployments.
func (*GoClient) GetDiscoveryClient ¶
func (c *GoClient) GetDiscoveryClient() (*discovery.DiscoveryClient, error)
func (*GoClient) GetDiscoveryRESTMapper ¶
func (c *GoClient) GetDiscoveryRESTMapper() (*restmapper.DeferredDiscoveryRESTMapper, error)
func (*GoClient) GetNamespace ¶
func (*GoClient) GetRestClient ¶
func (c *GoClient) GetRestClient() (*restclient.RESTClient, error)
func (*GoClient) GetSecretList ¶
func (c *GoClient) GetSecretList(namespace string) (*corev1.SecretList, error)
GetSecretList get a list of secrets.
func (*GoClient) GetSecretListByType ¶
func (c *GoClient) GetSecretListByType(namespace string, secretType string) (*corev1.SecretList, error)
GetSecretListByType get a list of secrets than select by type.
func (*GoClient) GetService ¶
func (*GoClient) GetServiceAccount ¶
func (c *GoClient) GetServiceAccount(name, namespace string) (*corev1.ServiceAccount, error)
Get serviceAccount
func (*GoClient) GetServiceList ¶
func (c *GoClient) GetServiceList(namespace string) (*corev1.ServiceList, error)
GetServiceList get a list of services.
func (*GoClient) GetStorageClassList ¶
func (c *GoClient) GetStorageClassList() (*storagev1.StorageClassList, error)
func (*GoClient) GetVirtualService ¶
func (c *GoClient) GetVirtualService(namespace, name string) (*v1alpha3.VirtualService, error)
func (*GoClient) GetVirtualServiceList ¶
func (c *GoClient) GetVirtualServiceList(namespace string) (*v1alpha3.VirtualServiceList, error)
GetVirtualServiceList get a list of virtualservices.
func (*GoClient) IfNocalhostNameSpaceExist ¶
check if exist namespace
func (*GoClient) IsAdmin ¶
check if admin for kubeconfig use SelfSubjectAccessReview check https://kubernetes.io/zh/docs/reference/access-authn-authz/authorization/ kubectl auth can-i '*' '*'
func (*GoClient) IsNamespaceExist ¶
IsNamespaceExist check if exist namespace
func (*GoClient) ListClusterRoleBindingByLabel ¶
func (c *GoClient) ListClusterRoleBindingByLabel(label string) (*rbacv1.ClusterRoleBindingList, error)
func (*GoClient) MatchedArtifactVersion ¶
Sprintf the specify artifact while image == "" or use the default image from param
func (*GoClient) RefreshServiceAccount ¶
nocalhost-dep watch the service account, so make some change to refresh the cache
func (*GoClient) RemoveClusterRoleBinding ¶
func (*GoClient) RemoveRoleBinding ¶
func (*GoClient) UpdateClusterRole ¶
func (c *GoClient) UpdateClusterRole(name string, rbacRule []rbacv1.PolicyRule) error
func (*GoClient) UpdateClusterRoleBindingForNocalhostLabel ¶
func (*GoClient) UpdateConfigMap ¶
func (*GoClient) UpdateDeployment ¶
func (c *GoClient) UpdateDeployment(namespace string, deployment *v1.Deployment) (*v1.Deployment, error)
func (*GoClient) UpdateRole ¶
func (c *GoClient) UpdateRole(name, namespace string, rbacRule []rbacv1.PolicyRule) error
func (*GoClient) UpdateRoleBindingForNocalhostLabel ¶
func (*GoClient) UpdateSecret ¶
func (*GoClient) UpdateService ¶
func (*GoClient) UpdateVirtualService ¶
func (c *GoClient) UpdateVirtualService(namespace string, vs *v1alpha3.VirtualService) (*v1alpha3.VirtualService, error)
func (*GoClient) WatchServiceAccount ¶
func (c *GoClient) WatchServiceAccount(name, namespace string) (*corev1.ServiceAccount, error)
Watch serviceAccount Bug Fix in Tencent TKE servieAccount secret will not return immediately
type InitResult ¶
type InitResult struct {
// contains filtered or unexported fields
}