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

Replicas missing in deepcopy #107

Closed
AdheipSingh opened this issue Jan 2, 2020 · 3 comments
Closed

Replicas missing in deepcopy #107

AdheipSingh opened this issue Jan 2, 2020 · 3 comments

Comments

@AdheipSingh
Copy link
Contributor

Replicas have not been added in deepcopy. In current master annotations, labels are available options in the the deployment spec.

func (in *GrafanaDeployment) DeepCopyInto(out *GrafanaDeployment) {
	*out = *in
	if in.Annotations != nil {
		in, out := &in.Annotations, &out.Annotations
		*out = make(map[string]string, len(*in))
		for key, val := range *in {
			(*out)[key] = val
		}
	}
	if in.Labels != nil {
		in, out := &in.Labels, &out.Labels
		*out = make(map[string]string, len(*in))
		for key, val := range *in {
			(*out)[key] = val
		}
	}
	return
}

I can add the replica deep copy in this PR #106

@pb82
Copy link
Collaborator

pb82 commented Jan 3, 2020

@AdheipSingh I ran the automatic code generation against master (operator-sdk generate k8s) and it doesn't look like anything is missing. Since the deployment spec is added as a pointer in the grafana type spec, I don't think we need a layer of deepcopy for it.

Are you seeing any issues with this on master?

@AdheipSingh
Copy link
Contributor Author

@pb82 yes i see that, the only thing which concerned me is that replicas were not included in the deepcopy objects whereas annotations and labels were rightly present.

I ran the same command but strange it does'nt genereate deepcopy for replicas.

Don't you think replicas should also be added in this, as the deployment spec also includes the replica paramenter. Maybe i am missing on some thing.

func (in *GrafanaDeployment) DeepCopyInto(out *GrafanaDeployment) {
	*out = *in
	if in.Replicas != nil {
		in, out := &in.Replicas, &out.Replicas
		*out = new(int32)
		**out = **in
	}
	if in.Annotations != nil {
		in, out := &in.Annotations, &out.Annotations
		*out = make(map[string]string, len(*in))
		for key, val := range *in {
			(*out)[key] = val
		}
	}
	if in.Labels != nil {
		in, out := &in.Labels, &out.Labels
		*out = make(map[string]string, len(*in))
		for key, val := range *in {
			(*out)[key] = val
		}
	}
	return
}

@pb82
Copy link
Collaborator

pb82 commented Jan 6, 2020

@AdheipSingh No, i don't think we should manually add anything to the auto generated code. Closing this issue as i don't think there's a problem with the auto generated code.

@pb82 pb82 closed this as completed Jan 6, 2020
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