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

Rename master to aggregator #847

Merged
merged 1 commit into from
Aug 23, 2019
Merged

Rename master to aggregator #847

merged 1 commit into from
Aug 23, 2019

Conversation

johnSchnake
Copy link
Contributor

What this PR does / why we need it:
Slightly more intuitive and useful name. Kept the old name
as an alias which we can decide to remove later if we want.

Did not update a few of the config values or script names
that are named with 'master' in order to avoid potentially
breaking changes.

Which issue(s) this PR fixes
Fixes #238

Special notes for your reviewer:
Adding comments inline but also adding a few things here for clarity:

  • Did not rename run_master.sh
  • Did not update run_master.sh to use the new aggregator
  • Renamed the master command to aggregator but kept master as an alias so there should be no problem with old clients/scripts calling newer Sonobuoy images.

Release note:

NONE

@johnSchnake johnSchnake requested a review from zubron August 19, 2019 17:20
type aggregatorInput struct {
noExit bool
kubecfg Kubeconfig
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just a single type/variable instead of 2 globals. I then create a single instance of this variable below in NewCmdAggregator which returns a closure around that instance.

Use: "aggregator",
Short: "Runs the aggregator component (for internal use)",
Long: "Sonobuoy is an introspective kubernetes component that generates reports on cluster conformance, configuration, and more",
Run: func(cmd *cobra.Command, args []string) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Didn't want to change this to RunE but will do that with a bunch of commands at the same time eventually. We should be writing our code in a way that allows us to bubble up errors to the main Execute method so we can centralize error handling rather than having logging/os.Exit all over the place.

@@ -65,10 +66,6 @@ var singleNodeCmd = &cobra.Command{
Args: cobra.ExactArgs(0),
}

func runGatherHelp(cmd *cobra.Command, args []string) {
cmd.Help()
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

No need to add this, if you don't set a Run or RunE it will show usage messages already.

main.go Outdated Show resolved Hide resolved
@@ -107,7 +107,7 @@ func (p *Plugin) createDaemonSetDefinition(hostname string, cert *tls.Certificat
Labels: labels,
Annotations: annotations,
OwnerReferences: []metav1.OwnerReference{
metav1.OwnerReference{
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just a gofmt change; I have my editor set to use gofmt -s which simplifies more than the default/minimum.

@@ -116,7 +116,7 @@ type AggregationConfig struct {

// WorkerConfig is the file given to the sonobuoy worker to configure it to phone home.
type WorkerConfig struct {
// MasterURL is the URL we talk to for submitting results
// MasterURL is the URL we talk to the aggregator pod on for submitting results
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Did not change this since it is part of an exported struct/config.

@@ -17,7 +17,7 @@

## How it works now

Sonobuoy uses a worker-master model, where a master delegates tasks to worker
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This one line from some old docs had gotten updated; I don't really care about the older ones. If its no different to anyone else I'll just leave it rather than trying to fix up other sections in this (or other older docs)

Copy link
Contributor

@zubron zubron Aug 23, 2019

Choose a reason for hiding this comment

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

Are these files even linked to from the site? I can't find any references to them. :-/

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The enhancements aren't linked but they do actually exist if you manually write the URL.

They were really for internal discussion/documentation back then; I made the decision that I didn't really want/need them to be displayed in our online docs site though.

@codecov-io
Copy link

codecov-io commented Aug 19, 2019

Codecov Report

Merging #847 into master will decrease coverage by 0.19%.
The diff coverage is 31.42%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master     #847     +/-   ##
=========================================
- Coverage   46.67%   46.48%   -0.2%     
=========================================
  Files          75       75             
  Lines        4831     4830      -1     
=========================================
- Hits         2255     2245     -10     
- Misses       2448     2454      +6     
- Partials      128      131      +3
Impacted Files Coverage Δ
pkg/plugin/aggregation/aggregator.go 79.2% <ø> (-4%) ⬇️
pkg/worker/worker.go 100% <ø> (ø) ⬆️
pkg/plugin/driver/daemonset/daemonset.go 66.03% <0%> (-0.22%) ⬇️
pkg/plugin/driver/job/job.go 73.98% <0%> (-0.21%) ⬇️
pkg/client/retrieve.go 4.95% <0%> (ø) ⬆️
pkg/config/config.go 60.65% <100%> (ø) ⬆️
cmd/sonobuoy/app/root.go 92.85% <100%> (ø) ⬆️
cmd/sonobuoy/app/worker.go 9.67% <25%> (-0.97%) ⬇️
pkg/worker/request.go 62.5% <25%> (ø) ⬆️
cmd/sonobuoy/app/master.go 40% <36.84%> (-10%) ⬇️
... and 1 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 58b331c...4530558. Read the comment docs.

logrus.Info("no-exit was specified, sonobuoy is now blocking")
select {}
}

os.Exit(errcount)
return fmt.Errorf("%v errors encountered during execution", errcount)
Copy link
Contributor

Choose a reason for hiding this comment

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

By using fmt.Errorf here, we're always returning a non-nil error. We should be returning nil in the case where errcount is 0.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

👍 Fixed.

@@ -17,7 +17,7 @@

## How it works now

Sonobuoy uses a worker-master model, where a master delegates tasks to worker
Copy link
Contributor

@zubron zubron Aug 23, 2019

Choose a reason for hiding this comment

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

Are these files even linked to from the site? I can't find any references to them. :-/

Slightly more intuitive and useful name. Kept the old name
as an alias which we can decide to remove later if we want.

Did not update a few of the config values or script names
that are named with 'master' in order to avoid potentially
breaking changes.

Fixes #238

Signed-off-by: John Schnake <[email protected]>
@johnSchnake johnSchnake merged commit 973e782 into vmware-tanzu:master Aug 23, 2019
@johnSchnake johnSchnake deleted the aggregatorRename branch August 23, 2019 14:11
zubron added a commit that referenced this pull request Jul 2, 2020
We renamed the `master` command to `aggregator` in #847 (released in
v0.15.3) but left the previous command there as an alias. Given that we
have had 3 minor releases since this and have phased out all use, we
can remove this alias.

Also rename the file to match the new command name.

Signed-off-by: Bridget McErlean <[email protected]>
zubron added a commit to zubron/sonobuoy that referenced this pull request Jul 7, 2020
We renamed the `master` command to `aggregator` in vmware-tanzu#847 (released in
v0.15.3). However, `master` was still being used in some of our
Kubernetes resource labels and names. We want to remove uses of
insensitive language and as such use different labels for
identifying resources.

Now, any aggregator resources will have the label
`sonobuoy-component: aggregator` and plugin resources will have
`sonobuoy-component: plugin`. The existing label is still in place as it
was used to identify the aggregator pod (which is required most sonobuoy
commands once a run has started). Removing it now would prevent users
with older clients from using newer images, or querying the state of
runs started by newer clients. Instead, both labels will be applied
howeve the `sonobuoy-component: aggregator` label is the preferred
label. If the aggregator pod cannot be found using the new label, the
client will retry using the now deprecated label. When retrying, the
client will display a warning that it is attempting to find the pod
using the deprecated label.

Newer clients will be able to query the state of runs with old labels
applied, and older clients will be able to query the state of runs
created by the newer clients.

The name of the service created by Sonobuoy has been renamed to
`sonobuoy-aggregator`. This has no user facing impact.

Signed-off-by: Bridget McErlean <[email protected]>
zubron added a commit to zubron/sonobuoy that referenced this pull request Jul 7, 2020
We renamed the `master` command to `aggregator` in vmware-tanzu#847 (released in
v0.15.3). However, `master` was still being used in some of our
Kubernetes resource labels and names. We want to remove uses of
insensitive language and as such use different labels for
identifying resources.

Now, any aggregator resources will have the label
`sonobuoy-component: aggregator` and plugin resources will have
`sonobuoy-component: plugin`. The existing label is still in place as it
was used to identify the aggregator pod (which is required most sonobuoy
commands once a run has started). Removing it now would prevent users
with older clients from using newer images, or querying the state of
runs started by newer clients. Instead, both labels will be applied
howeve the `sonobuoy-component: aggregator` label is the preferred
label. If the aggregator pod cannot be found using the new label, the
client will retry using the now deprecated label. When retrying, the
client will display a warning that it is attempting to find the pod
using the deprecated label.

Newer clients will be able to query the state of runs with old labels
applied, and older clients will be able to query the state of runs
created by the newer clients.

The name of the service created by Sonobuoy has been renamed to
`sonobuoy-aggregator`. This has no user facing impact.

Signed-off-by: Bridget McErlean <[email protected]>
zubron added a commit that referenced this pull request Jul 7, 2020
We renamed the `master` command to `aggregator` in #847 (released in
v0.15.3). However, `master` was still being used in some of our
Kubernetes resource labels and names. We want to remove usage of
insensitive language and as such use different labels for
identifying resources.

Now, any aggregator resources will have the label
`sonobuoy-component: aggregator` and plugin resources will have
`sonobuoy-component: plugin`. The existing label is still in place as it
was used to identify the aggregator pod (which is required most sonobuoy
commands once a run has started). Removing it now would prevent users
with older clients from using newer images, or querying the state of
runs started by newer clients. Instead, both labels will be applied
howeve the `sonobuoy-component: aggregator` label is the preferred
label. If the aggregator pod cannot be found using the new label, the
client will retry using the now deprecated label. When retrying, the
client will display a warning that it is attempting to find the pod
using the deprecated label.

Newer clients will be able to query the state of runs with old labels
applied, and older clients will be able to query the state of runs
created by the newer clients.

The name of the service created by Sonobuoy has been renamed to
`sonobuoy-aggregator`. This has no user facing impact.

Signed-off-by: Bridget McErlean <[email protected]>
zubron added a commit to zubron/sonobuoy that referenced this pull request Jul 8, 2020
We renamed the `master` command to `aggregator` in vmware-tanzu#847 (released in
v0.15.3). However, we left some of the existing uses in place to prevent
backwards incompatibility. This change renames the `MasterURL` field in
`WorkerConfig` to `AggregatorURL` in keeping with our terminology
elsewhere. Worker containers are configured using environment variables.
This change renames the environment variable but also adds some
compatibility for the original environment variable to still be
processed.

It is possible for different image versions to be used for the
aggregator and the worker (although it would have to be explicitly set
in the generated manifest). This changes allows older versions of
Sonobuoy to be used as the aggregator image but does not allow older
versions to be used as the worker image. Although some compatibility is
broken, this seems acceptable as we don't recommend mixing versions of
images within a single sonobuoy run.

Signed-off-by: Bridget McErlean <[email protected]>
zubron added a commit to zubron/sonobuoy that referenced this pull request Jul 8, 2020
We renamed the `master` command to `aggregator` in vmware-tanzu#847 (released in
v0.15.3). However, we left some of the existing uses in place to prevent
backwards incompatibility. This change renames the `MasterURL` field in
`WorkerConfig` to `AggregatorURL` in keeping with our terminology
elsewhere. Worker containers are configured using environment variables.
This change renames the environment variable but also adds some
compatibility for the original environment variable to still be
processed.

