Skip to content
This repository was archived by the owner on Oct 10, 2020. It is now read-only.

[merged] Add cluster subcommand#354

Closed
mbarnes wants to merge 1 commit intoprojectatomic:masterfrom
mbarnes:cluster-command
Closed

[merged] Add cluster subcommand#354
mbarnes wants to merge 1 commit intoprojectatomic:masterfrom
mbarnes:cluster-command

Conversation

@mbarnes
Copy link
Contributor

@mbarnes mbarnes commented Apr 22, 2016

This adds a cluster subcommand to integrate with Commissaire, as discussed in #329.

One thing to note about atomic cluster is it does not require root privilege; it's just talking over HTTP. I tried to solve that cleanly in followup commits by delaying the root user check until after the command line is parsed and then adding a way for subcommands to opt out of requiring the root user. This has the added benefit of letting non-root users at least get --help output for any atomic command.

@mbarnes
Copy link
Contributor Author

mbarnes commented Apr 22, 2016

CC @ashcrow: Extra pair of eyeballs wouldn't hurt, if you're interested.

@ashcrow
Copy link
Contributor

ashcrow commented Apr 23, 2016

@mbarnes looks good to me, though the last two commits might be squashable as they are editing the same lines.

bash/atomic Outdated

}

_atomic_cluster_no_opts() {
Copy link
Member

Choose a reason for hiding this comment

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

Can you create this in Atomic/cluster.py?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@rhatdan I can, but are you sure? Nothing else under Atomic/ appears to be serving bash completion. Just wanted to double check first.

Copy link
Member

Choose a reason for hiding this comment

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

Never mind, I though this was part of the atomic command not the bash completions.

@rhatdan
Copy link
Member

rhatdan commented Apr 23, 2016

How about this patch for running atomic as non root.

#355

@mbarnes
Copy link
Contributor Author

mbarnes commented Apr 25, 2016

How about this patch for running atomic as non root.
#355

Looks like it already got merged, but I'm happy with it too. I'll rebase this branch.


# SUBCOMMANDS
**get cluster** CLUSTER_NAME
Report status of the specified cluster.
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't this be just get not get cluster

atomic cluster get CLUSTER_NAME

Copy link
Contributor Author

@mbarnes mbarnes Apr 25, 2016

Choose a reason for hiding this comment

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

Hmm... I agree that particular case reads better. But there's some other types of things you can "get" (or "create" or "delete") besides cluster objects and I'm worried it would make parsing tricky -- or even ambiguous if we add more types of things to "get" in the future.

An easier solution to the redundancy is to rename the atomic cluster part, though the best I can think of is atomic multihost.

@ashcrow: Any thoughts here?

Copy link
Contributor

@ashcrow ashcrow Apr 26, 2016

Choose a reason for hiding this comment

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

There are other options to commctl'scluster command (get, create, delete). However, seeing cluster get cluster $NAME does seem odd.

A few ideas:

  • Maybe it would make better sense to use a different direct command than cluster. Maybe manage?
  • Maybe we can flatten out the commands we add so that they are at a higher level like:
atomic cluster get $NAME
atomic host delete $NAME
atomic status # maybe this one is a special case where we say atomic manager status
...

Copy link
Member

Choose a reason for hiding this comment

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

Perhaps we should setup a bluejeans to discuss this. I really do not understand what Commissaire does, so tough for me to give opinion.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe we can flatten out the commands we add so that they are at a higher level like:

atomic cluster get $NAME
atomic host delete $NAME
atomic status # maybe this one is a special case where we say atomic manager status

That's going to trample on the atomic namespace too much I think. atomic host, for example, is already a thing (wraps rpm-ostree). I'm on board with your first suggestion though, but picking a good name is hard.

One thing that maybe wasn't stated explicitly enough in #329 was that we already have a standalone command-line tool for this named commctl and it shares the same command syntax (and code) with what we're proposing for atomic cluster.

IOW, atomic cluster get cluster == commctl get cluster.

But it's not clear to me (or even @ashcrow I think) whether commctl is meant to be kept if/when this stuff lands in atomic.

@cgwalters-bot
Copy link

☔ The latest upstream changes (presumably #359) made this pull request unmergeable. Please resolve the merge conflicts.

@mbarnes
Copy link
Contributor Author

mbarnes commented Apr 26, 2016

@rhatdan, @ashcrow: I know we agreed on a syntax when we chatted, but the atomic host thing still isn't sitting right with me and I think I know why now.

Currently atomic host commands all act on the _local_ host through rpm-ostree, whereas these new commands all act on _remote_ hosts through Commissaire.

I think conflating local vs remote actions into the same atomic host prefix will be confusing to users.

@ashcrow and I were tossing around more ideas and we hit upon making it more explicit that a subset of atomic commands apply to remote hosts.

What do you think about these?

atomic remote cluster get|create|delete|list
atomic remote cluster reboot|upgrade start|status
atomic remote host get|create|delete|list

(@ashcrow, I took some liberties here vs what's in commctl)

@cgwalters
Copy link
Member

Seems sane to me. On a semi-related topic, Cockpit ships remotectl which I always thought was clever, but AFAIK it was never used for anything more than the cockpit cert.

@rhatdan
Copy link
Member

rhatdan commented Apr 26, 2016

Is the cluster remote Or just the host?
Aren't I just joining the cluster.

Not crazy about 4 commands.
atomic remote host delete foobar?

@mbarnes
Copy link
Contributor Author

mbarnes commented Apr 26, 2016

Is the cluster remote Or just the host?
Aren't I just joining the cluster.

You can add hosts to a cluster manually, but I believe the intent is for a cluster node to add itself on boot via cloud-init (which just uses Python libraries) and reserve the commctl/atomic whatever command for admins on a machine outside the cluster. (@ashcrow, right?)

Not crazy about 4 commands.

atomic remote host delete foobar?

Yeah, it's a little wordy. Would hyphenating help?

atomic remote-host delete foobar

@rhatdan
Copy link
Member

rhatdan commented Apr 27, 2016

How about
atomic rhost delete foobar
atomic cluster get foobar

@ashcrow
Copy link
Contributor

ashcrow commented Apr 27, 2016

rhost sounds good to me.

@mbarnes correct, the commands commctl provides do not require execution from inside the cluster.

@mbarnes
Copy link
Contributor Author

mbarnes commented Apr 27, 2016

I'm good with that too. It will require a bit of rework on the commctl side, so I'll do that first.

@rhatdan
Copy link
Member

rhatdan commented May 10, 2016

Any update?

@mbarnes
Copy link
Contributor Author

mbarnes commented May 10, 2016

Not quite yet. Got side tracked, but I'm back on this now.

@mbarnes
Copy link
Contributor Author

mbarnes commented May 13, 2016

@rhatdan Before I start on docs / bash completion updates here, can you take a look at projectatomic/commctl#12? That shows the new syntax for commctl.

atomic would be identical except rhost instead of host.

@rhatdan
Copy link
Member

rhatdan commented May 16, 2016

That looks good to me, except for the commctl passhash, Are you going to make a atomic equivalent?

@mbarnes
Copy link
Contributor Author

mbarnes commented May 16, 2016

That looks good to me, except for the commctl passhash, Are you going to make a atomic equivalent?

That one seems like a poor fit for atomic to me. It's just a helper script. I'm inclined to omit it for now and just leave it in commctl. If commctl ends up going away then maybe reevaluate.

Sound alright?

@rhatdan
Copy link
Member

rhatdan commented May 16, 2016

Fine with me. Your the boss.

@ashcrow
Copy link
Contributor

ashcrow commented May 16, 2016

I'm fine with keeping passhash in commctl only.

@mbarnes
Copy link
Contributor Author

mbarnes commented May 18, 2016

⬆️ Complete rewrite works with latest commctl

(which the Jenkins environment appears to be missing)

@mbarnes
Copy link
Contributor Author

mbarnes commented May 31, 2016

Rebased and updated bash completion + manpages for a new Commissaire operation coming soon. (projectatomic/commissaire#135)

I don't know how to correct for the Jenkins failure. The commctl package this feature needs is either outdated or missing in the test environment.

@rhatdan
Copy link
Member

rhatdan commented Jun 1, 2016

@jlebon How do we get the latest version of commictl into the test environment?

@jlebon
Copy link
Contributor

jlebon commented Jun 1, 2016

Shouldn't the import and cli parsers be conditional on commissaire being present? E.g. like we did for the recent system containers feature and ostree.

@mbarnes
Copy link
Contributor Author

mbarnes commented Jun 1, 2016

Shouldn't the import and cli parsers be conditional on commissaire being present? E.g. like we did for the recent system containers feature and ostree.

I had it conditional at first and some discussion ensued. See outdated patch review comments above from Apr 23 (can't seem to link to them directly...)

@jlebon
Copy link
Contributor

jlebon commented Jun 1, 2016

Yup, commented there as well, but you're right, the link to it doesn't actually bring you to the discussion. Reposting here to make it easier:

I don't follow this, why should we require it? Atomic on its own is useful without commissaire (e.g. I like using atomic on my workstation, but I'm not planning to join a cluster anytime soon).

@rhatdan
Copy link
Member

rhatdan commented Jun 1, 2016

I am fine with going back to making it optional, just not crazy about man pages being available but functionality not. But we set the president of ostree, so I guess we can follow it here.

@cgwalters
Copy link
Member

Talking about this in terms of Jenkins is mostly a red herring - there's two types of dependencies:

  • Build time
  • Runtime

(And each type can be either hard or soft/optional)

The current internal Jenkins PR tester conflates these, but the rpmdistro-gitoverlay builder does not, it uses RPM semantics. (On the other hand it doesn't yet run per-project make check)

One major pain point specific to this project is the way we extract the version number from the python code is that it turns all hard runtime dependencies into build-time too.

Philosophy aside it does seem like having the dep be soft/optional at runtime makes sense.

@mbarnes
Copy link
Contributor Author

mbarnes commented Jun 1, 2016

⬆️ Jenkins is happy again.

We could revisit the optional aspect once commctl is available where we need it.

# SYNOPSIS
**atomic cluster [OPTIONS] SUBCOMMAND**

**atomic cluster** will issue commands to a Commissaire server over HTTP.
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe a small line here to say that it will only be available if Commissaire is installed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure where manpages get packaged for AH these days but my thought was if we could temporarily delete these two pages in a spec file or whatever, that seems cleaner to me than a disclaimer. Failing that, yeah I can add a line.

Copy link
Member

Choose a reason for hiding this comment

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

They are packaged up in the RHELtools container

@rhatdan
Copy link
Member

rhatdan commented Jun 10, 2016

What is the latest on this pull request?

@ashcrow
Copy link
Contributor

ashcrow commented Jun 10, 2016

I'm 👍 on @jlebon's suggestions. @mbarnes do you mind you rebasing?

@mbarnes
Copy link
Contributor Author

mbarnes commented Jun 10, 2016

⬆️ I added the man page disclaimers @jlebon suggested, rebased on current master and squashed my previous fixup! comments. Should be good to go.

@jlebon
Copy link
Contributor

jlebon commented Jun 10, 2016

👍
@rh-atomic-bot r+ 2581030

@rh-atomic-bot
Copy link

⌛ Testing commit 2581030 with merge f556415...

@rh-atomic-bot
Copy link

☀️ Test successful - status-atomicjenkins
Approved by: jlebon
Pushing f556415 to master...

@rh-atomic-bot rh-atomic-bot changed the title Add cluster subcommand [merged] Add cluster subcommand Jun 10, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants