k8s

package
v0.0.0-...-1a1319b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 27, 2020 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CHAIN_FILE               string = "chain.json"
	CHAIN_STATUS_FREE        int    = 0
	CHAIN_STATUS_ORGADD      int    = 1
	CHAIN_STATUS_PKGCC       int    = 2
	CHAIN_STATUS_DEPLOYCC    int    = 3
	CHAIN_STATUS_CALLCC      int    = 4
	CHAIN_STATUS_QUERY       int    = 5
	CHAIN_STATUS_CREATEING   int    = 101
	CHAIN_STATUS_CREAT_ERROR int    = 102
	CHAIN_STATUS_DELETING    int    = 201
)
View Source
const (
	NAMESPACES  string = "namespaces"
	DEPLOYMENTS string = "deployments"
	SERVICES    string = "services"
	API_V1      string = "/api/v1/"
	API_APP     string = "/apis/apps/v1/"
)
View Source
const (
	CLUSTER_CFG_FILE string = "cluster.json"
)
View Source
const (
	NODES string = "nodes"
)

Variables

This section is empty.

Functions

func AddChain

func AddChain(chain Chain) error

func AddCluster

func AddCluster(cluster Cluster) error

func CheckChainStatus

func CheckChainStatus(chainId string) error

func DeleteChain

func DeleteChain(chain Chain) error

func DeleteCluster

func DeleteCluster(clusterId string, creator string) error

func GetNodePort

func GetNodePort(m map[string][]public.ServiceNodePortSt, firstKey string, secondKey string) string

func GetServicesNodePort

func GetServicesNodePort(clusterId string, namespaceId string, netCfg public.DeployNetConfig) (error, map[string][]public.ServiceNodePortSt)

func UpdateChainStatus

func UpdateChainStatus(chain Chain) error

Types

type Chain

type Chain struct {
	AllianceId     string `json:"AllianceId,omitempty"`
	BlockChainId   string `json:"BlockChainId"`
	BlockChainName string `json:"BlockChainName"`
	BlockChainType string `json:"BlockChainType"`
	ClusterId      string `json:"ClusterId"`
	Version        string `json:"Version"`
	Status         int    `json:"Status"`
}

func GetChain

func GetChain(chainId string, clusterId string) (*Chain, error)

func GetChainById

func GetChainById(blockChainId string) (*Chain, error)

func GetChainByName

func GetChainByName(chainName string, clusterId string) (*Chain, error)

func GetChainOnlyByName

func GetChainOnlyByName(blockChainName string) (*Chain, error)

func GetChains

func GetChains(clusterId string) ([]Chain, error)

type Cluster

type Cluster struct {
	AllianceId string `json:"AllianceId,omitempty"`
	Creator    string `json:"Creator,omitempty"`
	ClusterId  string `json:"ClusterId"`
	ApiUrl     string `json:"ApiUrl"`
	HostDomain string `json:"HostDomain"`
	PublicIp   string `json:"PublicIp"`
	InterIp    string `json:"InterIp"`
	Cert       string `json:"Cert"`
	Key        string `json:"Key"`
}

func GetCluster

func GetCluster(clusterId string) (*Cluster, error)

func GetClusters

func GetClusters() ([]Cluster, error)

func GetClustersByUser

func GetClustersByUser(user string) ([]Cluster, error)

type HostList

