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

feat(bootstrapping): Adds --bootstrap-only flag to accounts, which re… #729

Merged
merged 1 commit into from
Oct 30, 2017

Conversation

ttomsu
Copy link
Member

@ttomsu ttomsu commented Oct 16, 2017

…moves the flagged account from the deployed Spinnaker instance.

cc: @edwinavalos This isn't exactly what your group was looking for, but it's a jumping off point to pare down the unnecessary docker registries.

names = "--bootstrap-only",
description = AccountCommandProperties.BOOTSTRAP_ONLY
)
Boolean bootstrapOnly = false;
Copy link
Member

Choose a reason for hiding this comment

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

Don't set a default here, otherwise any edit that doesn't include this flag will turn off the --bootstrap-only mode.

.stream()
.filter(a -> ((Account) a).getBootstrapOnly())
.collect(Collectors.toList());
if (bootstrapAccounts.size() >= 2) {
Copy link
Member

Choose a reason for hiding this comment

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

You're only validating that there is at most 1 bootstrap-only account per provider. You want to do this check in the Providers class and validate across all accounts

.findFirst();
// Silly Java won't let me do this in the above chained call way.
if (account.isPresent()) {
provider.getAccounts().remove(account.get());
Copy link
Member

Choose a reason for hiding this comment

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

You can with .map on the optional

child = (Provider) children.getNext();
if (isBootstrappingProvider) {
List bootstrapAccounts = (List) provider.getAccounts()
.stream()
Copy link
Member

Choose a reason for hiding this comment

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

The rest of the project aligns these call chains two indent levels rather than against the first method call.

@@ -19,4 +19,5 @@

public class AccountCommandProperties {
public static final String REQUIRED_GROUP_MEMBERSHIP_DESCRIPTION = "A user must be a member of at least one specified group in order to make changes to this account's cloud resources.";
public static final String BOOTSTRAP_ONLY = "A bootstrap-only account is the account in which Spinnaker itself is deployed. When true, this account will not be included the accounts managed by Spinnaker. Similarly, the bootstrap instance of Spinnaker will only contain this account. Only one account can be marked as bootstrap-only.";
Copy link
Member

Choose a reason for hiding this comment

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

It feels tedious that a user has to manually flag this account after they've (in a separate place in the config) already marked the account as being used for "bootstrapping". It might make more sense to have this command be a flag in teh DeploymentEnvironment, so they can say something like hal deploy edit --account-name 'my-boostrapping-account' --bootstrap-only

Copy link
Member

Choose a reason for hiding this comment

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

Also it gets confusing if they've configured their k8s account with a docker registry that would have to be flagged too - which halyard should automatically address.

@ttomsu
Copy link
Member Author

ttomsu commented Oct 17, 2017

I moved the --bootstrap-only flag to the hal config deploy command as suggested. I also took a stab at intelligently removing and disabling docker registries/accounts when --bootstrap-only is specified. Namely, if one is deploying Spinnaker in a kubernetes environment (with a supporting docker registry), but is only managing other non-container based environments, the deployed Spinnaker will have both Kuberentes + Docker providers disabled.

Furthermore, this logic tries to identify and remove docker registries that do not have any associated container-based accounts. So if you add docker registry A, don't associate it with any thing, and enable --bootstrap-only, it will not appear in your Spinnaker deployment (basically just wasting cycles).

@ttomsu
Copy link
Member Author

ttomsu commented Oct 18, 2017

cc @willgorman

@willgorman
Copy link
Contributor

The DC/OS changes look fine to me.

Copy link
Member

@lwander lwander left a comment

Choose a reason for hiding this comment

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

Nice

@@ -0,0 +1,32 @@
/*
* Copyright 2017 Netflix, Inc.
Copy link
Member

Choose a reason for hiding this comment

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

Career move?

Copy link
Member Author

Choose a reason for hiding this comment

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

More like "CYA"

@@ -1,5 +1,5 @@
/*
* Copyright 2016 Google, Inc.
* Copyright 2017 Netflix, Inc.
Copy link
Member

Choose a reason for hiding this comment

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

This too

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

moves the flagged account from the deployed Spinnaker instance
@ttomsu ttomsu merged commit 45ef66d into spinnaker:master Oct 30, 2017
@ttomsu ttomsu deleted the bootstrap-only branch October 30, 2017 18:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants