Skip to content

support for custom Kubernetes cluster name shortening with regex#327

Open
joemiller wants to merge 1 commit intojustjanne:mainfrom
joemiller:shorten-kube-names-regex-2
Open

support for custom Kubernetes cluster name shortening with regex#327
joemiller wants to merge 1 commit intojustjanne:mainfrom
joemiller:shorten-kube-names-regex-2

Conversation

@joemiller
Copy link
Copy Markdown
Contributor

@joemiller joemiller commented Sep 9, 2021

Adds two new flags:

  • -shorten-kube-names-regex-match
  • -shorten-kube-names-regex-template (defaults to ${1})

Examples:

Assume a kubernetes cluster named myorg-region-profile-cluster-01

Using the default template:

powerline-go -shorten-kube-names-regex-match '^myorg-\w+-\w+-(.*)'

result: cluster-01

Using a custom template:

powerline-go -shorten-kube-names-regex-match '^myorg-(\w+)-\w+-(.*)' -shorten-kube-names-regex-template '${1}/${2}'

result: region/cluster-01

joemiller added a commit to joemiller/dotfiles that referenced this pull request Sep 10, 2021
@joemiller
Copy link
Copy Markdown
Contributor Author

bump. anything i can do to help this PR along? tnx

@joemiller joemiller force-pushed the shorten-kube-names-regex-2 branch from a510bef to 3570f87 Compare May 6, 2022 21:32
@joemiller
Copy link
Copy Markdown
Contributor Author

fixed up merge conflicts

Adds two new flags:

* - `-shorten-kube-names-regex-match`
* - `-shorten-kube-names-regex-template` (defaults to `${1}`)

Examples:

Assume a kubernetes cluster named `myorg-region-profile-cluster-01`

Using the default template:
```console
powerline-go -shorten-kube-names-regex-match '^myorg-\w+-\w+-(.*)'
```
result: `cluster-01`

Using a custom template:
```console
powerline-go -shorten-kube-names-regex-match '^myorg-(\w+)-\w+-(.*)' -shorten-kube-names-regex-template '${1}/${2}'
```
result: `region/cluster-01`
@joemiller joemiller force-pushed the shorten-kube-names-regex-2 branch from 3570f87 to 6fe0dba Compare September 17, 2023 16:01
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.

1 participant