问:
Swift - Generate an Address Format from Reverse Geocoding
I am trying to generate a Formatted Full address using CLGeocoder in Swift 3. I referred to this SO thread to get the code given below.

However, sometimes the app crashes with a 'nil' error at the line:

```<code>//Address dictionary
print(placeMark.addressDictionary ?? "")
</code>```

Questions:

How can I concatenate these values retrieved from the GeoCoder to form a full address? (Street + City + etc)

How do I handle the nil error I get when the func is unable to find an address?

Full code:

```<code>func getAddress() -> String {
        var address: String = ""

        let geoCoder = CLGeocoder()
        let location = CLLocation(latitude: selectedLat, longitude: selectedLon)
        //selectedLat and selectedLon are double values set by the app in a previous process

        geoCoder.reverseGeocodeLocation(location, completionHandler: { (placemarks, error) -> Void in

            // Place details
            var placeMark: CLPlacemark!
            placeMark = placemarks?[0]

            // Address dictionary
            //print(placeMark.addressDictionary ?? "")

            // Location name
            if let locationName = placeMark.addressDictionary!["Name"] as? NSString {
                //print(locationName)
            }

            // Street address
            if let street = placeMark.addressDictionary!["Thoroughfare"] as? NSString {
                //print(street)
            }

            // City
            if let city = placeMark.addressDictionary!["City"] as? NSString {
                //print(city)
            }

            // Zip code
            if let zip = placeMark.addressDictionary!["ZIP"] as? NSString {
                //print(zip)
            }

            // Country
            if let country = placeMark.addressDictionary!["Country"] as? NSString {
                //print(country)
            }

        })

        return address;
    }
</code>```

答:
Here's a 2-3 line version of the answers here:</p>
```<code>    func getAddress(placemarks: [CLPlacemark]) -> String {
        guard let placemark = placemarks.first, !placemarks.isEmpty else {return ""}
        let outputString = [placemark.locality,
                            placemark.subLocality,
                            placemark.thoroughfare,
                            placemark.postalCode,
                            placemark.subThoroughfare,
                            placemark.country].compactMap{$0}.joined(separator: ", ")
        print(outputString)
        return outputString
    }
</code>```

Body:
I am trying to generate a Formatted Full address using CLGeocoder in Swift 3. I referred to this SO thread to get the code given below.

However, sometimes the app crashes with a 'nil' error at the line:

//Address dictionary
print(placeMark.addressDictionary ?? "")

Questions:

How can I concatenate these values retrieved from the GeoCoder to form a full address? (Street + City + etc)

How do I handle the nil error I get when the func is unable to find an address?

Full code:

func getAddress() -> String {
        var address: String = ""

        let geoCoder = CLGeocoder()
        let location = CLLocation(latitude: selectedLat, longitude: selectedLon)
        //selectedLat and selectedLon are double values set by the app in a previous process

        geoCoder.reverseGeocodeLocation(location, completionHandler: { (placemarks, error) -> Void in

            // Place details
            var placeMark: CLPlacemark!
            placeMark = placemarks?[0]

            // Address dictionary
            //print(placeMark.addressDictionary ?? "")

            // Location name
            if let locationName = placeMark.addressDictionary!["Name"] as? NSString {
                //print(locationName)
            }

            // Street address
            if let street = placeMark.addressDictionary!["Thoroughfare"] as? NSString {
                //print(street)
            }

            // City
            if let city = placeMark.addressDictionary!["City"] as? NSString {
                //print(city)
            }

            // Zip code
            if let zip = placeMark.addressDictionary!["ZIP"] as? NSString {
                //print(zip)
            }

            // Country
            if let country = placeMark.addressDictionary!["Country"] as? NSString {
                //print(country)
            }

        })

        return address;
    }

Body:
Here's a 2-3 line version of the answers here:

    func getAddress(placemarks: [CLPlacemark]) -> String {
        guard let placemark = placemarks.first, !placemarks.isEmpty else {return ""}
        let outputString = [placemark.locality,
                            placemark.subLocality,
                            placemark.thoroughfare,
                            placemark.postalCode,
                            placemark.subThoroughfare,
                            placemark.country].compactMap{$0}.joined(separator: ", ")
        print(outputString)
        return outputString
    }


来源: stackexchange

问:
When i tried to send mail using phpmailer, i am getting error
Could not instantiate mail function.

Message couldnot be sentMailer Error: Could not instantiate mail function.

```<code>require 'PHPMailer/PHPMailerAutoload.php';
$mail =new PHPMailer;
$mail->HOST ='localhost';
$mail->PORT = 25;
$mail->SMTPAuth = true;
$mail->SMTPSecure = 'tls';
$mail->Username = 'Username';
$mail->Password = 'Pass';
$mail->setFrom('info@zoeticpolymers.com');
$mail->addAddress('nitesh54546@gmail.com','Nitesh');
$mail->AddReplyTo("info@zoeticpolymers.com");
$mail->isHTMl(true);
$mail->Subject = 'PHP Mailer Subject';
$mail->Body = '<h1>You are Welcome Here.....</h1>';
if(!$mail->send()){
    echo 'Message couldnot be sent';
     echo 'Mailer Error: ' . $mail->ErrorInfo; die;
}else{
    echo 'Message has been sent'; die;
}
</code>```

答:
Have you tried with smtp? The cause of Could not instantiate mail function error may be more than one reason. when you try to send large emails and your PHP error log contains the message Can not send a message: Too big then your mail transfer agent (Sendmail, postfix, Exim, etc) is refusing to deliver these emails.

The solution is to configure the MTA to allow larger attachments. But this is not always possible. The alternate solution is to use SMTP. You will need access to a SMTP server (and login credentials if your SMTP server requires authentication), consider the given example.

$mail->IsSMTP();
$mail->Host = "smtp.example.com";
// used only when SMTP requires authentication
$mail->SMTPAuth = true;
$mail->Username = 'smtp_username';
$mail->Password = 'smtp_password';
```

ContentLicense: CC BY-SA 4.0

Body:
Could not instantiate mail function.

Message couldnot be sentMailer Error: Could not instantiate mail function.

require 'PHPMailer/PHPMailerAutoload.php';
$mail =new PHPMailer;
$mail->HOST ='localhost';
$mail->PORT = 25;
$mail->SMTPAuth = true;
$mail->SMTPSecure = 'tls';
$mail->Username = 'Username';
$mail->Password = 'Pass';
$mail->setFrom('info@zoeticpolymers.com');
$mail->addAddress('nitesh54546@gmail.com','Nitesh');
$mail->AddReplyTo("info@zoeticpolymers.com");
$mail->isHTMl(true);
$mail->Subject = 'PHP Mailer Subject';
$mail->Body = '
You are Welcome Here.....
';
if(!$mail->send()){
    echo 'Message couldnot be sent';
     echo 'Mailer Error: ' . $mail->ErrorInfo; die;
}else{
    echo 'Message has been sent'; die;
}


问:
nestedrecyclerview inside recyclerview not scrolling android

            </p>

```<code>            <ImageView
                android:id="@+id/settings"
                android:layout_width="@dimen/_30sdp"
                android:layout_height="@dimen/_30sdp"
                android:layout_marginTop="@dimen/_5sdp"
                android:background="@mipmap/menu" />

            <TextView
                android:id="@+id/title"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerHorizontal="true"
                android:layout_gravity="center"
                android:layout_marginLeft="@dimen/_12sdp"
                android:layout_marginTop="5dip"
                android:layout_weight="1"
                android:fontFamily="@font/montserrat"
                android:gravity="center"
                android:text="2019"
                android:textColor="#EDF0F5"
                android:textSize="19dip"
                android:textStyle="bold" />
            <ImageView
                android:id="@+id/addPeople"
                android:layout_width="@dimen/_30sdp"
                android:layout_height="@dimen/_30sdp"
                android:layout_marginTop="@dimen/_5sdp"/>
        </LinearLayout>
        <android.core.widget.NestedScrollView
            android:id="@+id/nestedScrollView"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_below="@+id/l1"
            android:layout_gravity="fill_vertical"
            android:fillViewport="true"
            app:layout_behavior="@string/appbar_scrolling_view_behavior">
            <android.recyclerview.widget.RecyclerView
                android:id="@+id/rv_item"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="@dimen/_7sdp"
                tools:targetApi="lollipop" />
        </androidx.core.widget.NestedScrollView>
    </RelativeLayout>
    <include layout="@layout/listhome" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>
</code>```

<p>i written above xml code in my application recyclerview showing but not scrolling if i add nestedscrollview android i written above xml code in my application recyclerview showing but not scrolling if i add nestedscrollview android </p>

答:
You're nesting a recycler view inside another scrollable viewgroup i.e. NestedScrollView, Both have there own scroll mechanisms but since parent is NestedScrollView the child RecyclerView will loose its ability to scroll properly.

Solution to your problem is just disabling nested scrolling on recycler view.

Try this:

```<code>ViewCompat.setNestedScrollingEnabled(recyclerView,false);
</code>```

Body:
            <ImageView
                android:id="@+id/settings"
                android:layout_width="@dimen/_30sdp"
                android:layout_height="@dimen/_30sdp"
                android:layout_marginTop="@dimen/_5sdp"
                android:background="@mipmap/menu" />

            <TextView
                android:id="@+id/title"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerHorizontal="true"
                android:layout_gravity="center"
                android:layout_marginLeft="@dimen/_12sdp"
                android:layout_marginTop="5dip"
                android:layout_weight="1"
                android:fontFamily="@font/montserrat"
                android:gravity="center"
                android:text="2019"
                android:textColor="#EDF0F5"
                android:textSize="19dip"
                android:textStyle="bold" />
            <ImageView
                android:id="@+id/addPeople"
                android:layout_width="@dimen/_30sdp"
                android:layout_height="@dimen/_30sdp"
                android:layout_marginTop="@dimen/_5sdp"/>
        </LinearLayout>
        <android.core.widget.NestedScrollView
            android:id="@+id/nestedScrollView"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_below="@+id/l1"
            android:layout_gravity="fill_vertical"
            android:fillViewport="true"
            app:layout_behavior="@string/appbar_scrolling_view_behavior">
            <android.recyclerview.widget.RecyclerView
                android:id="@+id/rv_item"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="@dimen/_7sdp"
                tools:targetApi="lollipop" />
        </androidx.core.widget.NestedScrollView>
    </RelativeLayout>
    <include layout="@layout/listhome" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>

i written above xml code in my application recyclerview showing but not scrolling if i add nestedscrollview android i written above xml code in my application recyclerview showing but not scrolling if i add nestedscrollview android

Body:
You're nesting a recycler view inside another scrollable viewgroup i.e. NestedScrollView, Both have there own scroll mechanisms but since parent is NestedScrollView the child RecyclerView will loose its ability to scroll properly.

Solution to your problem is just disabling nested scrolling on recycler view.

Try this:

ViewCompat.setNestedScrollingEnabled(recyclerView,false);


问:
How to reduce context switches when traversing a Seq of Scala futures
I have a program that needs to fetch a large number (~300) records and do some operation on them. The records are cached, so it take no CPU and almost no time. However, at 50% CPU util the p95 latency is 40ms. When looking at the stack trace, threads spend most of the time in Parked state,  and the most used method is 'java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:215)'. So I am guesssing most of the time is used on context switching

```<code> def getObject(id: Ing): Future[SomeObject] = ??? // Can make a call to DB, but usually cached
 val ids: Seq[Int] = ??? // 300 ints

 Future.iterate(ids)(getObject)
