Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new Kafka Role to the docs #3186

Merged
merged 4 commits into from
Mar 20, 2018
Merged

Add new Kafka Role to the docs #3186

merged 4 commits into from
Mar 20, 2018

Conversation

manalibhutiyani
Copy link

Fixes: #3118
Signed-off-by: Manali Bhutiyani manali@covalent.io

Add new Kafka Role to the docs

@manalibhutiyani manalibhutiyani added wip release-note/bug This PR fixes an issue in a previous release of Cilium. labels Mar 16, 2018
@manalibhutiyani manalibhutiyani requested review from a team as code owners March 16, 2018 23:02
@manalibhutiyani
Copy link
Author

test-me-please

@manalibhutiyani manalibhutiyani force-pushed the kafka-docs branch 2 times, most recently from d942605 to 610d560 Compare March 17, 2018 06:26
@manalibhutiyani
Copy link
Author

test-me-please

@manalibhutiyani
Copy link
Author

test-me-please

Copy link
Member

@joestringer joestringer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, minor wording suggestions.

message. If set, it has to be a string representing a positive integer. If
omitted or empty, all versions are allowed.
Role
Role is a case-insensitive string and describes a group of API keys
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

case-insensitive string which describes...

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

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, i.e either APIKey or Role
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

either APIKey or Role can be specified -> APIKey and Role cannot both be specified in the same rule

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

//
// If omitted or empty, the field has no effect and the logic of the APIKey
// field applies.
// This field is incompatible with the APIKey field, i.e either APIKey or Role
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you take my suggestion above, this one needs updating too.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

- "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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... is also empty

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

@manalibhutiyani manalibhutiyani force-pushed the kafka-docs branch 2 times, most recently from 0f231d7 to d28ae7a Compare March 19, 2018 20:28
@manalibhutiyani
Copy link
Author

test-me-please

@manalibhutiyani manalibhutiyani force-pushed the kafka-docs branch 2 times, most recently from fd9eaa0 to cdeead4 Compare March 19, 2018 21:00
@manalibhutiyani
Copy link
Author

test-me-please

@manalibhutiyani
Copy link
Author

test-me-please

@manalibhutiyani
Copy link
Author

@ianvernon @joestringer : Addressed review comments. Need an approval if everything looks ok.

@manalibhutiyani
Copy link
Author

manalibhutiyani commented Mar 19, 2018

@eloycoto : Still seeing this test flake unrelated to my docs changes

21:46:33 
21:46:33 • Failure [200.479 seconds]
21:46:33 K8sValidatedPolicyTestAcrossNamespaces
21:46:33 /home/jenkins/workspace/Cilium-PR-Ginkgo-Tests-Validated/src/github.com/cilium/cilium/test/k8sT/Policies.go:675
21:46:33   Policies Across Namespaces [It]
21:46:33   /home/jenkins/workspace/Cilium-PR-Ginkgo-Tests-Validated/src/github.com/cilium/cilium/test/k8sT/Policies.go:712
21:46:33 
21:46:33   Unable to connect between frontend-d9q97 and 10.97.83.36:80/
21:46:33   Expected
21:46:33       <string>: 000command terminated with exit code 7
21:46:33       
21:46:33   to equal
21:46:33       <string>: 200
21:46:33 
21:46:33   /home/jenkins/workspace/Cilium-PR-Ginkgo-Tests-Validated/src/github.com/cilium/cilium/test/k8sT/Policies.go:855
21:46:33 ------------------------------
21:46:33 SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS```

@manalibhutiyani
Copy link
Author

test-me-please


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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This last sentence is not true. If omitted, APIKey can still be specified. This needs to be clear.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changing this to : If omitted or empty, and if APIKey is not specified then all keys are allowed.

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

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs a sentence here that describes the motivation of role and when to use roles and when to use apiKeys.

Copy link
Author

@manalibhutiyani manalibhutiyani Mar 19, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Planning to add this:

PortRuleKafka is a list of Kafka protocol constraints. All fields are optional,
if all fields are empty or missing, the rule will match all Kafka messages.
There are two ways to specify the Kafka rules. We can choose to specify a
high level "produce" or "consume" role to a topic or choose to specify more
low level kafka protocol specific apiKeys. Thus the rule allows us to specify both
high level role constructs as well as low level Kafka protocol constructs.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done, please let me know if you think this needs to be improved.

@@ -0,0 +1,23 @@
apiVersion: "cilium.io/v2"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rename the filename to all lowercase

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

//
// If omitted or empty, all keys are allowed.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs to be adjusted.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed to If omitted or empty, and if Role is not specified, then all keys are allowed.

@manalibhutiyani manalibhutiyani force-pushed the kafka-docs branch 2 times, most recently from 4820782 to 772cd7c Compare March 19, 2018 23:43
@manalibhutiyani
Copy link
Author

test-me-please

@manalibhutiyani
Copy link
Author

I am seeing a lot of unrelated CI errors. Not sure what's the best route here? Trying CI again.

@manalibhutiyani
Copy link
Author

test-me-please

@tgraf
Copy link
Member

tgraf commented Mar 20, 2018

I am seeing a lot of unrelated CI errors. Not sure what's the best route here? Trying CI again.

All PRs are seeing these right now. Nee to investigate tomorrow.

@@ -524,20 +524,38 @@ Kafka (Tech Preview)

PortRuleKafka is a list of Kafka protocol constraints. All fields are optional,
if all fields are empty or missing, the rule will match all Kafka messages.
There are two ways to specify the Kafka rules. We can choose to specify a
high level "produce" or "consume" role to a topic or choose to specify more
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high-level

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -524,20 +524,38 @@ Kafka (Tech Preview)

PortRuleKafka is a list of Kafka protocol constraints. All fields are optional,
if all fields are empty or missing, the rule will match all Kafka messages.
There are two ways to specify the Kafka rules. We can choose to specify a
high level "produce" or "consume" role to a topic or choose to specify more
low level kafka protocol specific apiKeys. Thus the rule allows us to specify
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

low-level

kafka --> Kafka

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

There are two ways to specify the Kafka rules. We can choose to specify a
high level "produce" or "consume" role to a topic or choose to specify more
low level kafka protocol specific apiKeys. Thus the rule allows us to specify
both high level role constructs as well as low level Kafka protocol constructs.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high-level ... low-level

Copy link
Member

@joestringer joestringer Mar 20, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These last two sentences appear to state the same thing. Perhaps replace the last sentence with something like:

"Writing rules based on Kafka roles is easier and covers most common use cases, however if more granularity is needed then users can alternatively write rules using specific apiKeys."

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done


The following fields can be matched on:

Role
Role is a case-insensitive string which describes a group of API keys
necessary to perform certain higher level Kafka operations such as "produce"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

higher-level

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

higher-level

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@manalibhutiyani
Copy link
Author

test-me-please

Manali Bhutiyani added 4 commits March 20, 2018 12:27
This change fixes the `Policy` docs to reflect the new `Kafka Role`

Fixes: #3118
Signed-off-by: Manali Bhutiyani <manali@covalent.io>
…ents

This change makes the `PortRuleKafka` fields consistent with the docs
and also improves/corrects the comments.

Fixes: #3118
Signed-off-by: Manali Bhutiyani <manali@covalent.io>
…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>
…role

Fixes: #3118
Signed-Off-By: Manali Bhutiyani <manali@covalent
@manalibhutiyani manalibhutiyani merged commit fbd2236 into master Mar 20, 2018
@manalibhutiyani manalibhutiyani deleted the kafka-docs branch March 20, 2018 19:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release-note/bug This PR fixes an issue in a previous release of Cilium.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants