Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

replacing hard coded cluster.local with variable #2892

Merged
merged 9 commits into from
Jan 15, 2019
Merged

replacing hard coded cluster.local with variable #2892

merged 9 commits into from
Jan 15, 2019

Conversation

sbezverk
Copy link
Contributor

Signed-off-by: Serguei Bezverkhi sbezverk@cisco.com

PR replaces hardcoded cluster.local with a variable which is populated from /etc/resolv.conf with actual cluster's domain name. In case of a failure it falls back to cluster.local

Fixes #knative/eventing#714

replacing hardcoded cluster.local with a variable which is populated from /etc/resolv.conf with actual cluster's domain name. In case of a failure it falls back to cluster.local

Signed-off-by: Serguei Bezverkhi <sbezverk@cisco.com>
@knative-prow-robot knative-prow-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jan 11, 2019
Signed-off-by: Serguei Bezverkhi <sbezverk@cisco.com>
"strings"
)

// GetClusterDomainName returns cluster's domain name or error
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In theory for getters go suggests omitting Get, so I'd suggest ClusterDomainName (same below).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the comment, having just ClusterDomainName sounds a bit unclear what this func does. I do not have any strong opinion about exact this name, but I would like it to be a bit self explanatory. wdyt?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So Getter/Setter convention in Go is for X is: SetX() and X(), i.e. Get is redundant.
Considering that here it's not a true getter on a struct, I don't want to be prescriptive, but ClusterDomainName() is shorter, and is readable for Go engineers in general. Up to you :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am for consistency, if the rules you have stated were followed in serving repo, then it would have made sense to change func name, but if you check, currently get is used in many funcs' names in serving:

.//pkg/reconciler/names.go:func GetK8sServiceFullname(name string, namespace string) string {
.//pkg/reconciler/names.go:func GetServingK8SServiceNameForObj(name string) string {

and in many more, as such I prefer to follow this pattern and leave this func name as is.


