Repository: knative-sandbox/eventing-kafka
Pull request #226 (2020-11-24 04:28:45)

[distributed] Use same configmap name, for the channels
Signed-off-by: Matthias Wessendorf <mwessend@redhat.com>

Fixes #

<!-- Please include the 'why' behind your changes if no issue exists -->

## Proposed Changes

- align name of the configmap with the consolidated
-
-

<!--
If this change has user-visible impact, follow the instructions below.
Examples include:

- 🎁 Add new feature
- 🐛 Fix bug
- 🧽 Update or clean up current behavior
- 🗑️ Remove feature or internal logic

Otherwise delete the rest of this template.
-->

**Release Note**

<!--
🗒️ If this change has user-visible impact, write a release note in the block
below. Include the string "action required" if additional action is required of
users switching to the new release, for example in case of a breaking change.

Write as if you are speaking to users, not other Knative contributors. If this
change has no user-visible impact, no release-note is needed.
-->

```release-note

```

**Docs**

<!--
📖 If this change has user-visible impact, link to an issue or PR in
https://github.com/knative/docs.
-->


knative-prow-robot: [APPROVALNOTIFIER] This PR is **APPROVED**

This pull-request has been approved by: *<a href="https://github.com/knative-sandbox/eventing-kafka/pull/226#" title="Author self-approved">matzew</a>*

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

