Skip to content

Commit

Permalink
policy: Make the kafka policy in the docs consistent with the yaml re…
Browse files Browse the repository at this point in the history
…presentation

The yaml and json representation of kafka policy was inconsistent. This change
fixes this inconsistency.

Fixes: #3118
Signed-Off-By: Manali Bhutiyani <manali@covalent.io>
  • Loading branch information
Manali Bhutiyani committed Mar 20, 2018
1 parent d4125be commit 105be17
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 12 deletions.
10 changes: 5 additions & 5 deletions Documentation/policy/language.rst
Original file line number Diff line number Diff line change
Expand Up @@ -528,17 +528,17 @@ if all fields are empty or missing, the rule will match all Kafka messages.
The following fields can be matched on:

Role
Role is a case-insensitive string and describes a group of API keys
Role is a case-insensitive string which describes a group of API keys
necessary to perform certain higher level Kafka operations such as "produce"
or "consume". A Role automatically expands into all APIKeys required
to perform the specified higher level operation.

The following values are supported:
- "produce": Allow producing to the topics specified in the rule
- "consume": Allow consuming from the topics specified in the rule
This field is incompatible with the APIKey field, either APIKey or Role
may be specified. If omitted or empty, all keys are allowed, if APIKey is also
the empty
This field is incompatible with the APIKey field, i.e i.e APIKey and Role
cannot both be specified in the same rule..
If omitted or empty, all keys are allowed.

APIKey
APIKey is a case-insensitive string matched against the key of a request,
Expand Down Expand Up @@ -579,7 +579,7 @@ Topic
If omitted or empty, all topics are allowed.

Only allow producing to topic empire-announce using Role
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. only:: html

Expand Down
6 changes: 2 additions & 4 deletions examples/policies/l7/kafka/kafka.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,8 @@
"kafka": [
{"apiKey": "apiversions"},
{"apiKey": "metadata"},
{"apiKey": "produce"},
{"topic": "deathstar-plans"},
{"apiKey": "produce"},
{"topic": "empire-announce"}
{"apiKey": "produce", "topic": "deathstar-plans"},
{"apiKey": "produce", "topic": "empire-announce"}
]
}
}]
Expand Down
6 changes: 3 additions & 3 deletions pkg/policy/api/rule.go
Original file line number Diff line number Diff line change
Expand Up @@ -445,10 +445,10 @@ type PortRuleKafka struct {
// - "produce": Allow producing to the topics specified in the rule
// - "consume": Allow consuming from the topics specified in the rule
//
// This field is incompatible with the APIKey field, either APIKey or Role
// may be specified.
// This field is incompatible with the APIKey field, i.e APIKey and Role
// cannot both be specified in the same rule.
//
// If omitted or empty, all keys are allowed, if APIKey is also empty.
// If omitted or empty, all keys are allowed.

// +optional
Role string `json:"role,omitempty"`
Expand Down

0 comments on commit 105be17

Please sign in to comment.