Navigation Menu

Skip to content

Commit

Permalink
make webhook support rewriteAppHTTPProbe flag.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jianfei Hu committed Dec 13, 2018
1 parent f60f18f commit 43522c1
Show file tree
Hide file tree
Showing 21 changed files with 35 additions and 80 deletions.
Expand Up @@ -14,10 +14,6 @@
"value": {
"name": "istio-proxy",
"image": "example.com/proxy:latest",
"args": [
"--statusPort",
"15020"
],
"resources": {}
}
},
Expand Down
@@ -0,0 +1,23 @@
rewriteAppHTTPProbe: true
initContainers:
- name: istio-init
image: example.com/init:latest
containers:
- name: istio-proxy
image: example.com/proxy:latest
args:
- --statusPort
- 15020
imagePullSecrets:
- name: istio-image-pull-secrets
volumes:
- emptyDir:
medium: Memory
name: istio-envoy
- name: istio-certs
secret:
[[ if eq .Spec.ServiceAccountName "" -]]
secretName: istio.default
[[ else -]]
secretName: [[ printf "istio.%s" .Spec.ServiceAccountName ]]
[[ end -]]
Expand Up @@ -15,10 +15,6 @@
{
"name": "istio-proxy",
"image": "example.com/proxy:latest",
"args": [
"--statusPort",
"15020"
],
"resources": {}
}
]
Expand Down
Expand Up @@ -15,10 +15,6 @@
{
"name": "istio-proxy",
"image": "example.com/proxy:latest",
"args": [
"--statusPort",
"15020"
],
"resources": {}
}
]
Expand Down
Expand Up @@ -15,10 +15,6 @@
{
"name": "istio-proxy",
"image": "example.com/proxy:latest",
"args": [
"--statusPort",
"15020"
],
"resources": {}
}
]
Expand Down
Expand Up @@ -15,10 +15,6 @@
{
"name": "istio-proxy",
"image": "example.com/proxy:latest",
"args": [
"--statusPort",
"15020"
],
"resources": {}
}
]
Expand Down
Expand Up @@ -14,10 +14,6 @@
"value": {
"name": "istio-proxy",
"image": "example.com/proxy:latest",
"args": [
"--statusPort",
"15020"
],
"resources": {}
}
},
Expand Down
Expand Up @@ -16,10 +16,6 @@
"value": {
"name": "istio-proxy",
"image": "example.com/proxy:latest",
"args": [
"--statusPort",
"15020"
],
"resources": {}
}
},
Expand Down
Expand Up @@ -17,10 +17,6 @@
{
"name": "istio-proxy",
"image": "example.com/proxy:latest",
"args": [
"--statusPort",
"15020"
],
"resources": {}
}
]
Expand Down
Expand Up @@ -17,10 +17,6 @@
{
"name": "istio-proxy",
"image": "example.com/proxy:latest",
"args": [
"--statusPort",
"15020"
],
"resources": {}
}
]
Expand Down
Expand Up @@ -17,10 +17,6 @@
{
"name": "istio-proxy",
"image": "example.com/proxy:latest",
"args": [
"--statusPort",
"15020"
],
"resources": {}
}
]
Expand Down
Expand Up @@ -16,10 +16,6 @@
"value": {
"name": "istio-proxy",
"image": "example.com/proxy:latest",
"args": [
"--statusPort",
"15020"
],
"resources": {}
}
},
Expand Down
Expand Up @@ -16,10 +16,6 @@
"value": {
"name": "istio-proxy",
"image": "example.com/proxy:latest",
"args": [
"--statusPort",
"15020"
],
"resources": {}
}
},
Expand Down
Expand Up @@ -16,10 +16,6 @@
"value": {
"name": "istio-proxy",
"image": "example.com/proxy:latest",
"args": [
"--statusPort",
"15020"
],
"resources": {}
}
},
Expand Down
Expand Up @@ -17,10 +17,6 @@
{
"name": "istio-proxy",
"image": "example.com/proxy:latest",
"args": [
"--statusPort",
"15020"
],
"resources": {}
}
]
Expand Down
Expand Up @@ -14,10 +14,6 @@
"value": {
"name": "istio-proxy",
"image": "example.com/proxy:latest",
"args": [
"--statusPort",
"15020"
],
"resources": {}
}
},
Expand Down
Expand Up @@ -14,10 +14,6 @@
"value": {
"name": "istio-proxy",
"image": "example.com/proxy:latest",
"args": [
"--statusPort",
"15020"
],
"resources": {}
}
},
Expand Down
Expand Up @@ -26,10 +26,6 @@
"value": {
"name": "istio-proxy",
"image": "example.com/proxy:latest",
"args": [
"--statusPort",
"15020"
],
"resources": {}
}
},
Expand Down
Expand Up @@ -30,10 +30,6 @@
"value": {
"name": "istio-proxy",
"image": "example.com/proxy:latest",
"args": [
"--statusPort",
"15020"
],
"resources": {}
}
},
Expand Down
Expand Up @@ -4,9 +4,6 @@ initContainers:
containers:
- name: istio-proxy
image: example.com/proxy:latest
args:
- --statusPort
- 15020
imagePullSecrets:
- name: istio-image-pull-secrets
volumes:
Expand Down
17 changes: 12 additions & 5 deletions pilot/pkg/kube/inject/webhook_test.go
Expand Up @@ -515,8 +515,9 @@ func TestInjectRequired(t *testing.T) {

func TestInject(t *testing.T) {
cases := []struct {
inputFile string
wantFile string
inputFile string
wantFile string
templateFile string
}{
{
inputFile: "TestWebhookInject.yaml",
Expand Down Expand Up @@ -595,16 +596,21 @@ func TestInject(t *testing.T) {
wantFile: "TestWebhookInject_replace_backwards_compat.patch",
},
{
inputFile: "TestWebhookInject_http_probe_rewrite.yaml",
wantFile: "TestWebhookInject_http_probe_rewrite.patch",
inputFile: "TestWebhookInject_http_probe_rewrite.yaml",
wantFile: "TestWebhookInject_http_probe_rewrite.patch",
templateFile: "TestWebhookInject_http_probe_rewrite_template.yaml",
},
}

for i, c := range cases {
input := filepath.Join("testdata/webhook", c.inputFile)
want := filepath.Join("testdata/webhook", c.wantFile)
templateFile := "TestWebhookInject_template.yaml"
if c.templateFile != "" {
templateFile = c.templateFile
}
t.Run(fmt.Sprintf("[%d] %s", i, c.inputFile), func(t *testing.T) {
wh := createTestWebhookFromFile("testdata/webhook/TestWebhookInject_template.yaml", t)
wh := createTestWebhookFromFile(filepath.Join("testdata/webhook", templateFile), t)
podYAML := util.ReadFile(input, t)
podJSON, err := yaml.YAMLToJSON(podYAML)
if err != nil {
Expand Down Expand Up @@ -797,6 +803,7 @@ func createTestWebhook(sidecarTemplate string) *Webhook {
func createTestWebhookFromFile(templateFile string, t *testing.T) *Webhook {
t.Helper()
sidecarTemplate := string(util.ReadFile(templateFile, t))
// fmt.Println("jianfeih debug sidecarTemplate ", sidecarTemplate)
return createTestWebhook(sidecarTemplate)
}

Expand Down

0 comments on commit 43522c1

Please sign in to comment.