Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/cmd/kn_service_create.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ kn service create NAME --image IMAGE
# (earlier configured environment variables will be cleared too if any)
kn service create --force s1 --image knativesamples/helloworld

# Create a service with annotation
kn service create s3 --image knativesamples/helloworld --annotation sidecar.istio.io/inject=false
# Create a service with label
kn service create s3 --image knativesamples/helloworld --label sidecar.istio.io/inject=false

# Create a private service (that is a service with no external endpoint)
kn service create s1 --image knativesamples/helloworld --cluster-local
Expand Down
4 changes: 2 additions & 2 deletions pkg/commands/service/configuration_edit_flags_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ func TestApplyDefaultProfileFlag(t *testing.T) {
cmd.SetArgs([]string{"--profile", "istio"})
cmd.Execute()
editFlags.Apply(&svc, nil, cmd)
assert.Equal(t, svc.Spec.Template.Annotations["sidecar.istio.io/inject"], "true")
assert.Equal(t, svc.ObjectMeta.Labels["sidecar.istio.io/inject"], "true")
assert.Equal(t, svc.Spec.Template.Annotations["sidecar.istio.io/rewriteAppHTTPProbers"], "true")
assert.Equal(t, svc.Spec.Template.Annotations["serving.knative.openshift.io/enablePassthrough"], "true")
}
Expand Down Expand Up @@ -169,7 +169,7 @@ profiles:
cmd.Execute()
editFlags.Apply(&svc, nil, cmd)

assert.Equal(t, svc.Spec.Template.Annotations["sidecar.istio.io/inject"], "")
assert.Equal(t, svc.Spec.Template.Annotations["sidecar.testprofile.io/inject"], "")
assert.Equal(t, len(svc.Spec.Template.Annotations), 1)

assert.Equal(t, svc.ObjectMeta.Labels["environment"], "")
Expand Down
4 changes: 2 additions & 2 deletions pkg/commands/service/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ var create_example = `
# (earlier configured environment variables will be cleared too if any)
kn service create --force s1 --image knativesamples/helloworld

# Create a service with annotation
kn service create s3 --image knativesamples/helloworld --annotation sidecar.istio.io/inject=false
# Create a service with label
kn service create s3 --image knativesamples/helloworld --label sidecar.istio.io/inject=false

# Create a private service (that is a service with no external endpoint)
kn service create s1 --image knativesamples/helloworld --cluster-local
Expand Down
4 changes: 3 additions & 1 deletion pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -299,10 +299,12 @@ func builtInProfiles() map[string]Profile {
return map[string]Profile{
istio: {
Annotations: []NamedValue{
{Name: "sidecar.istio.io/inject", Value: "true"},
{Name: "sidecar.istio.io/rewriteAppHTTPProbers", Value: "true"},
{Name: "serving.knative.openshift.io/enablePassthrough", Value: "true"},
},
Labels: []NamedValue{
{Name: "sidecar.istio.io/inject", Value: "true"},
},
},
}
}
Expand Down
11 changes: 7 additions & 4 deletions pkg/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ import (
// TestDefaultProfile tests that the default profile is correctly loaded
func TestDefaultProfile(t *testing.T) {
profile := builtInProfiles()
assert.Equal(t, len(profile[istio].Labels), 0)
assert.Equal(t, len(profile[istio].Annotations), 3)
assert.Equal(t, len(profile[istio].Labels), 1)
assert.Equal(t, len(profile[istio].Annotations), 2)
}

func TestBootstrapConfig(t *testing.T) {
Expand Down Expand Up @@ -68,12 +68,15 @@ eventing:
assert.Equal(t, GlobalConfig.PluginsDir(), "/tmp")
assert.Equal(t, GlobalConfig.LookupPluginsInPath(), true)
assert.Equal(t, len(GlobalConfig.SinkMappings()), 1)
assert.Equal(t, len(GlobalConfig.Profile("istio").Annotations), 3)
assert.DeepEqual(t, GlobalConfig.Profile("istio").Annotations, []NamedValue{
assert.Equal(t, len(GlobalConfig.Profile("istio").Labels), 1)
assert.Equal(t, len(GlobalConfig.Profile("istio").Annotations), 2)
assert.DeepEqual(t, GlobalConfig.Profile("istio").Labels, []NamedValue{
{
Name: "sidecar.istio.io/inject",
Value: "true",
},
})
assert.DeepEqual(t, GlobalConfig.Profile("istio").Annotations, []NamedValue{
{
Name: "sidecar.istio.io/rewriteAppHTTPProbers",
Value: "true",
Expand Down
Loading