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

enh: add cmd to patch bastion ipblock/cidr filter #180

Merged
merged 9 commits into from
Dec 19, 2022

Conversation

sven-petersen
Copy link
Contributor

What this PR does / why we need it:

Introduce a new command that allows the update, currently only the CIDR/IPBlock, of an existing bastion host previously created through the ssh command.

Which issue(s) this PR fixes:
Fixes #123

Special notes for your reviewer:

  • Name of the command needs to be decided on
  • The new command currently is part of the ssh package as they are closely related. Maybe makes sense to put it in its own package?
  • Probably the way suggestions for --bastion-name are created, by trying to determine the users name and list bastions created by that user only, needs to be tested further

Release note:

Introduce new command, `ssh-patch`, to update existing bastion resources

@sven-petersen sven-petersen requested a review from a team as a code owner November 7, 2022 15:27
@gardener-robot gardener-robot added the needs/review Needs review label Nov 7, 2022
Copy link
Member

@petersutter petersutter left a comment

Choose a reason for hiding this comment

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

part 1

pkg/cmd/ssh/ssh_patch_test.go Outdated Show resolved Hide resolved
pkg/cmd/ssh/ssh_patch_options.go Outdated Show resolved Hide resolved
pkg/cmd/ssh/ssh_patch_options.go Outdated Show resolved Hide resolved
internal/gardenclient/client.go Outdated Show resolved Hide resolved
pkg/cmd/ssh/ssh_patch.go Outdated Show resolved Hide resolved
pkg/cmd/ssh/ssh_patch.go Outdated Show resolved Hide resolved
pkg/cmd/ssh/ssh_patch_options.go Outdated Show resolved Hide resolved
pkg/cmd/ssh/ssh_patch_options.go Outdated Show resolved Hide resolved
pkg/cmd/ssh/ssh_patch_options.go Outdated Show resolved Hide resolved
pkg/cmd/ssh/ssh_patch_options.go Outdated Show resolved Hide resolved
Copy link
Member

@petersutter petersutter left a comment

Choose a reason for hiding this comment

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

part 2

pkg/cmd/ssh/ssh_patch.go Outdated Show resolved Hide resolved
pkg/cmd/ssh/ssh_patch_options.go Outdated Show resolved Hide resolved
pkg/cmd/ssh/ssh_patch_options.go Outdated Show resolved Hide resolved
pkg/cmd/ssh/ssh_patch_options.go Outdated Show resolved Hide resolved
pkg/cmd/ssh/ssh_patch_options.go Outdated Show resolved Hide resolved
pkg/cmd/ssh/ssh_patch_options.go Outdated Show resolved Hide resolved
pkg/cmd/ssh/ssh_patch_options.go Outdated Show resolved Hide resolved
pkg/cmd/ssh/ssh_patch_options.go Outdated Show resolved Hide resolved
pkg/cmd/ssh/ssh_patch_options.go Outdated Show resolved Hide resolved
pkg/cmd/ssh/ssh_patch_test.go Outdated Show resolved Hide resolved
@sven-petersen sven-petersen force-pushed the enh/update-bastion-ipblock branch from 8a4d9ec to 2443ea2 Compare November 10, 2022 08:53
@gardener-robot gardener-robot added size/xl Size of pull request is huge (see gardener-robot robot/bots/size.py) needs/second-opinion Needs second review by someone else labels Nov 10, 2022
@sven-petersen sven-petersen force-pushed the enh/update-bastion-ipblock branch from 2443ea2 to 8ac9726 Compare November 10, 2022 09:03
@petersutter petersutter self-requested a review November 11, 2022 10:04
@sven-petersen sven-petersen force-pushed the enh/update-bastion-ipblock branch from 4311ebd to e272423 Compare November 17, 2022 14:59
@sven-petersen sven-petersen requested review from holgerkoser and removed request for petersutter November 17, 2022 16:07
@sven-petersen sven-petersen changed the title feat: add cmd to patch bastion ipblock/cidr filter enh: add cmd to patch bastion ipblock/cidr filter Nov 22, 2022
@petersutter
Copy link
Member

/hold need to find a solution for the missing "tokenreviews" permission on regular gardener landscapes

