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 probe for Kubernetes ingress #78

Merged
merged 2 commits into from
May 5, 2020

Conversation

aleksandra-galara
Copy link
Member

It implements #28

Signed-off-by: Aleksandra Galara a.galara@samsung.com

It implements openrca#28

Signed-off-by: Aleksandra Galara <a.galara@samsung.com>
@bzurkowski bzurkowski self-requested a review April 29, 2020 10:56
@bzurkowski bzurkowski added this to the 0.2 milestone Apr 29, 2020
@bzurkowski bzurkowski linked an issue Apr 29, 2020 that may be closed by this pull request
Copy link
Member

@bzurkowski bzurkowski left a comment

Choose a reason for hiding this comment

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

A few cosmetic remarks. Good job!

def _extract_rules(self, entity):
rules = []
for rule in entity.spec.rules:
properties = {}
Copy link
Member

Choose a reason for hiding this comment

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

Let's add rule host property as well.

rules.append(properties)
return rules

def _extract_values(self, rule):
Copy link
Member

Choose a reason for hiding this comment

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

I suggest renaming the method to _extract_paths.

def _extract_values(self, rule):
values = []
for path in rule.http.paths:
properties = {}
Copy link
Member

Choose a reason for hiding this comment

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

Let's add path property as well.

@@ -218,6 +218,23 @@ def are_linked(self, obj, namespace):
return namespace.properties.name == obj.properties.namespace


class IngressToServiceMatcher(Matcher):

"""Generic matcher for links between Ingress and Service entities."""
Copy link
Member

Choose a reason for hiding this comment

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

It's not a "generic" linker (e.g. for links between a namespace and ANY resource). It's a linker for links between concrete entity types: ingress and service. Remove the generic keyword from the docstring.

matched_service = self._match_service(ingress, service)
return matched_namespace and matched_service

def _match_service(self, ingress, service):
Copy link
Member

Choose a reason for hiding this comment

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

Since we're matching rules here, I suggest renaming the method to _match_rules.

Signed-off-by: Aleksandra Galara <a.galara@samsung.com>
Copy link
Member

@bzurkowski bzurkowski 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 to me 😄 Ready for merge!

@bzurkowski bzurkowski merged commit 77c496c into openrca:master May 5, 2020
@bzurkowski bzurkowski removed this from the 0.2 milestone Sep 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add probe for Kubernetes ingress
2 participants