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 Size to Replicas #270

Closed
jpkrohling opened this issue Mar 6, 2019 · 3 comments
Closed

Rename Size to Replicas #270

jpkrohling opened this issue Mar 6, 2019 · 3 comments
Assignees

Comments

@jpkrohling
Copy link
Contributor

From #207 (comment)

@jpkrohling jpkrohling self-assigned this Mar 6, 2019
@jpkrohling
Copy link
Contributor Author

Should we keep Size for backwards compatibility?

cc @objectiser, @pavolloffay

@pavolloffay pavolloffay mentioned this issue Mar 6, 2019
@objectiser
Copy link
Contributor

objectiser commented Mar 6, 2019

I guess as the apiGroup has changed, then we could make this a breaking change (clearly marked in changelog)? Although in general if it doesn't complicate code too much, it would be easier to deprecate.

@jpkrohling
Copy link
Contributor Author

jpkrohling commented Mar 6, 2019

It requires both options to co-exist. Right now, the migration path from the old apiGroup to the new one is changing from io.jaegertracing to jaegertracing.io in the CR files.

Edit: expanding a bit on the above, here's what it would look like to have both.

The types, such as JaegerCollectorSpec would look like this:

// JaegerCollectorSpec defines the options to be used when deploying the collector
type JaegerCollectorSpec struct {
	// Size represents the number of replicas to create for this service. DEPRECATED, use `Replicas` instead.
	Size int `json:"size"`

	// Replicas represents the number of replicas to create for this service.
	Replicas *int `json:"replicas"`

	Image   string  `json:"image"`
	Options Options `json:"options"`
	JaegerCommonSpec
}

Then, functions like NewCollector would look like this:

// NewCollector builds a new Collector struct based on the given spec
func NewCollector(jaeger *v1.Jaeger) *Collector {
	if jaeger.Spec.Collector.Replicas == nil {
		replicaSize := 1
		if jaeger.Spec.Collector.Size > 0 {
			replicaSize = jaeger.Spec.Collector.Size
		}

		jaeger.Spec.Collector.Replicas = &replicaSize
	}

	if jaeger.Spec.Collector.Image == "" {
		jaeger.Spec.Collector.Image = fmt.Sprintf("%s:%s", viper.GetString("jaeger-collector-image"), viper.GetString("jaeger-version"))
	}

	return &Collector{jaeger: jaeger}
}

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

No branches or pull requests

2 participants