It is possible for different image versions to be used for the
aggregator and the worker (although it would have to be explicitly set
in the generated manifest). This changes allows older versions of
Sonobuoy to be used as the aggregator image but does not allow older
versions to be used as the worker image. Although some compatibility is
broken, this seems acceptable as we don't recommend mixing versions of
images within a single sonobuoy run.

Signed-off-by: Bridget McErlean <[email protected]>
zubron added a commit to zubron/sonobuoy that referenced this pull request Jul 8, 2020
We renamed the `master` command to `aggregator` in vmware-tanzu#847 (released in
v0.15.3). However, we left some of the existing uses in place to prevent
backwards incompatibility. This change renames the `MasterURL` field in
`WorkerConfig` to `AggregatorURL` in keeping with our terminology
elsewhere. Worker containers are configured using environment variables.
This change renames the environment variable but also adds some
compatibility for the original environment variable to still be
processed.

It is possible for different image versions to be used for the
aggregator and the worker (although it would have to be explicitly set
in the generated manifest). This changes allows older versions of
Sonobuoy to be used as the aggregator image but does not allow older
versions to be used as the worker image. Although some compatibility is
broken, this seems acceptable as we don't recommend mixing versions of
images within a single sonobuoy run.

Signed-off-by: Bridget McErlean <[email protected]>
zubron added a commit to zubron/sonobuoy that referenced this pull request Jul 8, 2020
We renamed the `master` command to `aggregator` in vmware-tanzu#847 (released in
v0.15.3). However, we left some of the existing uses in place to prevent
backwards incompatibility. This change renames the `MasterURL` field in
`WorkerConfig` to `AggregatorURL` in keeping with our terminology
elsewhere. Worker containers are configured using environment variables.
This change renames the environment variable but also adds some
compatibility for the original environment variable to still be
processed.

