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 code to remove legacy validation_marker file that created by etcd-custom-image on the filesystem #38

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

shreyas-s-rao
Copy link
Contributor

How to categorize this PR?

/area compliance security
/kind task

What this PR does / why we need it:

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

Special notes for your reviewer:

Release note:

NONE

@shreyas-s-rao shreyas-s-rao added this to the v0.4.0 milestone Dec 26, 2024
@shreyas-s-rao shreyas-s-rao self-assigned this Dec 26, 2024
@shreyas-s-rao shreyas-s-rao requested a review from a team as a code owner December 26, 2024 09:08
@gardener-robot gardener-robot added the needs/review Needs review label Dec 26, 2024
@shreyas-s-rao
Copy link
Contributor Author

/invite @ishan16696

@gardener-robot gardener-robot added area/compliance Compliance related area/security Security related kind/task General task labels Dec 26, 2024
@gardener-robot-ci-2 gardener-robot-ci-2 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 26, 2024
@gardener-robot gardener-robot added the size/xs Size of pull request is tiny (see gardener-robot robot/bots/size.py) label Dec 26, 2024
@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 26, 2024
@ishan16696
Copy link
Member

ishan16696 commented Dec 26, 2024

Hey Shreyas,
As I can see the code, there is already code present to clean-up the exit code after etcd successfully starts.

// Delete validation marker after etcd starts successfully
if err = bootstrap.CleanupExitCode(types.DefaultExitCodeFilePath); err != nil {
a.logger.Warn("failed to clean-up last captured exit code", zap.Error(err))
}

May be what you have seen could be some edge cases in which etcd-wrapper failed to remove old validation_marker.
Can you make changes in same file like this:

	// Delete legacy validation marker after etcd starts successfully
        // TODO: To be removed in next release
	if err = bootstrap.CleanupExitCode(types.LegacyValidationMarkerFilePath); err != nil {
		a.logger.Warn("failed to clean-up legacy exit code file", zap.Error(err))
	}

@shreyas-s-rao
Copy link
Contributor Author

@ishan16696 that code cleans up the new exit_code file, but not validation_marker. Seems to be a mistake in the comment on line 96 that says Delete validation marker after etcd starts successfully instead of saying Delete exit code file after etcd starts successfully.

So deletion of validation_marker file is necessary, via this PR. I'll fix the old comment as well.

@gardener-robot-ci-1 gardener-robot-ci-1 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 27, 2024
@gardener-robot-ci-3 gardener-robot-ci-3 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 27, 2024
@ishan16696
Copy link
Member

ishan16696 commented Dec 27, 2024

that code cleans up the new exit_code file, but not validation_marker

validation_marker is just a file name, you can call it either exit_code file or validation_marker file but both of them captures the exit code of etcd. It just file path has changed.
So, my point was there is already a code in place which removes the file which captures the exit code, and may be due to some edge case for which etcd-wrapper failed to remove old exit code file (i.e validation_marker file).

I'm saying can we reuse the same func and just pass the old path of exit code file (i.e validation_marker file).

	// Delete legacy validation marker after etcd starts successfully
        // TODO: To be removed in next release
	if err = bootstrap.CleanupExitCode(....); err != nil {
		a.logger.Warn("failed to clean-up legacy exit code file", zap.Error(err))
	}

@shreyas-s-rao
Copy link
Contributor Author

@ishan16696 not really. etcd-wrapper is designed to delete the exit_code file after the etcd process starts, so that an abrupt kill of the etcd-wrapper container does not lead to a wrong validation mode upon restart. Ok, I now understand that you want to re-use the CleanupExitCode() function for doing this, correct? My bad for not reading the previous comment correctly, sorry 😅.

I've pushed the change as requested. PTAL.

@gardener-robot-ci-1 gardener-robot-ci-1 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 27, 2024
@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 27, 2024
Copy link
Member

@ishan16696 ishan16696 left a comment

Choose a reason for hiding this comment

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

Thanks @shreyas-s-rao for PR.
LGTM!!

@shreyas-s-rao shreyas-s-rao 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 27, 2024
@gardener-robot-ci-1 gardener-robot-ci-1 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 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/compliance Compliance related area/security Security related kind/task General task needs/ok-to-test Needs approval for testing (check PR in detail before setting this label because PR is run on CI/CD) needs/review Needs review size/xs Size of pull request is tiny (see gardener-robot robot/bots/size.py)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove legacy validation_marker file
6 participants