type HostList struct {
	APIVersion string `json:"apiVersion"`
	Kind       string `json:"kind"`
	Metadata   struct {
		ResourceVersion string `json:"resourceVersion"`
		SelfLink        string `json:"selfLink"`
	} `json:"metadata"`
	Items []struct {
		Metadata struct {
			Name              string `json:"name"`
			ResourceVersion   string `json:"resourceVersion"`
			SelfLink          string `json:"selfLink"`
			UID               string `json:"uid"`
			CreationTimestamp string `json:"creationTimestamp"`
			Annotations       struct {
				Flannel_alpha_coreos_com_backend_data                  string `json:"flannel.alpha.coreos.com/backend-data"`
				Flannel_alpha_coreos_com_backend_type                  string `json:"flannel.alpha.coreos.com/backend-type"`
				Flannel_alpha_coreos_com_kube_subnet_manager           string `json:"flannel.alpha.coreos.com/kube-subnet-manager"`
				Flannel_alpha_coreos_com_public_ip                     string `json:"flannel.alpha.coreos.com/public-ip"`
				Kubeadm_alpha_kubernetes_io_cri_socket                 string `json:"kubeadm.alpha.kubernetes.io/cri-socket"`
				Node_alpha_kubernetes_io_ttl                           string `json:"node.alpha.kubernetes.io/ttl"`
				Volumes_kubernetes_io_controller_managed_attach_detach string `json:"volumes.kubernetes.io/controller-managed-attach-detach"`
			} `json:"annotations"`
			Labels struct {
				Beta_kubernetes_io_arch        string `json:"beta.kubernetes.io/arch"`
				Beta_kubernetes_io_os          string `json:"beta.kubernetes.io/os"`
				Kubernetes_io_arch             string `json:"kubernetes.io/arch"`
				Kubernetes_io_hostname         string `json:"kubernetes.io/hostname"`
				Kubernetes_io_os               string `json:"kubernetes.io/os"`
				Node_role_kubernetes_io_master string `json:"node-role.kubernetes.io/master"`
			} `json:"labels"`
		} `json:"metadata"`
		Spec struct {
			PodCIDR  string   `json:"podCIDR"`
			PodCIDRs []string `json:"podCIDRs"`
			Taints   []struct {
				Effect string `json:"effect"`
				Key    string `json:"key"`
			} `json:"taints"`
		} `json:"spec"`
		Status struct {
			Addresses []struct {
				Address string `json:"address"`
				Type    string `json:"type"`
			} `json:"addresses"`
			Allocatable struct {
				CPU               string `json:"cpu"`
				Ephemeral_storage string `json:"ephemeral-storage"`
				Hugepages_1Gi     string `json:"hugepages-1Gi"`
				Hugepages_2Mi     string `json:"hugepages-2Mi"`
				Memory            string `json:"memory"`
				Pods              string `json:"pods"`
			} `json:"allocatable"`
			Capacity struct {
				CPU               string `json:"cpu"`
				Ephemeral_storage string `json:"ephemeral-storage"`
				Hugepages_1Gi     string `json:"hugepages-1Gi"`
				Hugepages_2Mi     string `json:"hugepages-2Mi"`
				Memory            string `json:"memory"`
				Pods              string `json:"pods"`
			} `json:"capacity"`
			Conditions []struct {
				LastHeartbeatTime  string `json:"lastHeartbeatTime"`
				LastTransitionTime string `json:"lastTransitionTime"`
				Message            string `json:"message"`
				Reason             string `json:"reason"`
				Status             string `json:"status"`
				Type               string `json:"type"`
			} `json:"conditions"`
			DaemonEndpoints struct {
				KubeletEndpoint struct {
					Port int64 `json:"Port"`
				} `json:"kubeletEndpoint"`
			} `json:"daemonEndpoints"`
			Images []struct {
				Names     []string `json:"names"`
				SizeBytes int64    `json:"sizeBytes"`
			} `json:"images"`
			NodeInfo struct {
				Architecture            string `json:"architecture"`
				BootID                  string `json:"bootID"`
				ContainerRuntimeVersion string `json:"containerRuntimeVersion"`
				KernelVersion           string `json:"kernelVersion"`
				KubeProxyVersion        string `json:"kubeProxyVersion"`
				KubeletVersion          string `json:"kubeletVersion"`
				MachineID               string `json:"machineID"`
				OperatingSystem         string `json:"operatingSystem"`
				OsImage                 string `json:"osImage"`
				SystemUUID              string `json:"systemUUID"`
			} `json:"nodeInfo"`
		} `json:"status"`
	} `json:"items"`
}

func GetHostList

func GetHostList(clusterId string) (*HostList, error)

type Namespace

type Namespace struct {
	Metadata struct {
		Name              string    `json:"name"`
		SelfLink          string    `json:"selfLink"`
		UID               string    `json:"uid"`
		ResourceVersion   string    `json:"resourceVersion"`
		CreationTimestamp time.Time `json:"creationTimestamp"`
	} `json:"metadata"`
	Spec struct {
		Finalizers []string `json:"finalizers"`
	} `json:"spec"`
	Status struct {
		Phase string `json:"phase"`
	} `json:"status"`
}

func GetClusterNamespaces

func GetClusterNamespaces(cluserId string) ([]Namespace, error)

type Namespaces

type Namespaces struct {
	Kind       string `json:"kind"`
	APIVersion string `json:"apiVersion"`
	Metadata   struct {
		SelfLink        string `json:"selfLink"`
		ResourceVersion string `json:"resourceVersion"`
	} `json:"metadata"`
	Items []Namespace `json:"items"`
}

type Service

type Service struct {
	Metadata struct {
		Name              string    `json:"name"`
		Namespace         string    `json:"namespace"`
		SelfLink          string    `json:"selfLink"`
		UID               string    `json:"uid"`
		ResourceVersion   string    `json:"resourceVersion"`
		CreationTimestamp time.Time `json:"creationTimestamp"`
	} `json:"metadata"`
	Spec struct {
		Ports []struct {
			Name       string `json:"name"`
			Protocol   string `json:"protocol"`
			Port       int    `json:"port"`
			TargetPort int    `json:"targetPort"`
			NodePort   int    `json:"nodePort"`
		} `json:"ports"`
		Selector struct {
			App string `json:"app"`
		} `json:"selector"`
		ClusterIP             string `json:"clusterIP"`
		Type                  string `json:"type"`
		SessionAffinity       string `json:"sessionAffinity"`
		ExternalTrafficPolicy string `json:"externalTrafficPolicy"`
	} `json:"spec"`
	Status struct {
		LoadBalancer struct {
		} `json:"loadBalancer"`
	} `json:"status"`
}

func GetNamespaceServices

func GetNamespaceServices(clusterId string, namespaceId string) ([]Service, error)

type Services

type Services struct {
	Kind       string `json:"kind"`
	APIVersion string `json:"apiVersion"`
	Metadata   struct {
		SelfLink        string `json:"selfLink"`
		ResourceVersion string `json:"resourceVersion"`
	} `json:"metadata"`
	Items []Service `json:"items"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL