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 label matching according to RFC 1123 #43

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

kiarashazarnia
Copy link

This feature could be helpful to check the RFC 1123 Label standard.

One of the major use-cases is checking strings to be valid for Kubernetes Namespace.

Thanks for your attention. I hope it will be helpful for you folks.

Copy link

@swaeberle swaeberle left a comment

Choose a reason for hiding this comment

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

There is a little typo.

for example 'my-name', or '123-abc'
"""

RFC_1123_LABLE_REGEX = r"[a-zA-Z0-9]([-a-zA-Z0-9]*[a-zA-Z0-9])?$"

Choose a reason for hiding this comment

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

There is a little typo in your variable naming:

Suggested change
RFC_1123_LABLE_REGEX = r"[a-zA-Z0-9]([-a-zA-Z0-9]*[a-zA-Z0-9])?$"
RFC_1123_LABEL_REGEX = r"[a-zA-Z0-9]([-a-zA-Z0-9]*[a-zA-Z0-9])?$"


@property
def _regex(self):
return re.compile(self.RFC_1123_LABLE_REGEX)

Choose a reason for hiding this comment

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

Tpyo:

Suggested change
return re.compile(self.RFC_1123_LABLE_REGEX)
return re.compile(self.RFC_1123_LABEL_REGEX)

@swaeberle
Copy link

I think this would be also helpful when validating a single hostname (without any domain) for RFC1123 conformance.

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.

None yet

2 participants