</code>```

How can I improve the performance? I have tried Akka FastFuture, and tried using both global (work stealing thread pool) and Akka default dispatcher (ForkJoin).

Specifically
1) What can I do if we assume that some of the getObject calls blocking (cache miss)
2) What can I do if we assume that all getObject calls are served from cache (I can pre-wark the cache, and use background refresh )

p.s
Heap dump: https://heaphero.io/my-heap-report.jsp?p=YXJjaGl2ZWQvMjAyMC8wMi8xOC8tLWJhc2UtZm9yay56aXAtNC0yNi02Lmpzb24tLQ==

答: The best solution is to change the Database access so that multiple objects are fetched within a single Future. Even if there is a limit on the number of objects that can be fetched, it is still going to drastically reduce the overheads.

Body:
I have a program that needs to fetch a large number (~300) records and do some operation on them. The records are cached, so it take no CPU and almost no time. However, at 50% CPU util the p95 latency is 40ms. When looking at the stack trace, threads spend most of the time in Parked state,  and the most used method is 'java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:215)'. So I am guesssing most of the time is used on context switching

 def getObject(id: Ing): Future[SomeObject] = ??? // Can make a call to DB, but usually cached
 val ids: Seq[Int] = ??? // 300 ints

 Future.iterate(ids)(getObject)

How can I improve the performance? I have tried Akka FastFuture, and tried using both global (work stealing thread pool) and Akka default dispatcher (ForkJoin).

Specifically
1) What can I do if we assume that some of the getObject calls blocking (cache miss)
2) What can I do if we assume that all getObject calls are served from cache (I can pre-wark the cache, and use background refresh )

p.s
Heap dump: https://heaphero.io/my-heap-report.jsp?p=YXJjaGl2ZWQvMjAyMC8wMi8xOC8tLWJhc2UtZm9yay56aXAtNC0yNi02Lmpzb24tLQ==


问:
How to return location header url with protocol https?
I have a secured webapp with a flask based Web and Celery containers that communicates via https.

The Web container receives a POST fetch, with https protocol, from the client, starts a background task, and returns a response that includes the url for the task status:

```<code>jsonify({}), 202, {'Location': url_for('create_zip_file_taskstatus', task_id=task.id)}
</code>```

The client waits for the response and then gets the url for the task status:

```<code>let create_zipfile_status_url = response.headers.get('location');
</code>```

The relative url of the location itself without the protocol is fine:

```<code>url_for('create_zip_file_taskstatus', task_id=task.id): /status/c4bc9e2c-6ecd-4bf3-bc25-782f8e4e66c6
</code>```

But the full url has a protocol of http, which causes CORS errors.

```<code>create_zipfile_status_url: http://localhost/status/7aba0d27-712d-4623-a37e-5262b53fe212
</code>```

How can I set the location header url to be with protocol https (instead of http)?

答:
I found the solution here.
Needed to add _external=True, _scheme='https' i.e. change from

```<code>return jsonify({}), 202, {'Location': url_for('create_zip_file_taskstatus', task_id=task.id)}
</code>```

to

```<code>return jsonify({}), 202, {'Location': url_for('create_zip_file_taskstatus', task_id=task.id, _external=True, _scheme='https')}
</code>```

Body:
I have a secured webapp with a flask based Web and Celery containers that communicates via https.

The Web container receives a POST fetch, with https protocol, from the client, starts a background task, and returns a response that includes the url for the task status:

jsonify({}), 202, {'Location': url_for('create_zip_file_taskstatus', task_id=task.id)}

The client waits for the response and then gets the url for the task status:

let create_zipfile_status_url = response.headers.get('location');

The relative url of the location itself without the protocol is fine:

url_for('create_zip_file_taskstatus', task_id=task.id): /status/c4bc9e2c-6ecd-4bf3-bc25-782f8e4e66c6

But the full url has a protocol of http, which causes CORS errors.

create_zipfile_status_url: http://localhost/status/7aba0d27-712d-4623-a37e-5262b53fe212

How can I set the location header url to be with protocol https (instead of http)?

Body:
I found the solution here.
Needed to add _external=True, _scheme='https' i.e. change from

return jsonify({}), 202, {'Location': url_for('create_zip_file_taskstatus', task_id=task.id)}

to

return jsonify({}), 202, {'Location': url_for('create_zip_file_taskstatus', task_id=task.id, _external=True, _scheme='https')}


问:
Syncing localStorage
I'm looking for a solution that allows a browser's localStorage to be less local, so that people can access their data on multiple devices. The traditional way is to run a database on a server and have people log in; but I'm trying to avoid doing that. I'd like the server side to be lightweight - perhaps even completely static if possible - and to not have the job of safely storing passwords, worrying about data protection etc.

Many browsers have a login of some sort -- Google Account, Firefox Account etc -- that ties a user's browsers together. So the ideal solution would be to store data in localStorage, but use that account to sync across devices. There are interfaces such as chrome.storage that seem to be available to packaged apps, but not to ordinary web pages.

Is something like this possible with present technologies?

答:
You want secure cloud storage for your app in a browser without having to do the security?

You could have your app do OAuth with GitHub via Auth0, and create a GitHub App that the user adds to a private repo. Your app then syncs their data to the repo.

Then GitHub handles the identity, Auth0 handles the authentication, and GitHub handles the data storage.

ContentLicense: CC BY-SA 3.0

Title: Syncing localStorage


问:
How to omit null field from Swagger/OpenAPI in ResponseEntity?
I'm trying to omit null values in my ResponseEntity.

My controller looks something like this:

@RestController
public class FooController {

    //fields
    //constructor

    @PostMapping
    public ResponseEntity<CreateFooResponseV10> createFoo(@Valid @RequestBody CreateFooRequestV10 foo, HttpServletRequest request) {
        //some minor logic
        return new ResponseEntity<>(aFooResponseV10Builder()
                .withFirstName(foo.getFirstName())
                .withLastName(foo.getLastName())
                .withTestField(NULLABLE_OBJECT)
                .build(), ...);
    //I generated the builders from the output classes openapi-generator provided
    }
    // more stuff...
}
```

<p>When <code>NULLABLE_OBJECT</code> is equal to <code>null</code> I expect the field to be omitted from the response like this:</p>

```{
  "firstName": "John",
  "lastName": "Doe"
}
```

<p>But I either get these responses, depending on what I've tried so far:</p>

```{
  "firstName": "John",
  "lastName": "Doe",
  "testField": null
}
```

<p>or</p>

```{
   "firstName": "John",
   "lastName": "Doe",
   "testField": {"present":false}
}
```

<p>I generate my request/response objects (<code>CreateFooResponseV10</code> and <code>CreateFooRequestV10</code>) with the use of openapi-generator</p>

<p>Here is my redacted <code>api.json</code> file:</p>

```{
  "openapi": "3.0.1",
  "info": { ... },
  "servers": [ ... ],
  "paths": {
    "/foo": {
      "post": {
        ...
        "requestBody": {
          "description": "Foo to be created",
          "content": {
            "application/foo+json;version=1.0": {
              "schema": {
                "$ref": "#/components/schemas/CreateFooRequest_V1_0"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "description": "Foo is successfully created",
            "headers": { ... },
            "content": {
              "application/foo+json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateFooResponse_V1_0"
                }
              }
            }
          },
          ...
        }
      }
    }
  },
  "components": {
    "schemas": {
      "CreateFooRequest_V1_0": {
        "required": [
          "firstName",
          "lastName"
        ],
        "type": "object",
        "properties": {
          "firstName": { ... },
          "lastName": { ... },
          "testField": {
            "description": "...",
            "type": "string",
            "nullable": true
          }
        }
      },
      "CreateFooResponse_V1_0": {
        "required": [
          "firstName",
          "lastName"
        ],
        "type": "object",
        "properties": {
          "firstName": { ... },
          "lastName": { ... },
          "testField": {
            "description": "...",
            "type": "string",
            "nullable": true
          }
        }
      }
    }
  }
}
```

As you can see in both the request and response testField is not required and can be nullable.
So when testField is null it should be hidden from the response, but when it contains some date it should be shown of course.

I've tried overriding jackson's ObjectMapper bean as explained in this answer. Didn't work.

I've tried adding spring.jackson.default-property-inclusion=non_null to the application.properties. Didn't work.

What I think should work is adding @JsonIgnore above testField of the generated classes, but I don't know if this is something needed to be done manually (for each schema component, can be a lot of manual work for something that is generated) or if this can be configured in the plugin somewhere.

Thanks in advance.

extra info

OpenAPI 3.0.1

Maven 3.6.3

Java 11.0.2

jackson-databind-nullable 0.2.1

openapi-generator-maven-plugin 4.2.2

答:
Try registering the following bean in your spring context. It should override default bean</p>

```<code>@Bean
public HttpMessageConverters httpMessageConverters() {
    ObjectMapper mapper = new ObjectMapper();
    mapper.setSerializationInclusion(Include.NON_NULL)
    return new HttpMessageConverters(
            new MappingJackson2HttpMessageConverter(mapper));
}
</code>```

Body:
I'm trying to omit null values in my ResponseEntity.

My controller looks something like this:

@RestController
public class FooController {

    //fields
    //constructor

    @PostMapping
    public ResponseEntity<CreateFooResponseV10> createFoo(@Valid @RequestBody CreateFooRequestV10 foo, HttpServletRequest request) {
        //some minor logic
        return new ResponseEntity<>(aFooResponseV10Builder()
                .withFirstName(foo.getFirstName())
                .withLastName(foo.getLastName())
                .withTestField(NULLABLE_OBJECT)
                .build(), ...);
    //I generated the builders from the output classes openapi-generator provided
    }
    // more stuff...
}

When NULLABLE_OBJECT is equal to null I expect the field to be omitted from the response like this:

{
  "firstName": "John",
  "lastName": "Doe"
}

But I either get these responses, depending on what I've tried so far:

{
  "firstName": "John",
  "lastName": "Doe",
  "testField": null
}

or

{
   "firstName": "John",
   "lastName": "Doe",
   "testField": {"present":false}
}

I generate my request/response objects (CreateFooResponseV10 and CreateFooRequestV10) with the use of openapi-generator

Here is my redacted api.json file:

