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

Create tasks app to make tags consistent #388

Merged
merged 45 commits into from
Dec 18, 2024
Merged

Conversation

markdboyd
Copy link
Contributor

@markdboyd markdboyd commented Dec 18, 2024

Changes proposed in this pull request:

Related to cloud-gov/opensearch-boshrelease#144

Currently, old instances (RDS, Elasticache, or Elasticsearch) created by the broker before consistent tagging was introduced may not have that tagging applied to them.

This PR creates a new app, managed in cmd/tasks, which will be used to run various one-off tasks against the broker and its instances.

In particular, this PR introduces a task to update the tags for all instances to be consistent with what the broker now generates.

Things to check

  • For any logging statements, is there any chance that they could be logging sensitive data?
  • Are log statements using a logging library with a logging level set? Setting a logging level means that log statements "below" that level will not be written to the output. For example, if the logging level is set to INFO and debugging statements are written with log.debug or similar, then they won't be written to the otput, which can prevent unintentional leaks of sensitive data.

Security considerations

None. Tagging is already a feature of the broker, this script is just retroactively applying that tagging consistently to old instances. No new permissions or behaviors were added.

@markdboyd markdboyd requested a review from a team as a code owner December 18, 2024 16:05

func main() {
actionPtr := flag.String("action", "", "Action to take. Accepted options: 'update-tags'")
flag.Var(&servicesToTag, "service", "Specify AWS service whose instances should have tags updated. Accepted options: 'rds'")

Choose a reason for hiding this comment

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

It looks like this also handles ES & Redis now — I think the description needs an update


// Load settings from environment
if err := settings.LoadFromEnv(); err != nil {
log.Fatalf("There was an error loading settings: %s", err)

Choose a reason for hiding this comment

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

Not necessary but one trick I thought I'd share: Write a run() function that can return an error and call run() from main(), so you can centralize top-level error handling. Example: https://github.com/cloud-gov/csb/blob/4328653379aa40e09e298c2e9015926e37a4e69b/docproxy/main.go#L208-L227

@markdboyd markdboyd added this pull request to the merge queue Dec 18, 2024
Merged via the queue into main with commit c3f2f35 Dec 18, 2024
1 check passed
@markdboyd markdboyd deleted the make-tags-consistent branch December 18, 2024 16:51
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.

2 participants