cli

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2017 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Overview

Copyright 2016 Google Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. /////////////////////////////////////////////////////////////////////////

Copyright 2016 Google Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. /////////////////////////////////////////////////////////////////////////

Copyright 2016 Google Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. /////////////////////////////////////////////////////////////////////////

Copyright 2016 Google Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. /////////////////////////////////////////////////////////////////////////

Copyright 2016 Google Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. /////////////////////////////////////////////////////////////////////////

Index

Constants

View Source
const AnnotationConfigId = "endpoints.googleapis.com/config-id"
View Source
const AnnotationConfigName = "endpoints.googleapis.com/config-name"

Label to tag ESP services with service config name and id

View Source
const AnnotationDeploymentType = "endpoints.googleapis.com/deployment-type"

Label to tag ESP services with the type of the deployment

View Source
const AnnotationEndpointsService = "endpoints.googleapis.com/endpoints"

Label to tag ESP pods for loosely coupled ESP services (to support multiple loose ESP deployments for a service)

View Source
const AnnotationManagedService = "endpoints.googleapis.com/managed-service"

Label to tag pods running ESP for a given k8s service Label to tag ESP services for a given k8s service

View Source
const EndpointsContainer = "gcr.io/endpoints-release/endpoints-runtime:1"
View Source
const EndpointsPrefix = "endpoints-"

Prefix for ESP managed resources

View Source
const MaxTries = 10

Variables

View Source
var RootCmd = &cobra.Command{
	Use:   "espcli",
	Short: "ESP deployment manager for Kubernetes",
	Long:  "A tool to deploy and monitor Extensible Service Proxy on a Kubernetes cluster",
	Run: func(cmd *cobra.Command, args []string) {
		log.Println("Please run 'espcli help' to see the list of available commands.")
	},
	PersistentPreRun: func(cmd *cobra.Command, args []string) {
		config, err := clientcmd.NewNonInteractiveDeferredLoadingClientConfig(
			clientcmd.NewDefaultClientConfigLoadingRules(),
			&clientcmd.ConfigOverrides{},
		).ClientConfig()
		if err != nil {
			log.Println("Cannot find the default Kubernetes configuration.")
			log.Println("Please check with kubectl your cluster config.")
			os.Exit(-2)
		}

		clientset, err = kubernetes.NewForConfig(config)
		if err != nil {
			log.Println("Cannot connect to the Kubernetes API: ", err)
			os.Exit(-2)
		}
	},
}

RootCmd for CLI

Functions

func AddConfig

func AddConfig(key string, files map[string]string) (string, error)

AddConfig creates a config map from a map of files

func AddSecret

func AddSecret(key string, files map[string]string) (string, error)

AddSecret creates a secret map from file contents

func CreateServiceConfig

func CreateServiceConfig(name, namespace string) error

CreateServiceConfig creates/enables/submits configuration for the service

func CreateServicePorts

func CreateServicePorts(ports Ports) []api.ServicePort

CreateServicePorts lists published ports for ESP container

func ExtractFromGCP

func ExtractFromGCP(name string)

ExtractFromGCP Logging service

func ExtractFromPods

func ExtractFromPods(name string)

ExtractFromPods fetches logs from pods running ESP container

func GetBackend

func GetBackend() (string, error)

GetBackend returns the backend address for ESP service

func GetESPEndpoints

func GetESPEndpoints(name string) (map[string]map[string]string, error)

GetESPEndpoints collects endpoints information

func GetESPServices

func GetESPServices(name string) ([]*versioned.Service, error)

GetESPServices for a Kubernetes service

func GetEndpoints

func GetEndpoints(svc *versioned.Service) (map[string]string, error)

GetEndpoints retrieves endpoints information for an ESP service

func InjectDeployment

func InjectDeployment(app string, ports Ports, backend string) (map[string]string, error)

InjectDeployment creates ESP pods

func InjectService

func InjectService(
	app string,
	selector map[string]string,
	ports Ports,
	serviceType api.ServiceType) (err error)

InjectService creates ESP service

func MakeContainer

func MakeContainer(serviceName string, ports Ports, backend string) (*api.Container, []api.Volume, error)

MakeContainer from ESP image

func PrintLogs

func PrintLogs(name, pod string)

PrintLogs from all pods and containers

Types

type Ports

type Ports struct {
	// contains filtered or unexported fields
}

Ports are named ports in use by ESP

Jump to

Keyboard shortcuts

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