{
  "openapi": "3.0.1",
  "info": { ... },
  "servers": [ ... ],
  "paths": {
    "/foo": {
      "post": {
        ...
        "requestBody": {
          "description": "Foo to be created",
          "content": {
            "application/foo+json;version=1.0": {
              "schema": {
                "$ref": "#/components/schemas/CreateFooRequest_V1_0"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "description": "Foo is successfully created",
            "headers": { ... },
            "content": {
              "application/foo+json": {
                "schema": {
                  "$ref": "#/components/schemas/CreateFooResponse_V1_0"
                }
              }
            }
          },
          ...
        }
      }
    }
  },
  "components": {
    "schemas": {
      "CreateFooRequest_V1_0": {
        "required": [
          "firstName",
          "lastName"
        ],
        "type": "object",
        "properties": {
          "firstName": { ... },
          "lastName": { ... },
          "testField": {
            "description": "...",
            "type": "string",
            "nullable": true
          }
        }
      },
      "CreateFooResponse_V1_0": {
        "required": [
          "firstName",
          "lastName"
        ],
        "type": "object",
        "properties": {
          "firstName": { ... },
          "lastName": { ... },
          "testField": {
            "description": "...",
            "type": "string",
            "nullable": true
          }
        }
      }
    }
  }
}

As you can see in both the request and response testField is not required and can be nullable.
So when testField is null it should be hidden from the response, but when it contains some date it should be shown of course.

I've tried overriding jackson's ObjectMapper bean as explained in this answer. Didn't work.

I've tried adding spring.jackson.default-property-inclusion=non_null to the application.properties. Didn't work.

What I think should work is adding @JsonIgnore above testField of the generated classes, but I don't know if this is something needed to be done manually (for each schema component, can be a lot of manual work for something that is generated) or if this can be configured in the plugin somewhere.

Thanks in advance.

extra info

OpenAPI 3.0.1

Maven 3.6.3

Java 11.0.2

jackson-databind-nullable 0.2.1

openapi-generator-maven-plugin 4.2.2

Body:
Try registering the following bean in your spring context. It should override default bean

@Bean
public HttpMessageConverters httpMessageConverters() {
    ObjectMapper mapper = new ObjectMapper();
    mapper.setSerializationInclusion(Include.NON_NULL)
    return new HttpMessageConverters(
            new MappingJackson2HttpMessageConverter(mapper));
}


问:
git move directory to another repository while keeping the history
First - apologies for asking this question. There are a lot of topics about it already. But I'm not having much luck with them. My lack of familiarity with git is not much help.

I'm moving a folder from one git repo to another (which already exists). e.g.

```<code>repo-1
---- dir1
---- dir2
---- dir3
---- dir-to-move
---- dir5

repo-2
---- dir1
---- dir2
---- dir3
</code>```

In the end I want the repos to look like

```<code>repo-1
---- dir1
---- dir2
---- dir3
---- dir-to-move
---- dir5

repo-2
---- dir1
---- dir2
---- dir3
---- dir-to-move
</code>```

i.e. For a time dir-to-move will exist in both repos. But eventually I'll migrate the latest changes to repo-2 and remove dir-to-move from repo-1.

My initial research made me believe that I needed to use filter-branch. e.g.

How to move files from one git repo to another preserving history using `git format-patch`and `git am`

I've since learnt that subtree superseded that approach. However it's not doing what I expected. I thought I'd be able to do something like

In repo-1 workspace

```<code>git subtree split -P dir-to-move -b split
</code>```

to filter the split branch down to only dir-to-move and it's history.
Then in repo-2 workspace

```<code>git remote add repo-1 repo-1-url.git
git subtree add --prefix dir-to-move split
</code>```

This does move the code across. It also, sort of, includes the history

e.g.

```<code>cd repo-2
git log
</code>```

Shows commits from repo-1

but

```<code>cd repo-2
git log dir-to-move
</code>```

Shows only an 'Add dir-to-move from commit ....'

i.e. The history is included but does not show up when checked for the specific files/directories.

How can I do this properly?

答:
You can even make a commit on repo-1 by deleting all directory other than dir-to-move locally (by this way no need to use fitler-branch) and then pull to repo-2.

```<code>git clone https://path/to/repo-1
cd repo-1
rm dir1 dir2 dir3 dir5 -rf
git commit -m "Removed unwanted directory for repo-2
cd ../
git clone https://path/to/repo-2
cd repo-2
git remote add repo-1-src ../repo-1
git pull repo-1-src master --allow-unrelated-histories
</code>```

Note: Make sure git version is 2.9 or more for using --allow-unrelated-histories option

Body:
First - apologies for asking this question. There are a lot of topics about it already. But I'm not having much luck with them. My lack of familiarity with git is not much help.

I'm moving a folder from one git repo to another (which already exists). e.g.

repo-1
---- dir1
---- dir2
---- dir3
---- dir-to-move
---- dir5

repo-2
---- dir1
---- dir2
---- dir3

In the end I want the repos to look like

repo-1
---- dir1
---- dir2
---- dir3
---- dir-to-move
---- dir5

repo-2
---- dir1
---- dir2
---- dir3
---- dir-to-move

i.e. For a time dir-to-move will exist in both repos. But eventually I'll migrate the latest changes to repo-2 and remove dir-to-move from repo-1.

My initial research made me believe that I needed to use filter-branch. e.g.

How to move files from one git repo to another preserving history using `git format-patch`and `git am`

I've since learnt that subtree superseded that approach. However it's not doing what I expected. I thought I'd be able to do something like

In repo-1 workspace

git subtree split -P dir-to-move -b split

to filter the split branch down to only dir-to-move and it's history.
Then in repo-2 workspace

git remote add repo-1 repo-1-url.git
git subtree add --prefix dir-to-move split

This does move the code across. It also, sort of, includes the history

e.g.

cd repo-2
git log

Shows commits from repo-1

but

cd repo-2
git log dir-to-move

Shows only an 'Add dir-to-move from commit ....'

i.e. The history is included but does not show up when checked for the specific files/directories.

How can I do this properly?

Body:
You can even make a commit on repo-1 by deleting all directory other than dir-to-move locally (by this way no need to use fitler-branch) and then pull to repo-2.

git clone https://path/to/repo-1
cd repo-1
rm dir1 dir2 dir3 dir5 -rf
git commit -m "Removed unwanted directory for repo-2
cd ../
git clone https://path/to/repo-2
cd repo-2
git remote add repo-1-src ../repo-1
git pull repo-1-src master --allow-unrelated-histories

Note: Make sure git version is 2.9 or more for using --allow-unrelated-histories option


问:
Conditional Where Clause in SQL based on selected option
New to SQL Server and trying to write a query that changes the where statement based on the options presented to the report user. I want to select a location and see if items for that location meet certain criteria. The criteria change based on the location. I have working queries for each option, but want to use one report to check each location.</p>

```<code>SELECT
  Stuff
FROM
  Table1
  INNER JOIN Table2
    ON Table1.ID = Table2.ID
WHERE
  Table2.DefaultIPGateway0 LIKE N'10.'+(@Site)+'.%'
  AND Table2.IPAddress0 LIKE N'10.%'
  Case
    When (@Site) = "1" Then AND Table1.Name0 NOT LIKE N'ABC%' AND Table1.Name0 NOT LIKE N'ABD%'
    When (@Site) = "2" Then AND Table1.Name0 NOT LIKE N'EFG%'
    When (@Site) = "3" Then AND Table1.Name0 NOT LIKE N'HIJ%' AND Table1.Name0 NOT LIKE N'STU%' AND Table1.Name0 NOT LIKE N'MNO%'
  End
</code>```

答:
Your query is not a valid SQL statement, you can change your query like following if you want to have where condition using CASE.

```<code>SELECT Stuff
FROM Table1
INNER JOIN Table2 ON Table1.ID = Table2.ID
WHERE Table2.DefaultIPGateway0 LIKE N'10.' + @Site + '.%'
    AND Table2.IPAddress0 LIKE N'10.%'
    AND (
        CASE
            WHEN @Site = '1'
                AND Table1.Name0 NOT LIKE N'ABC%'
                AND Table1.Name0 NOT LIKE N'ABD%'
                THEN 1
            WHEN @Site = '2'
                AND Table1.Name0 NOT LIKE N'EFG%'
                THEN 1
            WHEN @Site = '3'
                AND Table1.Name0 NOT LIKE N'HIJ%'
                AND Table1.Name0 NOT LIKE N'STU%'
                AND Table1.Name0 NOT LIKE N'MNO%'
                THEN 1
            ELSE 0
            END
        ) = 1
</code>```

Body:
New to SQL Server and trying to write a query that changes the where statement based on the options presented to the report user. I want to select a location and see if items for that location meet certain criteria. The criteria change based on the location. I have working queries for each option, but want to use one report to check each location.

SELECT
  Stuff
FROM
  Table1
  INNER JOIN Table2
    ON Table1.ID = Table2.ID
WHERE
  Table2.DefaultIPGateway0 LIKE N'10.'+(@Site)+'.%'
  AND Table2.IPAddress0 LIKE N'10.%'
  Case
    When (@Site) = "1" Then AND Table1.Name0 NOT LIKE N'ABC%' AND Table1.Name0 NOT LIKE N'ABD%'
    When (@Site) = "2" Then AND Table1.Name0 NOT LIKE N'EFG%'
    When (@Site) = "3" Then AND Table1.Name0 NOT LIKE N'HIJ%' AND Table1.Name0 NOT LIKE N'STU%' AND Table1.Name0 NOT LIKE N'MNO%'
  End

Body:
Your query is not a valid SQL statement, you can change your query like following if you want to have where condition using CASE.

SELECT Stuff
FROM Table1
INNER JOIN Table2 ON Table1.ID = Table2.ID
WHERE Table2.DefaultIPGateway0 LIKE N'10.' + @Site + '.%'
    AND Table2.IPAddress0 LIKE N'10.%'
    AND (
        CASE
            WHEN @Site = '1'
                AND Table1.Name0 NOT LIKE N'ABC%'
                AND Table1.Name0 NOT LIKE N'ABD%'
                THEN 1
            WHEN @Site = '2'
                AND Table1.Name0 NOT LIKE N'EFG%'
                THEN 1
            WHEN @Site = '3'
                AND Table1.Name0 NOT LIKE N'HIJ%'
                AND Table1.Name0 NOT LIKE N'STU%'
                AND Table1.Name0 NOT LIKE N'MNO%'
                THEN 1
            ELSE 0
            END
        ) = 1


问:
Show file path using WX
I am trying to show the file path after it been dropped in NewText label
but it only show me the path on the top window...
what can i do to make it work.

This is my code
I am  trying to show path where is 'Path will be' staticText

```<code>import wx

class MyFileDropTarget(wx.FileDropTarget):
    def __init__(self, window):
        wx.FileDropTarget.__init__(self)
        self.window = window

    def OnDropFiles(self, x, y, filename):
        #self.window.SetInsertionPointEnd()
        TempTxt = filename
        print(TempTxt)
        print(type(TempTxt))
        TempTxt = str(TempTxt)
        print(type(TempTxt))
        self.window.LabelTextUpdate(TempTxt)
        return True

class Example(wx.Frame):
    def __init__(self, parent, title):
        super(Example, self).__init__(parent, title=title)
        self.InitUI()
        self.Center()

    def InitUI(self):
        panel = wx.Panel(self)
        FileDrTr = MyFileDropTarget(self)
        font = wx.SystemSettings.GetFont(wx.SYS_SYSTEM_FONT)
        font.SetPointSize(9)
        verBox = wx.BoxSizer(wx.VERTICAL)
        horBoxOne = wx.BoxSizer(wx.HORIZONTAL)
        TextLabel = wx.StaticText(panel, label = 'Drop file hear')
        TextLabel.SetFont(font)
        horBoxOne.Add(TextLabel, flag=wx.RIGHT, border=10)
        DropePlace = wx.TextCtrl(panel)
        DropePlace.SetDropTarget(FileDrTr)
        horBoxOne.Add(DropePlace, proportion=1)
        verBox.Add(horBoxOne, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=10)
        verBox.Add((-1, 10))
        horBoxTwo = wx.BoxSizer(wx.HORIZONTAL)
        NewText = wx.StaticText(panel, label = 'Path will be')
        horBoxTwo.Add(NewText, flag=wx.RIGHT, border=5)
        verBox.Add(horBoxTwo, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=10)
        panel.SetSizer(verBox)

    def LabelTextUpdate(self, txt):
        print(txt)
        print(type(txt))
        NewText = wx.StaticText(self, label = txt)

def main():
    app = wx.App()
    ex = Example(None, title = 'drope and see file path')
    ex.Show()
    app.MainLoop()

if __name__ == '__main__':
    main()
</code>```

答:
In your InitUI you have created some widgets, one of them is the NewText, which I suppose it the one you want to use for displaying the file path. You have placed it in the window using a sizer. So far so good.

In LabelTextUpdate you create a completely new widget and set its text. The widget is placed inside your window, probably at the top-left coordinates, therefore it looks as if you changed the text of the window. But in fact you placed a new widgets.

In fact, you want to change the NewText's label. You must keep the reference to the NewText within the object, so in InitUI you will do (notice the self):

```<code>    self.NewText = wx.StaticText(panel, label = 'Path will be')
    horBoxTwo.Add(self.NewText, flag=wx.RIGHT, border=5)
</code>```

And LabelTextUpdate will use this member variable:

```<code>def LabelTextUpdate(self, txt):
    self.NewText.SetLabel(txt)
</code>```

That's it.

Title: Show file path using WX

Body:
I am trying to show the file path after it been dropped in NewText label
but it only show me the path on the top window...
what can i do to make it work.

This is my code
I am  trying to show path where is 'Path will be' staticText

import wx

class MyFileDropTarget(wx.FileDropTarget):
    def __init__(self, window):
        wx.FileDropTarget.__init__(self)
        self.window = window

    def OnDropFiles(self, x, y, filename):
        #self.window.SetInsertionPointEnd()
        TempTxt = filename
        print(TempTxt)
        print(type(TempTxt))
        TempTxt = str(TempTxt)
        print(type(TempTxt))
        self.window.LabelTextUpdate(TempTxt)
        return True

class Example(wx.Frame):
    def __init__(self, parent, title):
        super(Example, self).__init__(parent, title=title)
        self.InitUI()
        self.Center()

    def InitUI(self):
        panel = wx.Panel(self)
        FileDrTr = MyFileDropTarget(self)
        font = wx.SystemSettings.GetFont(wx.SYS_SYSTEM_FONT)
        font.SetPointSize(9)
        verBox = wx.BoxSizer(wx.VERTICAL)
        horBoxOne = wx.BoxSizer(wx.HORIZONTAL)
        TextLabel = wx.StaticText(panel, label = 'Drop file hear')
        TextLabel.SetFont(font)
        horBoxOne.Add(TextLabel, flag=wx.RIGHT, border=10)
        DropePlace = wx.TextCtrl(panel)
        DropePlace.SetDropTarget(FileDrTr)
        horBoxOne.Add(DropePlace, proportion=1)
        verBox.Add(horBoxOne, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=10)
        verBox.Add((-1, 10))
        horBoxTwo = wx.BoxSizer(wx.HORIZONTAL)
        NewText = wx.StaticText(panel, label = 'Path will be')
        horBoxTwo.Add(NewText, flag=wx.RIGHT, border=5)
        verBox.Add(horBoxTwo, flag=wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, border=10)
        panel.SetSizer(verBox)

    def LabelTextUpdate(self, txt):
        print(txt)
        print(type(txt))
        NewText = wx.StaticText(self, label = txt)

def main():
    app = wx.App()
    ex = Example(None, title = 'drope and see file path')
    ex.Show()
    app.MainLoop()

if __name__ == '__main__':
    main()

Body:
In your InitUI you have created some widgets, one of them is the NewText, which I suppose it the one you want to use for displaying the file path. You have placed it in the window using a sizer. So far so good.

In LabelTextUpdate you create a completely new widget and set its text. The widget is placed inside your window, probably at the top-left coordinates, therefore it looks as if you changed the text of the window. But in fact you placed a new widgets.

In fact, you want to change the NewText's label. You must keep the reference to the NewText within the object, so in InitUI you will do (notice the self):

    self.NewText = wx.StaticText(panel, label = 'Path will be')
    horBoxTwo.Add(self.NewText, flag=wx.RIGHT, border=5)

And LabelTextUpdate will use this member variable:

def LabelTextUpdate(self, txt):
    self.NewText.SetLabel(txt)

That's it.


问:
Failed to run BookInfo example behind proxy server, failed calling webhook "pilot.validation.istio.io"
Issue also posted at:

https://github.com/istio/istio/issues/21195

https://www.reddit.com/r/istio/comments/f57v2a/help_failed_to_run_bookinfo_example_behind_proxy/

Problem:

Following the bookinfo example, when trying to apply bookinfo-gateway, I get the following error:

```<code>Error from server (InternalError): error when creating "samples/bookinfo/networking/bookinfo-gateway.yaml": Internal error occurred: failed calling webhook "pilot.validation.istio.io": Post https://istio-galley.istio-system.svc:443/admitpilot?timeout=30s: context deadline exceeded
</code>```

Output:

```$ kubectl --v=9 apply -f samples/bookinfo/networking/bookinfo-gateway.yaml
I0216 18:01:08.548290    4904 loader.go:375] Config loaded from file:  /home/user/.kube/config
I0216 18:01:08.550426    4904 round_trippers.go:423] curl -k -v -XGET  -H "User-Agent: kubectl/v1.17.3 (linux/amd64) kubernetes/06ad960" -H "Accept: application/com.github.proto-openapi.spec.v2@v1.0+protobuf" 'https://ha-lb-ip:6443/openapi/v2?timeout=32s'
I0216 18:01:08.600310    4904 round_trippers.go:443] GET https://ha-lb-ip:6443/openapi/v2?timeout=32s 200 OK in 49 milliseconds
I0216 18:01:08.600348    4904 round_trippers.go:449] Response Headers:
I0216 18:01:08.600355    4904 round_trippers.go:452]     Accept-Ranges: bytes
I0216 18:01:08.600361    4904 round_trippers.go:452]     X-Varied-Accept: application/com.github.proto-openapi.spec.v2@v1.0+protobuf
I0216 18:01:08.600366    4904 round_trippers.go:452]     Content-Type: application/octet-stream
I0216 18:01:08.600371    4904 round_trippers.go:452]     Etag: "DCA49D599C62F0A8DDF840BBF0F4DB11A2B0C9805F7F6CEB19F163F61CA7D40F9E7A3607B007A74CCD6DBA6565BE6E6E3085528F7FD18EDAE99BABE9702D8700"
I0216 18:01:08.600378    4904 round_trippers.go:452]     Last-Modified: Sun, 16 Feb 2020 11:54:46 GMT
I0216 18:01:08.600430    4904 round_trippers.go:452]     Vary: Accept-Encoding
I0216 18:01:08.600435    4904 round_trippers.go:452]     Vary: Accept
I0216 18:01:08.600439    4904 round_trippers.go:452]     Date: Sun, 16 Feb 2020 12:01:08 GMT
I0216 18:01:08.817775    4904 request.go:1015] Response Body:
00000000  0a 03 32 2e 30 12 15 0a  0a 4b 75 62 65 72 6e 65  |..2.0....Kuberne|
00000010  74 65 73 12 07 76 31 2e  31 37 2e 33 42 93 f7 a9  |tes..v1.17.3B...|
00000020  01 12 ae 27 0a 29 2f 61  70 69 2f 76 31 2f 77 61  |...'.)/api/v1/wa|
00000030  74 63 68 2f 6e 61 6d 65  73 70 61 63 65 73 2f 7b  |tch/namespaces/{|
00000040  6e 61 6d 65 73 70 61 63  65 7d 2f 70 6f 64 73 12  |namespace}/pods.|
00000050  80 27 12 97 04 0a 07 63  6f 72 65 5f 76 31 1a 6f  |.'.....core_v1.o|
00000060  77 61 74 63 68 20 69 6e  64 69 76 69 64 75 61 6c  |watch individual|
00000070  20 63 68 61 6e 67 65 73  20 74 6f 20 61 20 6c 69  | changes to a li|
00000080  73 74 20 6f 66 20 50 6f  64 2e 20 64 65 70 72 65  |st of Pod. depre|
00000090  63 61 74 65 64 3a 20 75  73 65 20 74 68 65 20 27  |cated: use the '|
000000a0  77 61 74 63 68 27 20 70  61 72 61 6d 65 74 65 72  |watch' parameter|
000000b0  20 77 69 74 68 20 61 20  6c 69 73 74 20 6f 70 65  | with a list ope|
000000c0  72 61 74 69 6f 6e 20 69  6e 73 74 65 61 64 2e 2a  |ration instead.*|
000000d0  1c 77 61 74 63 68 43 6f  72 65 56 31 4e 61 6d 65  |.watchCoreV1Name|
000000e0  73 70 61 63 65 64 50 6f  64 4c 69 73 74 32 10 61  |spacedPodList2.a|
000000f0  70 70 6c 69 63 61 74 69  6f 6e 2f 6a 73 6f 6e 32  |pplication/json2|
00000100  10 61 70 70 6c 69 63 61  74 69 6f 6e 2f 79 61 6d  |.application/yam|
00000110  6c 32 23 61 70 70 6c 69  63 61 74 69 6f 6e 2f 76  |l2#application/v|
00000120  6e 64 2e 6b 75 62 65 72  6e 65 74 65 73 2e 70 72  |nd.kubernetes.pr|
00000130  6f 74 6f 62 75 66 32 1d  61 70 70 6c 69 63 61 74  |otobuf2.applicat|
00000140  69 6f 6e 2f 6a 73 6f 6e  3b 73 74 72 65 61 6d 3d  |ion/json;stream=|
00000150  77 61 74 63 68 32 30 61  70 70 6c 69 63 61 74 69  |watch20applicati|
00000160  6f 6e 2f 76 6e 64 2e 6b  75 62 65 72 6e 65 74 65  |on/vnd.kubernete|
00000170  73 2e 70 72 6f 74 6f 62  75 66 3b 73 74 72 65 61  |s.protobuf;strea|
00000180  6d 3d 77 61 74 63 68 3a  03 2a 2f 2a 4a 6b 0a 50  |m=watch:.*/*Jk.P|
00000190  0a 03 32 30 30 12 49 0a  47 0a 02 4f 4b 12 41 0a  |..200.I.G..OK.A.|
000001a0  3f 0a 3d 23 2f 64 65 66  69 6e 69 74 69 6f 6e 73  |?.=#/definitions|
000001b0  2f 69 6f 2e 6b 38 73 2e  61 70 69 6d 61 63 68 69  |/io.k8s.apimachi|
000001c0  6e 65 72 79 2e 70 6b 67  2e 61 70 69 73 2e 6d 65  |nery.pkg.apis.me|
000001d0  74 61 2e 76 31 2e 57 61  74 63 68 45 76 65 6e 74  |ta.v1.WatchEvent|
000001e0  0a 17 0a 03 34 30 31 12  10 0a 0e 0a 0c 55 6e 61  |....401......Una|
000001f0  75 74 68 6f 72 69 7a 65  64 52 05 68 74 74 70 73  |uthorizedR.https|
00000200  6a 23 0a 13 78 2d 6b 75  62 65 72 6e 65 74 65 73  |j#..x-kubernetes|
00000210  2d 61 63 74 69 6f 6e 12  0c 12 0a 77 61 74 63 68  |-action....watch|
00000220  6c 69 73 74 0a 6a 45 0a  1f 78 2d 6b 75 62 65 72  |list.jE..x-kuber|
00000230  6e 65 74 65 73 2d 67 72  6f 75 70 2d 76 65 72 73  |netes-group-vers|
00000240  69 6f 6e 2d 6b 69 6e 64  12 22 12 20 6b 69 6e 64  |ion-kind.". kind|
00000250  3a 20 50 6f 64 0a 76 65  72 73 69 6f 6e 3a 20 76  |: Pod.version: v|
00000260  31 0a 67 72 6f 75 70 3a  20 22 22 0a 4a 82 04 0a  |1.group: "".J...|
00000270  ff 03 12 fc 03 1a f9 03  12 05 71 75 65 72 79 1a  |..........query.|
00000280  ce 03 61 6c 6c 6f 77 57  61 74 63 68 42 6f 6f 6b  |..allowWatchBook|
00000290  6d 61 72 6b 73 20 72 65  71 75 65 73 74 73 20 77  |marks requests w|
000002a0  61 74 63 68 20 65 76 65  6e 74 73 20 77 69 74 68  |atch events with|
000002b0  20 74 79 70 65 20 22 42  4f 4f 4b 4d 41 52 4b 22  | type "BOOKMARK"|
000002c0  2e 20 53 65 72 76 65 72  73 20 74 68 61 74 20 64  |. Servers that d|
000002d0  6f 20 6e 6f 74 20 69 6d  70 6c 65 6d 65 6e 74 20  |o not implement |
000002e0  62 6f 6f 6b 6d 61 72 6b  73 20 6d 61 79 20 69 67  |bookmarks may ig|
000002f0  6e 6f 72 65 20 74 68 69  73 20 66 6c 61 67 20 61  |nore this flag a|
00000300  6e 64 20 62 6f 6f 6b 6d  61 72 6b 73 20 61 72 65  |nd bookmarks are|
00000310  20 73 65 6e 74 20 61 74  20 74 68 65 20 73 65 72  | sent at the ser|
00000320  76 65 72 27 73 20 64 69  73 63 72 65 74 69 6f 6e  |ver's discretion|
00000330  2e 20 43 6c 69 65 6e 74  73 20 73 68 6f 75 6c 64  |. Clients should|
00000340  20 6e 6f 74 20 61 73 73  75 6d 65 20 62 6f 6f 6b  | not assume book|
00000350  6d 61 72 6b 73 20 61 72  65 20 72 65 74 75 72 6e  |marks are return|
00000360  65 64 20 61 74 20 61 6e  79 20 73 70 65 63 69 66  |ed at any specif|
00000370  69 63 20 69 6e 74 65 72  76 61 6c 2c 20 6e 6f 72  |ic interval, nor|
00000380  20 6d 61 79 20 74 68 65  79 20 61 73 73 75 6d 65  | may they assume|
00000390  20 74 68 65 20 73 65 72  76 65 72 20 77 69 6c 6c  | the server will|
000003a0  20 73 65 6e 64 20 61 6e  79 20 42 4f 4f 4b 4d 41  | send any BOOKMA|
000003b0  52 4b 20 65 76 65 6e 74  20 64 75 72 69 6e 67 20  |RK event during |
000003c0  61 20 73 65 73 73 69 6f  6e 2e 20 49 66 20 74 68  |a session. If th|
000003d0  69 73 20 69 73 20 6e 6f  74 20 61 20 77 61 74 63  |is is not a watc|
000003e0  68 2c 20 74 68 69 73 20  66 69 65 6c 64 20 69 73  |h, this field is|
000003f0  20 69 67 6e 6f 72 65 64  2e 20 49 66 20 74 68 65  | ignored. If the|
00000400  20 66 65 61 74 75 72 65  20 67 61 74 65 20 57 61  | feature gate Wa|
00000410  74 63 68 42 6f 6f 6b 6d  61 72 6b 73 20 69 73 20  |tchBookmarks is |
00000420  6e 6f 74 20 65 6e 61 62  6c 65 64 20 69 6e 20 61  |not enabled in a|
00000430  70 69 73 65 72 76 65 72  2c 20 74 68 69 73 20 66  |piserver, this f|
00000440  69 65 6c 64 20 69 73 20  69 67 6e 6f 72 65 64 2e  |ield is ignored.|
00000450  22 13 61 6c 6c 6f 77 57  61 74 63 68 42 6f 6f 6b  |".allowWatchBook|
00000460  6d 61 72 6b 73 32 07 62  6f 6f 6c 65 61 6e a0 01  |marks2.boolean..|
00000470  01 4a ef 09 0a ec 09 12  e9 09 1a e6 09 12 05 71  |.J.............q|
00000480  75 65 72 79 1a c7 09 54  68 65 20 63 6f 6e 74 69  |uery...The conti|
00000490  6e 75 65 20 6f 70 74 69  6f 6e 20 73 68 6f 75 6c  |nue option shoul|
000004a0  64 20 62 65 20 73 65 74  20 77 68 65 6e 20 72 65  |d be set when re|
000004b0  74 72 69 65 76 69 6e 67  20 6d 6f 72 65 20 72 65  |trieving more re|
000004c0  73 75 6c 74 73 20 66 72  6f 6d 20 74 68 65 20 73  |sults from the s|
000004d0  65 72 76 65 72 2e 20 53  69 6e 63 65 20 74 68 69  |erver. Since thi|
000004e0  73 20 76 61 6c 75 65 20  69 73 20 73 65 72 76 65  |s value is serve|
000004f0  72 20 64 65 66 69 6e 65  64 2c 20 63 6c 69 65 6e  |r defined, clien|
00000500  74 73 20 6d 61 79 20 6f  6e 6c 79 20 75 73 65 20  |ts may only use |
00000510  74 68 65 20 63 6f 6e 74  69 6e 75 65 20 76 61 6c  |the continue val|
00000520  75 65 20 66 72 6f 6d 20  61 20 70 72 65 76 69 6f  |ue from a previo|
00000530  75 73 20 71 75 65 72 79  20 72 65 73 75 6c 74 20  |us query result |
00000540  77 69 74 68 20 69 64 65  6e 74 69 63 61 6c 20 71  |with identical q|
00000550  75 65 72 79 20 70 61 72  61 6d 65 74 65 72 73 20  |uery parameters |
00000560  28 65 78 63 65 70 74 20  66 6f 72 20 74 68 65 20  |(except for the |
00000570  76 61 6c 75 65 20 6f 66  20 63 6f 6e 74 69 6e 75  |value of continu|
00000580  65 29 20 61 6e 64 20 74  68 65 20 73 65 72 76 65  |e) and the serve|
00000590  72 20 6d 61 79 20 72 65  6a 65 63 74 20 61 20 63  |r may reject a c|
000005a0  6f 6e 74 69 6e 75 65 20  76 61 6c 75 65 20 69 74  |ontinue value it|
000005b0  20 64 6f 65 73 20 6e 6f  74 20 72 65 63 6f 67 6e  | does not recogn|
000005c0  69 7a 65 2e 20 49 66 20  74 68 65 20 73 70 65 63  |ize. If the spec|
000005d0  69 66 69 65 64 20 63 6f  6e 74 69 6e 75 65 20 76  |ified continue v|
000005e0  61 6c 75 65 20 69 73 20  6e 6f 20 6c 6f 6e 67 65  |alue is no longe|
000005f0  72 20 76 61 6c 69 64 20  77 68 65 74 68 65 72 20  |r valid whether |
00000600  64 75 65 20 74 6f 20 65  78 70 69 72 61 74 69 6f  |due to expiratio|
00000610  6e 20 28 67 65 6e 65 72  61 6c 6c 79 20 66 69 76  |n (generally fiv|
00000620  65 20 74 6f 20 66 69 66  74 65 65 6e 20 6d 69 6e  |e to fifteen min|
00000630  75 74 65 73 29 20 6f 72  20 61 20 63 6f 6e 66 69  |utes) or a confi|
00000640  67 75 72 61 74 69 6f 6e  20 63 68 61 6e 67 65 20  |guration change |
00000650  6f 6e 20 74 68 65 20 73  65 72 76 65 72 2c 20 74  |on the server, t|
00000660  68 65 20 73 65 72 76 65  72 20 77 69 6c 6c 20 72  |he server will r|
00000670  65 73 70 6f 6e 64 20 77  69 74 68 20 61 20 34 31  |espond with a 41|
00000680  30 20 52 65 73 6f 75 72  63 65 45 78 70 69 72 65  |0 ResourceExpire|
00000690  64 20 65 72 72 6f 72 20  74 6f 67 65 74 68 65 72  |d error together|
000006a0  20 77 69 74 68 20 61 20  63 6f 6e 74 69 6e 75 65  | with a continue|
000006b0  20 74 6f 6b 65 6e 2e 20  49 66 20 74 68 65 20 63  | token. If the c|
000006c0  6c 69 65 6e 74 20 6e 65  65 64 73 20 61 20 63 6f  |lient needs a co|
000006d0  6e 73 69 73 74 65 6e 74  20 6c 69 73 74 2c 20 69  |nsistent list, i|
000006e0  74 20 6d 75 73 74 20 72  65 73 74 61 72 74 20 74  |t must restart t|
000006f0  68 65 69 72 20 6c 69 73  74 20 77 69 74 68 6f 75  |heir list withou|
00000700  74 20 74 68 65 20 63 6f  6e 74 69 6e 75 65 20 66  |t the continue f|
00000710  69 65 6c 64 2e 20 4f 74  68 65 72 77 69 73 65 2c  |ield. Otherwise,|
00000720  20 74 68 65 20 63 6c 69  65 6e 74 20 6d 61 79 20  | the client may |
00000730  73 65 6e 64 20 61 6e 6f  74 68 65 72 20 6c 69 73  |send another lis|
00000740  74 20 72 65 71 75 65 73  74 20 77 69 74 68 20 74  |t request with t|
00000750  68 65 20 74 6f 6b 65 6e  20 72 65 63 65 69 76 65  |he token receive|
00000760  64 20 77 69 74 68 20 74  68 65 20 34 31 30 20 65  |d with the 410 e|
00000770  72 72 6f 72 2c 20 74 68  65 20 73 65 72 76 65 72  |rror, the server|
00000780  20 77 69 6c 6c 20 72 65  73 70 6f 6e 64 20 77 69  | will respond wi|
00000790  74 68 20 61 20 6c 69 73  74 20 73 74 61 72 74 69  |th a list starti|
000007a0  6e 67 20 66 72 6f 6d 20  74 68 65 20 6e 65 78 74  |ng from the next|
000007b0  20 6b 65 79 2c 20 62 75  74 20 66 72 6f 6d 20 74  | key, but from t|
000007c0  68 65 20 6c 61 74 65 73  74 20 73 6e 61 70 73 68  |he latest snapsh|
000007d0  6f 74 2c 20 77 68 69 63  68 20 69 73 20 69 6e 63  |ot, which is inc|
000007e0  6f 6e 73 69 73 74 65 6e  74 20 66 72 6f 6d 20 74  |onsistent from t|
000007f0  68 65 20 70 72 65 76 69  6f 75 73 20 6c 69 73 74  |he previous list|
00000800  20 72 65 73 75 6c 74 73  20 2d 20 6f 62 6a 65 63  | results - objec|
00000810  74 73 20 74 68 61 74 20  61 72 65 20 63 [truncated 17345571 chars]
I0216 18:01:08.944681    4904 round_trippers.go:423] curl -k -v -XGET  -H "Accept: application/json" -H "User-Agent: kubectl/v1.17.3 (linux/amd64) kubernetes/06ad960" 'https://ha-lb-ip:6443/apis/networking.istio.io/v1alpha3/namespaces/default/gateways/bookinfo-gateway'
I0216 18:01:08.988784    4904 round_trippers.go:443] GET https://ha-lb-ip:6443/apis/networking.istio.io/v1alpha3/namespaces/default/gateways/bookinfo-gateway 404 Not Found in 44 milliseconds
I0216 18:01:08.988834    4904 round_trippers.go:449] Response Headers:
I0216 18:01:08.988840    4904 round_trippers.go:452]     Content-Length: 258
I0216 18:01:08.988844    4904 round_trippers.go:452]     Date: Sun, 16 Feb 2020 12:01:08 GMT
I0216 18:01:08.988848    4904 round_trippers.go:452]     Content-Type: application/json
I0216 18:01:08.988896    4904 request.go:1017] Response Body: {"kind":"Status","apiVersion":"v1","metadata":{},"status":"Failure","message":"gateways.networking.istio.io \"bookinfo-gateway\" not found","reason":"NotFound","details":{"name":"bookinfo-gateway","group":"networking.istio.io","kind":"gateways"},"code":404}
I0216 18:01:08.989774    4904 request.go:1017] Request Body: {"apiVersion":"networking.istio.io/v1alpha3","kind":"Gateway","metadata":{"annotations":{"kubectl.kubernetes.io/last-applied-configuration":"{\"apiVersion\":\"networking.istio.io/v1alpha3\",\"kind\":\"Gateway\",\"metadata\":{\"annotations\":{},\"name\":\"bookinfo-gateway\",\"namespace\":\"default\"},\"spec\":{\"selector\":{\"istio\":\"ingressgateway\"},\"servers\":[{\"hosts\":[\"*\"],\"port\":{\"name\":\"http\",\"number\":80,\"protocol\":\"HTTP\"}}]}}\n"},"name":"bookinfo-gateway","namespace":"default"},"spec":{"selector":{"istio":"ingressgateway"},"servers":[{"hosts":["*"],"port":{"name":"http","number":80,"protocol":"HTTP"}}]}}
I0216 18:01:08.989839    4904 round_trippers.go:423] curl -k -v -XPOST  -H "Accept: application/json" -H "Content-Type: application/json" -H "User-Agent: kubectl/v1.17.3 (linux/amd64) kubernetes/06ad960" 'https://ha-lb-ip:6443/apis/networking.istio.io/v1alpha3/namespaces/default/gateways'
I0216 18:01:38.996165    4904 round_trippers.go:443] POST https://ha-lb-ip:6443/apis/networking.istio.io/v1alpha3/namespaces/default/gateways 500 Internal Server Error in 30006 milliseconds
I0216 18:01:38.996302    4904 round_trippers.go:449] Response Headers:
I0216 18:01:38.996315    4904 round_trippers.go:452]     Content-Type: application/json
I0216 18:01:38.996320    4904 round_trippers.go:452]     Content-Length: 481
I0216 18:01:38.996349    4904 round_trippers.go:452]     Date: Sun, 16 Feb 2020 12:01:38 GMT
I0216 18:01:38.996563    4904 request.go:1017] Response Body: {"kind":"Status","apiVersion":"v1","metadata":{},"status":"Failure","message":"Internal error occurred: failed calling webhook \"pilot.validation.istio.io\": Post https://istio-galley.istio-system.svc:443/admitpilot?timeout=30s: context deadline exceeded","reason":"InternalError","details":{"causes":[{"message":"failed calling webhook \"pilot.validation.istio.io\": Post https://istio-galley.istio-system.svc:443/admitpilot?timeout=30s: context deadline exceeded"}]},"code":500}
I0216 18:01:38.999383    4904 round_trippers.go:423] curl -k -v -XGET  -H "Accept: application/json" -H "User-Agent: kubectl/v1.17.3 (linux/amd64) kubernetes/06ad960" 'https://ha-lb-ip:6443/apis/networking.istio.io/v1alpha3/namespaces/default/virtualservices/bookinfo'
I0216 18:01:39.042269    4904 round_trippers.go:443] GET https://ha-lb-ip:6443/apis/networking.istio.io/v1alpha3/namespaces/default/virtualservices/bookinfo 404 Not Found in 42 milliseconds
I0216 18:01:39.042304    4904 round_trippers.go:449] Response Headers:
I0216 18:01:39.042310    4904 round_trippers.go:452]     Content-Type: application/json
I0216 18:01:39.042315    4904 round_trippers.go:452]     Content-Length: 256
I0216 18:01:39.042319    4904 round_trippers.go:452]     Date: Sun, 16 Feb 2020 12:01:39 GMT
I0216 18:01:39.042352    4904 request.go:1017] Response Body: {"kind":"Status","apiVersion":"v1","metadata":{},"status":"Failure","message":"virtualservices.networking.istio.io \"bookinfo\" not found","reason":"NotFound","details":{"name":"bookinfo","group":"networking.istio.io","kind":"virtualservices"},"code":404}
I0216 18:01:39.043083    4904 request.go:1017] Request Body: {"apiVersion":"networking.istio.io/v1alpha3","kind":"VirtualService","metadata":{"annotations":{"kubectl.kubernetes.io/last-applied-configuration":"{\"apiVersion\":\"networking.istio.io/v1alpha3\",\"kind\":\"VirtualService\",\"metadata\":{\"annotations\":{},\"name\":\"bookinfo\",\"namespace\":\"default\"},\"spec\":{\"gateways\":[\"bookinfo-gateway\"],\"hosts\":[\"*\"],\"http\":[{\"match\":[{\"uri\":{\"exact\":\"/productpage\"}},{\"uri\":{\"prefix\":\"/static\"}},{\"uri\":{\"exact\":\"/login\"}},{\"uri\":{\"exact\":\"/logout\"}},{\"uri\":{\"prefix\":\"/api/v1/products\"}}],\"route\":[{\"destination\":{\"host\":\"productpage\",\"port\":{\"number\":9080}}}]}]}}\n"},"name":"bookinfo","namespace":"default"},"spec":{"gateways":["bookinfo-gateway"],"hosts":["*"],"http":[{"match":[{"uri":{"exact":"/productpage"}},{"uri":{"prefix":"/static"}},{"uri":{"exact":"/login"}},{"uri":{"exact":"/logout"}},{"uri":{"prefix":"/api/v1/products"}}],"route":[{"destination":{"host":"productpage","port":{"number":9080}}}]}]}}
I0216 18:01:39.043172    4904 round_trippers.go:423] curl -k -v -XPOST  -H "Accept: application/json" -H "Content-Type: application/json" -H "User-Agent: kubectl/v1.17.3 (linux/amd64) kubernetes/06ad960" 'https://ha-lb-ip:6443/apis/networking.istio.io/v1alpha3/namespaces/default/virtualservices'
I0216 18:02:09.049842    4904 round_trippers.go:443] POST https://ha-lb-ip:6443/apis/networking.istio.io/v1alpha3/namespaces/default/virtualservices 500 Internal Server Error in 30006 milliseconds
I0216 18:02:09.050031    4904 round_trippers.go:449] Response Headers:
I0216 18:02:09.050043    4904 round_trippers.go:452]     Content-Type: application/json
I0216 18:02:09.050052    4904 round_trippers.go:452]     Content-Length: 481
I0216 18:02:09.050059    4904 round_trippers.go:452]     Date: Sun, 16 Feb 2020 12:02:09 GMT
I0216 18:02:09.050249    4904 request.go:1017] Response Body: {"kind":"Status","apiVersion":"v1","metadata":{},"status":"Failure","message":"Internal error occurred: failed calling webhook \"pilot.validation.istio.io\": Post https://istio-galley.istio-system.svc:443/admitpilot?timeout=30s: context deadline exceeded","reason":"InternalError","details":{"causes":[{"message":"failed calling webhook \"pilot.validation.istio.io\": Post https://istio-galley.istio-system.svc:443/admitpilot?timeout=30s: context deadline exceeded"}]},"code":500}
I0216 18:02:09.051955    4904 helpers.go:203] server response object: [{
  "kind": "Status",
  "apiVersion": "v1",
  "metadata": {},
  "status": "Failure",
  "message": "error when creating \"samples/bookinfo/networking/bookinfo-gateway.yaml\": Internal error occurred: failed calling webhook \"pilot.validation.istio.io\": Post https://istio-galley.istio-system.svc:443/admitpilot?timeout=30s: context deadline exceeded",
  "reason": "InternalError",
  "details": {
    "causes": [
      {
        "message": "failed calling webhook \"pilot.validation.istio.io\": Post https://istio-galley.istio-system.svc:443/admitpilot?timeout=30s: context deadline exceeded"
      }
    ]
  },
  "code": 500
}]
I0216 18:02:09.052104    4904 helpers.go:203] server response object: [{
  "kind": "Status",
  "apiVersion": "v1",
  "metadata": {},
  "status": "Failure",
  "message": "error when creating \"samples/bookinfo/networking/bookinfo-gateway.yaml\": Internal error occurred: failed calling webhook \"pilot.validation.istio.io\": Post https://istio-galley.istio-system.svc:443/admitpilot?timeout=30s: context deadline exceeded",
  "reason": "InternalError",
  "details": {
    "causes": [
      {
        "message": "failed calling webhook \"pilot.validation.istio.io\": Post https://istio-galley.istio-system.svc:443/admitpilot?timeout=30s: context deadline exceeded"
      }
    ]
  },
  "code": 500
}]
F0216 18:02:09.052210    4904 helpers.go:114] Error from server (InternalError): error when creating "samples/bookinfo/networking/bookinfo-gateway.yaml": Internal error occurred: failed calling webhook "pilot.validation.istio.io": Post https://istio-galley.istio-system.svc:443/admitpilot?timeout=30s: context deadline exceeded
Error from server (InternalError): error when creating "samples/bookinfo/networking/bookinfo-gateway.yaml": Internal error occurred: failed calling webhook "pilot.validation.istio.io": Post https://istio-galley.istio-system.svc:443/admitpilot?timeout=30s: context deadline exceeded
```

<p><strong>Related Information:</strong></p>

<ul>
<li>Docker version 19.03.5</li>
<li>Kubernetes version 1.17.3</li>
<li>Istio version 1.4.4</li>
<li>Kubernetes clusters are run behind company's proxy server. CNI using <code>kube-flannel</code></li>
<li>The <code>docker.service.d</code> config has proxy configured at <code>/etc/systemd/system/docker.service.d/proxy.conf</code>.</li>
<li><code>NO_PROXY</code>/<code>no_proxy</code> is set to <code>localhost,127.0.0.1,::1,.grameenphone.com,10.10.18.188,10.10.23.57,10.10.23.58,10.10.23.59,10.10.23.60,10.10.23.61,kubernetes.default,.validation.istio.io,.istio.io,.istio-system.svc,.svc,.istio-system,.svc.cluster.local,.cluster.local,10.244.0.0/16</code>.</li>
<li>Installed ISTIO using <code>istioctl</code>, yaml given below:</li>
</ul>

```apiVersion: install.istio.io/v1alpha2
kind: IstioControlPlane
spec:
  defaultNamespace: istio-system
  cni:
    enabled: true
  gateways:
    components:
      egressGateway:
        enabled: false
      ingressGateway:
        enabled: true
    enabled: true
  values:
    cni:
      excludeNamespaces:
        - istio-system
        - kube-system
    gateways:
      istio-ingressgateway:
        type: NodePort
    global:
      configValidation: true
    grafana:
      enabled: true
    kiali:
      enabled: true
    tracing:
      enabled: true
```

<ul>
<li>Istio install was successful, verified using g<code>isitoctl verify-install</code>.</li>
<li>Tried modifying <code>/etc/kubernetes/manifests/kube-apiserver.yaml</code> by adding <code>env:</code> section to the container, but still fails to create <code>bookinfo-gateway</code>.</li>
</ul>

```    env:
      - name: http_proxy
        value: http://10.10.20.107:3828
      - name: https_proxy
        value: http://10.10.20.107:3828
      - name: no_proxy
        value: localhost,127.0.0.1,::1,.grameenphone.com,10.10.18.188,10.10.23.57,10.10.23.58,10.10.23.59,10.10.23.60,10.10.23.61,kubernetes.default,.validation.istio.io,.istio.io,.istio-system.svc,.svc,.istio-system,.svc.cluster.local,.cluster.local,10.244.0.0/16,10.96.0.0/12
```

<ul>
<li>For sidecar injection, I'm following the manual procedure.</li>
<li>All Isito pods are up & running.</li>
<li>Log from <code>kube-apiserver</code>:</li>
</ul>

```I0217 06:36:08.719672       1 controller.go:606] quota admission added evaluator for: deployments.apps
I0217 06:37:19.151894       1 trace.go:116] Trace[2116455659]: "Call validating webhook" configuration:istio-galley,webhook:pilot.validation.istio.io,resource:networking.istio.io/v1alpha3, Resource=gateways,subresource:,operation:CREATE,UID:de57f49e-fd19-44ea-99d7-414dfec0981f (started: 2020-02-17 06:36:49.150893916 +0000 UTC m=+6172.698922922) (total time: 30.000884409s):
Trace[2116455659]: [30.000884409s] [30.000884409s] END
W0217 06:37:19.151963       1 dispatcher.go:133] Failed calling webhook, failing closed pilot.validation.istio.io: failed calling webhook "pilot.validation.istio.io": Post https://istio-galley.istio-system.svc:443/admitpilot?timeout=30s: context deadline exceeded
I0217 06:37:19.152376       1 trace.go:116] Trace[2129026394]: "Create" url:/apis/networking.istio.io/v1alpha3/namespaces/default/gateways,user-agent:kubectl/v1.17.3 (linux/amd64) kubernetes/06ad960,client:10.10.18.188 (started: 2020-02-17 06:36:49.149255324 +0000 UTC m=+6172.697284349) (total time: 30.003096239s):
Trace[2129026394]: [30.003096239s] [30.002534955s] END
I0217 06:37:49.167492       1 trace.go:116] Trace[1063136940]: "Call validating webhook" configuration:istio-galley,webhook:pilot.validation.istio.io,resource:networking.istio.io/v1alpha3, Resource=virtualservices,subresource:,operation:CREATE,UID:2dd4b3e7-8333-4c1d-8222-dd53f8ce2db4 (started: 2020-02-17 06:37:19.166772885 +0000 UTC m=+6202.714801862) (total time: 30.000661809s):
Trace[1063136940]: [30.000661809s] [30.000661809s] END
W0217 06:37:49.167530       1 dispatcher.go:133] Failed calling webhook, failing closed pilot.validation.istio.io: failed calling webhook "pilot.validation.istio.io": Post https://istio-galley.istio-system.svc:443/admitpilot?timeout=30s: context deadline exceeded
I0217 06:37:49.167996       1 trace.go:116] Trace[639287810]: "Create" url:/apis/networking.istio.io/v1alpha3/namespaces/default/virtualservices,user-agent:kubectl/v1.17.3 (linux/amd64) kubernetes/06ad960,client:10.10.18.188 (started: 2020-02-17 06:37:19.165649222 +0000 UTC m=+6202.713678242) (total time: 30.002325938s):
Trace[639287810]: [30.002325938s] [30.001822425s] END
```

I googled/looked into other related issues & tried their solutions, but did not worked.

If there is any additional information required, please do let me know.

答:
Seems that galley stopped or doesn't answer.

Galley provides configuration management services for Istio.

So, pls check these two steps:

1. Is galley running?

galley probe

2. If it runs, try the WA

Due to this known issue istio/istio#17162, seems that your problem is related to api-server proxy settings.

And there is a workaround

Try to use --set global.configValidation=false when installing istio

See also manual on istio validation

Body:
Issue also posted at:

https://github.com/istio/istio/issues/21195

https://www.reddit.com/r/istio/comments/f57v2a/help_failed_to_run_bookinfo_example_behind_proxy/

Problem:

Following the bookinfo example, when trying to apply bookinfo-gateway, I get the following error:

Error from server (InternalError): error when creating "samples/bookinfo/networking/bookinfo-gateway.yaml": Internal error occurred: failed calling webhook "pilot.validation.istio.io": Post https://istio-galley.istio-system.svc:443/admitpilot?timeout=30s: context deadline exceeded

Output:

$ kubectl --v=9 apply -f samples/bookinfo/networking/bookinfo-gateway.yaml
I0216 18:01:08.548290    4904 loader.go:375] Config loaded from file:  /home/user/.kube/config
I0216 18:01:08.550426    4904 round_trippers.go:423] curl -k -v -XGET  -H "User-Agent: kubectl/v1.17.3 (linux/amd64) kubernetes/06ad960" -H "Accept: application/com.github.proto-openapi.spec.v2@v1.0+protobuf" 'https://ha-lb-ip:6443/openapi/v2?timeout=32s'
I0216 18:01:08.600310    4904 round_trippers.go:443] GET https://ha-lb-ip:6443/openapi/v2?timeout=32s 200 OK in 49 milliseconds
I0216 18:01:08.600348    4904 round_trippers.go:449] Response Headers:
I0216 18:01:08.600355    4904 round_trippers.go:452]     Accept-Ranges: bytes
I0216 18:01:08.600361    4904 round_trippers.go:452]     X-Varied-Accept: application/com.github.proto-openapi.spec.v2@v1.0+protobuf
I0216 18:01:08.600366    4904 round_trippers.go:452]     Content-Type: application/octet-stream
I0216 18:01:08.600371    4904 round_trippers.go:452]     Etag: "DCA49D599C62F0A8DDF840BBF0F4DB11A2B0C9805F7F6CEB19F163F61CA7D40F9E7A3607B007A74CCD6DBA6565BE6E6E3085528F7FD18EDAE99BABE9702D8700"
I0216 18:01:08.600378    4904 round_trippers.go:452]     Last-Modified: Sun, 16 Feb 2020 11:54:46 GMT
I0216 18:01:08.600430    4904 round_trippers.go:452]     Vary: Accept-Encoding
I0216 18:01:08.600435    4904 round_trippers.go:452]     Vary: Accept
I0216 18:01:08.600439    4904 round_trippers.go:452]     Date: Sun, 16 Feb 2020 12:01:08 GMT
I0216 18:01:08.817775    4904 request.go:1015] Response Body:
00000000  0a 03 32 2e 30 12 15 0a  0a 4b 75 62 65 72 6e 65  |..2.0....Kuberne|
00000010  74 65 73 12 07 76 31 2e  31 37 2e 33 42 93 f7 a9  |tes..v1.17.3B...|
00000020  01 12 ae 27 0a 29 2f 61  70 69 2f 76 31 2f 77 61  |...'.)/api/v1/wa|
00000030  74 63 68 2f 6e 61 6d 65  73 70 61 63 65 73 2f 7b  |tch/namespaces/{|
00000040  6e 61 6d 65 73 70 61 63  65 7d 2f 70 6f 64 73 12  |namespace}/pods.|
00000050  80 27 12 97 04 0a 07 63  6f 72 65 5f 76 31 1a 6f  |.'.....core_v1.o|
00000060  77 61 74 63 68 20 69 6e  64 69 76 69 64 75 61 6c  |watch individual|
00000070  20 63 68 61 6e 67 65 73  20 74 6f 20 61 20 6c 69  | changes to a li|
00000080  73 74 20 6f 66 20 50 6f  64 2e 20 64 65 70 72 65  |st of Pod. depre|
00000090  63 61 74 65 64 3a 20 75  73 65 20 74 68 65 20 27  |cated: use the '|
000000a0  77 61 74 63 68 27 20 70  61 72 61 6d 65 74 65 72  |watch' parameter|
000000b0  20 77 69 74 68 20 61 20  6c 69 73 74 20 6f 70 65  | with a list ope|
000000c0  72 61 74 69 6f 6e 20 69  6e 73 74 65 61 64 2e 2a  |ration instead.*|
000000d0  1c 77 61 74 63 68 43 6f  72 65 56 31 4e 61 6d 65  |.watchCoreV1Name|
000000e0  73 70 61 63 65 64 50 6f  64 4c 69 73 74 32 10 61  |spacedPodList2.a|
000000f0  70 70 6c 69 63 61 74 69  6f 6e 2f 6a 73 6f 6e 32  |pplication/json2|
00000100  10 61 70 70 6c 69 63 61  74 69 6f 6e 2f 79 61 6d  |.application/yam|
00000110  6c 32 23 61 70 70 6c 69  63 61 74 69 6f 6e 2f 76  |l2#application/v|
00000120  6e 64 2e 6b 75 62 65 72  6e 65 74 65 73 2e 70 72  |nd.kubernetes.pr|
00000130  6f 74 6f 62 75 66 32 1d  61 70 70 6c 69 63 61 74  |otobuf2.applicat|
00000140  69 6f 6e 2f 6a 73 6f 6e  3b 73 74 72 65 61 6d 3d  |ion/json;stream=|
00000150  77 61 74 63 68 32 30 61  70 70 6c 69 63 61 74 69  |watch20applicati|
00000160  6f 6e 2f 76 6e 64 2e 6b  75 62 65 72 6e 65 74 65  |on/vnd.kubernete|
00000170  73 2e 70 72 6f 74 6f 62  75 66 3b 73 74 72 65 61  |s.protobuf;strea|
00000180  6d 3d 77 61 74 63 68 3a  03 2a 2f 2a 4a 6b 0a 50  |m=watch:.*/*Jk.P|
00000190  0a 03 32 30 30 12 49 0a  47 0a 02 4f 4b 12 41 0a  |..200.I.G..OK.A.|
000001a0  3f 0a 3d 23 2f 64 65 66  69 6e 69 74 69 6f 6e 73  |?.=#/definitions|
000001b0  2f 69 6f 2e 6b 38 73 2e  61 70 69 6d 61 63 68 69  |/io.k8s.apimachi|
000001c0  6e 65 72 79 2e 70 6b 67  2e 61 70 69 73 2e 6d 65  |nery.pkg.apis.me|
000001d0  74 61 2e 76 31 2e 57 61  74 63 68 45 76 65 6e 74  |ta.v1.WatchEvent|
000001e0  0a 17 0a 03 34 30 31 12  10 0a 0e 0a 0c 55 6e 61  |....401......Una|
000001f0  75 74 68 6f 72 69 7a 65  64 52 05 68 74 74 70 73  |uthorizedR.https|
00000200  6a 23 0a 13 78 2d 6b 75  62 65 72 6e 65 74 65 73  |j#..x-kubernetes|
00000210  2d 61 63 74 69 6f 6e 12  0c 12 0a 77 61 74 63 68  |-action....watch|
00000220  6c 69 73 74 0a 6a 45 0a  1f 78 2d 6b 75 62 65 72  |list.jE..x-kuber|
00000230  6e 65 74 65 73 2d 67 72  6f 75 70 2d 76 65 72 73  |netes-group-vers|
00000240  69 6f 6e 2d 6b 69 6e 64  12 22 12 20 6b 69 6e 64  |ion-kind.". kind|
00000250  3a 20 50 6f 64 0a 76 65  72 73 69 6f 6e 3a 20 76  |: Pod.version: v|
00000260  31 0a 67 72 6f 75 70 3a  20 22 22 0a 4a 82 04 0a  |1.group: "".J...|
00000270  ff 03 12 fc 03 1a f9 03  12 05 71 75 65 72 79 1a  |..........query.|
00000280  ce 03 61 6c 6c 6f 77 57  61 74 63 68 42 6f 6f 6b  |..allowWatchBook|
00000290  6d 61 72 6b 73 20 72 65  71 75 65 73 74 73 20 77  |marks requests w|
000002a0  61 74 63 68 20 65 76 65  6e 74 73 20 77 69 74 68  |atch events with|
000002b0  20 74 79 70 65 20 22 42  4f 4f 4b 4d 41 52 4b 22  | type "BOOKMARK"|
000002c0  2e 20 53 65 72 76 65 72  73 20 74 68 61 74 20 64  |. Servers that d|
000002d0  6f 20 6e 6f 74 20 69 6d  70 6c 65 6d 65 6e 74 20  |o not implement |
000002e0  62 6f 6f 6b 6d 61 72 6b  73 20 6d 61 79 20 69 67  |bookmarks may ig|
000002f0  6e 6f 72 65 20 74 68 69  73 20 66 6c 61 67 20 61  |nore this flag a|
00000300  6e 64 20 62 6f 6f 6b 6d  61 72 6b 73 20 61 72 65  |nd bookmarks are|
00000310  20 73 65 6e 74 20 61 74  20 74 68 65 20 73 65 72  | sent at the ser|
00000320  76 65 72 27 73 20 64 69  73 63 72 65 74 69 6f 6e  |ver's discretion|
00000330  2e 20 43 6c 69 65 6e 74  73 20 73 68 6f 75 6c 64  |. Clients should|
00000340  20 6e 6f 74 20 61 73 73  75 6d 65 20 62 6f 6f 6b  | not assume book|
00000350  6d 61 72 6b 73 20 61 72  65 20 72 65 74 75 72 6e  |marks are return|
00000360  65 64 20 61 74 20 61 6e  79 20 73 70 65 63 69 66  |ed at any specif|
00000370  69 63 20 69 6e 74 65 72  76 61 6c 2c 20 6e 6f 72  |ic interval, nor|
00000380  20 6d 61 79 20 74 68 65  79 20 61 73 73 75 6d 65  | may they assume|
00000390  20 74 68 65 20 73 65 72  76 65 72 20 77 69 6c 6c  | the server will|
000003a0  20 73 65 6e 64 20 61 6e  79 20 42 4f 4f 4b 4d 41  | send any BOOKMA|
000003b0  52 4b 20 65 76 65 6e 74  20 64 75 72 69 6e 67 20  |RK event during |
000003c0  61 20 73 65 73 73 69 6f  6e 2e 20 49 66 20 74 68  |a session. If th|
000003d0  69 73 20 69 73 20 6e 6f  74 20 61 20 77 61 74 63  |is is not a watc|
000003e0  68 2c 20 74 68 69 73 20  66 69 65 6c 64 20 69 73  |h, this field is|
000003f0  20 69 67 6e 6f 72 65 64  2e 20 49 66 20 74 68 65  | ignored. If the|
00000400  20 66 65 61 74 75 72 65  20 67 61 74 65 20 57 61  | feature gate Wa|
00000410  74 63 68 42 6f 6f 6b 6d  61 72 6b 73 20 69 73 20  |tchBookmarks is |
00000420  6e 6f 74 20 65 6e 61 62  6c 65 64 20 69 6e 20 61  |not enabled in a|
00000430  70 69 73 65 72 76 65 72  2c 20 74 68 69 73 20 66  |piserver, this f|
00000440  69 65 6c 64 20 69 73 20  69 67 6e 6f 72 65 64 2e  |ield is ignored.|
00000450  22 13 61 6c 6c 6f 77 57  61 74 63 68 42 6f 6f 6b  |".allowWatchBook|
00000460  6d 61 72 6b 73 32 07 62  6f 6f 6c 65 61 6e a0 01  |marks2.boolean..|
00000470  01 4a ef 09 0a ec 09 12  e9 09 1a e6 09 12 05 71  |.J.............q|
00000480  75 65 72 79 1a c7 09 54  68 65 20 63 6f 6e 74 69  |uery...The conti|
00000490  6e 75 65 20 6f 70 74 69  6f 6e 20 73 68 6f 75 6c  |nue option shoul|
000004a0  64 20 62 65 20 73 65 74  20 77 68 65 6e 20 72 65  |d be set when re|
000004b0  74 72 69 65 76 69 6e 67  20 6d 6f 72 65 20 72 65  |trieving more re|
000004c0  73 75 6c 74 73 20 66 72  6f 6d 20 74 68 65 20 73  |sults from the s|
000004d0  65 72 76 65 72 2e 20 53  69 6e 63 65 20 74 68 69  |erver. Since thi|
000004e0  73 20 76 61 6c 75 65 20  69 73 20 73 65 72 76 65  |s value is serve|
000004f0  72 20 64 65 66 69 6e 65  64 2c 20 63 6c 69 65 6e  |r defined, clien|
00000500  74 73 20 6d 61 79 20 6f  6e 6c 79 20 75 73 65 20  |ts may only use |
00000510  74 68 65 20 63 6f 6e 74  69 6e 75 65 20 76 61 6c  |the continue val|
00000520  75 65 20 66 72 6f 6d 20  61 20 70 72 65 76 69 6f  |ue from a previo|
00000530  75 73 20 71 75 65 72 79  20 72 65 73 75 6c 74 20  |us query result |
00000540  77 69 74 68 20 69 64 65  6e 74 69 63 61 6c 20 71  |with identical q|
00000550  75 65 72 79 20 70 61 72  61 6d 65 74 65 72 73 20  |uery parameters |
00000560  28 65 78 63 65 70 74 20  66 6f 72 20 74 68 65 20  |(except for the |
00000570  76 61 6c 75 65 20 6f 66  20 63 6f 6e 74 69 6e 75  |value of continu|
00000580  65 29 20 61 6e 64 20 74  68 65 20 73 65 72 76 65  |e) and the serve|
00000590  72 20 6d 61 79 20 72 65  6a 65 63 74 20 61 20 63  |r may reject a c|
000005a0  6f 6e 74 69 6e 75 65 20  76 61 6c 75 65 20 69 74  |ontinue value it|
000005b0  20 64 6f 65 73 20 6e 6f  74 20 72 65 63 6f 67 6e  | does not recogn|
000005c0  69 7a 65 2e 20 49 66 20  74 68 65 20 73 70 65 63  |ize. If the spec|
000005d0  69 66 69 65 64 20 63 6f  6e 74 69 6e 75 65 20 76  |ified continue v|
000005e0  61 6c 75 65 20 69 73 20  6e 6f 20 6c 6f 6e 67 65  |alue is no longe|
000005f0  72 20 76 61 6c 69 64 20  77 68 65 74 68 65 72 20  |r valid whether |
00000600  64 75 65 20 74 6f 20 65  78 70 69 72 61 74 69 6f  |due to expiratio|
00000610  6e 20 28 67 65 6e 65 72  61 6c 6c 79 20 66 69 76  |n (generally fiv|
00000620  65 20 74 6f 20 66 69 66  74 65 65 6e 20 6d 69 6e  |e to fifteen min|
00000630  75 74 65 73 29 20 6f 72  20 61 20 63 6f 6e 66 69  |utes) or a confi|
00000640  67 75 72 61 74 69 6f 6e  20 63 68 61 6e 67 65 20  |guration change |
00000650  6f 6e 20 74 68 65 20 73  65 72 76 65 72 2c 20 74  |on the server, t|
00000660  68 65 20 73 65 72 76 65  72 20 77 69 6c 6c 20 72  |he server will r|
00000670  65 73 70 6f 6e 64 20 77  69 74 68 20 61 20 34 31  |espond with a 41|
00000680  30 20 52 65 73 6f 75 72  63 65 45 78 70 69 72 65  |0 ResourceExpire|
00000690  64 20 65 72 72 6f 72 20  74 6f 67 65 74 68 65 72  |d error together|
000006a0  20 77 69 74 68 20 61 20  63 6f 6e 74 69 6e 75 65  | with a continue|
000006b0  20 74 6f 6b 65 6e 2e 20  49 66 20 74 68 65 20 63  | token. If the c|
000006c0  6c 69 65 6e 74 20 6e 65  65 64 73 20 61 20 63 6f  |lient needs a co|
000006d0  6e 73 69 73 74 65 6e 74  20 6c 69 73 74 2c 20 69  |nsistent list, i|
000006e0  74 20 6d 75 73 74 20 72  65 73 74 61 72 74 20 74  |t must restart t|
000006f0  68 65 69 72 20 6c 69 73  74 20 77 69 74 68 6f 75  |heir list withou|
00000700  74 20 74 68 65 20 63 6f  6e 74 69 6e 75 65 20 66  |t the continue f|
00000710  69 65 6c 64 2e 20 4f 74  68 65 72 77 69 73 65 2c  |ield. Otherwise,|
00000720  20 74 68 65 20 63 6c 69  65 6e 74 20 6d 61 79 20  | the client may |
00000730  73 65 6e 64 20 61 6e 6f  74 68 65 72 20 6c 69 73  |send another lis|
00000740  74 20 72 65 71 75 65 73  74 20 77 69 74 68 20 74  |t request with t|
00000750  68 65 20 74 6f 6b 65 6e  20 72 65 63 65 69 76 65  |he token receive|
00000760  64 20 77 69 74 68 20 74  68 65 20 34 31 30 20 65  |d with the 410 e|
00000770  72 72 6f 72 2c 20 74 68  65 20 73 65 72 76 65 72  |rror, the server|
00000780  20 77 69 6c 6c 20 72 65  73 70 6f 6e 64 20 77 69  | will respond wi|
00000790  74 68 20 61 20 6c 69 73  74 20 73 74 61 72 74 69  |th a list starti|
000007a0  6e 67 20 66 72 6f 6d 20  74 68 65 20 6e 65 78 74  |ng from the next|
000007b0  20 6b 65 79 2c 20 62 75  74 20 66 72 6f 6d 20 74  | key, but from t|
000007c0  68 65 20 6c 61 74 65 73  74 20 73 6e 61 70 73 68  |he latest snapsh|
000007d0  6f 74 2c 20 77 68 69 63  68 20 69 73 20 69 6e 63  |ot, which is inc|
000007e0  6f 6e 73 69 73 74 65 6e  74 20 66 72 6f 6d 20 74  |onsistent from t|
000007f0  68 65 20 70 72 65 76 69  6f 75 73 20 6c 69 73 74  |he previous list|
00000800  20 72 65 73 75 6c 74 73  20 2d 20 6f 62 6a 65 63  | results - objec|
00000810  74 73 20 74 68 61 74 20  61 72 65 20 63 [truncated 17345571 chars]
I0216 18:01:08.944681    4904 round_trippers.go:423] curl -k -v -XGET  -H "Accept: application/json" -H "User-Agent: kubectl/v1.17.3 (linux/amd64) kubernetes/06ad960" 'https://ha-lb-ip:6443/apis/networking.istio.io/v1alpha3/namespaces/default/gateways/bookinfo-gateway'
I0216 18:01:08.988784    4904 round_trippers.go:443] GET https://ha-lb-ip:6443/apis/networking.istio.io/v1alpha3/namespaces/default/gateways/bookinfo-gateway 404 Not Found in 44 milliseconds
I0216 18:01:08.988834    4904 round_trippers.go:449] Response Headers:
I0216 18:01:08.988840    4904 round_trippers.go:452]     Content-Length: 258
I0216 18:01:08.988844    4904 round_trippers.go:452]     Date: Sun, 16 Feb 2020 12:01:08 GMT
I0216 18:01:08.988848    4904 round_trippers.go:452]     Content-Type: application/json
I0216 18:01:08.988896    4904 request.go:1017] Response Body: {"kind":"Status","apiVersion":"v1","metadata":{},"status":"Failure","message":"gateways.networking.istio.io \"bookinfo-gateway\" not found","reason":"NotFound","details":{"name":"bookinfo-gateway","group":"networking.istio.io","kind":"gateways"},"code":404}
I0216 18:01:08.989774    4904 request.go:1017] Request Body: {"apiVersion":"networking.istio.io/v1alpha3","kind":"Gateway","metadata":{"annotations":{"kubectl.kubernetes.io/last-applied-configuration":"{\"apiVersion\":\"networking.istio.io/v1alpha3\",\"kind\":\"Gateway\",\"metadata\":{\"annotations\":{},\"name\":\"bookinfo-gateway\",\"namespace\":\"default\"},\"spec\":{\"selector\":{\"istio\":\"ingressgateway\"},\"servers\":[{\"hosts\":[\"*\"],\"port\":{\"name\":\"http\",\"number\":80,\"protocol\":\"HTTP\"}}]}}\n"},"name":"bookinfo-gateway","namespace":"default"},"spec":{"selector":{"istio":"ingressgateway"},"servers":[{"hosts":["*"],"port":{"name":"http","number":80,"protocol":"HTTP"}}]}}
I0216 18:01:08.989839    4904 round_trippers.go:423] curl -k -v -XPOST  -H "Accept: application/json" -H "Content-Type: application/json" -H "User-Agent: kubectl/v1.17.3 (linux/amd64) kubernetes/06ad960" 'https://ha-lb-ip:6443/apis/networking.istio.io/v1alpha3/namespaces/default/gateways'
I0216 18:01:38.996165    4904 round_trippers.go:443] POST https://ha-lb-ip:6443/apis/networking.istio.io/v1alpha3/namespaces/default/gateways 500 Internal Server Error in 30006 milliseconds
I0216 18:01:38.996302    4904 round_trippers.go:449] Response Headers:
I0216 18:01:38.996315    4904 round_trippers.go:452]     Content-Type: application/json
I0216 18:01:38.996320    4904 round_trippers.go:452]     Content-Length: 481
I0216 18:01:38.996349    4904 round_trippers.go:452]     Date: Sun, 16 Feb 2020 12:01:38 GMT
I0216 18:01:38.996563    4904 request.go:1017] Response Body: {"kind":"Status","apiVersion":"v1","metadata":{},"status":"Failure","message":"Internal error occurred: failed calling webhook \"pilot.validation.istio.io\": Post https://istio-galley.istio-system.svc:443/admitpilot?timeout=30s: context deadline exceeded","reason":"InternalError","details":{"causes":[{"message":"failed calling webhook \"pilot.validation.istio.io\": Post https://istio-galley.istio-system.svc:443/admitpilot?timeout=30s: context deadline exceeded"}]},"code":500}
I0216 18:01:38.999383    4904 round_trippers.go:423] curl -k -v -XGET  -H "Accept: application/json" -H "User-Agent: kubectl/v1.17.3 (linux/amd64) kubernetes/06ad960" 'https://ha-lb-ip:6443/apis/networking.istio.io/v1alpha3/namespaces/default/virtualservices/bookinfo'
I0216 18:01:39.042269    4904 round_trippers.go:443] GET https://ha-lb-ip:6443/apis/networking.istio.io/v1alpha3/namespaces/default/virtualservices/bookinfo 404 Not Found in 42 milliseconds
I0216 18:01:39.042304    4904 round_trippers.go:449] Response Headers:
I0216 18:01:39.042310    4904 round_trippers.go:452]     Content-Type: application/json
I0216 18:01:39.042315    4904 round_trippers.go:452]     Content-Length: 256
I0216 18:01:39.042319    4904 round_trippers.go:452]     Date: Sun, 16 Feb 2020 12:01:39 GMT
I0216 18:01:39.042352    4904 request.go:1017] Response Body: {"kind":"Status","apiVersion":"v1","metadata":{},"status":"Failure","message":"virtualservices.networking.istio.io \"bookinfo\" not found","reason":"NotFound","details":{"name":"bookinfo","group":"networking.istio.io","kind":"virtualservices"},"code":404}
I0216 18:01:39.043083    4904 request.go:1017] Request Body: {"apiVersion":"networking.istio.io/v1alpha3","kind":"VirtualService","metadata":{"annotations":{"kubectl.kubernetes.io/last-applied-configuration":"{\"apiVersion\":\"networking.istio.io/v1alpha3\",\"kind\":\"VirtualService\",\"metadata\":{\"annotations\":{},\"name\":\"bookinfo\",\"namespace\":\"default\"},\"spec\":{\"gateways\":[\"bookinfo-gateway\"],\"hosts\":[\"*\"],\"http\":[{\"match\":[{\"uri\":{\"exact\":\"/productpage\"}},{\"uri\":{\"prefix\":\"/static\"}},{\"uri\":{\"exact\":\"/login\"}},{\"uri\":{\"exact\":\"/logout\"}},{\"uri\":{\"prefix\":\"/api/v1/products\"}}],\"route\":[{\"destination\":{\"host\":\"productpage\",\"port\":{\"number\":9080}}}]}]}}\n"},"name":"bookinfo","namespace":"default"},"spec":{"gateways":["bookinfo-gateway"],"hosts":["*"],"http":[{"match":[{"uri":{"exact":"/productpage"}},{"uri":{"prefix":"/static"}},{"uri":{"exact":"/login"}},{"uri":{"exact":"/logout"}},{"uri":{"prefix":"/api/v1/products"}}],"route":[{"destination":{"host":"productpage","port":{"number":9080}}}]}]}}
I0216 18:01:39.043172    4904 round_trippers.go:423] curl -k -v -XPOST  -H "Accept: application/json" -H "Content-Type: application/json" -H "User-Agent: kubectl/v1.17.3 (linux/amd64) kubernetes/06ad960" 'https://ha-lb-ip:6443/apis/networking.istio.io/v1alpha3/namespaces/default/virtualservices'
I0216 18:02:09.049842    4904 round_trippers.go:443] POST https://ha-lb-ip:6443/apis/networking.istio.io/v1alpha3/namespaces/default/virtualservices 500 Internal Server Error in 30006 milliseconds
I0216 18:02:09.050031    4904 round_trippers.go:449] Response Headers:
I0216 18:02:09.050043    4904 round_trippers.go:452]     Content-Type: application/json
I0216 18:02:09.050052    4904 round_trippers.go:452]     Content-Length: 481
I0216 18:02:09.050059    4904 round_trippers.go:452]     Date: Sun, 16 Feb 2020 12:02:09 GMT
I0216 18:02:09.050249    4904 request.go:1017] Response Body: {"kind":"Status","apiVersion":"v1","metadata":{},"status":"Failure","message":"Internal error occurred: failed calling webhook \"pilot.validation.istio.io\": Post https://istio-galley.istio-system.svc:443/admitpilot?timeout=30s: context deadline exceeded","reason":"InternalError","details":{"causes":[{"message":"failed calling webhook \"pilot.validation.istio.io\": Post https://istio-galley.istio-system.svc:443/admitpilot?timeout=30s: context deadline exceeded"}]},"code":500}
I0216 18:02:09.051955    4904 helpers.go:203] server response object: [{
  "kind": "Status",
  "apiVersion": "v1",
  "metadata": {},
  "status": "Failure",
  "message": "error when creating \"samples/bookinfo/networking/bookinfo-gateway.yaml\": Internal error occurred: failed calling webhook \"pilot.validation.istio.io\": Post https://istio-galley.istio-system.svc:443/admitpilot?timeout=30s: context deadline exceeded",
  "reason": "InternalError",
  "details": {
    "causes": [
      {
        "message": "failed calling webhook \"pilot.validation.istio.io\": Post https://istio-galley.istio-system.svc:443/admitpilot?timeout=30s: context deadline exceeded"
      }
    ]
  },
  "code": 500
}]
I0216 18:02:09.052104    4904 helpers.go:203] server response object: [{
  "kind": "Status",
  "apiVersion": "v1",
  "metadata": {},
  "status": "Failure",
  "message": "error when creating \"samples/bookinfo/networking/bookinfo-gateway.yaml\": Internal error occurred: failed calling webhook \"pilot.validation.istio.io\": Post https://istio-galley.istio-system.svc:443/admitpilot?timeout=30s: context deadline exceeded",
  "reason": "InternalError",
  "details": {
    "causes": [
      {
        "message": "failed calling webhook \"pilot.validation.istio.io\": Post https://istio-galley.istio-system.svc:443/admitpilot?timeout=30s: context deadline exceeded"
      }
    ]
  },
  "code": 500
}]
F0216 18:02:09.052210    4904 helpers.go:114] Error from server (InternalError): error when creating "samples/bookinfo/networking/bookinfo-gateway.yaml": Internal error occurred: failed calling webhook "pilot.validation.istio.io": Post https://istio-galley.istio-system.svc:443/admitpilot?timeout=30s: context deadline exceeded
Error from server (InternalError): error when creating "samples/bookinfo/networking/bookinfo-gateway.yaml": Internal error occurred: failed calling webhook "pilot.validation.istio.io": Post https://istio-galley.istio-system.svc:443/admitpilot?timeout=30s: context deadline exceeded

Related Information:

Docker version 19.03.5

Kubernetes version 1.17.3

Istio version 1.4.4

Kubernetes clusters are run behind company's proxy server. CNI using kube-flannel

The docker.service.d config has proxy configured at /etc/systemd/system/docker.service.d/proxy.conf.

NO_PROXY/no_proxy is set to localhost,127.0.0.1,::1,.grameenphone.com,10.10.18.188,10.10.23.57,10.10.23.58,10.10.23.59,10.10.23.60,10.10.23.61,kubernetes.default,.validation.istio.io,.istio.io,.istio-system.svc,.svc,.istio-system,.svc.cluster.local,.cluster.local,10.244.0.0/16.

Installed ISTIO using istioctl, yaml given below:

apiVersion: install.istio.io/v1alpha2
kind: IstioControlPlane
spec:
  defaultNamespace: istio-system
  cni:
    enabled: true
  gateways:
    components:
      egressGateway:
        enabled: false
      ingressGateway:
        enabled: true
    enabled: true
  values:
    cni:
      excludeNamespaces:
        - istio-system
        - kube-system
    gateways:
      istio-ingressgateway:
        type: NodePort
    global:
      configValidation: true
    grafana:
      enabled: true
    kiali:
      enabled: true
    tracing:
      enabled: true

Istio install was successful, verified using gisitoctl verify-install.

Tried modifying /etc/kubernetes/manifests/kube-apiserver.yaml by adding env: section to the container, but still fails to create bookinfo-gateway.

    env:
      - name: http_proxy
        value: http://10.10.20.107:3828
      - name: https_proxy
        value: http://10.10.20.107:3828
      - name: no_proxy
        value: localhost,127.0.0.1,::1,.grameenphone.com,10.10.18.188,10.10.23.57,10.10.23.58,10.10.23.59,10.10.23.60,10.10.23.61,kubernetes.default,.validation.istio.io,.istio.io,.istio-system.svc,.svc,.istio-system,.svc.cluster.local,.cluster.local,10.244.0.0/16,10.96.0.0/12

For sidecar injection, I'm following the manual procedure.

All Isito pods are up & running.

Log from kube-apiserver:

I0217 06:36:08.719672       1 controller.go:606] quota admission added evaluator for: deployments.apps
I0217 06:37:19.151894       1 trace.go:116] Trace[2116455659]: "Call validating webhook" configuration:istio-galley,webhook:pilot.validation.istio.io,resource:networking.istio.io/v1alpha3, Resource=gateways,subresource:,operation:CREATE,UID:de57f49e-fd19-44ea-99d7-414dfec0981f (started: 2020-02-17 06:36:49.150893916 +0000 UTC m=+6172.698922922) (total time: 30.000884409s):
Trace[2116455659]: [30.000884409s] [30.000884409s] END
W0217 06:37:19.151963       1 dispatcher.go:133] Failed calling webhook, failing closed pilot.validation.istio.io: failed calling webhook "pilot.validation.istio.io": Post https://istio-galley.istio-system.svc:443/admitpilot?timeout=30s: context deadline exceeded
I0217 06:37:19.152376       1 trace.go:116] Trace[2129026394]: "Create" url:/apis/networking.istio.io/v1alpha3/namespaces/default/gateways,user-agent:kubectl/v1.17.3 (linux/amd64) kubernetes/06ad960,client:10.10.18.188 (started: 2020-02-17 06:36:49.149255324 +0000 UTC m=+6172.697284349) (total time: 30.003096239s):
Trace[2129026394]: [30.003096239s] [30.002534955s] END
I0217 06:37:49.167492       1 trace.go:116] Trace[1063136940]: "Call validating webhook" configuration:istio-galley,webhook:pilot.validation.istio.io,resource:networking.istio.io/v1alpha3, Resource=virtualservices,subresource:,operation:CREATE,UID:2dd4b3e7-8333-4c1d-8222-dd53f8ce2db4 (started: 2020-02-17 06:37:19.166772885 +0000 UTC m=+6202.714801862) (total time: 30.000661809s):
Trace[1063136940]: [30.000661809s] [30.000661809s] END
W0217 06:37:49.167530       1 dispatcher.go:133] Failed calling webhook, failing closed pilot.validation.istio.io: failed calling webhook "pilot.validation.istio.io": Post https://istio-galley.istio-system.svc:443/admitpilot?timeout=30s: context deadline exceeded
I0217 06:37:49.167996       1 trace.go:116] Trace[639287810]: "Create" url:/apis/networking.istio.io/v1alpha3/namespaces/default/virtualservices,user-agent:kubectl/v1.17.3 (linux/amd64) kubernetes/06ad960,client:10.10.18.188 (started: 2020-02-17 06:37:19.165649222 +0000 UTC m=+6202.713678242) (total time: 30.002325938s):
Trace[639287810]: [30.002325938s] [30.001822425s] END

I googled/looked into other related issues & tried their solutions, but did not worked.

If there is any additional information required, please do let me know.


问:
How to check two month are equal or not from date format YYYY-MM-DD?
I have two dates like 2020-12-31 and 2020-12-01 in string format yyyy-mm-dd while check the month it should return true.

Suppose I compare 2020-11-31 and 2020-12-31 it should return false.

If there is a difference in only month and year, it should return true.

For example today Feb 18, 2020, Suppose I choose Feb 11, 2020, it should return true, If I choose Jan 11, 2020, then it should return false.

Date difference should not be considered

答:
You can go with the following code:

```<code>const date1 = new Date('2020-12-01');
const date2 = new Date('2020-12-31');

// if you want to return true or false based on either date or month or year difference then use the following code.

const diffTime = Math.abs(date2 - date1);
const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24));
// this way if there is difference in either date or month or year then it will return true
if(diffDays) {
  return true;
} else {
  return false;
}
</code>```

If you want to return either true or false on basis of either month or year only then you can use the following code.

```<code>const date1 = new Date('2020-12-01');
const date2 = new Date('2020-12-31');
// return basis on difference of either month OR year
return date1.getMonth() === date2.getMonth() || date1.getYear() === date2.getYear()

// return basis on the difference of month AND year
return date1.getMonth() === date2.getMonth() && date1.getYear() === date2.getYear()
</code>```

Body:
You can go with the following code:

const date1 = new Date('2020-12-01');
const date2 = new Date('2020-12-31');

// if you want to return true or false based on either date or month or year difference then use the following code.

const diffTime = Math.abs(date2 - date1);
const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24));
// this way if there is difference in either date or month or year then it will return true
if(diffDays) {
  return true;
} else {
  return false;
}

If you want to return either true or false on basis of either month or year only then you can use the following code.

const date1 = new Date('2020-12-01');
const date2 = new Date('2020-12-31');
// return basis on difference of either month OR year
return date1.getMonth() === date2.getMonth() || date1.getYear() === date2.getYear()

// return basis on the difference of month AND year
return date1.getMonth() === date2.getMonth() && date1.getYear() === date2.getYear()


问:
SwiftUI - Saving ARRAY into NSSet
I'am having trouble with adding an Array [Categories] into my Questions entity relationship

The categories relationship being a "to many" it is an NSSet, so I would like to add my [Categories] array into this NSSet.

I have tried  something like this, but nothing gets in.

newQuestion.categories?.addingObjects(from: self.selections)

self.selection being an Array of

Thanks for your help.

Tim

答:
Try the following instead of that line</p>

```<code>if let categories = newQuestion.categories {
    newQuestion.categories = categories.addingObjects(from: self.selections)
} else {
    newQuestion.categories = Set(self.selections)
}
</code>```

Title: SwiftUI - Saving ARRAY into NSSet

Body:
Try the following instead of that line

if let categories = newQuestion.categories {
    newQuestion.categories = categories.addingObjects(from: self.selections)
} else {
    newQuestion.categories = Set(self.selections)
}


问:
how reliable would it be to download over a 100,000 files via wget from a bash file over ssh?
I have a bash file that contains wget commands to download over 100,000 files totaling around 20gb of data.

The bash file looks something like:

wget http://something.com/path/to/file.data

wget http://something.com/path/to/file2.data

wget http://something.com/path/to/file3.data

wget http://something.com/path/to/file4.data

And there are exactly 114,770 rows of this. How reliable would it be to ssh into a server I have an account on and run this? Would my ssh session time out eventually? would I have to be ssh'ed in the entire time? What if my local computer crashed/got shut down?

Also, does anyone know how many resources this would take? Am I crazy to want to do this on a shared server?

I know this is a weird question, just wondering if anyone has any ideas. Thanks!

答: It may be worth it to look at an alternate technology, like rsync.  I've used it on many projects and it works very, very well.</p>

OwnerDisplayName: markwatson

ContentLicense: CC BY-SA 2.5

OwnerDisplayName: Joe Casadonte