Thanks to visit codestin.com
Credit goes to github.com

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
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ spec:
sources.knative.dev/role: adapter
knative.dev/release: devel
spec:
enableServiceLinks: false
containers:
- name: dispatcher
image: ko://knative.dev/eventing/cmd/mtping
Expand Down
1 change: 1 addition & 0 deletions config/in-memory/deployments/controller.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ spec:
labels: *labels
spec:
serviceAccountName: imc-controller
enableServiceLinks: false
containers:
- name: controller
image: ko://knative.dev/eventing/cmd/in_memory/channel_controller
Expand Down
5 changes: 5 additions & 0 deletions config/in-memory/deployments/dispatcher.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ spec:
topologyKey: kubernetes.io/hostname
weight: 100
serviceAccountName: imc-dispatcher
enableServiceLinks: false
containers:
- name: dispatcher
image: ko://knative.dev/eventing/cmd/in_memory/channel_dispatcher
Expand Down Expand Up @@ -70,6 +71,10 @@ spec:
fieldPath: metadata.name
- name: CONTAINER_NAME
value: dispatcher
- name: MAX_IDLE_CONNS
value: "1000"
- name: MAX_IDLE_CONNS_PER_HOST
value: "1000"
ports:
- containerPort: 8080
name: http
Expand Down
16 changes: 8 additions & 8 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ require (
github.com/spf13/pflag v1.0.5
github.com/spf13/viper v1.7.0
github.com/tektoncd/cli v0.3.1-0.20210105092911-ed9fefc25145
github.com/tektoncd/pipeline v0.19.1-0.20210112203514-23b37ac8c07d
github.com/tektoncd/pipeline v0.20.1-0.20210113192614-2e26eef219dd
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a
gopkg.in/src-d/go-billy.v4 v4.3.2
gopkg.in/src-d/go-git.v4 v4.13.1
Expand All @@ -30,13 +30,13 @@ require (
k8s.io/gengo v0.0.0-20201102161653-419f1598dd9a // indirect
k8s.io/klog/v2 v2.4.0 // indirect
knative.dev/caching v0.0.0-20210107021736-1ee47505018d
knative.dev/eventing v0.20.0
knative.dev/hack v0.0.0-20201214230143-4ed1ecb8db24
knative.dev/net-contour v0.20.0
knative.dev/net-http01 v0.20.0
knative.dev/networking v0.0.0-20210107024535-ecb89ced52d9
knative.dev/pkg v0.0.0-20210107022335-51c72e24c179
knative.dev/serving v0.20.0
knative.dev/eventing v0.20.1-0.20210113192431-1897543ff672
knative.dev/hack v0.0.0-20210112093330-d946d2557383
knative.dev/net-contour v0.20.1-0.20210113185432-8bb7f0f024e5
knative.dev/net-http01 v0.20.1-0.20210113185332-cc06c000c7b3
knative.dev/networking v0.0.0-20210113172032-07a8160d1971
knative.dev/pkg v0.0.0-20210112143930-acbf2af596cf
knative.dev/serving v0.20.1-0.20210113202032-0f2d35099d02
)

replace (
Expand Down
31 changes: 18 additions & 13 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1448,8 +1448,8 @@ github.com/tektoncd/pipeline v0.13.1-0.20200625065359-44f22a067b75/go.mod h1:R5A
github.com/tektoncd/pipeline v0.17.1-0.20201007165454-9611f3e4509e/go.mod h1:FoQiX9l6e/B3wGGAR4zgMHU849OYa6as3HG4xhRaFiE=
github.com/tektoncd/pipeline v0.18.0/go.mod h1:PxRWs4faBD15pG0EGQs3f/65hX97sMjjqtiKG3JY2rk=
github.com/tektoncd/pipeline v0.19.0/go.mod h1:fcbDwrxMGybeaLFFAVq6bhaM/fvJDMRxQ4IZDJkiGo0=
github.com/tektoncd/pipeline v0.19.1-0.20210112203514-23b37ac8c07d h1:96v+080ifgV7Rdi3RoZ5jwR7p6eMIFE9M8b0m5sS74M=
github.com/tektoncd/pipeline v0.19.1-0.20210112203514-23b37ac8c07d/go.mod h1:xF5WxMLvp/05oGZ+Fvqcbglmf4HVU9u1keXHaM+rR14=
github.com/tektoncd/pipeline v0.20.1-0.20210113192614-2e26eef219dd h1:u3fteQEoQLpfIcLsKPzmFoRAc1dYJa2Q0ybcFK3AVjA=
github.com/tektoncd/pipeline v0.20.1-0.20210113192614-2e26eef219dd/go.mod h1:xF5WxMLvp/05oGZ+Fvqcbglmf4HVU9u1keXHaM+rR14=
github.com/tektoncd/plumbing v0.0.0-20191216083742-847dcf196de9/go.mod h1:QZHgU07PRBTRF6N57w4+ApRu8OgfYLFNqCDlfEZaD9Y=
github.com/tektoncd/plumbing v0.0.0-20200217163359-cd0db6e567d2/go.mod h1:QZHgU07PRBTRF6N57w4+ApRu8OgfYLFNqCDlfEZaD9Y=
github.com/tektoncd/plumbing v0.0.0-20200430135134-e53521e1d887/go.mod h1:cZPJIeTIoP7UPTxQyTQLs7VE1TiXJSNj0te+If4Q+jI=
Expand Down Expand Up @@ -2297,18 +2297,21 @@ knative.dev/caching v0.0.0-20190719140829-2032732871ff/go.mod h1:dHXFU6CGlLlbzaW
knative.dev/caching v0.0.0-20200116200605-67bca2c83dfa/go.mod h1:dHXFU6CGlLlbzaWc32g80cR92iuBSpsslDNBWI8C7eg=
knative.dev/caching v0.0.0-20210107021736-1ee47505018d h1:C5JgxpCO4Dv+pqUHxIS+e+OVOf4QLGjcQUTbe9+SNB8=
knative.dev/caching v0.0.0-20210107021736-1ee47505018d/go.mod h1:N3jOlbf/CWZsEcfEpthv5b+LB9e+TqiDTVLH/Ti+vWE=
knative.dev/eventing v0.20.0 h1:CtW8JYds0gvaiCWvoeX6zHbm8Jbfwu3hieyCTNudNnk=
knative.dev/eventing v0.20.0/go.mod h1:7KjOHRQTPqsH0y1NbQLnboZeWJWVTztQVd/0lFCmz7A=
knative.dev/eventing v0.20.1-0.20210113192431-1897543ff672 h1:jHWWj6KtBKqb6kIEk7dJRRHCYE6KRaVgvBCn1h03Sy0=
knative.dev/eventing v0.20.1-0.20210113192431-1897543ff672/go.mod h1:HdS7UgtDbKQuCuEwgS3+jxtHvpm+PPp/eEsjaQwfWl8=
knative.dev/eventing-contrib v0.6.1-0.20190723221543-5ce18048c08b/go.mod h1:SnXZgSGgMSMLNFTwTnpaOH7hXDzTFtw0J8OmHflNx3g=
knative.dev/eventing-contrib v0.11.2/go.mod h1:SnXZgSGgMSMLNFTwTnpaOH7hXDzTFtw0J8OmHflNx3g=
knative.dev/hack v0.0.0-20201214230143-4ed1ecb8db24 h1:kIztWfvnIFV8Lhlea02K3YO2mIzcDyQNzrBLn0Oq9sA=
knative.dev/hack v0.0.0-20201214230143-4ed1ecb8db24/go.mod h1:PHt8x8yX5Z9pPquBEfIj0X66f8iWkWfR0S/sarACJrI=
knative.dev/net-contour v0.20.0 h1:GFzI8LAc6Q025LZ8p83Q4hxCVBQrWAH1gknV7zWzMww=
knative.dev/net-contour v0.20.0/go.mod h1:e/kj9F0vs6x+xvujeZX5jBRyN5IVDMdZMlO6N7WLqdk=
knative.dev/net-http01 v0.20.0 h1:MDNewMntjPCxejOTdcg0Iarc1Dnz11oPUcf+8PXusaQ=
knative.dev/net-http01 v0.20.0/go.mod h1:KIkcE8MisCXDWB3kIPmSrSunl9B3Kn9DRcu7MkIW+NA=
knative.dev/networking v0.0.0-20210107024535-ecb89ced52d9 h1:7SXik2ulHr7URICeDYHPVdnyuT72RW9GouJ97XRkWbo=
knative.dev/networking v0.0.0-20210107024535-ecb89ced52d9/go.mod h1:N123KICErXy+bPo1oBszM6TVYGG0Za2wMmnEqX4MlFg=
knative.dev/hack v0.0.0-20210112093330-d946d2557383 h1:YDYKfHaplhMelgOVP8eRvHlYf5elgZveo36GBDFfDqA=
knative.dev/hack v0.0.0-20210112093330-d946d2557383/go.mod h1:PHt8x8yX5Z9pPquBEfIj0X66f8iWkWfR0S/sarACJrI=
knative.dev/net-contour v0.20.1-0.20210113185432-8bb7f0f024e5 h1:yCeakKuVBysG6mpRmj0M/1EgrJu44osXgiI87ainiRY=
knative.dev/net-contour v0.20.1-0.20210113185432-8bb7f0f024e5/go.mod h1:cT3gc4aDP+IzhAJcpBl9bMRtyz18biSMTmtOjH6QmIE=
knative.dev/net-http01 v0.20.1-0.20210113185332-cc06c000c7b3 h1:v8xEhrpTRf48RU+OUDmux9LVP+KI0+iruWe5l5dwyLo=
knative.dev/net-http01 v0.20.1-0.20210113185332-cc06c000c7b3/go.mod h1:T7TrUjaQB0m6Zz9jlbM/6JJcfK0/qgLhkp6+uKWtWco=
knative.dev/networking v0.0.0-20210112144630-4c4c2378e90e/go.mod h1:N123KICErXy+bPo1oBszM6TVYGG0Za2wMmnEqX4MlFg=
knative.dev/networking v0.0.0-20210113172032-07a8160d1971 h1:Iig2pviCKuZYoIH+wgeUoJz1U4gQ18LXX7JpwRO5AYo=
knative.dev/networking v0.0.0-20210113172032-07a8160d1971/go.mod h1:lAll0+JcN2iKex0P9hOXZ4siOdryW+HIuK4KBRM+ca4=
knative.dev/pkg v0.0.0-20191101194912-56c2594e4f11/go.mod h1:pgODObA1dTyhNoFxPZTTjNWfx6F0aKsKzn+vaT9XO/Q=
knative.dev/pkg v0.0.0-20191111150521-6d806b998379/go.mod h1:pgODObA1dTyhNoFxPZTTjNWfx6F0aKsKzn+vaT9XO/Q=
knative.dev/pkg v0.0.0-20200207155214-fef852970f43/go.mod h1:pgODObA1dTyhNoFxPZTTjNWfx6F0aKsKzn+vaT9XO/Q=
Expand All @@ -2322,9 +2325,11 @@ knative.dev/pkg v0.0.0-20201224024804-27db5ac24cfb h1:XVcmpSvfDMZ5Z+1pebSm5Msq5s
knative.dev/pkg v0.0.0-20201224024804-27db5ac24cfb/go.mod h1:hckgW978SdzPA2H5EDvRPY8xsnPuDZLJLbPf8Jte7Q0=
knative.dev/pkg v0.0.0-20210107022335-51c72e24c179 h1:lkrgrv69iUk2qhOG9symy15kJUaJZmMybSloi7C3gIw=
knative.dev/pkg v0.0.0-20210107022335-51c72e24c179/go.mod h1:hckgW978SdzPA2H5EDvRPY8xsnPuDZLJLbPf8Jte7Q0=
knative.dev/reconciler-test v0.0.0-20210108100436-db4d65735605/go.mod h1:rmQpZseeqDpg6/ToFzIeV5hTRkOJujaXBCK7iYL7M4E=
knative.dev/serving v0.20.0 h1:bxnmLCrwXDESqM4J1d8uKdl1XUQOq1DnHEVl6Ottnwo=
knative.dev/serving v0.20.0/go.mod h1:357cOGGPTY1aNqbDeyr35/LvYn1yc0WCe0EQLTNN8Mc=
knative.dev/pkg v0.0.0-20210112143930-acbf2af596cf h1:6/VyHMk6pa395xWho0KLfVj+7NNrmlO7Ki9jLbVjoaI=
knative.dev/pkg v0.0.0-20210112143930-acbf2af596cf/go.mod h1:hckgW978SdzPA2H5EDvRPY8xsnPuDZLJLbPf8Jte7Q0=
knative.dev/reconciler-test v0.0.0-20210111135237-9b251467ccb6/go.mod h1:rmQpZseeqDpg6/ToFzIeV5hTRkOJujaXBCK7iYL7M4E=
knative.dev/serving v0.20.1-0.20210113202032-0f2d35099d02 h1:wZAJFOVAsPuh3ukWa9Pyk8btkN6KO5nMiFgiD1lKMtA=
knative.dev/serving v0.20.1-0.20210113202032-0f2d35099d02/go.mod h1:m24eWeQ394GFbz3WnacOiQXFx/mSTBSgpQf+9/c4YMs=
knative.dev/test-infra v0.0.0-20200407185800-1b88cb3b45a5/go.mod h1:xcdUkMJrLlBswIZqL5zCuBFOC22WIPMQoVX1L35i0vQ=
knative.dev/test-infra v0.0.0-20200505052144-5ea2f705bb55/go.mod h1:WqF1Azka+FxPZ20keR2zCNtiQA1MP9ZB4BH4HuI+SIU=
knative.dev/test-infra v0.0.0-20200513011557-d03429a76034/go.mod h1:aMif0KXL4g19YCYwsy4Ocjjz5xgPlseYV+B95Oo4JGE=
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ spec:
labels: *labels
spec:
serviceAccountName: imc-controller
enableServiceLinks: false
containers:
- name: controller
image: ko://knative.dev/eventing/cmd/in_memory/channel_controller
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ spec:
topologyKey: kubernetes.io/hostname
weight: 100
serviceAccountName: imc-dispatcher
enableServiceLinks: false
containers:
- name: dispatcher
image: ko://knative.dev/eventing/cmd/in_memory/channel_dispatcher
Expand Down Expand Up @@ -70,6 +71,10 @@ spec:
fieldPath: metadata.name
- name: CONTAINER_NAME
value: dispatcher
- name: MAX_IDLE_CONNS
value: "1000"
- name: MAX_IDLE_CONNS_PER_HOST
value: "1000"
ports:
- containerPort: 8080
name: http
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ spec:
weight: 100

serviceAccountName: eventing-controller

enableServiceLinks: false
containers:
- name: eventing-controller
terminationMessagePolicy: FallbackToLogsOnError
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ spec:
sources.knative.dev/role: adapter
eventing.knative.dev/release: devel
spec:
enableServiceLinks: false
containers:
- name: dispatcher
image: ko://knative.dev/eventing/cmd/mtping
Expand Down
2 changes: 1 addition & 1 deletion vendor/knative.dev/eventing/pkg/apis/config/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (

eventingduckv1 "knative.dev/eventing/pkg/apis/duck/v1"

"github.com/ghodss/yaml"
"sigs.k8s.io/yaml"

corev1 "k8s.io/api/core/v1"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ type HTTPMessageReceiver struct {

server *http.Server
listener net.Listener

checker http.HandlerFunc
}

// HTTPMessageReceiverOption enables further configuration of a HTTPMessageReceiver.
Expand All @@ -52,6 +54,16 @@ func NewHTTPMessageReceiver(port int, o ...HTTPMessageReceiverOption) *HTTPMessa
return h
}

// WithChecker takes a handler func which will run as an additional health check in Drainer.
// kncloudevents HTTPMessageReceiver uses Drainer to perform health check.
// By default, Drainer directly writes StatusOK to kubelet probe if the Pod is not draining.
// Users can configure customized liveness and readiness check logic by defining checker here.
func WithChecker(checker http.HandlerFunc) HTTPMessageReceiverOption {
return func(h *HTTPMessageReceiver) {
h.checker = checker
}
}

// Blocking
func (recv *HTTPMessageReceiver) StartListen(ctx context.Context, handler http.Handler) error {
var err error
Expand All @@ -60,7 +72,8 @@ func (recv *HTTPMessageReceiver) StartListen(ctx context.Context, handler http.H
}

drainer := &handlers.Drainer{
Inner: CreateHandler(handler),
Inner: CreateHandler(handler),
HealthCheck: recv.checker,
}
recv.server = &http.Server{
Addr: recv.listener.Addr().String(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import (
v1 "knative.dev/eventing/pkg/apis/sources/v1"
reconcilersource "knative.dev/eventing/pkg/reconciler/source"
"knative.dev/pkg/kmeta"
"knative.dev/pkg/ptr"
"knative.dev/pkg/system"
)

Expand Down Expand Up @@ -78,6 +79,7 @@ func MakeReceiveAdapter(args *ReceiveAdapterArgs) (*appsv1.Deployment, error) {
},
Spec: corev1.PodSpec{
ServiceAccountName: args.Source.Spec.ServiceAccountName,
EnableServiceLinks: ptr.Bool(false),
Containers: []corev1.Container{
{
Name: "receive-adapter",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package channel
package config

import (
corev1 "k8s.io/api/core/v1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ import (

"knative.dev/eventing/pkg/client/injection/informers/messaging/v1/inmemorychannel"
inmemorychannelreconciler "knative.dev/eventing/pkg/client/injection/reconciler/messaging/v1/inmemorychannel"
"knative.dev/eventing/pkg/reconciler/inmemorychannel/controller/config"

"knative.dev/pkg/client/injection/kube/informers/apps/v1/deployment"
"knative.dev/pkg/client/injection/kube/informers/core/v1/endpoints"
"knative.dev/pkg/client/injection/kube/informers/core/v1/service"
Expand Down Expand Up @@ -116,5 +118,10 @@ func NewController(
Handler: controller.HandleAll(grCh),
})

// Setup the watch on the config map of dispatcher config
configStore := config.NewEventDispatcherConfigStore(logging.FromContext(ctx))
configStore.WatchConfigs(cmw)
r.eventDispatcherConfigStore = configStore

return impl
}
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import (
v1 "knative.dev/eventing/pkg/apis/messaging/v1"
inmemorychannelreconciler "knative.dev/eventing/pkg/client/injection/reconciler/messaging/v1/inmemorychannel"
listers "knative.dev/eventing/pkg/client/listers/messaging/v1"
"knative.dev/eventing/pkg/reconciler/inmemorychannel/controller/config"
"knative.dev/eventing/pkg/reconciler/inmemorychannel/controller/resources"
"knative.dev/pkg/logging"
)
Expand Down Expand Up @@ -82,6 +83,8 @@ type Reconciler struct {
endpointsLister corev1listers.EndpointsLister
serviceAccountLister corev1listers.ServiceAccountLister
roleBindingLister rbacv1listers.RoleBindingLister

eventDispatcherConfigStore *config.EventDispatcherConfigStore
}

// Check that our Reconciler implements Interface
Expand Down Expand Up @@ -193,6 +196,9 @@ func (r *Reconciler) reconcileDispatcher(ctx context.Context, scope, dispatcherN
if scope == eventing.ScopeNamespace {
// Create dispatcher in imc's namespace
args := resources.DispatcherArgs{
EventDispatcherConfig: config.EventDispatcherConfig{
ConnectionArgs: r.eventDispatcherConfigStore.GetConfig().ConnectionArgs,
},
ServiceAccountName: dispatcherName,
DispatcherName: dispatcherName,
DispatcherNamespace: dispatcherNamespace,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ limitations under the License.
package resources

import (
"strconv"

v1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource"
Expand All @@ -25,7 +27,10 @@ import (

"knative.dev/pkg/logging"
"knative.dev/pkg/metrics"
"knative.dev/pkg/ptr"
"knative.dev/pkg/system"

"knative.dev/eventing/pkg/reconciler/inmemorychannel/controller/config"
)

var (
Expand All @@ -36,6 +41,7 @@ var (
)

type DispatcherArgs struct {
config.EventDispatcherConfig
ServiceAccountName string
DispatcherName string
DispatcherNamespace string
Expand Down Expand Up @@ -66,11 +72,12 @@ func MakeDispatcher(args DispatcherArgs) *v1.Deployment {
},
Spec: corev1.PodSpec{
ServiceAccountName: args.ServiceAccountName,
EnableServiceLinks: ptr.Bool(false),
Containers: []corev1.Container{
{
Name: "dispatcher",
Image: args.Image,
Env: makeEnv(),
Env: makeEnv(args.EventDispatcherConfig),

// Set low resource requests and limits.
// This should be configurable.
Expand Down Expand Up @@ -101,7 +108,7 @@ func MakeDispatcher(args DispatcherArgs) *v1.Deployment {
}
}

func makeEnv() []corev1.EnvVar {
func makeEnv(dispatcherConfig config.EventDispatcherConfig) []corev1.EnvVar {
return []corev1.EnvVar{{
Name: system.NamespaceEnvKey,
Value: system.Namespace(),
Expand All @@ -121,5 +128,11 @@ func makeEnv() []corev1.EnvVar {
FieldPath: "metadata.namespace",
},
},
}, {
Name: "MAX_IDLE_CONNS",
Value: strconv.Itoa(dispatcherConfig.MaxIdleConns),
}, {
Name: "MAX_IDLE_CONNS_PER_HOST",
Value: strconv.Itoa(dispatcherConfig.MaxIdleConnsPerHost),
}}
}
Loading