{"modulePath":"github.com/knative/serving","version":"v0.1.1","isLatest":false,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package controller\n\n## Functions\n\n```go\nfunc Filter(kind string) func(obj interface{}) bool\n```\nFilter makes it simple to create FilterFunc's for use with cache.FilteringResourceEventHandler that filter based on the kind of the controlling resources.\n\n```go\nfunc GetK8sServiceFullname(name string, namespace string) string\n```\n\n```go\nfunc GetRevisionHeaderName() string\n```\n\n```go\nfunc GetRevisionHeaderNamespace() string\n```\n\n```go\nfunc GetServingK8SServiceNameForObj(name string) string\n```\n\n```go\nfunc NewControllerRef(obj metav1.Object) *metav1.OwnerReference\n```\nNewControllerRef creates an OwnerReference pointing to the given Resource.\n\n```go\nfunc PassNew(f func(interface{})) func(interface{}, interface{})\n```\nPassNew makes it simple to create an UpdateFunc for use with cache.ResourceEventHandlerFuncs that can delegate the same methods as AddFunc/DeleteFunc but passing through only the second argument (which is the \"new\" object).\n\n## Types\n\n```go\ntype Base struct {\n\t// KubeClientSet allows us to talk to the k8s for core APIs\n\tKubeClientSet kubernetes.Interface\n\n\t// ServingClientSet allows us to configure Serving objects\n\tServingClientSet clientset.Interface\n\n\t// BuildClientSet allows us to configure Build objects\n\tBuildClientSet buildclientset.Interface\n\n\t// ConfigMapWatcher allows us to watch for ConfigMap changes.\n\tConfigMapWatcher configmap.Watcher\n\n\t// Recorder is an event recorder for recording Event resources to the\n\t// Kubernetes API.\n\tRecorder record.EventRecorder\n\n\t// WorkQueue is a rate limited work queue. This is used to queue work to be\n\t// processed instead of performing it as soon as a change happens. This\n\t// means we can ensure we only process a fixed amount of resources at a\n\t// time, and makes it easy to ensure we are never processing the same item\n\t// simultaneously in two different workers.\n\tWorkQueue workqueue.RateLimitingInterface\n\n\t// Sugared logger is easier to use but is not as performant as the\n\t// raw logger. In performance critical paths, call logger.Desugar()\n\t// and use the returned raw logger instead. In addition to the\n\t// performance benefits, raw logger also preserves type-safety at\n\t// the expense of slightly greater verbosity.\n\tLogger *zap.SugaredLogger\n}\n```\nBase implements most of the boilerplate and common code we have in our controllers.\n\n```go\nfunc NewBase(opt Options, controllerAgentName, workQueueName string) *Base\n```\nNewBase instantiates a new instance of Base implementing the common \u0026 boilerplate code between our controllers.\n\n```go\nfunc (c *Base) Enqueue(obj interface{})\n```\nEnqueue takes a resource and converts it into a namespace/name string which is then put onto the work queue.\n\n```go\nfunc (c *Base) EnqueueControllerOf(obj interface{})\n```\nEnqueueControllerOf takes a resource, identifies its controller resource, and converts it into a namespace/name string which is then put onto the work queue.\n\n```go\nfunc (c *Base) EnqueueKey(key string)\n```\nEnqueueKey takes a namespace/name string and puts it onto the work queue.\n\n```go\nfunc (b *Base) GetWorkQueue() workqueue.RateLimitingInterface\n```\nGetWorkQueue helps implement Interface for derivatives.\n\n```go\nfunc (c *Base) RunController(\n\tthreadiness int,\n\tstopCh \u003c-chan struct{},\n\tsyncHandler func(string) error,\n\tcontrollerName string) error\n```\nRunController starts the controller's worker threads, the number of which is threadiness. It then blocks until stopCh is closed, at which point it shuts down its internal work queue and waits for workers to finish processing their current work items.\n\n```go\ntype Interface interface {\n\tRun(threadiness int, stopCh \u003c-chan struct{}) error\n\tReconcile(key string) error\n\tGetWorkQueue() workqueue.RateLimitingInterface\n}\n```\nInterface defines the controller interface\n\n```go\ntype Options struct {\n\tKubeClientSet    kubernetes.Interface\n\tServingClientSet clientset.Interface\n\tBuildClientSet   buildclientset.Interface\n\tConfigMapWatcher configmap.Watcher\n\tLogger           *zap.SugaredLogger\n}\n```\nOptions defines the common controller options passed to NewBase. We define this to reduce the boilerplate argument list when creating derivative controllers.\n\n","path":"github.com/knative/serving/pkg/controller","name":"controller","synopsis":"","isRedistributable":true}
