Repository: jenkins-x/lighthouse
Pull request #967 (2020-08-24 15:31:07)

chore: Switch Keeper to config map watcher
This'll keep it from failing to start if the configmaps aren't present and/or are malformed, and avoids the need for mounting the configmap as well.

And I fixed up the out-of-the-box `config` configmap to not be invalid.

Signed-off-by: Andrew Bayer <andrew.bayer@gmail.com>

abayer: /assign @hferentschik 
/assign @eddycharly 
jenkins-x-bot: [APPROVALNOTIFIER] This PR is **NOT APPROVED**

This pull-request has been approved by:
To complete the [pull request process](https://git.k8s.io/community/contributors/guide/owners.md#the-code-review-process), please assign **abayer**
You can assign the PR to them by writing `/assign @abayer` in a comment when ready.

The full list of commands accepted by this bot can be found [here](https://go.k8s.io/bot-commands?repo=jenkins-x%2Flighthouse).

<details open>
Needs approval from an approver in each of these files:

- **[OWNERS](https://github.com/jenkins-x/lighthouse/blob/master/OWNERS)**

Approvers can indicate their approval by writing `/approve` in a comment
Approvers can cancel approval by writing `/approve cancel` in a comment
</details>
<!-- META={"approvers":["abayer"]} -->
eddycharly: /lgtm
jenkins-x-bot: [APPROVALNOTIFIER] This PR is **NOT APPROVED**

This pull-request has been approved by: *[eddycharly](https://github.com/jenkins-x/lighthouse/pull/967#issuecomment-679200150 "LGTM")*
To complete the [pull request process](https://git.k8s.io/community/contributors/guide/owners.md#the-code-review-process), please assign **abayer**
You can assign the PR to them by writing `/assign @abayer` in a comment when ready.

The full list of commands accepted by this bot can be found [here](https://go.k8s.io/bot-commands?repo=jenkins-x%2Flighthouse).

<details open>
Needs approval from an approver in each of these files:

- **[OWNERS](https://github.com#issuecomment-679200150/jenkins-x/lighthouse/blob/master/OWNERS)**

Approvers can indicate their approval by writing `/approve` in a comment
Approvers can cancel approval by writing `/approve cancel` in a comment
</details>
<!-- META={"approvers":["abayer"]} -->
jenkins-x-bot: New changes are detected. LGTM label has been removed.
jenkins-x-bot: [APPROVALNOTIFIER] This PR is **NOT APPROVED**

This pull-request has been approved by: *[eddycharly](https://github.com/jenkins-x/lighthouse/pull/967#issuecomment-679200150 "LGTM")*
To complete the [pull request process](https://git.k8s.io/community/contributors/guide/owners.md#the-code-review-process), please assign **abayer**
You can assign the PR to them by writing `/assign @abayer` in a comment when ready.

The full list of commands accepted by this bot can be found [here](https://go.k8s.io/bot-commands?repo=jenkins-x%2Flighthouse).

<details open>
Needs approval from an approver in each of these files:

- **[OWNERS](https://github.com/jenkins-x/lighthouse/blob/master/OWNERS)**

Approvers can indicate their approval by writing `/approve` in a comment
Approvers can cancel approval by writing `/approve cancel` in a comment
</details>
<!-- META={"approvers":["abayer"]} -->
jenkins-x-bot: @abayer: The following test **failed**, say `/retest` to rerun them all:

Test name | Commit | Details | Rerun command
--- | --- | --- | ---
gitlab | 24cb8c2589bc2f26692fef9e0f693bb57191d041 | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-967/5) | `/test gitlab`

[View all Builds for this Pull Request](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-967) 

<details>

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md).  If you have questions or suggestions related to my behavior, please file an issue against the [jenkins-x/lighthouse](https://github.com/jenkins-x/lighthouse/issues/new?title=Command%20issue:) repository. I understand the commands that are listed [here](https://go.k8s.io/bot-commands).
</details>
<!-- test report -->
jenkins-x-bot: @abayer: The following tests **failed**, say `/retest` to rerun them all:

Test name | Commit | Details | Rerun command
--- | --- | --- | ---
gitlab | 24cb8c2589bc2f26692fef9e0f693bb57191d041 | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-967/5) | `/test gitlab`
github | 24cb8c2589bc2f26692fef9e0f693bb57191d041 | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-967/3) | `/test github`

[View all Builds for this Pull Request](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-967) 

<details>

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md).  If you have questions or suggestions related to my behavior, please file an issue against the [jenkins-x/lighthouse](https://github.com/jenkins-x/lighthouse/issues/new?title=Command%20issue:) repository. I understand the commands that are listed [here](https://go.k8s.io/bot-commands).
</details>
<!-- test report -->
jenkins-x-bot: @abayer: The following tests **failed**, say `/retest` to rerun them all:

Test name | Commit | Details | Rerun command
--- | --- | --- | ---
gitlab | 24cb8c2589bc2f26692fef9e0f693bb57191d041 | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-967/5) | `/test gitlab`
github | 24cb8c2589bc2f26692fef9e0f693bb57191d041 | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-967/3) | `/test github`
bbs | 24cb8c2589bc2f26692fef9e0f693bb57191d041 | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-967/4) | `/test bbs`

[View all Builds for this Pull Request](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-967) 

<details>

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md).  If you have questions or suggestions related to my behavior, please file an issue against the [jenkins-x/lighthouse](https://github.com/jenkins-x/lighthouse/issues/new?title=Command%20issue:) repository. I understand the commands that are listed [here](https://go.k8s.io/bot-commands).
</details>
<!-- test report -->
jenkins-x-bot: @abayer: The following tests **failed**, say `/retest` to rerun them all:

Test name | Commit | Details | Rerun command
--- | --- | --- | ---
gitlab | 24cb8c2589bc2f26692fef9e0f693bb57191d041 | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-967/5) | `/test gitlab`
github | 24cb8c2589bc2f26692fef9e0f693bb57191d041 | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-967/3) | `/test github`
bbs | 24cb8c2589bc2f26692fef9e0f693bb57191d041 | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-967/4) | `/test bbs`
ghe | 24cb8c2589bc2f26692fef9e0f693bb57191d041 | [link](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-967/2) | `/test ghe`

[View all Builds for this Pull Request](https://dashboard-jx.jenkins-x.live/teams/jx/projects/jenkins-x/lighthouse/PR-967) 

<details>

Instructions for interacting with me using PR comments are available [here](https://git.k8s.io/community/contributors/guide/pull-requests.md).  If you have questions or suggestions related to my behavior, please file an issue against the [jenkins-x/lighthouse](https://github.com/jenkins-x/lighthouse/issues/new?title=Command%20issue:) repository. I understand the commands that are listed [here](https://go.k8s.io/bot-commands).
</details>
<!-- test report -->

Patch:
diff --git a/charts/lighthouse/templates/config-cm.yaml b/charts/lighthouse/templates/config-cm.yaml
index 749f7a1e..e5ae5aeb 100644
--- a/charts/lighthouse/templates/config-cm.yaml
+++ b/charts/lighthouse/templates/config-cm.yaml
@@ -19,7 +19,6 @@ data:
     branch-protection:
       orgs: {}
       protect-tested-repos: true
-    gerrit: {}
     github:
       LinkURL: null
     owners_dir_excludes:
@@ -46,15 +45,16 @@ data:
         required-if-present-contexts: []
         skip-unknown-contexts: false
       merge_method: {}
-      queries:
-      - labels:
-        - approved
-        missingLabels:
-        - do-not-merge
-        - do-not-merge/hold
-        - do-not-merge/work-in-progress
-        - needs-ok-to-test
-        - needs-rebase
-        repos: []
+      queries: []
+      # Example configuration for a query
+      # - labels:
+      #   - approved
+      #   missingLabels:
+      #   - do-not-merge
+      #   - do-not-merge/hold
+      #   - do-not-merge/work-in-progress
+      #   - needs-ok-to-test
+      #   repos:
+      #   - org/repo
 {{- end }}
 {{- end }}
diff --git a/charts/lighthouse/templates/keeper-deployment.yaml b/charts/lighthouse/templates/keeper-deployment.yaml
index 35cd4fad..16973098 100644
--- a/charts/lighthouse/templates/keeper-deployment.yaml
+++ b/charts/lighthouse/templates/keeper-deployment.yaml
@@ -21,7 +21,7 @@ spec:
     metadata:
 {{- if .Values.keeper.datadog.enabled }}
       annotations:
-        ad.datadoghq.com/keeper.logs: '[{"source":"prow","service":"tide"}]'
+        ad.datadoghq.com/keeper.logs: '[{"source":"lighthouse","service":"keeper"}]'
 {{- end }}
       labels:
         draft: {{ default "draft-app" .Values.draft }}
@@ -85,20 +85,14 @@ spec:
 {{- end }}
         resources:
 {{ toYaml .Values.keeper.resources | indent 10 }}
-        volumeMounts:
-        - name: config
-          mountPath: /etc/config
-          readOnly: true
 {{- if .Values.githubApp.enabled }}
+        volumeMounts:
         - name: githubapp-tokens
           mountPath: /secrets/githubapp/tokens
           readOnly: true
 {{- end }}
-      volumes:
-      - name: config
-        configMap:
-          name: config
 {{- if .Values.githubApp.enabled }}
+      volumes:
       - name: githubapp-tokens
         secret:
           secretName: tide-githubapp-tokens
diff --git a/cmd/foghorn/main.go b/cmd/foghorn/main.go
index 1f62674a..01867b57 100644
--- a/cmd/foghorn/main.go
+++ b/cmd/foghorn/main.go
@@ -5,11 +5,11 @@ import (
 	"os"
 
 	lighthousev1alpha1 "github.com/jenkins-x/lighthouse/pkg/apis/lighthouse/v1alpha1"
-	"github.com/jenkins-x/lighthouse/pkg/clients"
 	"github.com/jenkins-x/lighthouse/pkg/foghorn"
 	"github.com/jenkins-x/lighthouse/pkg/logrusutil"
 	"github.com/sirupsen/logrus"
 	"k8s.io/apimachinery/pkg/runtime"
+	"k8s.io/client-go/tools/clientcmd"
 	ctrl "sigs.k8s.io/controller-runtime"
 )
 
@@ -46,7 +46,7 @@ func main() {
 		logrus.WithError(err).Fatal("Invalid options")
 	}
 
-	cfg, err := clients.GetConfig("", "")
+	cfg, err := clientcmd.BuildConfigFromFlags("", "")
 	if err != nil {
 		logrus.WithError(err).Fatal("Could not create kubeconfig")
 	}
diff --git a/cmd/gc/main.go b/cmd/gc/main.go
index f6dadcef..1dec2274 100644
--- a/cmd/gc/main.go
+++ b/cmd/gc/main.go
@@ -9,10 +9,10 @@ import (
 	"github.com/jenkins-x/lighthouse/pkg/apis/lighthouse/v1alpha1"
 	clientset "github.com/jenkins-x/lighthouse/pkg/client/clientset/versioned"
 	lhclient "github.com/jenkins-x/lighthouse/pkg/client/clientset/versioned/typed/lighthouse/v1alpha1"
-	"github.com/jenkins-x/lighthouse/pkg/clients"
 	"github.com/jenkins-x/lighthouse/pkg/logrusutil"
 	"github.com/sirupsen/logrus"
 	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+	"k8s.io/client-go/tools/clientcmd"
 )
 
 type options struct {
@@ -48,7 +48,7 @@ func main() {
 		logrus.WithError(err).Fatal("Invalid options")
 	}
 
-	cfg, err := clients.GetConfig("", "")
+	cfg, err := clientcmd.BuildConfigFromFlags("", "")
 	if err != nil {
 		logrus.WithError(err).Fatal("Could not create kubeconfig")
 	}
diff --git a/cmd/keeper/main.go b/cmd/keeper/main.go
index 2b5536c5..e851c84e 100644
--- a/cmd/keeper/main.go
+++ b/cmd/keeper/main.go
@@ -31,6 +31,7 @@ import (
 	"github.com/jenkins-x/lighthouse/pkg/logrusutil"
 	"github.com/jenkins-x/lighthouse/pkg/metrics"
 	"github.com/jenkins-x/lighthouse/pkg/util"
+	"github.com/jenkins-x/lighthouse/pkg/watcher"
 	"github.com/sirupsen/logrus"
 )
 
@@ -102,11 +103,12 @@ func main() {
 	}
 
 	configAgent := &config.Agent{}
-	if err := configAgent.Start(o.configPath, o.jobConfigPath); err != nil {
-		logrus.WithError(err).Fatal("Error starting config agent.")
+	cfgMapWatcher, err := watcher.SetupConfigMapWatchers(o.namespace, configAgent, nil)
+	if err != nil {
+		logrus.WithError(err).Fatal("error starting config map watcher")
 	}
+	defer cfgMapWatcher.Stop()
 
-	var err error
 	botName := o.botName
 	if botName == "" {
 		botName = util.GetBotName(configAgent.Config)
diff --git a/cmd/tektoncontroller/main.go b/cmd/tektoncontroller/main.go
index 82c1c477..ffb2dc2e 100644
--- a/cmd/tektoncontroller/main.go
+++ b/cmd/tektoncontroller/main.go
@@ -5,13 +5,13 @@ import (
 	"os"
 
 	lighthousev1alpha1 "github.com/jenkins-x/lighthouse/pkg/apis/lighthouse/v1alpha1"
-	"github.com/jenkins-x/lighthouse/pkg/clients"
 	tektonengine "github.com/jenkins-x/lighthouse/pkg/engines/tekton"
 	"github.com/jenkins-x/lighthouse/pkg/interrupts"
 	"github.com/jenkins-x/lighthouse/pkg/logrusutil"
 	"github.com/sirupsen/logrus"
 	pipelinev1beta1 "github.com/tektoncd/pipeline/pkg/apis/pipeline/v1beta1"
 	"k8s.io/apimachinery/pkg/runtime"
+	"k8s.io/client-go/tools/clientcmd"
 	ctrl "sigs.k8s.io/controller-runtime"
 )
 
@@ -52,7 +52,7 @@ func main() {
 		logrus.WithError(err).Fatal("Invalid options")
 	}
 
-	cfg, err := clients.GetConfig("", "")
+	cfg, err := clientcmd.BuildConfigFromFlags("", "")
 	if err != nil {
 		logrus.WithError(err).Fatal("Could not create kubeconfig")
 	}
diff --git a/config.yaml b/config.yaml
index fef13faf..4f7442d8 100644
--- a/config.yaml
+++ b/config.yaml
@@ -21,7 +21,6 @@ branch-protection:
             contexts:
               - pr-build
   protect-tested-repos: true
-gerrit: {}
 owners_dir_blacklist:
   default: null
   repos: null
diff --git a/docs/config/Lighthouse config.md b/docs/config/Lighthouse config.md
index 9a3303a4..528e5a9f 100644
--- a/docs/config/Lighthouse config.md
+++ b/docs/config/Lighthouse config.md
@@ -8,7 +8,6 @@
 - [ContextPolicy](#ContextPolicy)
 - [Controller](#Controller)
 - [Cookie](#Cookie)
-- [Gerrit](#Gerrit)
 - [GitHubOptions](#GitHubOptions)
 - [GithubOAuthConfig](#GithubOAuthConfig)
 - [JenkinsOperator](#JenkinsOperator)
@@ -123,16 +122,6 @@ Cookie holds the secret returned from github that authenticates the user who aut
 |---|---|---|---|---|
 | Secret | `secret` | string | No |  |
 
-## Gerrit
-
-Gerrit is config for the gerrit controller.
-
-| Variable Name | Stanza | Type | Required | Description |
-|---|---|---|---|---|
-| TickIntervalString | `tick_interval` | string | No | TickInterval is how often we do a sync with binded gerrit instance |
-| TickInterval | `-` | time.Duration | Yes |  |
-| RateLimit | `ratelimit` | int | No | RateLimit defines how many changes to query per gerrit API call<br />default is 5 |
-
 ## GitHubOptions
 
 GitHubOptions allows users to control how prow applications display GitHub website links.
@@ -415,7 +404,6 @@ ProwConfig is config for all prow controllers
 | Plank | `plank` | [Plank](#Plank) | No |  |
 | BranchProtection | `branch-protection` | [BranchProtection](#BranchProtection) | No |  |
 | Orgs | `orgs` | map[string]org.Config | No |  |
-| Gerrit | `gerrit` | [Gerrit](#Gerrit) | No |  |
 | JenkinsOperators | `jenkins_operators` | [][JenkinsOperator](#JenkinsOperator) | No | TODO: Move this out of the main config. |
 | LighthouseJobNamespace | `prowjob_namespace` | string | No | LighthouseJobNamespace is the namespace in the cluster that prow<br />components will use for looking up LighthouseJobs. The namespace<br />needs to exist and will not be created by prow.<br />Defaults to "default". |
 | PodNamespace | `pod_namespace` | string | No | PodNamespace is the namespace in the cluster that prow<br />components will use for looking up Pods owned by LighthouseJobs.<br />The namespace needs to exist and will not be created by prow.<br />Defaults to "default". |
diff --git a/pkg/clients/clients.go b/pkg/clients/clients.go
index f050b0fa..69145b96 100644
--- a/pkg/clients/clients.go
+++ b/pkg/clients/clients.go
@@ -1,11 +1,6 @@
 package clients
 
 import (
-	"fmt"
-	"os"
-	"os/user"
-	"path/filepath"
-
 	clientset "github.com/jenkins-x/lighthouse/pkg/client/clientset/versioned"
 	"github.com/pkg/errors"
 	"k8s.io/client-go/rest"
@@ -20,7 +15,7 @@ import (
 
 // GetAPIClients returns the tekton, kube, and Lighthouse clients and the kubeconfig used to create them
 func GetAPIClients() (tektonclient.Interface, kubeclient.Interface, clientset.Interface, *rest.Config, error) {
-	kubeCfg, err := GetConfig("", "")
+	kubeCfg, err := clientcmd.BuildConfigFromFlags("", "")
 	if err != nil {
 		return nil, nil, nil, nil, errors.Wrap(err, "unable to get kubeconfig")
 	}
@@ -42,31 +37,3 @@ func GetAPIClients() (tektonclient.Interface, kubeclient.Interface, clientset.In
 
 	return tektonClient, kubeClient, lhClient, kubeCfg, nil
 }
-
-// GetConfig returns a rest.Config to be used for kubernetes client creation.
-// It does so in the following order:
-//   1. Use the passed kubeconfig/masterURL.
-//   2. Fallback to the KUBECONFIG environment variable.
-//   3. Fallback to in-cluster config.
-//   4. Fallback to the ~/.kube/config.
-func GetConfig(masterURL, kubeconfig string) (*rest.Config, error) {
-	if kubeconfig == "" {
-		kubeconfig = os.Getenv("KUBECONFIG")
-	}
-	// If we have an explicit indication of where the kubernetes config lives, read that.
-	if kubeconfig != "" {
-		return clientcmd.BuildConfigFromFlags(masterURL, kubeconfig)
-	}
-	// If not, try the in-cluster config.
-	if c, err := rest.InClusterConfig(); err == nil {
-		return c, nil
-	}
-	// If no in-cluster config, try the default location in the user's home directory.
-	if usr, err := user.Current(); err == nil {
-		if c, err := clientcmd.BuildConfigFromFlags("", filepath.Join(usr.HomeDir, ".kube", "config")); err == nil {
-			return c, nil
-		}
-	}
-
-	return nil, fmt.Errorf("could not create a valid kubeconfig")
-}
diff --git a/pkg/config/agent.go b/pkg/config/agent.go
index c0c5064f..f4ac8ba5 100644
--- a/pkg/config/agent.go
+++ b/pkg/config/agent.go
@@ -17,11 +17,8 @@ limitations under the License.
 package config
 
 import (
-	"os"
 	"sync"
 	"time"
-
-	"github.com/sirupsen/logrus"
 )
 
 // Delta represents the before and after states of a Config change detected by the Agent.
@@ -40,65 +37,6 @@ type Agent struct {
 	subscriptions []DeltaChan
 }
 
-// Start will begin polling the config file at the path. If the first load
-// fails, Start will return the error and abort. Future load failures will log
-// the failure message but continue attempting to load.
-func (ca *Agent) Start(prowConfig, jobConfig string) error {
-	c, err := Load(prowConfig, jobConfig)
-	if err != nil {
-		return err
-	}
-	ca.Set(c)
-	go func() {
-		var lastModTime time.Time
-		// Rarely, if two changes happen in the same second, mtime will
-		// be the same for the second change, and an mtime-based check would
-		// fail. Reload periodically just in case.
-		skips := 0
-		for range time.Tick(1 * time.Second) {
-			if skips < 600 {
-				// Check if the file changed to see if it needs to be re-read.
-				// os.Stat follows symbolic links, which is how ConfigMaps work.
-				prowStat, err := os.Stat(prowConfig)
-				if err != nil {
-					logrus.WithField("prowConfig", prowConfig).WithError(err).Error("Error loading prow config.")
-					continue
-				}
-
-				recentModTime := prowStat.ModTime()
-
-				// TODO(krzyzacy): allow empty jobConfig till fully migrate config to subdirs
-				if jobConfig != "" {
-					jobConfigStat, err := os.Stat(jobConfig)
-					if err != nil {
-						logrus.WithField("jobConfig", jobConfig).WithError(err).Error("Error loading job configs.")
-						continue
-					}
-
-					if jobConfigStat.ModTime().After(recentModTime) {
-						recentModTime = jobConfigStat.ModTime()
-					}
-				}
-
-				if !recentModTime.After(lastModTime) {
-					skips++
-					continue // file hasn't been modified
-				}
-				lastModTime = recentModTime
-			}
-			if c, err := Load(prowConfig, jobConfig); err != nil {
-				logrus.WithField("prowConfig", prowConfig).
-					WithField("jobConfig", jobConfig).
-					WithError(err).Error("Error loading config.")
-			} else {
-				skips = 0
-				ca.Set(c)
-			}
-		}
-	}()
-	return nil
-}
-
 // Subscribe registers the channel for messages on config reload.
 // The caller can expect a copy of the previous and current config
 // to be sent down the subscribed channel when a new configuration
diff --git a/pkg/config/config.go b/pkg/config/config.go
index cb7bf2ba..1558e13d 100644
--- a/pkg/config/config.go
+++ b/pkg/config/config.go
@@ -75,7 +75,6 @@ type ProwConfig struct {
 	Plank            Plank                 `json:"plank,omitempty"`
 	BranchProtection BranchProtection      `json:"branch-protection,omitempty"`
 	Orgs             map[string]org.Config `json:"orgs,omitempty"`
-	Gerrit           Gerrit                `json:"gerrit,omitempty"`
 
 	// TODO: Move this out of the main config.
 	JenkinsOperators []JenkinsOperator `json:"jenkins_operators,omitempty"`
@@ -198,16 +197,6 @@ type Plank struct {
 	ReportTemplate *template.Template `json:"-"`
 }
 
-// Gerrit is config for the gerrit controller.
-type Gerrit struct {
-	// TickInterval is how often we do a sync with binded gerrit instance
-	TickIntervalString string        `json:"tick_interval,omitempty"`
-	TickInterval       time.Duration `json:"-"`
-	// RateLimit defines how many changes to query per gerrit API call
-	// default is 5
-	RateLimit int `json:"ratelimit,omitempty"`
-}
-
 // JenkinsOperator is config for the jenkins-operator controller.
 type JenkinsOperator struct {
 	Controller `json:",inline"`
@@ -721,20 +710,6 @@ func parseProwConfig(c *Config) error {
 	}
 	c.Plank.ReportTemplate = reportTmpl
 
-	if c.Gerrit.TickIntervalString == "" {
-		c.Gerrit.TickInterval = time.Minute
-	} else {
-		tickInterval, err := time.ParseDuration(c.Gerrit.TickIntervalString)
-		if err != nil {
-			return fmt.Errorf("cannot parse duration for c.gerrit.tick_interval: %v", err)
-		}
-		c.Gerrit.TickInterval = tickInterval
-	}
-
-	if c.Gerrit.RateLimit == 0 {
-		c.Gerrit.RateLimit = 5
-	}
-
 	for i := range c.JenkinsOperators {
 		if err := ValidateController(&c.JenkinsOperators[i].Controller); err != nil {
 			return fmt.Errorf("validating jenkins_operators config: %v", err)
diff --git a/pkg/plugins/plugins.go b/pkg/plugins/plugins.go
index d884812f..65a26c03 100644
--- a/pkg/plugins/plugins.go
+++ b/pkg/plugins/plugins.go
@@ -24,7 +24,6 @@ import (
 	"os"
 	"strings"
 	"sync"
-	"time"
 
 	"github.com/jenkins-x/go-scm/scm"
 	lighthouseclient "github.com/jenkins-x/lighthouse/pkg/client/clientset/versioned/typed/lighthouse/v1alpha1"
@@ -288,23 +287,6 @@ func (pa *ConfigAgent) Set(pc *Configuration) {
 	pa.configuration = pc
 }
 
-// Start starts polling path for plugin config. If the first attempt fails,
-// then start returns the error. Future errors will halt updates but not stop.
-func (pa *ConfigAgent) Start(path string) error {
-	if err := pa.Load(path); err != nil {
-		return err
-	}
-	ticker := time.Tick(1 * time.Minute)
-	go func() {
-		for range ticker {
-			if err := pa.Load(path); err != nil {
-				logrus.WithField("path", path).WithError(err).Error("Error loading plugin config.")
-			}
-		}
-	}()
-	return nil
-}
-
 // GenericCommentHandlers returns a map of plugin names to handlers for the repo.
 func (pa *ConfigAgent) GenericCommentHandlers(owner, repo string) map[string]GenericCommentHandler {
 	pa.mut.Lock()
diff --git a/pkg/watcher/configmap_watcher.go b/pkg/watcher/configmap_watcher.go
index 4803ee9e..356db8f5 100644
--- a/pkg/watcher/configmap_watcher.go
+++ b/pkg/watcher/configmap_watcher.go
@@ -50,9 +50,9 @@ func SetupConfigMapWatchers(ns string, configAgent *config.Agent, pluginAgent *p
 			if text != "" {
 				loadedConfig, err := config.LoadYAMLConfig([]byte(text))
 				if err != nil {
-					logrus.WithError(err).Error("Error processing the prow Config YAML")
+					logrus.WithError(err).Error("Error processing the Lighthouse Config YAML")
 				} else {
-					logrus.Info("updating the prow core configuration")
+					logrus.Info("updating the Lighthouse core configuration")
 					configAgent.Set(loadedConfig)
 				}
 			}
@@ -67,12 +67,12 @@ func SetupConfigMapWatchers(ns string, configAgent *config.Agent, pluginAgent *p
 	if pluginAgent != nil {
 		onPluginsYamlChange := func(text string) {
 			if text != "" {
-				config, err := pluginAgent.LoadYAMLConfig([]byte(text))
+				loadedConfig, err := pluginAgent.LoadYAMLConfig([]byte(text))
 				if err != nil {
-					logrus.WithError(err).Error("Error processing the prow Plugins YAML")
+					logrus.WithError(err).Error("Error processing the Lighthouse Plugins YAML")
 				} else {
-					logrus.Info("updating the prow plugins configuration")
-					pluginAgent.Set(config)
+					logrus.Info("updating the Lighthouse plugins configuration")
+					pluginAgent.Set(loadedConfig)
 				}
 			}
 		}


Test patch:
diff --git a/pkg/foghorn/controller_test.go b/pkg/foghorn/controller_test.go
index e85ebd95..a182a7d4 100644
--- a/pkg/foghorn/controller_test.go
+++ b/pkg/foghorn/controller_test.go
@@ -47,7 +47,6 @@ func TestReconcile(t *testing.T) {
 			Plank:                  config.Plank{},
 			BranchProtection:       config.BranchProtection{},
 			Orgs:                   nil,
-			Gerrit:                 config.Gerrit{},
 			JenkinsOperators:       nil,
 			LighthouseJobNamespace: "",
 			PodNamespace:           "",
diff --git a/pkg/repoconfig/merge/test_data/simple/expected-config.yaml b/pkg/repoconfig/merge/test_data/simple/expected-config.yaml
index 6ea8420a..ebe9c82e 100644
--- a/pkg/repoconfig/merge/test_data/simple/expected-config.yaml
+++ b/pkg/repoconfig/merge/test_data/simple/expected-config.yaml
@@ -6,7 +6,6 @@ branch-protection:
           required_status_checks:
             contexts:
             - lint
-gerrit: {}
 github:
   LinkURL: null
 owners_dir_blacklist:
diff --git a/pkg/repoconfig/merge/test_data/simple/source-config.yaml b/pkg/repoconfig/merge/test_data/simple/source-config.yaml
index 19456fe0..b60e2d51 100644
--- a/pkg/repoconfig/merge/test_data/simple/source-config.yaml
+++ b/pkg/repoconfig/merge/test_data/simple/source-config.yaml
@@ -1,5 +1,4 @@
 branch-protection: {}
-gerrit: {}
 github:
   LinkURL: null
 owners_dir_blacklist:
diff --git a/pkg/webhook/test_data/test_config.yaml b/pkg/webhook/test_data/test_config.yaml
index 819ec71d..addde5ff 100644
--- a/pkg/webhook/test_data/test_config.yaml
+++ b/pkg/webhook/test_data/test_config.yaml
@@ -65,7 +65,6 @@ branch-protection:
             contexts:
             - pr-build
   protect-tested-repos: true
-gerrit: {}
 owners_dir_excludes:
   default: null
   repos: null
diff --git a/test/e2e/test_data/example-config.tmpl.yml b/test/e2e/test_data/example-config.tmpl.yml
index 20b9b373..6a4a092c 100644
--- a/test/e2e/test_data/example-config.tmpl.yml
+++ b/test/e2e/test_data/example-config.tmpl.yml
@@ -7,7 +7,6 @@ branch-protection:
             contexts:
             - pr-build
   protect-tested-repos: true
-gerrit: {}
 github:
   LinkURL: null
 owners_dir_excludes: