Skip to content
This repository has been archived by the owner on Nov 15, 2022. It is now read-only.

merge DeploymentSpec with PodSpec on the top level #36

Merged
merged 1 commit into from
Jun 22, 2017
Merged

merge DeploymentSpec with PodSpec on the top level #36

merged 1 commit into from
Jun 22, 2017

Conversation

kadel
Copy link
Member

@kadel kadel commented Jun 19, 2017

fixes #35

There is more checks that needs to be done, I've added TODO for few that I could think of while writing this.

Copy link
Collaborator

@concaf concaf left a comment

Choose a reason for hiding this comment

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

LGTM except for a few nits

},
func createDeployment(app *spec.App) (*ext_v1beta1.Deployment, error) {

// We are merging whole DeploymentSpect with PodSpec.
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: typo DeploymentSpect

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed, thx ;-)

}

// TODO: check if this wasn't set by user, in that case we shouldn't ovewrite it
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we want to do this in this PR or later?

Copy link
Member Author

Choose a reason for hiding this comment

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

I wanted to handle this more systematically.
It is a bit ralted to your PR #37

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ack


// use top level name and labels for deployment
deployment.ObjectMeta.Name = app.Name
deployment.ObjectMeta.Labels = app.Labels
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we do this like we were doing before -

&ext_v1beta1.Deployment{
 -		ObjectMeta: api_v1.ObjectMeta{
 -			Name:   app.Name,
 -			Labels: app.Labels,
 -		},
 -		Spec: ext_v1beta1.DeploymentSpec{
 -			Replicas: app.Replicas,

it's a bit more readable and consistent with the rest of the code, WDYT?

Copy link
Member Author

Choose a reason for hiding this comment

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

I think this is far more readable. At least for me. Otherwise, it can get quite messy with deep indentation.
But more importantly, if you have it like this it allows you to add additional logic more easily.

Copy link
Collaborator

Choose a reason for hiding this comment

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

When we do the deep indentation, the code actually looks a bit the objects that will get generated, which is helpful while reading.
Also, everywhere we have done it with the indentation way.
And, the object to which we want to add additional logic, we create it separately and substitute it in the indentation.
Idk, I really like the indentation way :( a lot more readable.
@surajssd WDYT?

Copy link
Member Author

Choose a reason for hiding this comment

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

if you both agree, I will change it

Copy link
Member Author

Choose a reason for hiding this comment

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

what do you think @surajssd ?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I'll have to agree with @containscafeine that the previous way looks more straight-forward.

Copy link
Member Author

Choose a reason for hiding this comment

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

ok, I will change it back

@surajssd
Copy link
Member

This LGTM, merge when you feel @containscafeine 's concerns are addressed!


// use top level name and labels for deployment
deployment.ObjectMeta.Name = app.Name
deployment.ObjectMeta.Labels = app.Labels
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'll have to agree with @containscafeine that the previous way looks more straight-forward.

deployment, err := createDeployment(app)
if err != nil {
return nil, errors.Wrapf(err, "app %q", app.Name)
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

👍

@kadel
Copy link
Member Author

kadel commented Jun 22, 2017

updated.

I can't do everything like that as deplymentSpec needs to be modified and I can't do that if I create new one.

Copy link
Collaborator

@cdrage cdrage left a comment

Choose a reason for hiding this comment

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

LGTM

@concaf concaf merged commit 44acab9 into kedgeproject:master Jun 22, 2017
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.

Implement DeploymentSpec in our spec
4 participants