@gardener-robot gardener-robot added the reviewed/do-not-merge Has no approval for merging as it may break things, be of poor quality or have (ext.) dependencies label Nov 23, 2022
pkg/cmd/ssh/ssh_patch_options.go Outdated Show resolved Hide resolved
pkg/cmd/ssh/ssh_patch_options.go Outdated Show resolved Hide resolved
pkg/cmd/ssh/ssh_patch_options.go Outdated Show resolved Hide resolved
pkg/cmd/ssh/ssh_patch_options.go Outdated Show resolved Hide resolved
pkg/cmd/ssh/ssh_patch_options.go Outdated Show resolved Hide resolved
pkg/cmd/ssh/ssh_patch_options.go Outdated Show resolved Hide resolved
pkg/cmd/ssh/ssh_patch_options.go Outdated Show resolved Hide resolved
pkg/cmd/ssh/ssh_patch_options.go Outdated Show resolved Hide resolved
pkg/cmd/ssh/ssh_patch.go Outdated Show resolved Hide resolved
pkg/cmd/ssh/ssh_patch_options.go Outdated Show resolved Hide resolved
pkg/cmd/ssh/ssh_patch_options.go Outdated Show resolved Hide resolved
pkg/cmd/ssh/ssh_patch_options.go Outdated Show resolved Hide resolved
pkg/cmd/ssh/ssh_patch_options.go Outdated Show resolved Hide resolved
}

func (o *sshPatchOptions) AddFlags(flags *pflag.FlagSet) {
flags.StringArrayVar(&o.CIDRs, "cidr", o.CIDRs, "CIDRs to allow access to the bastion host; if not given, your system's public IPs (v4 and v6) are auto-detected.")
Copy link
Member

Choose a reason for hiding this comment

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

also re-use the cidr completion

@sven-petersen sven-petersen force-pushed the enh/update-bastion-ipblock branch from e88e55d to 75a171d Compare November 29, 2022 15:04
Copy link
Member

@petersutter petersutter left a comment

Choose a reason for hiding this comment

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

/lgtm

@gardener-robot gardener-robot added reviewed/lgtm Has approval for merging and removed needs/review Needs review needs/second-opinion Needs second review by someone else labels Nov 29, 2022
@sven-petersen sven-petersen force-pushed the enh/update-bastion-ipblock branch from 75a171d to faa9990 Compare November 30, 2022 09:37
@gardener-robot gardener-robot added the needs/second-opinion Needs second review by someone else label Nov 30, 2022
@holgerkoser holgerkoser added the reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) label Dec 12, 2022
@gardener-robot-ci-2 gardener-robot-ci-2 removed the reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) label Dec 12, 2022
@holgerkoser
Copy link
Member

holgerkoser commented Dec 13, 2022

/hold need to find a solution for the missing "tokenreviews" permission on regular gardener landscapes

I have create a PR gardener/gardener#7201 that give this authorization to all authenticated users.

@sven-petersen sven-petersen force-pushed the enh/update-bastion-ipblock branch from 1e811d8 to 21a2f6a Compare December 14, 2022 09:18
@petersutter
Copy link
Member

/unhold gardener/gardener#7201 was merged and released

@gardener-robot gardener-robot removed the reviewed/do-not-merge Has no approval for merging as it may break things, be of poor quality or have (ext.) dependencies label Dec 16, 2022
@petersutter petersutter added reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) reviewed/do-not-merge Has no approval for merging as it may break things, be of poor quality or have (ext.) dependencies and removed needs/ok-to-test Needs approval for testing (check PR in detail before setting this label because PR is run on CI/CD) labels Dec 16, 2022
@gardener-robot-ci-1 gardener-robot-ci-1 added needs/ok-to-test Needs approval for testing (check PR in detail before setting this label because PR is run on CI/CD) and removed reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) labels Dec 16, 2022
@petersutter
Copy link
Member

@sven-petersen

> Check Markdown
Error: Diff does not match. Run "make gen-markdown" and commit the generated files
Cause:
diff -x .DS_Store /tmp/build/d56d9853/pull-request-gardener.gardenctl-v2-pr.master/docs/help/gardenctl_ssh-patch.md /tmp/tmp.xIIC3ssiQ2/gardenctl_ssh-patch.md

@petersutter petersutter added reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) and removed reviewed/do-not-merge Has no approval for merging as it may break things, be of poor quality or have (ext.) dependencies needs/ok-to-test Needs approval for testing (check PR in detail before setting this label because PR is run on CI/CD) labels Dec 19, 2022
@gardener-robot-ci-2 gardener-robot-ci-2 added needs/ok-to-test Needs approval for testing (check PR in detail before setting this label because PR is run on CI/CD) and removed reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) labels Dec 19, 2022
@petersutter petersutter merged commit 6d9b513 into gardener:master Dec 19, 2022
@gardener-robot gardener-robot added the status/closed Issue is closed (either delivered or triaged) label Dec 19, 2022
@sven-petersen sven-petersen deleted the enh/update-bastion-ipblock branch December 19, 2022 12:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs/ok-to-test Needs approval for testing (check PR in detail before setting this label because PR is run on CI/CD) needs/second-opinion Needs second review by someone else size/xl Size of pull request is huge (see gardener-robot robot/bots/size.py) status/closed Issue is closed (either delivered or triaged)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update own (public) IP of Bastion (SSH)
7 participants