本文整理汇总了Golang中github.com/fabric8io/gofabric8/util.Errorf函数的典型用法代码示例。如果您正苦于以下问题:Golang Errorf函数的具体用法?Golang Errorf怎么用?Golang Errorf使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Errorf函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Golang代码示例。
示例1: downloadKubernetes
func downloadKubernetes(d downloadProperties) (err error) {
os := runtime.GOOS
arch := runtime.GOARCH
if runtime.GOOS == "windows" {
d.kubeBinary += ".exe"
}
_, err = exec.LookPath(d.kubeBinary)
if err != nil {
latestVersion, err := getLatestVersionFromGitHub(d.kubeDistroOrg, d.kubeDistroRepo)
if err != nil {
util.Errorf("Unable to get latest version for %s/%s %v", d.kubeDistroOrg, d.kubeDistroRepo, err)
return err
}
kubeURL := fmt.Sprintf(d.downloadURL+d.kubeDistroRepo+"/releases/"+d.extraPath+"v%s/%s-%s-%s", latestVersion, d.kubeDistroRepo, os, arch)
if runtime.GOOS == "windows" {
kubeURL += ".exe"
}
util.Infof("Downloading %s...\n", kubeURL)
fullPath := filepath.Join(getFabric8BinLocation(), d.kubeBinary)
err = downloadFile(fullPath, kubeURL)
if err != nil {
util.Errorf("Unable to download file %s/%s %v", fullPath, kubeURL, err)
return err
}
util.Successf("Downloaded %s\n", fullPath)
} else {
util.Successf("%s is already available on your PATH\n", d.kubeBinary)
}
return nil
}
开发者ID:rawlingsj,项目名称:gofabric8,代码行数:35,代码来源:install.go
示例2: openService
func openService(ns string, serviceName string, c *k8sclient.Client, printURL bool, retry bool) {
if retry {
if err := RetryAfter(40, func() error { return CheckService(ns, serviceName, c) }, 10*time.Second); err != nil {
util.Errorf("Could not find finalized endpoint being pointed to by %s: %v", serviceName, err)
os.Exit(1)
}
}
svcs, err := c.Services(ns).List(kubeApi.ListOptions{})
if err != nil {
util.Errorf("No services found %v\n", err)
}
found := false
for _, service := range svcs.Items {
if serviceName == service.Name {
url := service.ObjectMeta.Annotations[exposeURLAnnotation]
if printURL {
util.Successf("%s\n", url)
} else {
util.Successf("\nOpening URL %s\n", url)
browser.OpenURL(url)
}
found = true
break
}
}
if !found {
util.Errorf("No service %s in namespace %s\n", serviceName, ns)
}
}
开发者ID:fabric8io,项目名称:gofabric8,代码行数:31,代码来源:service.go
示例3: downloadFunktion
func downloadFunktion() (err error) {
os := runtime.GOOS
arch := runtime.GOARCH
_, err = exec.LookPath(funktion)
if err != nil {
latestVersion, err := getLatestVersionFromGitHub(fabric8io, funktionOperator)
if err != nil {
util.Errorf("Unable to get latest version for %s/%s %v", fabric8io, funktionOperator, err)
return err
}
funktionURL := fmt.Sprintf(githubURL+fabric8io+"/"+funktionOperator+"/releases/download/v%s/%s-%s-%s", latestVersion, funktionOperator, os, arch)
if runtime.GOOS == "windows" {
funktionURL += ".exe"
}
util.Infof("Downloading %s...\n", funktionURL)
fullPath := filepath.Join(getFabric8BinLocation(), funktion)
err = downloadFile(fullPath, funktionURL)
if err != nil {
util.Errorf("Unable to download file %s/%s %v", fullPath, funktionURL, err)
return err
}
util.Successf("Downloaded %s\n", fullPath)
} else {
util.Successf("%s is already available on your PATH\n", funktion)
}
return nil
}
开发者ID:fabric8io,项目名称:gofabric8,代码行数:31,代码来源:install.go
示例4: downloadKubernetes
func downloadKubernetes(isMinishift bool) (err error) {
os := runtime.GOOS
arch := runtime.GOARCH
if isMinishift {
kubeDistroOrg = minishiftOwner
kubeDistroRepo = minishift
kubeDownloadURL = minishiftDownloadURL
downloadPath = "download/"
kubeBinary = minishift
}
_, err = exec.LookPath(kubeBinary)
if err != nil {
latestVersion, err := getLatestVersionFromGitHub(kubeDistroOrg, kubeDistroRepo)
if err != nil {
util.Errorf("Unable to get latest version for %s/%s %v", kubeDistroOrg, kubeDistroRepo, err)
return err
}
kubeURL := fmt.Sprintf(kubeDownloadURL+kubeDistroRepo+"/releases/"+downloadPath+"v%s/%s-%s-%s", latestVersion, kubeDistroRepo, os, arch)
util.Infof("Downloading %s...", kubeURL)
err = downloadFile(writeFileLocation+kubeBinary, kubeURL)
if err != nil {
util.Errorf("Unable to download file %s/%s %v", writeFileLocation+kubeBinary, kubeURL, err)
return err
}
util.Successf("Downloaded %s\n", kubeBinary)
} else {
util.Successf("%s is already available on your PATH\n", kubeBinary)
}
return nil
}
开发者ID:gashcrumb,项目名称:gofabric8,代码行数:34,代码来源:install.go
示例5: createRoutesForDomain
func createRoutesForDomain(ns string, domain string, c *k8sclient.Client, oc *oclient.Client, fac *cmdutil.Factory) error {
rc, err := c.Services(ns).List(labels.Everything())
if err != nil {
util.Errorf("Failed to load services in namespace %s with error %v", ns, err)
return err
}
items := rc.Items
for _, service := range items {
// TODO use the external load balancer as a way to know if we should create a route?
name := service.ObjectMeta.Name
if name != "kubernetes" {
routes := oc.Routes(ns)
_, err = routes.Get(name)
if err != nil {
hostName := name + "." + domain
route := rapi.Route{
ObjectMeta: kapi.ObjectMeta{
Name: name,
},
Host: hostName,
ServiceName: name,
}
// lets create the route
_, err = routes.Create(&route)
if err != nil {
util.Errorf("Failed to create the route %s with error %v", name, err)
return err
}
}
}
}
return nil
}
开发者ID:Dumidu,项目名称:gofabric8,代码行数:33,代码来源:routes.go
示例6: deployFabric8SASSecurityContextConstraints
func deployFabric8SASSecurityContextConstraints(c *k8sclient.Client, f *cmdutil.Factory, ns string) (Result, error) {
name := Fabric8SASSCC
scc := kapi.SecurityContextConstraints{
ObjectMeta: kapi.ObjectMeta{
Name: name,
},
SELinuxContext: kapi.SELinuxContextStrategyOptions{
Type: kapi.SELinuxStrategyRunAsAny,
},
RunAsUser: kapi.RunAsUserStrategyOptions{
Type: kapi.RunAsUserStrategyRunAsAny,
},
Groups: []string{"system:serviceaccounts"},
Volumes: []kapi.FSType{kapi.FSTypeGitRepo, kapi.FSTypeConfigMap, kapi.FSTypeSecret, kapi.FSTypeEmptyDir},
}
_, err := c.SecurityContextConstraints().Get(name)
if err == nil {
err = c.SecurityContextConstraints().Delete(name)
if err != nil {
return Failure, err
}
}
_, err = c.SecurityContextConstraints().Create(&scc)
if err != nil {
util.Errorf("Cannot create SecurityContextConstraints: %v\n", err)
util.Errorf("Failed to create SecurityContextConstraints %v in namespace %s: %v\n", scc, ns, err)
return Failure, err
}
util.Infof("SecurityContextConstraints %s is setup correctly\n", name)
return Success, err
}
开发者ID:fabric8io,项目名称:gofabric8,代码行数:31,代码来源:deploy.go
示例7: createPV
func createPV(c *k8sclient.Client, ns string, pvcNames []string, sshCommand string) (Result, error) {
for _, pvcName := range pvcNames {
hostPath := path.Join("/data", ns, pvcName)
nsPvcName := ns + "-" + pvcName
pvs := c.PersistentVolumes()
rc, err := pvs.List(api.ListOptions{})
if err != nil {
util.Errorf("Failed to load PersistentVolumes with error %v\n", err)
}
items := rc.Items
for _, volume := range items {
if nsPvcName == volume.ObjectMeta.Name {
util.Infof("Already created PersistentVolumes for %s\n", nsPvcName)
}
}
// we no longer need to do chmod on kubernetes as we have init containers now
typeOfMaster := util.TypeOfMaster(c)
if typeOfMaster != util.Kubernetes || len(sshCommand) > 0 {
err = configureHostPathVolume(c, ns, hostPath, sshCommand)
if err != nil {
util.Errorf("Failed to configure the host path %s with error %v\n", hostPath, err)
}
}
// lets create a new PV
util.Infof("PersistentVolume name %s will be created on host path %s\n", nsPvcName, hostPath)
pv := api.PersistentVolume{
ObjectMeta: api.ObjectMeta{
Name: nsPvcName,
},
Spec: api.PersistentVolumeSpec{
Capacity: api.ResourceList{
api.ResourceName(api.ResourceStorage): resource.MustParse("1Gi"),
},
AccessModes: []api.PersistentVolumeAccessMode{api.ReadWriteOnce},
PersistentVolumeSource: api.PersistentVolumeSource{
HostPath: &api.HostPathVolumeSource{Path: hostPath},
},
PersistentVolumeReclaimPolicy: api.PersistentVolumeReclaimRecycle,
},
}
_, err = pvs.Create(&pv)
if err != nil {
util.Errorf("Failed to create PersistentVolume %s at %s with error %v\n", nsPvcName, hostPath, err)
}
}
return Success, nil
}
开发者ID:rawlingsj,项目名称:gofabric8,代码行数:53,代码来源:volumes.go
示例8: deployFabric8SecurityContextConstraints
func deployFabric8SecurityContextConstraints(c *k8sclient.Client, f *cmdutil.Factory, ns string) (Result, error) {
name := Fabric8SCC
if ns != "default" {
name += "-" + ns
}
var priority int32 = 10
scc := kapi.SecurityContextConstraints{
ObjectMeta: kapi.ObjectMeta{
Name: name,
},
Priority: &priority,
AllowPrivilegedContainer: true,
AllowHostNetwork: true,
AllowHostPorts: true,
Volumes: []kapi.FSType{kapi.FSTypeAll},
SELinuxContext: kapi.SELinuxContextStrategyOptions{
Type: kapi.SELinuxStrategyRunAsAny,
},
RunAsUser: kapi.RunAsUserStrategyOptions{
Type: kapi.RunAsUserStrategyRunAsAny,
},
Users: []string{
"system:serviceaccount:openshift-infra:build-controller",
"system:serviceaccount:" + ns + ":default",
"system:serviceaccount:" + ns + ":fabric8",
"system:serviceaccount:" + ns + ":gerrit",
"system:serviceaccount:" + ns + ":jenkins",
"system:serviceaccount:" + ns + ":router",
"system:serviceaccount:" + ns + ":registry",
"system:serviceaccount:" + ns + ":gogs",
"system:serviceaccount:" + ns + ":fluentd",
},
Groups: []string{bootstrappolicy.ClusterAdminGroup, bootstrappolicy.NodesGroup},
}
_, err := c.SecurityContextConstraints().Get(name)
if err == nil {
err = c.SecurityContextConstraints().Delete(name)
if err != nil {
return Failure, err
}
}
_, err = c.SecurityContextConstraints().Create(&scc)
if err != nil {
util.Errorf("Cannot create SecurityContextConstraints: %v\n", err)
util.Errorf("Failed to create SecurityContextConstraints %v in namespace %s: %v\n", scc, ns, err)
return Failure, err
}
util.Infof("SecurityContextConstraints %s is setup correctly\n", name)
return Success, err
}
开发者ID:fabric8io,项目名称:gofabric8,代码行数:50,代码来源:deploy.go
示例9: createPersistentVolume
func createPersistentVolume(cmd *cobra.Command, ns string, c *k8sclient.Client, fac *cmdutil.Factory) (Result, error) {
flags := cmd.Flags()
hostPath := flags.Lookup(hostPathFlag).Value.String()
name := flags.Lookup(nameFlag).Value.String()
pvs := c.PersistentVolumes()
rc, err := pvs.List(labels.Everything(), fields.Everything())
if err != nil {
util.Errorf("Failed to load PersistentVolumes with error %v", err)
return Failure, err
}
items := rc.Items
for _, volume := range items {
// TODO use the external load balancer as a way to know if we should create a route?
vname := volume.ObjectMeta.Name
if vname == name {
util.Infof("Already created PersistentVolumes for %s\n", name)
return Success, nil
}
}
if hostPath == "" {
return missingFlag(cmd, hostPathFlag)
}
if confirmAction(flags) == false {
return Failure, nil
}
// lets create a new PV
util.Infof("PersistentVolume name %s will be created on host path %s\n", name, hostPath)
pv := api.PersistentVolume{
ObjectMeta: api.ObjectMeta{
Name: name,
},
Spec: api.PersistentVolumeSpec{
Capacity: api.ResourceList{
api.ResourceName(api.ResourceStorage): resource.MustParse("100G"),
},
AccessModes: []api.PersistentVolumeAccessMode{api.ReadWriteMany},
PersistentVolumeSource: api.PersistentVolumeSource{
HostPath: &api.HostPathVolumeSource{Path: hostPath},
},
},
}
_, err = pvs.Create(&pv)
if err != nil {
util.Errorf("Failed to create PersistentVolume %s at %s with error %v", name, hostPath, err)
return Failure, err
}
return Success, nil
}
开发者ID:ALRubinger,项目名称:gofabric8,代码行数:50,代码来源:volume.go
示例10: install
func install(isMinishift bool) {
writeFileLocation := getFabric8BinLocation()
err := os.MkdirAll(writeFileLocation, 0700)
if err != nil {
util.Errorf("Unable to create directory to download files %s %v\n", writeFileLocation, err)
}
err = downloadDriver()
if err != nil {
util.Warnf("Unable to download driver %v\n", err)
}
d := getDownloadProperties(isMinishift)
err = downloadKubernetes(d)
if err != nil {
util.Warnf("Unable to download kubernetes distro %v\n", err)
}
err = downloadKubectlClient()
if err != nil {
util.Warnf("Unable to download client %v\n", err)
}
if d.isMiniShift {
err = downloadOpenShiftClient()
if err != nil {
util.Warnf("Unable to download client %v\n", err)
}
}
}
开发者ID:rawlingsj,项目名称:gofabric8,代码行数:33,代码来源:install.go
示例11: downloadClient
func downloadClient(isMinishift bool) (err error) {
os := runtime.GOOS
arch := runtime.GOARCH
_, err = exec.LookPath(kubectl)
if err != nil {
latestVersion, err := getLatestVersionFromGitHub(kubeDistroOrg, kubernetes)
if err != nil {
return fmt.Errorf("Unable to get latest version for %s/%s %v", kubeDistroOrg, kubernetes, err)
}
if isMinishift {
clientBinary = oc
return fmt.Errorf("Openshift client download not yet supported")
}
clientURL := fmt.Sprintf("https://storage.googleapis.com/kubernetes-release/release/v%s/bin/%s/%s/%s", latestVersion, os, arch, kubectl)
util.Infof("Downloading %s...", clientURL)
err = downloadFile(writeFileLocation+clientBinary, clientURL)
if err != nil {
util.Errorf("Unable to download file %s/%s %v", writeFileLocation+clientBinary, clientURL, err)
return err
}
util.Successf("Downloaded %s\n", clientBinary)
} else {
util.Successf("%s is already available on your PATH\n", clientBinary)
}
return nil
}
开发者ID:gashcrumb,项目名称:gofabric8,代码行数:32,代码来源:install.go
示例12: printSummary
func printSummary(typeOfMaster util.MasterType, externalNodeName string, ns string, domain string, c *k8sclient.Client) {
util.Info("\n")
util.Info("-------------------------\n")
util.Info("\n")
clientType := getClientTypeName(typeOfMaster)
if externalNodeName != "" {
util.Info("Deploying ingress controller on node ")
util.Successf("%s", externalNodeName)
util.Info(" use its external ip when configuring your wildcard DNS.\n")
util.Infof("To change node move the label: `%s label node %s %s- && %s label node $YOUR_NEW_NODE %s=true`\n", clientType, externalNodeName, externalIPLabel, clientType, externalIPLabel)
util.Info("\n")
}
util.Info("Default GOGS admin username/password = ")
util.Successf("%s/%s\n", gogsDefaultUsername, gogsDefaultPassword)
util.Info("\n")
found, _ := checkIfPVCsPending(c, ns)
if found {
util.Errorf("There are pending PersistentVolumeClaims\n")
util.Infof("If using a local cluster run `gofabric8 volumes` to create missing HostPath volumes\n")
util.Infof("If using a remote cloud then enable dynamic persistence with a StorageClass. For details see http://fabric8.io/guide/getStarted/persistence.html\n")
util.Info("\n")
}
util.Infof("Downloading images and waiting to open the fabric8 console...\n")
util.Info("\n")
util.Info("-------------------------\n")
}
开发者ID:fabric8io,项目名称:gofabric8,代码行数:29,代码来源:deploy.go
示例13: addIngressInfraLabel
func addIngressInfraLabel(c *k8sclient.Client, ns string) string {
nodeClient := c.Nodes()
nodes, err := nodeClient.List(api.ListOptions{})
if err != nil {
util.Errorf("\nUnable to find any nodes: %s\n", err)
}
changed := false
hasExistingExposeIPLabel, externalNodeName := hasExistingLabel(nodes, externalIPLabel)
if externalNodeName != "" {
return externalNodeName
}
if !hasExistingExposeIPLabel && len(nodes.Items) > 0 {
for _, node := range nodes.Items {
if !node.Spec.Unschedulable {
changed = addLabelIfNotExist(&node.ObjectMeta, externalIPLabel, "true")
if changed {
_, err = nodeClient.Update(&node)
if err != nil {
printError("Failed to label node with ", err)
}
return node.Name
}
}
}
}
if !changed && !hasExistingExposeIPLabel {
util.Warnf("Unable to add label for ingress controller to run on a specific node, please add manually: kubectl label node [your node name] %s=true", externalIPLabel)
}
return ""
}
开发者ID:fabric8io,项目名称:gofabric8,代码行数:30,代码来源:deploy.go
示例14: resolveBinaryLocation
// lets find the executable on the PATH or in the fabric8 directory
func resolveBinaryLocation(executable string) string {
path, err := exec.LookPath(executable)
if err != nil || fileNotExist(path) {
home := os.Getenv("HOME")
if home == "" {
util.Error("No $HOME environment variable found")
}
writeFileLocation := getFabric8BinLocation()
// lets try in the fabric8 folder
path = filepath.Join(writeFileLocation, executable)
if fileNotExist(path) {
path = executable
// lets try in the folder where we found the gofabric8 executable
folder, err := osext.ExecutableFolder()
if err != nil {
util.Errorf("Failed to find executable folder: %v\n", err)
} else {
path = filepath.Join(folder, executable)
if fileNotExist(path) {
util.Infof("Could not find executable at %v\n", path)
path = executable
}
}
}
}
util.Infof("using the executable %s\n", path)
return path
}
开发者ID:fabric8io,项目名称:gofabric8,代码行数:30,代码来源:start.go
示例15: downloadKubectlClient
func downloadKubectlClient() (err error) {
os := runtime.GOOS
arch := runtime.GOARCH
kubectlBinary := kubectl
if runtime.GOOS == "windows" {
kubectlBinary += ".exe"
}
_, err = exec.LookPath(kubectlBinary)
if err != nil {
latestVersion, err := getLatestVersionFromGitHub(kubernetes, kubernetes)
if err != nil {
return fmt.Errorf("Unable to get latest version for %s/%s %v", kubernetes, kubernetes, err)
}
clientURL := fmt.Sprintf("https://storage.googleapis.com/kubernetes-release/release/v%s/bin/%s/%s/%s", latestVersion, os, arch, kubectlBinary)
util.Infof("Downloading %s...\n", clientURL)
fullPath := filepath.Join(getFabric8BinLocation(), kubectlBinary)
err = downloadFile(fullPath, clientURL)
if err != nil {
util.Errorf("Unable to download file %s/%s %v", fullPath, clientURL, err)
return err
}
util.Successf("Downloaded %s\n", fullPath)
} else {
util.Successf("%s is already available on your PATH\n", kubectlBinary)
}
return nil
}
开发者ID:rawlingsj,项目名称:gofabric8,代码行数:34,代码来源:install.go
示例16: createPV
func createPV(c *k8sclient.Client, ns string, pvcNames []string, cmd *cobra.Command) (Result, error) {
for _, pvcName := range pvcNames {
hostPath := "/data/" + pvcName
pvs := c.PersistentVolumes()
rc, err := pvs.List(api.ListOptions{})
if err != nil {
util.Errorf("Failed to load PersistentVolumes with error %v\n", err)
}
items := rc.Items
for _, volume := range items {
vname := volume.ObjectMeta.Name
if vname == pvcName {
util.Infof("Already created PersistentVolumes for %s\n", pvcName)
}
}
err = configureHostPathVolume(c, ns, hostPath, cmd)
if err != nil {
util.Errorf("Failed to configure the host path %s with error %v\n", hostPath, err)
}
// lets create a new PV
util.Infof("PersistentVolume name %s will be created on host path %s\n", pvcName, hostPath)
pv := api.PersistentVolume{
ObjectMeta: api.ObjectMeta{
Name: pvcName,
},
Spec: api.PersistentVolumeSpec{
Capacity: api.ResourceList{
api.ResourceName(api.ResourceStorage): resource.MustParse("5Gi"),
},
AccessModes: []api.PersistentVolumeAccessMode{api.ReadWriteOnce},
PersistentVolumeSource: api.PersistentVolumeSource{
HostPath: &api.HostPathVolumeSource{Path: hostPath},
},
},
}
_, err = pvs.Create(&pv)
if err != nil {
util.Errorf("Failed to create PersistentVolume %s at %s with error %v\n", pvcName, hostPath, err)
}
}
return Success, nil
}
开发者ID:gashcrumb,项目名称:gofabric8,代码行数:47,代码来源:volumes.go
示例17: NewCmdInstall
// NewCmdInstall installs the dependencies to run the fabric8 microservices platform
func NewCmdInstall(f *cmdutil.Factory) *cobra.Command {
cmd := &cobra.Command{
Use: "install",
Short: "Installs the dependencies to locally run the fabric8 microservices platform",
Long: `Installs the dependencies to locally run the fabric8 microservices platform`,
Run: func(cmd *cobra.Command, args []string) {
if runtime.GOOS == "windows" {
util.Errorf("%s is not yet supported by gofabric8 install", runtime.GOOS)
}
isMinishift := cmd.Flags().Lookup(minishiftFlag).Value.String() == "true"
home := os.Getenv("HOME")
if home == "" {
util.Error("No $HOME environment variable found")
}
writeFileLocation = home + binLocation
err := os.MkdirAll(writeFileLocation, 0700)
if err != nil {
util.Errorf("Unable to create directory to download files %s %v\n", writeFileLocation, err)
}
err = downloadDriver()
if err != nil {
util.Warnf("Unable to download driver %v\n", err)
}
err = downloadKubernetes(isMinishift)
if err != nil {
util.Warnf("Unable to download kubernetes distro %v\n", err)
}
err = downloadClient(isMinishift)
if err != nil {
util.Warnf("Unable to download client %v\n", err)
}
},
}
cmd.PersistentFlags().Bool(minishiftFlag, false, "Install minishift rather than minikube")
return cmd
}
开发者ID:gashcrumb,项目名称:gofabric8,代码行数:46,代码来源:install.go
示例18: missingFlag
func missingFlag(cmd *cobra.Command, name string) (Result, error) {
util.Errorf("No option -%s specified!\n", hostPathFlag)
text := cmd.Name()
parent := cmd.Parent()
if parent != nil {
text = parent.Name() + " " + text
}
util.Infof("Please try something like: %s --%s='some value' ...\n\n", text, hostPathFlag)
return Failure, nil
}
开发者ID:ALRubinger,项目名称:gofabric8,代码行数:10,代码来源:common.go
示例19: createRoutesForDomain
func createRoutesForDomain(ns string, domain string, c *k8sclient.Client, oc *oclient.Client, fac *cmdutil.Factory) error {
rapi.AddToScheme(kapi.Scheme)
rapiv1.AddToScheme(kapi.Scheme)
rc, err := c.Services(ns).List(kapi.ListOptions{})
if err != nil {
util.Errorf("Failed to load services in namespace %s with error %v", ns, err)
return err
}
var labels = make(map[string]string)
labels["provider"] = "fabric8"
items := rc.Items
for _, service := range items {
// TODO use the external load balancer as a way to know if we should create a route?
name := service.ObjectMeta.Name
if name != "kubernetes" {
routes := oc.Routes(ns)
_, err = routes.Get(name)
if err != nil {
hostName := name + "." + domain
route := rapi.Route{
ObjectMeta: kapi.ObjectMeta{
Labels: labels,
Name: name,
},
Spec: rapi.RouteSpec{
Host: hostName,
To: kapi.ObjectReference{Name: name},
},
}
// lets create the route
_, err = routes.Create(&route)
if err != nil {
util.Errorf("Failed to create the route %s with error %v", name, err)
return err
}
}
}
}
return nil
}
开发者ID:rhuss,项目名称:gofabric8,代码行数:42,代码来源:routes.go
示例20: isMini
func isMini(c *k8sclient.Client, ns string) bool {
nodes, err := c.Nodes().List(api.ListOptions{})
if err != nil {
util.Errorf("\nUnable to find any nodes: %s\n", err)
}
if len(nodes.Items) == 1 {
node := nodes.Items[0]
return node.Name == minikubeNodeName || node.Name == minishiftNodeName || node.Name == boot2docker
}
return false
}
开发者ID:gashcrumb,项目名称:gofabric8,代码行数:11,代码来源:deploy.go
注:本文中的github.com/fabric8io/gofabric8/util.Errorf函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论