The pull request process is described [here](https://git.k8s.io/community/contributors/guide/owners.md#the-code-review-process)

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

- ~~[OWNERS](https://github.com/knative-sandbox/eventing-kafka/blob/master/OWNERS)~~ [matzew]

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":[]} -->
matzew: /hold
/assign @travis-minke-sap 
/cc @eric-sap 

I was wondering how you'd think about this.

I was also thinking about doing a follow up PR, where I'd like to also change the CM and use the `authSecretName` and `authSecretNamespace` keys, instead of the current label you are using.

Let me know what you think! 
knative-prow-robot: @matzew: GitHub didn't allow me to request PR reviews from the following users: eric-sap.

Note that only [knative-sandbox members](https://github.com/orgs/knative-sandbox/people) and repo collaborators can review this PR, and authors cannot review their own PRs.

<details>

In response to [this](https://github.com/knative-sandbox/eventing-kafka/pull/226#issuecomment-732645651):

>/hold
>/assign @travis-minke-sap 
>/cc @eric-sap 
>
>I was wondering how you'd think about this.
>
>I was also thinking about doing a follow up PR, where I'd like to also change the CM and use the `authSecretName` and `authSecretNamespace` keys, instead of the current label you are using.
>
>Let me know what you think! 


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 [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository.
</details>
knative-prow-robot: @matzew: The following test **failed**, say `/retest` to rerun all failed tests:

Test name | Commit | Details | Rerun command
--- | --- | --- | ---
pull-knative-sandbox-eventing-kafka-unit-tests | fdbb47eb34fece90348151e86bfe165b8cf93aa2 | [link](https://prow.knative.dev/view/gs/knative-prow/pr-logs/pull/knative-sandbox_eventing-kafka/226/pull-knative-sandbox-eventing-kafka-unit-tests/1331092382392782848) | `/test pull-knative-sandbox-eventing-kafka-unit-tests`

[Full PR test history](https://gubernator.knative.dev/pr/knative-sandbox_eventing-kafka/226). [Your PR dashboard](https://gubernator.knative.dev/pr/matzew).

<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 [kubernetes/test-infra](https://github.com/kubernetes/test-infra/issues/new?title=Prow%20issue:) repository. I understand the commands that are listed [here](https://go.k8s.io/bot-commands).
</details>
<!-- test report -->
codecov[bot]: # [Codecov](https://codecov.io/gh/knative-sandbox/eventing-kafka/pull/226?src=pr&el=h1) Report
> Merging [#226](https://codecov.io/gh/knative-sandbox/eventing-kafka/pull/226?src=pr&el=desc) (fdbb47e) into [master](https://codecov.io/gh/knative-sandbox/eventing-kafka/commit/e71a1b1373574d96e9f951d7eb76eae8192ff466?el=desc) (e71a1b1) will **not change** coverage.
> The diff coverage is `n/a`.

[![Impacted file tree graph](https://codecov.io/gh/knative-sandbox/eventing-kafka/pull/226/graphs/tree.svg?width=650&height=150&src=pr&token=W765CT93QC)](https://codecov.io/gh/knative-sandbox/eventing-kafka/pull/226?src=pr&el=tree)

```diff
@@           Coverage Diff           @@
##           master     #226   +/-   ##
=======================================
  Coverage   75.99%   75.99%           
=======================================
  Files         112      112           
  Lines        4274     4274           
=======================================
  Hits         3248     3248           
  Misses        831      831           
  Partials      195      195           
```


| [Impacted Files](https://codecov.io/gh/knative-sandbox/eventing-kafka/pull/226?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [...channel/distributed/common/config/configwatcher.go](https://codecov.io/gh/knative-sandbox/eventing-kafka/pull/226/diff?src=pr&el=tree#diff-cGtnL2NoYW5uZWwvZGlzdHJpYnV0ZWQvY29tbW9uL2NvbmZpZy9jb25maWd3YXRjaGVyLmdv) | `40.00% <ø> (ø)` | |
| [.../channel/distributed/common/kafka/sarama/sarama.go](https://codecov.io/gh/knative-sandbox/eventing-kafka/pull/226/diff?src=pr&el=tree#diff-cGtnL2NoYW5uZWwvZGlzdHJpYnV0ZWQvY29tbW9uL2thZmthL3NhcmFtYS9zYXJhbWEuZ28=) | `87.64% <ø> (ø)` | |

------

[Continue to review full report at Codecov](https://codecov.io/gh/knative-sandbox/eventing-kafka/pull/226?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/knative-sandbox/eventing-kafka/pull/226?src=pr&el=footer). Last update [e71a1b1...fdbb47e](https://codecov.io/gh/knative-sandbox/eventing-kafka/pull/226?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

matzew: /retest

Patch:
diff --git a/cmd/webhook/main.go b/cmd/webhook/main.go
index ef98e2976..6af200566 100644
--- a/cmd/webhook/main.go
+++ b/cmd/webhook/main.go
@@ -17,7 +17,6 @@ package main
 
 import (
 	channelwebhook "knative.dev/eventing-kafka/pkg/channel/webhook"
-	"knative.dev/eventing/pkg/logconfig"
 	"knative.dev/pkg/injection/sharedmain"
 	"knative.dev/pkg/signals"
 	"knative.dev/pkg/webhook"
@@ -33,7 +32,7 @@ func main() {
 
 	// Define Webhook Options
 	options := webhook.Options{
-		ServiceName: logconfig.WebhookName(),
+		ServiceName: webhook.NameFromEnv(),
 		Port:        webhook.PortFromEnv(8443),
 		SecretName:  Secret,
 	}
diff --git a/config/channel/distributed/300-eventing-kafka-configmap.yaml b/config/channel/distributed/300-eventing-kafka-configmap.yaml
index 6c106e3a7..f46fd7d7b 100644
--- a/config/channel/distributed/300-eventing-kafka-configmap.yaml
+++ b/config/channel/distributed/300-eventing-kafka-configmap.yaml
@@ -59,5 +59,5 @@ data:
       adminType: kafka # One of "kafka", "azure", "custom"
 kind: ConfigMap
 metadata:
-  name: config-eventing-kafka
+  name: config-kafka
   namespace: knative-eventing
diff --git a/pkg/channel/distributed/common/config/configwatcher.go b/pkg/channel/distributed/common/config/configwatcher.go
index aa2de8fb7..3cedada30 100644
--- a/pkg/channel/distributed/common/config/configwatcher.go
+++ b/pkg/channel/distributed/common/config/configwatcher.go
@@ -30,7 +30,7 @@ import (
 )
 
 // The EventingKafkaConfig and these EK sub-structs contain our custom configuration settings,
-// stored in the config-eventing-kafka configmap.  The sub-structs are explicitly declared so that they
+// stored in the config-kafka configmap.  The sub-structs are explicitly declared so that they
 // can have their own JSON tags in the overall EventingKafkaConfig
 type EKKubernetesConfig struct {
 	CpuLimit      resource.Quantity `json:"cpuLimit,omitempty"`
diff --git a/pkg/channel/distributed/common/config/constants.go b/pkg/channel/distributed/common/config/constants.go
index af53d434f..af2d7ad0c 100644
--- a/pkg/channel/distributed/common/config/constants.go
+++ b/pkg/channel/distributed/common/config/constants.go
@@ -19,7 +19,7 @@ package config
 // Package Constants
 const (
 	// The name of the configmap used to hold eventing-kafka settings
-	SettingsConfigMapName = "config-eventing-kafka"
+	SettingsConfigMapName = "config-kafka"
 	// The name of the keys in the Data section of the eventing-kafka configmap that holds Sarama and Eventing-Kafka configuration YAML
 	SaramaSettingsConfigKey        = "sarama"
 	EventingKafkaSettingsConfigKey = "eventing-kafka"
diff --git a/pkg/channel/distributed/common/kafka/sarama/sarama.go b/pkg/channel/distributed/common/kafka/sarama/sarama.go
index b66f148cb..6ebc55561 100644
--- a/pkg/channel/distributed/common/kafka/sarama/sarama.go
+++ b/pkg/channel/distributed/common/kafka/sarama/sarama.go
@@ -131,7 +131,7 @@ The following shows an example of the expected usage...
 apiVersion: v1
 kind: ConfigMap
 metadata:
-  name: config-eventing-kafka
+  name: config-kafka
   namespace: knative-eventing
 data:
   sarama: |
diff --git a/vendor/knative.dev/eventing/pkg/logconfig/config.go b/vendor/knative.dev/eventing/pkg/logconfig/config.go
deleted file mode 100644
index 4678db8af..000000000
--- a/vendor/knative.dev/eventing/pkg/logconfig/config.go
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
-Copyright 2018 The Knative Authors
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
-    http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-*/
-
-package logconfig
-
-import (
-	"fmt"
-	"os"
-)
-
-const (
-	// Named Loggers are used to override the default log level. config-logging.yaml will use the follow:
-	//
-	// loglevel.controller: "info"
-	// loglevel.webhook: "info"
-
-	// Controller is the name of the override key used inside of the logging config for Controller.
-	Controller = "controller"
-
-	// Webhook is the name of the override key used inside of the logging config for Webhook Controller.
-	WebhookNameEnv = "WEBHOOK_NAME"
-)
-
-func WebhookName() string {
-	if webhook := os.Getenv(WebhookNameEnv); webhook != "" {
-		return webhook
-	}
-
-	panic(fmt.Sprintf(`The environment variable %q is not set
-
-If this is a process running on Kubernetes, then it should be using the downward
-API to initialize this variable via:
-
-  env:
-  - name: WEBHOOK_NAME
-    value: webhook
-`, WebhookNameEnv))
-}
diff --git a/vendor/modules.txt b/vendor/modules.txt
index 3b281c8e1..97578334d 100644
--- a/vendor/modules.txt
+++ b/vendor/modules.txt
@@ -1167,7 +1167,6 @@ knative.dev/eventing/pkg/client/listers/sources/v1alpha2
 knative.dev/eventing/pkg/client/listers/sources/v1beta1
 knative.dev/eventing/pkg/client/listers/sources/v1beta2
 knative.dev/eventing/pkg/kncloudevents
-knative.dev/eventing/pkg/logconfig
 knative.dev/eventing/pkg/reconciler/source
 knative.dev/eventing/pkg/reconciler/sugar
 knative.dev/eventing/pkg/reconciler/testing


Test patch:
diff --git a/pkg/channel/distributed/common/testing/constants.go b/pkg/channel/distributed/common/testing/constants.go
index 2bfccd75e..4da092a7b 100644
--- a/pkg/channel/distributed/common/testing/constants.go
+++ b/pkg/channel/distributed/common/testing/constants.go
@@ -25,7 +25,7 @@ const (
 	NewPassword = "TestNewPassword"
 
 	KnativeEventingNamespace       = "knative-eventing"
-	SettingsConfigMapName          = "config-eventing-kafka"
+	SettingsConfigMapName          = "config-kafka"
 	SaramaSettingsConfigKey        = "sarama"
 	EventingKafkaSettingsConfigKey = "eventing-kafka"
 
diff --git a/test/e2e-tests.sh b/test/e2e-tests.sh
index 99e1052f1..aefa076f1 100755
--- a/test/e2e-tests.sh
+++ b/test/e2e-tests.sh
@@ -299,7 +299,7 @@ function install_distributed_channel_crds() {
   # Update The Kafka Secret With Strimzi Kafka Cluster Brokers (No Authentication)
   sed -i "s/brokers: \"\"/brokers: ${STRIMZI_KAFKA_CLUSTER_BROKERS_ENCODED}/" "${KAFKA_CRD_CONFIG_DIR}/${EVENTING_KAFKA_SECRET_TEMPLATE}"
 
-  # Update the config-eventing-kafka configmap to disable SASL/TLS for the tests
+  # Update the config-kafka configmap to disable SASL/TLS for the tests
   sed -i '/^ *TLS:/{n;s/true/false/};/^ *SASL:/{n;s/true/false/}' "${KAFKA_CRD_CONFIG_DIR}/${EVENTING_KAFKA_CONFIG_TEMPLATE}"
 
   # Install The eventing-kafka KafkaChannel Implementation