It is possible for different image versions to be used for the
aggregator and the worker (although it would have to be explicitly set
in the generated manifest). This changes allows older versions of
Sonobuoy to be used as the aggregator image but does not allow older
versions to be used as the worker image. Although some compatibility is
broken, this seems acceptable as we don't recommend mixing versions of
images within a single sonobuoy run.

Signed-off-by: Bridget McErlean <[email protected]>
zubron added a commit that referenced this pull request Jul 8, 2020
We renamed the `master` command to `aggregator` in #847 (released in
v0.15.3). However, we left some of the existing uses in place to prevent
backwards incompatibility. This change renames the `MasterURL` field in
`WorkerConfig` to `AggregatorURL` in keeping with our terminology
elsewhere. Worker containers are configured using environment variables.
This change renames the environment variable but also adds some
compatibility for the original environment variable to still be
processed.

It is possible for different image versions to be used for the
aggregator and the worker (although it would have to be explicitly set
in the generated manifest). This changes allows older versions of
Sonobuoy to be used as the aggregator image but does not allow older
versions to be used as the worker image. Although some compatibility is
broken, this seems acceptable as we don't recommend mixing versions of
images within a single sonobuoy run.

Signed-off-by: Bridget McErlean <[email protected]>
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.

rename master to aggregator
3 participants