// GetClusterDomainName returns cluster's domain name or error
func GetClusterDomainName() (string, error) {
_, err := os.Stat("/etc/resolv.conf")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if _, err :=...; err != nil {}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for catching it, will change

if err != nil {
return "", err
}
f, err := os.Open("/etc/resolv.conf")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const for the file name?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do,thanks

Signed-off-by: Serguei Bezverkhi <sbezverk@cisco.com>

func GetK8sServiceFullname(name string, namespace string) string {
return fmt.Sprintf("%s.%s.svc.cluster.local", name, namespace)
clusterDomainName, err := utils.GetClusterDomainName()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we compute this once when the binary starts up so that we won't read a file everytime we want to get the full name of a K8s Service?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this operation is infrequent so the should not be any quantifiable performance impact. Also this approach allows different reaction of a failure of getting domain name. In some cases it might be useful. Appreciate other folks to chime in and share their opinion.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it's going to be constant, I don't see reasons for it to be recomputed each time.
If we need to test failure cases, then go provides various methods to spoof failures (substitute files, use different file path, mockout internal function).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, does it work for you, if I call it from main, set global var in utils package and then when domain name is needed utils.ClusterDomainName var can be used?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather, I'd recommend to use this: https://golang.org/pkg/sync/#Once.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please see new solution based on once.Do()

Signed-off-by: Serguei Bezverkhi <sbezverk@cisco.com>
}
for _, tt := range tests {
dn, err := getClusterDomainName(strings.NewReader(tt.resolvConf))
if err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if got, want := (err != nil), t.shouldFail; got != want {
   t.Errorf("....")
} else if err == nil {
  if got, want := domain, t.domainName; got != want {
    t.Errorf("... domain: got: %s, want: %s",...)
  }
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this sequence, it does not catch directly func returns err == nil but the expectation was to fail. Do you think it is sufficient to catch this condition just on domain name mismatch? Currently err==nil validation covers 2 scenarios, 1 incorrect parsing of domain name when func returns nil and wrong domain name and 2 not detecting corruption of resolv.conf file. Please let me know if this explanation makes sense to you. Appreciate a lot your feedback.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it does not catch directly func returns err == nil but the expectation was to fail -- wouldn't (err != nil) != t.shouldFail condition catch that?
We want to make sure errors are returned when it's an error condition. But since your tests don't discriminate errors, just making sure error was returned in the erroneous condition will suffice. That's what my suggested change does.
Hope, this makes sense :)


func TestGetDomainName(t *testing.T) {
tests := []struct {
descr string
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/descr/name/?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done


func GetK8sServiceFullname(name string, namespace string) string {
return fmt.Sprintf("%s.%s.svc.cluster.local", name, namespace)
clusterDomainName, err := utils.GetClusterDomainName()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it's going to be constant, I don't see reasons for it to be recomputed each time.
If we need to test failure cases, then go provides various methods to spoof failures (substitute files, use different file path, mockout internal function).

Signed-off-by: Serguei Bezverkhi <sbezverk@cisco.com>
Signed-off-by: Serguei Bezverkhi <sbezverk@cisco.com>
@sbezverk
Copy link
Contributor Author

/test pull-knative-serving-integration-tests

Copy link
Contributor

@vagababov vagababov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the changes!

/lgtm

@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Jan 13, 2019
Signed-off-by: Serguei Bezverkhi <sbezverk@cisco.com>
@knative-prow-robot knative-prow-robot removed the lgtm Indicates that a PR is ready to be merged. label Jan 13, 2019
Signed-off-by: Serguei Bezverkhi <sbezverk@cisco.com>
@sbezverk
Copy link
Contributor Author

/test pull-knative-serving-integration-tests

Signed-off-by: Serguei Bezverkhi <sbezverk@cisco.com>
@knative-metrics-robot
Copy link

The following is the coverage report on pkg/.
Say /test pull-knative-serving-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/utils/utils.go Do not exist 56.2%

@sbezverk
Copy link
Contributor Author

With this patch, I can see success in both control plane and data plane, k8s event source generates messages and they are transferred to the user container via the im memory channel dispatcher :) !!!

@@ -302,7 +303,7 @@ func main() {
}()

// Open a websocket connection to the autoscaler
autoscalerEndpoint := fmt.Sprintf("ws://%s.%s:%d", servingAutoscaler, system.Namespace, servingAutoscalerPort)
autoscalerEndpoint := fmt.Sprintf("ws://%s.%s.svc.%s:%d", servingAutoscaler, system.Namespace, utils.GetClusterDomainName(), servingAutoscalerPort)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this change? (or why part of this pr?)

Copy link
Contributor Author

@sbezverk sbezverk Jan 14, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

queue-proxy was constantly failing to establish connectivity with autoscaller, had to fix it to be able to prove that domain name change it working.

{"level":"info","ts":"2019-01-12T05:29:12.179Z","logger":"queueproxy","caller":"queue/main.go:306","msg":"Connecting to autoscaler at ws://autoscaler.knative-serving:8080","commit":"4d198db","knative.dev/key":"default/k8s-event-dumper-00001","knative.dev/pod":"k8s-event-dumper-00001-deployment-59466d48f-x9zxf"}
{"level":"error","ts":"2019-01-12T05:29:13.179Z","logger":"queueproxy","caller":"queue/main.go:114","msg":"Error while sending stat{error 25 0  connection has not yet been established}","commit":"4d198db","knative.dev/key":"default/k8s-event-dumper-00001","knative.dev/pod":"k8s-event-dumper-00001-deployment-59466d48f-x9zxf","stacktrace":"main.statReporter\n\t/usr/local/google/home/mattmoor/go/src/github.com/knative/serving/cmd/queue/main.go:114"}

@vagababov
Copy link
Contributor

/lgtm

@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Jan 14, 2019
@tcnghia
Copy link
Contributor

tcnghia commented Jan 14, 2019

/approve

@tcnghia
Copy link
Contributor

tcnghia commented Jan 15, 2019

/assign @mdemirhan

for /approve.

Copy link
Contributor

@vvraskin vvraskin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one comment related to closing a file in case of error

once.Do(func() {
f, err := os.Open(resolverFileName)
if err == nil {
defer f.Close()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need to put the defer in front of If so we close the file even when the error happens?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we close the file only if open succeed, otherwise there is nothing to close, f would be nil.

@mdemirhan
Copy link
Contributor

/approve

@knative-prow-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mdemirhan, sbezverk, tcnghia

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@knative-prow-robot knative-prow-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 15, 2019
@knative-prow-robot knative-prow-robot merged commit 58ab04b into knative:master Jan 15, 2019
@owenthereal
Copy link

owenthereal commented Jan 20, 2019

I got the following errors for queue-proxy 0.0.3:

{"level":"info","ts":"2019-01-20T07:53:00.017Z","logger":"queueproxy","caller":"queue/main.go:306","msg":"Connecting to autoscaler at ws://autoscaler.knative-serving:8080","commit":"4d198db","knative.dev/key":"default/helloworld-go-00001","knative.dev/pod":"helloworld-go-00001-deployment-6d5496697b-glw8p"}
{"level":"error","ts":"2019-01-20T07:53:01.017Z","logger":"queueproxy","caller":"queue/main.go:114","msg":"Error while sending stat{error 25 0  connection has not yet been established}","commit":"4d198db","knative.dev/key":"default/helloworld-go-00001","knative.dev/pod":"helloworld-go-00001-deployment-6d5496697b-glw8p","stacktrace":"main.statReporter\n\t/usr/local/google/home/mattmoor/go/src/github.com/knative/serving/cmd/queue/main.go:114"}
{"level":"error","ts":"2019-01-20T07:53:02.017Z","logger":"queueproxy","caller":"queue/main.go:114","msg":"Error while sending stat{error 25 0  connection has not yet been established}","commit":"4d198db","knative.dev/key":"default/helloworld-go-00001","knative.dev/pod":"helloworld-go-00001-deployment-6d5496697b-glw8p","stacktrace":"main.statReporter\n\t/usr/local/google/home/mattmoor/go/src/github.com/knative/serving/cmd/queue/main.go:114"}
$ kc describe pod
Name:           helloworld-go-00001-deployment-6d5496697b-glw8p
Namespace:      default
Node:           ip-10-0-106-252.us-west-2.compute.internal/10.0.106.252
Start Time:     Sat, 19 Jan 2019 23:52:57 -0800
Labels:         app=helloworld-go-00001
                pod-template-hash=2810522536
                serving.knative.dev/configuration=helloworld-go
                serving.knative.dev/configurationGeneration=1
                serving.knative.dev/configurationMetadataGeneration=1
                serving.knative.dev/revision=helloworld-go-00001
                serving.knative.dev/revisionUID=e5459f6e-1c87-11e9-a139-02fa14382c64
                serving.knative.dev/service=helloworld-go
Annotations:    sidecar.istio.io/inject: true
                sidecar.istio.io/status:
                  {"version":"2153b4a1c36b2db7abd8141cba9723db658c4a56673d25af8d1d18641270f3a2","initContainers":["istio-init"],"containers":["istio-proxy"]...
                traffic.sidecar.istio.io/includeOutboundIPRanges: *
Status:         Running
IP:             10.0.98.237
Controlled By:  ReplicaSet/helloworld-go-00001-deployment-6d5496697b
Init Containers:
  istio-init:
    Container ID:  docker://06766cf55fe7802798955e990b4e5d0324b33cdc6684eb3e27b9c3eebd53df59
    Image:         docker.io/istio/proxy_init:1.0.2
    Image ID:      docker-pullable://istio/proxy_init@sha256:e16a0746f46cd45a9f63c27b9e09daff5432e33a2d80c8cc0956d7d63e2f9185
    Port:          <none>
    Host Port:     <none>
    Args:
      -p
      15001
      -u
      1337
      -m
      REDIRECT
      -i
      *
      -x

      -b
      8080, 8012, 8022, 9090,
      -d

    State:          Terminated
      Reason:       Completed
      Exit Code:    0
      Started:      Sat, 19 Jan 2019 23:52:58 -0800
      Finished:     Sat, 19 Jan 2019 23:52:58 -0800
    Ready:          True
    Restart Count:  0
    Environment:    <none>
    Mounts:         <none>
Containers:
  user-container:
    Container ID:   docker://1e6a11786ff41a58c369d43ace42d4716f08e9a38fca8d65064917f81cf2ca12
    Image:          index.docker.io/jingweno/helloworld-go@sha256:2ae651664b67ed7438db4b1810358a0b89962351282123f8c9c16f5c4d9c5d04
    Image ID:       docker-pullable://jingweno/helloworld-go@sha256:2ae651664b67ed7438db4b1810358a0b89962351282123f8c9c16f5c4d9c5d04
    Port:           8080/TCP
    Host Port:      0/TCP
    State:          Running
      Started:      Sat, 19 Jan 2019 23:52:59 -0800
    Ready:          True
    Restart Count:  0
    Requests:
      cpu:  400m
    Environment:
      TARGET:           Go Sample v1
      PORT:             8080
      K_REVISION:       helloworld-go-00001
      K_CONFIGURATION:  helloworld-go
      K_SERVICE:        helloworld-go
    Mounts:
      /var/log from varlog (rw)
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-jk7xd (ro)
  queue-proxy:
    Container ID:   docker://b30f535aab6df4262abf76bc37915137b759334c7ecbed5106b85d09c84d4c3a
    Image:          gcr.io/knative-releases/github.com/knative/serving/cmd/queue@sha256:fc49125cb29f7bb2de2c4d6bd51153ce190cb522cf42df59898147d2074885cc
    Image ID:       docker-pullable://gcr.io/knative-releases/github.com/knative/serving/cmd/queue@sha256:fc49125cb29f7bb2de2c4d6bd51153ce190cb522cf42df59898147d2074885cc
    Ports:          8012/TCP, 8022/TCP, 9090/TCP
    Host Ports:     0/TCP, 0/TCP, 0/TCP
    State:          Running
      Started:      Sat, 19 Jan 2019 23:53:00 -0800
    Ready:          True
    Restart Count:  0
    Requests:
      cpu:      25m
    Readiness:  http-get http://:8022/health delay=0s timeout=1s period=1s #success=1 #failure=3
    Environment:
      SERVING_NAMESPACE:         default
      SERVING_CONFIGURATION:     helloworld-go
      SERVING_REVISION:          helloworld-go-00001
      SERVING_AUTOSCALER:        autoscaler
      SERVING_AUTOSCALER_PORT:   8080
      CONTAINER_CONCURRENCY:     0
      REVISION_TIMEOUT_SECONDS:  300
      SERVING_POD:               helloworld-go-00001-deployment-6d5496697b-glw8p (v1:metadata.name)
      SERVING_LOGGING_CONFIG:    {
                                   "level": "info",
                                   "development": false,
                                   "outputPaths": ["stdout"],
                                   "errorOutputPaths": ["stderr"],
                                   "encoding": "json",
                                   "encoderConfig": {
                                     "timeKey": "ts",
                                     "levelKey": "level",
                                     "nameKey": "logger",
                                     "callerKey": "caller",
                                     "messageKey": "msg",
                                     "stacktraceKey": "stacktrace",
                                     "lineEnding": "",
                                     "levelEncoder": "",
                                     "timeEncoder": "iso8601",
                                     "durationEncoder": "",
                                     "callerEncoder": ""
                                   }
                                 }

      SERVING_LOGGING_LEVEL:     info
      USER_PORT:                 8080
    Mounts:
      /var/run/secrets/kubernetes.io/serviceaccount from default-token-jk7xd (ro)
  istio-proxy:
    Container ID:  docker://b6bcdf72b6f8fa338ad6bb654d403f419938c1220fde38526e665368af045b57
    Image:         docker.io/istio/proxyv2:1.0.2
    Image ID:      docker-pullable://istio/proxyv2@sha256:54e206530ba6ca9b3820254454e01b7592e9f986d27a5640b6c03704b3b68332
    Port:          <none>
    Host Port:     <none>
    Args:
      proxy
      sidecar
      --configPath
      /etc/istio/proxy
      --binaryPath
      /usr/local/bin/envoy
      --serviceCluster
      helloworld-go-00001
      --drainDuration
      45s
      --parentShutdownDuration
      1m0s
      --discoveryAddress
      istio-pilot.istio-system:15007
      --discoveryRefreshDelay
      1s
      --zipkinAddress
      zipkin.istio-system:9411
      --connectTimeout
      10s
      --statsdUdpAddress
      istio-statsd-prom-bridge.istio-system:9125
      --proxyAdminPort
      15000
      --controlPlaneAuthPolicy
      NONE
    State:          Running
      Started:      Sat, 19 Jan 2019 23:53:00 -0800
    Ready:          True
    Restart Count:  0
    Requests:
      cpu:  10m
    Environment:
      POD_NAME:                      helloworld-go-00001-deployment-6d5496697b-glw8p (v1:metadata.name)
      POD_NAMESPACE:                 default (v1:metadata.namespace)
      INSTANCE_IP:                    (v1:status.podIP)
      ISTIO_META_POD_NAME:           helloworld-go-00001-deployment-6d5496697b-glw8p (v1:metadata.name)
      ISTIO_META_INTERCEPTION_MODE:  REDIRECT
    Mounts:
      /etc/certs/ from istio-certs (ro)
      /etc/istio/proxy from istio-envoy (rw)
Conditions:
  Type           Status
  Initialized    True
  Ready          True
  PodScheduled   True
Volumes:
  varlog:
    Type:    EmptyDir (a temporary directory that shares a pod's lifetime)
    Medium:
  default-token-jk7xd:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  default-token-jk7xd
    Optional:    false
  istio-envoy:
    Type:    EmptyDir (a temporary directory that shares a pod's lifetime)
    Medium:  Memory
  istio-certs:
    Type:        Secret (a volume populated by a Secret)
    SecretName:  istio.default
    Optional:    true
QoS Class:       Burstable
Node-Selectors:  <none>
Tolerations:     node.kubernetes.io/not-ready:NoExecute for 300s
                 node.kubernetes.io/unreachable:NoExecute for 300s
Events:
  Type     Reason                 Age   From                                                 Message
  ----     ------                 ----  ----                                                 -------
  Normal   SuccessfulMountVolume  37m   kubelet, ip-10-0-106-252.us-west-2.compute.internal  MountVolume.SetUp succeeded for volume "varlog"
  Normal   SuccessfulMountVolume  37m   kubelet, ip-10-0-106-252.us-west-2.compute.internal  MountVolume.SetUp succeeded for volume "istio-certs"
  Normal   SuccessfulMountVolume  37m   kubelet, ip-10-0-106-252.us-west-2.compute.internal  MountVolume.SetUp succeeded for volume "default-token-jk7xd"
  Normal   SuccessfulMountVolume  37m   kubelet, ip-10-0-106-252.us-west-2.compute.internal  MountVolume.SetUp succeeded for volume "istio-envoy"
  Normal   Scheduled              37m   default-scheduler                                    Successfully assigned helloworld-go-00001-deployment-6d5496697b-glw8p to ip-10-0-106-252.us-west-2.compute.internal
  Normal   Created                37m   kubelet, ip-10-0-106-252.us-west-2.compute.internal  Created container
  Normal   Pulled                 37m   kubelet, ip-10-0-106-252.us-west-2.compute.internal  Container image "docker.io/istio/proxy_init:1.0.2" already present on machine
  Normal   Started                37m   kubelet, ip-10-0-106-252.us-west-2.compute.internal  Started container
  Normal   Created                37m   kubelet, ip-10-0-106-252.us-west-2.compute.internal  Created container
  Normal   Pulled                 37m   kubelet, ip-10-0-106-252.us-west-2.compute.internal  Container image "index.docker.io/jingweno/helloworld-go@sha256:2ae651664b67ed7438db4b1810358a0b89962351282123f8c9c16f5c4d9c5d04" already present on machine
  Normal   Started                37m   kubelet, ip-10-0-106-252.us-west-2.compute.internal  Started container
  Normal   Pulled                 37m   kubelet, ip-10-0-106-252.us-west-2.compute.internal  Container image "gcr.io/knative-releases/github.com/knative/serving/cmd/queue@sha256:fc49125cb29f7bb2de2c4d6bd51153ce190cb522cf42df59898147d2074885cc" already present on machine
  Normal   Created                37m   kubelet, ip-10-0-106-252.us-west-2.compute.internal  Created container
  Normal   Started                37m   kubelet, ip-10-0-106-252.us-west-2.compute.internal  Started container
  Normal   Pulled                 37m   kubelet, ip-10-0-106-252.us-west-2.compute.internal  Container image "docker.io/istio/proxyv2:1.0.2" already present on machine
  Normal   Created                37m   kubelet, ip-10-0-106-252.us-west-2.compute.internal  Created container
  Normal   Started                37m   kubelet, ip-10-0-106-252.us-west-2.compute.internal  Started container
  Warning  Unhealthy              37m   kubelet, ip-10-0-106-252.us-west-2.compute.internal  Readiness probe failed: Get http://10.0.98.237:8022/health: dial tcp 10.0.98.237:8022: getsockopt: connection refused
$ kc describe ksvc
Name:         helloworld-go
Namespace:    default
Labels:       <none>
Annotations:  kubectl.kubernetes.io/last-applied-configuration:
                {"apiVersion":"serving.knative.dev/v1alpha1","kind":"Service","metadata":{"annotations":{},"name":"helloworld-go","namespace":"default"},"...
API Version:  serving.knative.dev/v1alpha1
Kind:         Service
Metadata:
  Cluster Name:
  Creation Timestamp:  2019-01-20T07:48:04Z
  Generation:          1
  Resource Version:    2083524
  Self Link:           /apis/serving.knative.dev/v1alpha1/namespaces/default/services/helloworld-go
  UID:                 b838b708-1c87-11e9-adf0-0a3097e01ea8
Spec:
  Generation:  1
  Run Latest:
    Configuration:
      Revision Template:
        Spec:
          Container:
            Env:
              Name:         TARGET
              Value:        Go Sample v1
            Image:          docker.io/jingweno/helloworld-go
          Timeout Seconds:  300
Events:
  Type     Reason        Age                From                Message
  ----     ------        ----               ----                -------
  Normal   Created       45m                service-controller  Created Configuration "helloworld-go"
  Normal   Created       45m                service-controller  Created Route "helloworld-go"
  Warning  UpdateFailed  11m (x3 over 45m)  service-controller  Failed to update status for Service "helloworld-go": the server could not find the requested resource (put services.serving.knative.dev helloworld-go)

Wondering whether this PR will fix it.

@sbezverk
Copy link
Contributor Author

@jingweno I saw similar error too, but this PR addresses issues when cluster name is not cluster.local. If you are using default cluster name, then no change in original behaviour. What is your cluster name?

@owenthereal
Copy link

@sbezverk The cluster name is cluster.local and I still get the above errors. I tried to follow https://github.com/knative/docs/blob/master/install/getting-started-knative-app.md#interacting-with-your-app and the example app doesn't have a domain:

$ kc get ksvc helloworld-go  --output=custom-columns=NAME:.metadata.name,DOMAIN:.status.domain
NAME            DOMAIN
helloworld-go   <none>

I wonder what went wrong...running out of ideas

@sbezverk sbezverk deleted the cluster_local branch January 21, 2019 02:48
@markusthoemmes
Copy link
Contributor

The queue-proxy errors might be red-herrings. They appear almost always. I created #2951 to get rid of the "false-positives".

@jingweno Do the errors persist or are there only a few of them?

On the other error, are you on Kubernetes 1.11+?

@owenthereal
Copy link

@markusthoemmes There are only a few of the errors. But readiness check for port 8022 (queue-proxy) always failed and caused the pod to be terminated:

Warning  Unhealthy              37m   kubelet, ip-10-0-106-252.us-west-2.compute.internal  Readiness probe failed: Get http://10.0.98.237:8022/health: dial tcp 10.0.98.237:8022: getsockopt: connection refused

Yes, I'm on 1.11+:

kc version
Client Version: version.Info{Major:"1", Minor:"13", GitVersion:"v1.13.1", GitCommit:"eec55b9ba98609a46fee712359c7b5b365bdd920", GitTreeState:"clean", BuildDate:"2018-12-13T19:44:19Z", GoVersion:"go1.11.2", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"11+", GitVersion:"v1.11.5-eks-6bad6d", GitCommit:"6bad6d9c768dc0864dab48a11653aa53b5a47043", GitTreeState:"clean", BuildDate:"2018-12-06T23:13:14Z", GoVersion:"go1.10.3", Compiler:"gc", Platform:"linux/amd64"}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

9 participants