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

controller: Add defaulter #483

Merged
merged 7 commits into from
Mar 21, 2018
Merged

controller: Add defaulter #483

merged 7 commits into from
Mar 21, 2018

Conversation

gaocegege
Copy link
Member

@gaocegege gaocegege commented Mar 20, 2018

Signed-off-by: Ce Gao [email protected]


This change is Reviewable

@@ -28,7 +28,8 @@ CODEGEN_PKG=${CODEGEN_PKG:-$(cd ${SCRIPT_ROOT}; ls -d -1 ./vendor/k8s.io/code-ge
# --output-base because this script should also be able to run inside the vendor dir of
# k8s.io/kubernetes. The output-base is needed for the generators to output into the vendor dir
# instead of the $GOPATH directly. For normal projects this can be dropped.
${CODEGEN_PKG}/generate-groups.sh "defaulter,deepcopy,client,informer,lister" \
# Notice: The code in code-generator does not generate defaulter by default.
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks for your advice I have asked the upstream how to deal with the defaulter-gen and if they do not reply I will add it to update-codegen

@gaocegege gaocegege changed the title WIP: Add defaulter controller: Add defaulter Mar 21, 2018
@gaocegege
Copy link
Member Author

gaocegege commented Mar 21, 2018

/assign @ScorpioCPH
/assign @jose5918

@coveralls
Copy link

coveralls commented Mar 21, 2018

Coverage Status

Coverage decreased (-0.04%) to 60.631% when pulling 92ce3bf on gaocegege:defaulter into e6d3c73 on kubeflow:v1alpha2.


defaultPortName = "default-tfjob-port"
defaultPort = 2222
defaultImage = "tensorflow/tensorflow:1.3.0"
Copy link
Member

Choose a reason for hiding this comment

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

Why do we need to set a default image?
I think this is user-defined :)

Copy link
Member Author

Choose a reason for hiding this comment

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

https://github.com/kubeflow/tf-operator/blob/master/pkg/apis/tensorflow/v1alpha1/defaults.go#L31

I follow the code in master, and I agree with you. I think we could remove the defaults for image.

@gaocegege
Copy link
Member Author

Updated, PTAL @ScorpioCPH


func setDefaultRestartPolicy(spec *TFReplicaSpec) {
if spec.RestartPolicy == RestartPolicy("") {
spec.RestartPolicy = RestartPolicyAlways
Copy link
Member

Choose a reason for hiding this comment

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

If none of the restart policies is specified, kubernetes will set it to RestartPolicyAlways by default.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah but the RestartPolicy is not pod's, it is defined in replicasSpec by our own, I think we should set the default for it manually. Could k8s do it for us?

Copy link
Member

Choose a reason for hiding this comment

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

Yes, I think so.

@@ -0,0 +1,21 @@
package v1alpha2
Copy link
Member

Choose a reason for hiding this comment

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

Please add copyright.

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

@gaocegege
Copy link
Member Author

Addressed your comments, PTAL @ScorpioCPH

Copy link
Member

@ScorpioCPH ScorpioCPH left a comment

Choose a reason for hiding this comment

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

Thanks!
/lgtm

@k8s-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ScorpioCPH

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot merged commit 4550f1d into kubeflow:v1alpha2 Mar 21, 2018
@gaocegege gaocegege deleted the defaulter branch March 21, 2018 07:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants