| ... | ... |
@@ -1,6 +1,7 @@ |
| 1 | 1 |
package main |
| 2 | 2 |
|
| 3 | 3 |
import ( |
| 4 |
+ "fmt" |
|
| 4 | 5 |
"io" |
| 5 | 6 |
"os" |
| 6 | 7 |
"runtime" |
| ... | ... |
@@ -11,6 +12,7 @@ import ( |
| 11 | 11 |
|
| 12 | 12 |
kapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
| 13 | 13 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/conversion" |
| 14 |
+ "github.com/GoogleCloudPlatform/kubernetes/pkg/util" |
|
| 14 | 15 |
|
| 15 | 16 |
//"github.com/openshift/origin/pkg/api" |
| 16 | 17 |
_ "github.com/openshift/origin/pkg/api/v1beta1" |
| ... | ... |
@@ -59,7 +61,7 @@ func main() {
|
| 59 | 59 |
continue |
| 60 | 60 |
} |
| 61 | 61 |
if err := generator.GenerateConversionsForType(*version, knownType); err != nil {
|
| 62 |
- glog.Errorf("error while generating conversion functions for %v: %v", knownType, err)
|
|
| 62 |
+ util.HandleError(fmt.Errorf("error while generating conversion functions for %v: %v", knownType, err))
|
|
| 63 | 63 |
} |
| 64 | 64 |
} |
| 65 | 65 |
if err := generator.WriteConversionFunctions(funcOut); err != nil {
|
| ... | ... |
@@ -13,7 +13,7 @@ import ( |
| 13 | 13 |
"sort" |
| 14 | 14 |
"strings" |
| 15 | 15 |
|
| 16 |
- "github.com/golang/glog" |
|
| 16 |
+ "github.com/GoogleCloudPlatform/kubernetes/pkg/util" |
|
| 17 | 17 |
) |
| 18 | 18 |
|
| 19 | 19 |
var varyHeaderRegexp = regexp.MustCompile("\\s*,\\s*")
|
| ... | ... |
@@ -186,7 +186,7 @@ func GeneratedConfigHandler(config WebConsoleConfig, h http.Handler) http.Handle |
| 186 | 186 |
w.Header().Add("Cache-Control", "no-cache, no-store")
|
| 187 | 187 |
w.Header().Add("Content-Type", "application/json")
|
| 188 | 188 |
if err := configTemplate.Execute(w, config); err != nil {
|
| 189 |
- glog.Errorf("Unable to render config template: %v", err)
|
|
| 189 |
+ util.HandleError(fmt.Errorf("unable to render config template: %v", err))
|
|
| 190 | 190 |
} |
| 191 | 191 |
return |
| 192 | 192 |
} |
| ... | ... |
@@ -1,6 +1,7 @@ |
| 1 | 1 |
package grant |
| 2 | 2 |
|
| 3 | 3 |
import ( |
| 4 |
+ "fmt" |
|
| 4 | 5 |
"html/template" |
| 5 | 6 |
"net/http" |
| 6 | 7 |
"net/url" |
| ... | ... |
@@ -8,6 +9,7 @@ import ( |
| 8 | 8 |
|
| 9 | 9 |
kapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
| 10 | 10 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/auth/user" |
| 11 |
+ "github.com/GoogleCloudPlatform/kubernetes/pkg/util" |
|
| 11 | 12 |
|
| 12 | 13 |
"github.com/golang/glog" |
| 13 | 14 |
"github.com/openshift/origin/pkg/auth/authenticator" |
| ... | ... |
@@ -257,7 +259,7 @@ func (r grantTemplateRenderer) Render(form Form, w http.ResponseWriter, req *htt |
| 257 | 257 |
w.Header().Add("Content-Type", "text/html")
|
| 258 | 258 |
w.WriteHeader(http.StatusOK) |
| 259 | 259 |
if err := grantTemplate.Execute(w, form); err != nil {
|
| 260 |
- glog.Errorf("Unable to render grant template: %v", err)
|
|
| 260 |
+ util.HandleError(fmt.Errorf("unable to render grant template: %v", err))
|
|
| 261 | 261 |
} |
| 262 | 262 |
} |
| 263 | 263 |
|
| ... | ... |
@@ -1,12 +1,15 @@ |
| 1 | 1 |
package login |
| 2 | 2 |
|
| 3 | 3 |
import ( |
| 4 |
+ "fmt" |
|
| 4 | 5 |
"html/template" |
| 5 | 6 |
"net/http" |
| 6 | 7 |
|
| 7 | 8 |
"github.com/golang/glog" |
| 8 | 9 |
|
| 9 | 10 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/auth/user" |
| 11 |
+ "github.com/GoogleCloudPlatform/kubernetes/pkg/util" |
|
| 12 |
+ |
|
| 10 | 13 |
"github.com/openshift/origin/pkg/auth/authenticator" |
| 11 | 14 |
"github.com/openshift/origin/pkg/auth/oauth/handlers" |
| 12 | 15 |
"github.com/openshift/origin/pkg/auth/server/csrf" |
| ... | ... |
@@ -82,7 +85,7 @@ func (c *Confirm) handleConfirmForm(w http.ResponseWriter, req *http.Request) {
|
| 82 | 82 |
|
| 83 | 83 |
csrf, err := c.csrf.Generate(w, req) |
| 84 | 84 |
if err != nil {
|
| 85 |
- glog.Errorf("Unable to generate CSRF token: %v", err)
|
|
| 85 |
+ util.HandleError(fmt.Errorf("unable to generate CSRF token: %v", err))
|
|
| 86 | 86 |
} |
| 87 | 87 |
form.Values.CSRF = csrf |
| 88 | 88 |
|
| ... | ... |
@@ -128,7 +131,7 @@ func (r confirmTemplateRenderer) Render(form ConfirmForm, w http.ResponseWriter, |
| 128 | 128 |
w.Header().Add("Content-Type", "text/html")
|
| 129 | 129 |
w.WriteHeader(http.StatusOK) |
| 130 | 130 |
if err := confirmTemplate.Execute(w, form); err != nil {
|
| 131 |
- glog.Errorf("Unable render confirm template: %v", err)
|
|
| 131 |
+ util.HandleError(fmt.Errorf("unable render confirm template: %v", err))
|
|
| 132 | 132 |
} |
| 133 | 133 |
} |
| 134 | 134 |
|
| ... | ... |
@@ -1,12 +1,15 @@ |
| 1 | 1 |
package login |
| 2 | 2 |
|
| 3 | 3 |
import ( |
| 4 |
+ "fmt" |
|
| 4 | 5 |
"html/template" |
| 5 | 6 |
"net/http" |
| 6 | 7 |
"strings" |
| 7 | 8 |
|
| 8 | 9 |
"github.com/golang/glog" |
| 9 | 10 |
|
| 11 |
+ "github.com/GoogleCloudPlatform/kubernetes/pkg/util" |
|
| 12 |
+ |
|
| 10 | 13 |
"github.com/openshift/origin/pkg/auth/authenticator" |
| 11 | 14 |
"github.com/openshift/origin/pkg/auth/oauth/handlers" |
| 12 | 15 |
"github.com/openshift/origin/pkg/auth/server/csrf" |
| ... | ... |
@@ -98,7 +101,7 @@ func (l *Login) handleLoginForm(w http.ResponseWriter, req *http.Request) {
|
| 98 | 98 |
|
| 99 | 99 |
csrf, err := l.csrf.Generate(w, req) |
| 100 | 100 |
if err != nil {
|
| 101 |
- glog.Errorf("Unable to generate CSRF token: %v", err)
|
|
| 101 |
+ util.HandleError(fmt.Errorf("unable to generate CSRF token: %v", err))
|
|
| 102 | 102 |
} |
| 103 | 103 |
form.Values.CSRF = csrf |
| 104 | 104 |
|
| ... | ... |
@@ -138,7 +141,7 @@ func (r loginTemplateRenderer) Render(form LoginForm, w http.ResponseWriter, req |
| 138 | 138 |
w.Header().Add("Content-Type", "text/html")
|
| 139 | 139 |
w.WriteHeader(http.StatusOK) |
| 140 | 140 |
if err := loginTemplate.Execute(w, form); err != nil {
|
| 141 |
- glog.Errorf("Unable to render login template: %v", err)
|
|
| 141 |
+ util.HandleError(fmt.Errorf("unable to render login template: %v", err))
|
|
| 142 | 142 |
} |
| 143 | 143 |
} |
| 144 | 144 |
|
| ... | ... |
@@ -9,7 +9,8 @@ import ( |
| 9 | 9 |
"path" |
| 10 | 10 |
|
| 11 | 11 |
"github.com/RangelReale/osincli" |
| 12 |
- "github.com/golang/glog" |
|
| 12 |
+ |
|
| 13 |
+ "github.com/GoogleCloudPlatform/kubernetes/pkg/util" |
|
| 13 | 14 |
|
| 14 | 15 |
"github.com/openshift/origin/pkg/auth/server/login" |
| 15 | 16 |
) |
| ... | ... |
@@ -86,7 +87,7 @@ func (endpoints *endpointDetails) displayToken(w http.ResponseWriter, req *http. |
| 86 | 86 |
|
| 87 | 87 |
func renderToken(w io.Writer, data tokenData) {
|
| 88 | 88 |
if err := tokenTemplate.Execute(w, data); err != nil {
|
| 89 |
- glog.Errorf("Unable to render token template: %v", err)
|
|
| 89 |
+ util.HandleError(fmt.Errorf("unable to render token template: %v", err))
|
|
| 90 | 90 |
} |
| 91 | 91 |
} |
| 92 | 92 |
|
| ... | ... |
@@ -1,9 +1,12 @@ |
| 1 | 1 |
package builder |
| 2 | 2 |
|
| 3 | 3 |
import ( |
| 4 |
+ "fmt" |
|
| 4 | 5 |
"os" |
| 5 | 6 |
"time" |
| 6 | 7 |
|
| 8 |
+ "github.com/GoogleCloudPlatform/kubernetes/pkg/util" |
|
| 9 |
+ |
|
| 7 | 10 |
docker "github.com/fsouza/go-dockerclient" |
| 8 | 11 |
"github.com/golang/glog" |
| 9 | 12 |
"github.com/openshift/source-to-image/pkg/tar" |
| ... | ... |
@@ -41,7 +44,7 @@ func pushImage(client DockerClient, name string, authConfig docker.AuthConfigura |
| 41 | 41 |
if retries == DefaultPushRetryCount {
|
| 42 | 42 |
return err |
| 43 | 43 |
} |
| 44 |
- glog.Errorf("Push for image %s failed, will retry in %ds ...", name, DefaultPushRetryDelay)
|
|
| 44 |
+ util.HandleError(fmt.Errorf("push for image %s failed, will retry in %ds ...", name, DefaultPushRetryDelay))
|
|
| 45 | 45 |
glog.Flush() |
| 46 | 46 |
time.Sleep(DefaultPushRetryDelay) |
| 47 | 47 |
} |
| ... | ... |
@@ -1,6 +1,7 @@ |
| 1 | 1 |
package deployerpod |
| 2 | 2 |
|
| 3 | 3 |
import ( |
| 4 |
+ "fmt" |
|
| 4 | 5 |
"time" |
| 5 | 6 |
|
| 6 | 7 |
"github.com/golang/glog" |
| ... | ... |
@@ -112,7 +113,7 @@ func pollPods(deploymentStore cache.Store, kClient kclient.Interface) (cache.Enu |
| 112 | 112 |
deployment.Annotations[deployapi.DeploymentStatusReasonAnnotation] = deployapi.DeploymentFailedDeployerPodNoLongerExists |
| 113 | 113 |
|
| 114 | 114 |
if _, err := kClient.ReplicationControllers(deployment.Namespace).Update(deployment); err != nil {
|
| 115 |
- glog.Errorf("couldn't update deployment %s to status %s: %v", deployutil.LabelForDeployment(deployment), nextStatus, err)
|
|
| 115 |
+ kutil.HandleError(fmt.Errorf("couldn't update deployment %s to status %s: %v", deployutil.LabelForDeployment(deployment), nextStatus, err))
|
|
| 116 | 116 |
} |
| 117 | 117 |
glog.V(2).Infof("Updated deployment %s status from %s to %s", deployutil.LabelForDeployment(deployment), currentStatus, nextStatus)
|
| 118 | 118 |
} |
| ... | ... |
@@ -9,6 +9,7 @@ import ( |
| 9 | 9 |
kapi "github.com/GoogleCloudPlatform/kubernetes/pkg/api" |
| 10 | 10 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/api/errors" |
| 11 | 11 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/client/record" |
| 12 |
+ "github.com/GoogleCloudPlatform/kubernetes/pkg/util" |
|
| 12 | 13 |
|
| 13 | 14 |
deployapi "github.com/openshift/origin/pkg/deploy/api" |
| 14 | 15 |
deployutil "github.com/openshift/origin/pkg/deploy/util" |
| ... | ... |
@@ -84,7 +85,7 @@ func (c *DeploymentConfigController) Handle(config *deployapi.DeploymentConfig) |
| 84 | 84 |
deploymentForCancellation.Annotations[deployapi.DeploymentCancelledAnnotation] = deployapi.DeploymentCancelledAnnotationValue |
| 85 | 85 |
deploymentForCancellation.Annotations[deployapi.DeploymentStatusReasonAnnotation] = deployapi.DeploymentCancelledNewerDeploymentExists |
| 86 | 86 |
if _, err := c.deploymentClient.updateDeployment(deploymentForCancellation.Namespace, deploymentForCancellation); err != nil {
|
| 87 |
- glog.Errorf("couldn't cancel Deployment %s: %v", deployutil.LabelForDeployment(deploymentForCancellation), err)
|
|
| 87 |
+ util.HandleError(fmt.Errorf("couldn't cancel Deployment %s: %v", deployutil.LabelForDeployment(deploymentForCancellation), err))
|
|
| 88 | 88 |
} |
| 89 | 89 |
glog.V(4).Infof("Cancelled Deployment %s for DeploymentConfig %s", deployutil.LabelForDeployment(deploymentForCancellation), deployutil.LabelForDeploymentConfig(config))
|
| 90 | 90 |
} |
| ... | ... |
@@ -11,6 +11,7 @@ import ( |
| 11 | 11 |
kerrors "github.com/GoogleCloudPlatform/kubernetes/pkg/api/errors" |
| 12 | 12 |
kclient "github.com/GoogleCloudPlatform/kubernetes/pkg/client" |
| 13 | 13 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime" |
| 14 |
+ "github.com/GoogleCloudPlatform/kubernetes/pkg/util" |
|
| 14 | 15 |
|
| 15 | 16 |
deployapi "github.com/openshift/origin/pkg/deploy/api" |
| 16 | 17 |
stratsupport "github.com/openshift/origin/pkg/deploy/strategy/support" |
| ... | ... |
@@ -80,7 +81,7 @@ func (s *RecreateDeploymentStrategy) Deploy(deployment *kapi.ReplicationControll |
| 80 | 80 |
if desired, hasDesired := deployment.Annotations[deployapi.DesiredReplicasAnnotation]; hasDesired {
|
| 81 | 81 |
val, err := strconv.Atoi(desired) |
| 82 | 82 |
if err != nil {
|
| 83 |
- glog.Errorf("Deployment has an invalid desired replica count '%s'; falling back to config value %d", desired, desiredReplicas)
|
|
| 83 |
+ util.HandleError(fmt.Errorf("deployment has an invalid desired replica count '%s'; falling back to config value %d", desired, desiredReplicas))
|
|
| 84 | 84 |
} else {
|
| 85 | 85 |
glog.V(4).Infof("Deployment has an explicit desired replica count %d", val)
|
| 86 | 86 |
desiredReplicas = val |
| ... | ... |
@@ -94,7 +95,7 @@ func (s *RecreateDeploymentStrategy) Deploy(deployment *kapi.ReplicationControll |
| 94 | 94 |
allProcessed := true |
| 95 | 95 |
for _, oldDeployment := range oldDeployments {
|
| 96 | 96 |
if err = s.updateReplicas(oldDeployment.Namespace, oldDeployment.Name, 0); err != nil {
|
| 97 |
- glog.Errorf("%v", err)
|
|
| 97 |
+ util.HandleError(fmt.Errorf("%v", err))
|
|
| 98 | 98 |
allProcessed = false |
| 99 | 99 |
} |
| 100 | 100 |
} |
| ... | ... |
@@ -112,7 +113,7 @@ func (s *RecreateDeploymentStrategy) Deploy(deployment *kapi.ReplicationControll |
| 112 | 112 |
if params != nil && params.Post != nil {
|
| 113 | 113 |
err := s.hookExecutor.Execute(params.Post, deployment, "posthook") |
| 114 | 114 |
if err != nil {
|
| 115 |
- glog.Errorf("Post hook failed: %s", err)
|
|
| 115 |
+ util.HandleError(fmt.Errorf("post hook failed: %s", err))
|
|
| 116 | 116 |
} else {
|
| 117 | 117 |
glog.Infof("Post hook finished")
|
| 118 | 118 |
} |
| ... | ... |
@@ -134,7 +135,7 @@ func (s *RecreateDeploymentStrategy) updateReplicas(namespace, name string, repl |
| 134 | 134 |
return fmt.Errorf("couldn't successfully update Deployment %s/%s replica count to %d (timeout exceeded)", namespace, name, replicaCount)
|
| 135 | 135 |
default: |
| 136 | 136 |
if deployment, err = s.client.getReplicationController(namespace, name); err != nil {
|
| 137 |
- glog.Errorf("Couldn't get Deployment %s/%s: %v", namespace, name, err)
|
|
| 137 |
+ util.HandleError(fmt.Errorf("couldn't get Deployment %s/%s: %v", namespace, name, err))
|
|
| 138 | 138 |
} else {
|
| 139 | 139 |
deployment.Spec.Replicas = replicaCount |
| 140 | 140 |
glog.V(4).Infof("Updating Deployment %s/%s replica count to %d", namespace, name, replicaCount)
|
| ... | ... |
@@ -145,7 +146,7 @@ func (s *RecreateDeploymentStrategy) updateReplicas(namespace, name string, repl |
| 145 | 145 |
if kerrors.IsConflict(err) {
|
| 146 | 146 |
continue |
| 147 | 147 |
} |
| 148 |
- glog.Errorf("Error updating Deployment %s/%s replica count to %d: %v", namespace, name, replicaCount, err)
|
|
| 148 |
+ util.HandleError(fmt.Errorf("error updating Deployment %s/%s replica count to %d: %v", namespace, name, replicaCount, err))
|
|
| 149 | 149 |
} |
| 150 | 150 |
|
| 151 | 151 |
time.Sleep(s.retryPeriod) |
| ... | ... |
@@ -11,6 +11,7 @@ import ( |
| 11 | 11 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/kubectl" |
| 12 | 12 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels" |
| 13 | 13 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime" |
| 14 |
+ "github.com/GoogleCloudPlatform/kubernetes/pkg/util" |
|
| 14 | 15 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/util/wait" |
| 15 | 16 |
|
| 16 | 17 |
deployapi "github.com/openshift/origin/pkg/deploy/api" |
| ... | ... |
@@ -136,7 +137,7 @@ func (s *RollingDeploymentStrategy) Deploy(deployment *kapi.ReplicationControlle |
| 136 | 136 |
if params.Post != nil {
|
| 137 | 137 |
err := s.hookExecutor.Execute(params.Post, deployment, "posthook") |
| 138 | 138 |
if err != nil {
|
| 139 |
- glog.Errorf("Post hook failed: %s", err)
|
|
| 139 |
+ util.HandleError(fmt.Errorf("post hook failed: %s", err))
|
|
| 140 | 140 |
} else {
|
| 141 | 141 |
glog.Infof("Post hook finished")
|
| 142 | 142 |
} |
| ... | ... |
@@ -151,7 +152,7 @@ func (s *RollingDeploymentStrategy) Deploy(deployment *kapi.ReplicationControlle |
| 151 | 151 |
if params.Pre != nil {
|
| 152 | 152 |
err := s.hookExecutor.Execute(params.Pre, deployment, "prehook") |
| 153 | 153 |
if err != nil {
|
| 154 |
- return fmt.Errorf("Pre hook failed: %s", err)
|
|
| 154 |
+ return fmt.Errorf("pre hook failed: %s", err)
|
|
| 155 | 155 |
} |
| 156 | 156 |
glog.Infof("Pre hook finished")
|
| 157 | 157 |
} |
| ... | ... |
@@ -212,7 +213,7 @@ func (s *RollingDeploymentStrategy) Deploy(deployment *kapi.ReplicationControlle |
| 212 | 212 |
if params.Post != nil {
|
| 213 | 213 |
err := s.hookExecutor.Execute(params.Post, deployment, "posthook") |
| 214 | 214 |
if err != nil {
|
| 215 |
- glog.Errorf("Post hook failed: %s", err)
|
|
| 215 |
+ util.HandleError(fmt.Errorf("Post hook failed: %s", err))
|
|
| 216 | 216 |
} else {
|
| 217 | 217 |
glog.Info("Post hook finished")
|
| 218 | 218 |
} |
| ... | ... |
@@ -140,7 +140,7 @@ func addImagesToGraph(g graph.Graph, images *imageapi.ImageList, algorithm prune |
| 140 | 140 |
|
| 141 | 141 |
manifest := imageapi.DockerImageManifest{}
|
| 142 | 142 |
if err := json.Unmarshal([]byte(image.DockerImageManifest), &manifest); err != nil {
|
| 143 |
- glog.Errorf("Unable to extract manifest from image: %v. This image's layers won't be pruned if the image is pruned now.", err)
|
|
| 143 |
+ util.HandleError(fmt.Errorf("unable to extract manifest from image: %v. This image's layers won't be pruned if the image is pruned now.", err))
|
|
| 144 | 144 |
continue |
| 145 | 145 |
} |
| 146 | 146 |
|
| ... | ... |
@@ -262,7 +262,7 @@ func addPodSpecToGraph(g graph.Graph, spec *kapi.PodSpec, predecessor gonum.Node |
| 262 | 262 |
|
| 263 | 263 |
ref, err := imageapi.ParseDockerImageReference(container.Image) |
| 264 | 264 |
if err != nil {
|
| 265 |
- glog.Errorf("Unable to parse DockerImageReference %q: %v", container.Image, err)
|
|
| 265 |
+ util.HandleError(fmt.Errorf("unable to parse DockerImageReference %q: %v", container.Image, err))
|
|
| 266 | 266 |
continue |
| 267 | 267 |
} |
| 268 | 268 |
|
| ... | ... |
@@ -435,7 +435,7 @@ func pruneImages(g graph.Graph, imageNodes []*graph.ImageNode, pruneImage ImageP |
| 435 | 435 |
glog.V(4).Infof("Image has only weak references - pruning")
|
| 436 | 436 |
|
| 437 | 437 |
if err := pruneImage(imageNode.Image); err != nil {
|
| 438 |
- glog.Errorf("Error pruning image %q: %v", imageNode.Image.Name, err)
|
|
| 438 |
+ util.HandleError(fmt.Errorf("error pruning image %q: %v", imageNode.Image.Name, err))
|
|
| 439 | 439 |
} |
| 440 | 440 |
|
| 441 | 441 |
for _, n := range g.Predecessors(imageNode) {
|
| ... | ... |
@@ -446,7 +446,7 @@ func pruneImages(g graph.Graph, imageNodes []*graph.ImageNode, pruneImage ImageP |
| 446 | 446 |
glog.V(4).Infof("Pruning image from stream %s", repoName)
|
| 447 | 447 |
updatedStream, err := pruneStream(stream, imageNode.Image) |
| 448 | 448 |
if err != nil {
|
| 449 |
- glog.Errorf("Error pruning image from stream: %v", err)
|
|
| 449 |
+ util.HandleError(fmt.Errorf("error pruning image from stream: %v", err))
|
|
| 450 | 450 |
continue |
| 451 | 451 |
} |
| 452 | 452 |
|
| ... | ... |
@@ -454,13 +454,13 @@ func pruneImages(g graph.Graph, imageNodes []*graph.ImageNode, pruneImage ImageP |
| 454 | 454 |
|
| 455 | 455 |
ref, err := imageapi.DockerImageReferenceForStream(stream) |
| 456 | 456 |
if err != nil {
|
| 457 |
- glog.Errorf("Error constructing DockerImageReference for %q: %v", repoName, err)
|
|
| 457 |
+ util.HandleError(fmt.Errorf("error constructing DockerImageReference for %q: %v", repoName, err))
|
|
| 458 | 458 |
continue |
| 459 | 459 |
} |
| 460 | 460 |
|
| 461 | 461 |
glog.V(4).Infof("Invoking pruneManifest for registry %q, repo %q, image %q", ref.Registry, repoName, imageNode.Image.Name)
|
| 462 | 462 |
if err := pruneManifest(ref.Registry, repoName, imageNode.Image.Name); err != nil {
|
| 463 |
- glog.Errorf("Error pruning manifest for registry %q, repo %q, image %q: %v", ref.Registry, repoName, imageNode.Image.Name, err)
|
|
| 463 |
+ util.HandleError(fmt.Errorf("error pruning manifest for registry %q, repo %q, image %q: %v", ref.Registry, repoName, imageNode.Image.Name, err))
|
|
| 464 | 464 |
} |
| 465 | 465 |
} |
| 466 | 466 |
} |
| ... | ... |
@@ -547,7 +547,7 @@ func pruneLayers(g graph.Graph, layerNodes []*graph.ImageLayerNode, pruneLayer L |
| 547 | 547 |
|
| 548 | 548 |
ref, err := imageapi.DockerImageReferenceForStream(stream) |
| 549 | 549 |
if err != nil {
|
| 550 |
- glog.Errorf("Error constructing DockerImageReference for %q: %v", streamName, err)
|
|
| 550 |
+ util.HandleError(fmt.Errorf("error constructing DockerImageReference for %q: %v", streamName, err))
|
|
| 551 | 551 |
continue |
| 552 | 552 |
} |
| 553 | 553 |
|
| ... | ... |
@@ -555,14 +555,14 @@ func pruneLayers(g graph.Graph, layerNodes []*graph.ImageLayerNode, pruneLayer L |
| 555 | 555 |
registries.Insert(ref.Registry) |
| 556 | 556 |
glog.V(4).Infof("Invoking pruneBlob with registry=%q, blob=%q", ref.Registry, layerNode.Layer)
|
| 557 | 557 |
if err := pruneBlob(ref.Registry, layerNode.Layer); err != nil {
|
| 558 |
- glog.Errorf("Error invoking pruneBlob: %v", err)
|
|
| 558 |
+ util.HandleError(fmt.Errorf("error invoking pruneBlob: %v", err))
|
|
| 559 | 559 |
} |
| 560 | 560 |
} |
| 561 | 561 |
|
| 562 | 562 |
repoName := fmt.Sprintf("%s/%s", ref.Namespace, ref.Name)
|
| 563 | 563 |
glog.V(4).Infof("Invoking pruneLayer with registry=%q, repo=%q, layer=%q", ref.Registry, repoName, layerNode.Layer)
|
| 564 | 564 |
if err := pruneLayer(ref.Registry, repoName, layerNode.Layer); err != nil {
|
| 565 |
- glog.Errorf("Error invoking pruneLayer: %v", err)
|
|
| 565 |
+ util.HandleError(fmt.Errorf("error invoking pruneLayer: %v", err))
|
|
| 566 | 566 |
} |
| 567 | 567 |
} |
| 568 | 568 |
} |
| ... | ... |
@@ -187,7 +187,7 @@ func (s Strategy) tagsChanged(old, stream *api.ImageStream) fielderrors.Validati |
| 187 | 187 |
} |
| 188 | 188 |
|
| 189 | 189 |
if event == nil {
|
| 190 |
- glog.Errorf("unable to find tag event for %#v", tagRef.From)
|
|
| 190 |
+ util.HandleError(fmt.Errorf("unable to find tag event for %#v", tagRef.From))
|
|
| 191 | 191 |
continue |
| 192 | 192 |
} |
| 193 | 193 |
|
| ... | ... |
@@ -1,11 +1,13 @@ |
| 1 | 1 |
package osinserver |
| 2 | 2 |
|
| 3 | 3 |
import ( |
| 4 |
+ "fmt" |
|
| 4 | 5 |
"net/http" |
| 5 | 6 |
"path" |
| 6 | 7 |
|
| 7 | 8 |
"github.com/RangelReale/osin" |
| 8 |
- "github.com/golang/glog" |
|
| 9 |
+ |
|
| 10 |
+ "github.com/GoogleCloudPlatform/kubernetes/pkg/util" |
|
| 9 | 11 |
) |
| 10 | 12 |
|
| 11 | 13 |
const ( |
| ... | ... |
@@ -94,7 +96,7 @@ func (s *Server) handleAuthorize(w http.ResponseWriter, r *http.Request) {
|
| 94 | 94 |
} |
| 95 | 95 |
|
| 96 | 96 |
if resp.IsError && resp.InternalError != nil {
|
| 97 |
- glog.Errorf("Internal error: %s", resp.InternalError)
|
|
| 97 |
+ util.HandleError(fmt.Errorf("internal error: %s", resp.InternalError))
|
|
| 98 | 98 |
} |
| 99 | 99 |
osin.OutputJSON(resp, w, r) |
| 100 | 100 |
} |
| ... | ... |
@@ -111,7 +113,7 @@ func (s *Server) handleToken(w http.ResponseWriter, r *http.Request) {
|
| 111 | 111 |
s.server.FinishAccessRequest(resp, r, ar) |
| 112 | 112 |
} |
| 113 | 113 |
if resp.IsError && resp.InternalError != nil {
|
| 114 |
- glog.Errorf("Internal error: %s", resp.InternalError)
|
|
| 114 |
+ util.HandleError(fmt.Errorf("internal error: %s", resp.InternalError))
|
|
| 115 | 115 |
} |
| 116 | 116 |
osin.OutputJSON(resp, w, r) |
| 117 | 117 |
} |
| ... | ... |
@@ -105,7 +105,7 @@ func (e *DockercfgController) serviceAccountAdded(obj interface{}) {
|
| 105 | 105 |
serviceAccount := obj.(*api.ServiceAccount) |
| 106 | 106 |
|
| 107 | 107 |
if err := e.createDockercfgSecretIfNeeded(serviceAccount); err != nil {
|
| 108 |
- glog.Error(err) |
|
| 108 |
+ util.HandleError(err) |
|
| 109 | 109 |
} |
| 110 | 110 |
} |
| 111 | 111 |
|
| ... | ... |
@@ -114,7 +114,7 @@ func (e *DockercfgController) serviceAccountUpdated(oldObj interface{}, newObj i
|
| 114 | 114 |
newServiceAccount := newObj.(*api.ServiceAccount) |
| 115 | 115 |
|
| 116 | 116 |
if err := e.createDockercfgSecretIfNeeded(newServiceAccount); err != nil {
|
| 117 |
- glog.Error(err) |
|
| 117 |
+ util.HandleError(err) |
|
| 118 | 118 |
} |
| 119 | 119 |
} |
| 120 | 120 |
|
| ... | ... |
@@ -188,7 +188,7 @@ func (e *DockercfgController) createDockercfgSecretIfNeeded(serviceAccount *api. |
| 188 | 188 |
// we do need to clean up our dockercfgSecret. token secrets are cleaned up by the controller handling service account dockercfg secret deletes |
| 189 | 189 |
glog.V(2).Infof("Deleting secret %s/%s (err=%v)", dockercfgSecret.Namespace, dockercfgSecret.Name, err)
|
| 190 | 190 |
if err := e.client.Secrets(dockercfgSecret.Namespace).Delete(dockercfgSecret.Name); err != nil {
|
| 191 |
- glog.Error(err) |
|
| 191 |
+ util.HandleError(err) |
|
| 192 | 192 |
} |
| 193 | 193 |
return nil |
| 194 | 194 |
} |
| ... | ... |
@@ -275,7 +275,7 @@ func (e *DockercfgController) createTokenSecret(serviceAccount *api.ServiceAccou |
| 275 | 275 |
// the token wasn't ever created, attempt deletion |
| 276 | 276 |
glog.Warningf("Deleting unfilled token secret %s/%s", tokenSecret.Namespace, tokenSecret.Name)
|
| 277 | 277 |
if err := e.client.Secrets(tokenSecret.Namespace).Delete(tokenSecret.Name); err != nil {
|
| 278 |
- glog.Error(err) |
|
| 278 |
+ util.HandleError(err) |
|
| 279 | 279 |
} |
| 280 | 280 |
return nil, fmt.Errorf("token never generated for %s", tokenSecret.Name)
|
| 281 | 281 |
} |
| ... | ... |
@@ -10,6 +10,7 @@ import ( |
| 10 | 10 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/fields" |
| 11 | 11 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels" |
| 12 | 12 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime" |
| 13 |
+ "github.com/GoogleCloudPlatform/kubernetes/pkg/util" |
|
| 13 | 14 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/watch" |
| 14 | 15 |
"github.com/golang/glog" |
| 15 | 16 |
) |
| ... | ... |
@@ -92,7 +93,7 @@ func (e *DockercfgTokenDeletedController) secretDeleted(obj interface{}) {
|
| 92 | 92 |
// remove the reference token secrets |
| 93 | 93 |
for _, dockercfgSecret := range dockercfgSecrets {
|
| 94 | 94 |
if err := e.client.Secrets(dockercfgSecret.Namespace).Delete(dockercfgSecret.Name); err != nil {
|
| 95 |
- glog.Error(err) |
|
| 95 |
+ util.HandleError(err) |
|
| 96 | 96 |
} |
| 97 | 97 |
} |
| 98 | 98 |
} |
| ... | ... |
@@ -17,7 +17,6 @@ import ( |
| 17 | 17 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime" |
| 18 | 18 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/util" |
| 19 | 19 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/watch" |
| 20 |
- "github.com/golang/glog" |
|
| 21 | 20 |
) |
| 22 | 21 |
|
| 23 | 22 |
const DefaultOpenshiftDockerURL = "docker-registry.default.svc.cluster.local:5000" |
| ... | ... |
@@ -114,7 +113,7 @@ func (e *DockerRegistryServiceController) serviceAdded(obj interface{}) {
|
| 114 | 114 |
} |
| 115 | 115 |
|
| 116 | 116 |
if err := e.handleLocationChange(e.getServiceLocation(service)); err != nil {
|
| 117 |
- glog.Error(err) |
|
| 117 |
+ util.HandleError(err) |
|
| 118 | 118 |
} |
| 119 | 119 |
} |
| 120 | 120 |
|
| ... | ... |
@@ -131,7 +130,7 @@ func (e *DockerRegistryServiceController) serviceUpdated(oldObj interface{}, new
|
| 131 | 131 |
} |
| 132 | 132 |
|
| 133 | 133 |
if err := e.handleLocationChange(e.getServiceLocation(newService)); err != nil {
|
| 134 |
- glog.Error(err) |
|
| 134 |
+ util.HandleError(err) |
|
| 135 | 135 |
} |
| 136 | 136 |
} |
| 137 | 137 |
|
| ... | ... |
@@ -146,7 +145,7 @@ func (e *DockerRegistryServiceController) serviceDeleted(obj interface{}) {
|
| 146 | 146 |
} |
| 147 | 147 |
|
| 148 | 148 |
if err := e.handleLocationChange(e.defaultDockerURL); err != nil {
|
| 149 |
- glog.Error(err) |
|
| 149 |
+ util.HandleError(err) |
|
| 150 | 150 |
} |
| 151 | 151 |
} |
| 152 | 152 |
|
| ... | ... |
@@ -162,14 +161,14 @@ func (e *DockerRegistryServiceController) handleLocationChange(serviceLocation s |
| 162 | 162 |
for _, dockercfgSecret := range dockercfgSecrets {
|
| 163 | 163 |
dockercfg := &credentialprovider.DockerConfig{}
|
| 164 | 164 |
if err := json.Unmarshal(dockercfgSecret.Data[api.DockerConfigKey], dockercfg); err != nil {
|
| 165 |
- glog.Error(err) |
|
| 165 |
+ util.HandleError(err) |
|
| 166 | 166 |
continue |
| 167 | 167 |
} |
| 168 | 168 |
|
| 169 | 169 |
dockercfgMap := map[string]credentialprovider.DockerConfigEntry(*dockercfg) |
| 170 | 170 |
keys := util.KeySet(reflect.ValueOf(dockercfgMap)) |
| 171 | 171 |
if len(keys) != 1 {
|
| 172 |
- glog.Error(err) |
|
| 172 |
+ util.HandleError(err) |
|
| 173 | 173 |
continue |
| 174 | 174 |
} |
| 175 | 175 |
oldKey := keys.List()[0] |
| ... | ... |
@@ -186,13 +185,13 @@ func (e *DockerRegistryServiceController) handleLocationChange(serviceLocation s |
| 186 | 186 |
|
| 187 | 187 |
dockercfgContent, err := json.Marshal(dockercfg) |
| 188 | 188 |
if err != nil {
|
| 189 |
- glog.Error(err) |
|
| 189 |
+ util.HandleError(err) |
|
| 190 | 190 |
continue |
| 191 | 191 |
} |
| 192 | 192 |
dockercfgSecret.Data[api.DockerConfigKey] = dockercfgContent |
| 193 | 193 |
|
| 194 | 194 |
if _, err := e.client.Secrets(dockercfgSecret.Namespace).Update(dockercfgSecret); err != nil {
|
| 195 |
- glog.Error(err) |
|
| 195 |
+ util.HandleError(err) |
|
| 196 | 196 |
continue |
| 197 | 197 |
} |
| 198 | 198 |
} |
| ... | ... |
@@ -10,7 +10,6 @@ import ( |
| 10 | 10 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/runtime" |
| 11 | 11 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/util" |
| 12 | 12 |
"github.com/GoogleCloudPlatform/kubernetes/pkg/util/fielderrors" |
| 13 |
- "github.com/golang/glog" |
|
| 14 | 13 |
|
| 15 | 14 |
"github.com/openshift/origin/pkg/user/api" |
| 16 | 15 |
"github.com/openshift/origin/pkg/user/api/validation" |
| ... | ... |
@@ -229,7 +228,7 @@ func (s *REST) createOrUpdate(ctx kapi.Context, obj runtime.Object, forceCreate |
| 229 | 229 |
// If this fails, log the error, but continue, because Update is no longer re-entrant |
| 230 | 230 |
if oldUser != nil && removeIdentityFromUser(identity, oldUser) {
|
| 231 | 231 |
if _, err := s.userRegistry.UpdateUser(ctx, oldUser); err != nil {
|
| 232 |
- glog.Errorf("Error removing identity reference %s from user %s: %v", identity.Name, oldUser.Name, err)
|
|
| 232 |
+ util.HandleError(fmt.Errorf("error removing identity reference %s from user %s: %v", identity.Name, oldUser.Name, err))
|
|
| 233 | 233 |
} |
| 234 | 234 |
} |
| 235 | 235 |
|
| ... | ... |
@@ -258,7 +257,7 @@ func (s *REST) Delete(ctx kapi.Context, name string) (runtime.Object, error) {
|
| 258 | 258 |
// At this point, the mapping for the identity no longer exists |
| 259 | 259 |
if unsetIdentityUser(identity) {
|
| 260 | 260 |
if _, err := s.identityRegistry.UpdateIdentity(ctx, identity); err != nil {
|
| 261 |
- glog.Errorf("Error removing user reference %s from identity %s: %v", user.Name, identity.Name, err)
|
|
| 261 |
+ util.HandleError(fmt.Errorf("error removing user reference %s from identity %s: %v", user.Name, identity.Name, err))
|
|
| 262 | 262 |
} |
| 263 | 263 |
} |
| 264 | 264 |
|
| ... | ... |
@@ -13,6 +13,7 @@ import ( |
| 13 | 13 |
"strings" |
| 14 | 14 |
|
| 15 | 15 |
kclient "github.com/GoogleCloudPlatform/kubernetes/pkg/client" |
| 16 |
+ "github.com/GoogleCloudPlatform/kubernetes/pkg/util" |
|
| 16 | 17 |
"github.com/GoogleCloudPlatform/kubernetes/third_party/golang/netutil" |
| 17 | 18 |
|
| 18 | 19 |
"github.com/golang/glog" |
| ... | ... |
@@ -55,7 +56,7 @@ func (p *UpgradeAwareSingleHostReverseProxy) RoundTrip(req *http.Request) (*http |
| 55 | 55 |
removeCORSHeaders(resp) |
| 56 | 56 |
removeChallengeHeaders(resp) |
| 57 | 57 |
if resp.StatusCode == http.StatusUnauthorized {
|
| 58 |
- glog.Errorf("Got unauthorized error from backend for: %s %s", req.Method, req.URL)
|
|
| 58 |
+ util.HandleError(fmt.Errorf("got unauthorized error from backend for: %s %s", req.Method, req.URL))
|
|
| 59 | 59 |
// Internal error, backend didn't recognize proxy identity |
| 60 | 60 |
// Surface as a server error to the client |
| 61 | 61 |
// TODO do we need to do more than this? |
| ... | ... |
@@ -218,7 +219,7 @@ func (p *UpgradeAwareSingleHostReverseProxy) serveUpgrade(w http.ResponseWriter, |
| 218 | 218 |
go func() {
|
| 219 | 219 |
_, err := io.Copy(backendConn, requestHijackedConn) |
| 220 | 220 |
if err != nil && !strings.Contains(err.Error(), "use of closed network connection") {
|
| 221 |
- glog.Errorf("Error proxying data from client to backend: %v", err)
|
|
| 221 |
+ util.HandleError(fmt.Errorf("error proxying data from client to backend: %v", err))
|
|
| 222 | 222 |
} |
| 223 | 223 |
done <- struct{}{}
|
| 224 | 224 |
}() |
| ... | ... |
@@ -226,7 +227,7 @@ func (p *UpgradeAwareSingleHostReverseProxy) serveUpgrade(w http.ResponseWriter, |
| 226 | 226 |
go func() {
|
| 227 | 227 |
_, err := io.Copy(requestHijackedConn, backendConn) |
| 228 | 228 |
if err != nil && !strings.Contains(err.Error(), "use of closed network connection") {
|
| 229 |
- glog.Errorf("Error proxying data from backend to client: %v", err)
|
|
| 229 |
+ util.HandleError(fmt.Errorf("error proxying data from backend to client: %v", err))
|
|
| 230 | 230 |
} |
| 231 | 231 |
done <- struct{}{}
|
| 232 | 232 |
}() |