Skip to content

Commit 6c2d91b

Browse files
authored
fix: Kafka/SASL Verbiage cleanup and examples (argoproj#1220)
* Fix: Clean up descriptions, add example and rename configration names for Kafka/SASL argoproj#1217 Signed-off-by: Christopher Buckley <[email protected]>
1 parent 76d16eb commit 6c2d91b

File tree

11 files changed

+134
-126
lines changed

11 files changed

+134
-126
lines changed

USERS.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
Organizations below are **officially** using Argo Events. Please send a PR with your organization name if you are using Argo Events.
44

55
1. [3Rein](https://www.3rein.com)
6+
1. [7shifts](https://www.7shifts.com)
67
1. [BioBox Analytics](https://biobox.io)
78
1. [BlackRock](https://www.blackrock.com/)
89
1. [Canva](https://www.canva.com/)
@@ -13,8 +14,8 @@ Organizations below are **officially** using Argo Events. Please send a PR with
1314
1. [Intuit](https://www.intuit.com/)
1415
1. [OneCause](https://www.onecause.com/)
1516
1. [Produvar](https://www.produvar.com/)
17+
1. [ProPoint Solutions](https://supersalon.com)
1618
1. [Rakuten](https://www.rakuten.com)
1719
1. [RTL Nederland](https://www.rtl.nl)
1820
1. [Viaduct](https://www.viaduct.ai/)
1921
1. [Woolworths Group](https://www.woolworthsgroup.com.au/)
20-
1. [7shifts](https://www.7shifts.com)

api/openapi-spec/swagger.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

eventsources/sources/kafka/start.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -275,14 +275,14 @@ func getSaramaConfig(kafkaEventSource *v1alpha1.KafkaEventSource, log *zap.Sugar
275275

276276
config.Net.SASL.Mechanism = sarama.SASLMechanism(kafkaEventSource.SASL.GetMechanism())
277277

278-
user, err := common.GetSecretFromVolume(kafkaEventSource.SASL.User)
278+
user, err := common.GetSecretFromVolume(kafkaEventSource.SASL.UserSecret)
279279
if err != nil {
280280
log.Errorf("Error getting user value from secret: %v", err)
281281
return nil, err
282282
}
283283
config.Net.SASL.User = user
284284

285-
password, err := common.GetSecretFromVolume(kafkaEventSource.SASL.Password)
285+
password, err := common.GetSecretFromVolume(kafkaEventSource.SASL.PasswordSecret)
286286
if err != nil {
287287
log.Errorf("Error getting password value from secret: %v", err)
288288
return nil, err

examples/event-sources/kafka.yaml

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,7 @@ spec:
3333
# limitEventsPerSecond: 1
3434
# version: "2.5.0"
3535

36-
# example-tls:
37-
# url: "kafka.argo-events:9092"
38-
# topic: "topic-2"
39-
# jsonBody: true
40-
# partition: "1"
36+
## Enable TLS authentication ( not to be used with SASL)
4137
# tls:
4238
# caCertSecret:
4339
# name: my-secret
@@ -48,3 +44,13 @@ spec:
4844
# clientKeySecret:
4945
# name: my-secret
5046
# key: client-key-key
47+
48+
## Enable SASL authentication (not to be used with TLS)
49+
# sasl:
50+
# mechanism: PLAIN
51+
# passwordSecret:
52+
# key: password
53+
# name: my-user
54+
# userSecret:
55+
# key: user
56+
# name: my-user

pkg/apis/common/common.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,9 @@ type SASLConfig struct {
136136
Mechanism string `json:"mechanism,omitempty" protobuf:"bytes,1,opt,name=mechanism"`
137137
// User is the authentication identity (authcid) to present for
138138
// SASL/PLAIN or SASL/SCRAM authentication
139-
User *corev1.SecretKeySelector `json:"user,omitempty" protobuf:"bytes,2,opt,name=user"`
139+
UserSecret *corev1.SecretKeySelector `json:"userSecret,omitempty" protobuf:"bytes,2,opt,name=user"`
140140
// Password for SASL/PLAIN authentication
141-
Password *corev1.SecretKeySelector `json:"password,omitempty" protobuf:"bytes,3,opt,name=password"`
141+
PasswordSecret *corev1.SecretKeySelector `json:"passwordSecret,omitempty" protobuf:"bytes,3,opt,name=password"`
142142
}
143143

144144
// Backoff for an operation

pkg/apis/common/deepcopy_generated.go

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/apis/common/generated.pb.go

Lines changed: 100 additions & 99 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/apis/common/openapi_generated.go

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/apis/common/validate.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ func ValidateSASLConfig(saslConfig *SASLConfig) error {
4343
}
4444

4545
// user and password must both be set
46-
if saslConfig.User == nil || saslConfig.Password == nil {
47-
return errors.New("invalid sasl config, please configure either User, and/or Password")
46+
if saslConfig.UserSecret == nil || saslConfig.PasswordSecret == nil {
47+
return errors.New("invalid sasl config, both userSecret and passwordSecret must be defined")
4848
}
4949

5050
return nil

pkg/apis/common/validate_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,13 @@ func fakeSASLConfig(t *testing.T) *SASLConfig {
3737
return &SASLConfig{
3838
Mechanism: "PLAIN",
3939

40-
User: &corev1.SecretKeySelector{
40+
UserSecret: &corev1.SecretKeySelector{
4141
Key: "fake-key1",
4242
LocalObjectReference: corev1.LocalObjectReference{
4343
Name: "user",
4444
},
4545
},
46-
Password: &corev1.SecretKeySelector{
46+
PasswordSecret: &corev1.SecretKeySelector{
4747
Key: "fake-key2",
4848
LocalObjectReference: corev1.LocalObjectReference{
4949
Name: "password",
@@ -96,7 +96,7 @@ func TestValidateSASLConfig(t *testing.T) {
9696
s := &SASLConfig{}
9797
err := ValidateSASLConfig(s)
9898
assert.NotNil(t, err)
99-
assert.True(t, strings.Contains(err.Error(), "invalid sasl config, please configure either User, and/or Password"))
99+
assert.True(t, strings.Contains(err.Error(), "invalid sasl config, both userSecret and passwordSecret must be defined"))
100100
})
101101

102102
t.Run("test invalid Mechanism is set", func(t *testing.T) {
@@ -109,14 +109,14 @@ func TestValidateSASLConfig(t *testing.T) {
109109

110110
t.Run("test only User is set", func(t *testing.T) {
111111
s := fakeSASLConfig(t)
112-
s.Password = nil
112+
s.PasswordSecret = nil
113113
err := ValidateSASLConfig(s)
114114
assert.NotNil(t, err)
115115
})
116116

117117
t.Run("test only Password is set", func(t *testing.T) {
118118
s := fakeSASLConfig(t)
119-
s.User = nil
119+
s.UserSecret = nil
120120
err := ValidateSASLConfig(s)
121121
assert.NotNil(t, err)
122122
})

0 commit comments

Comments
 (0)