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

Allow nodePort value for the postgres-operator-ui service #928

Merged
merged 7 commits into from Apr 29, 2020
Merged

Allow nodePort value for the postgres-operator-ui service #928

merged 7 commits into from Apr 29, 2020

Conversation

marcusportmann
Copy link
Contributor

Added support for specifying a nodePort value for the postgres-operator-ui service when the service type is NodePort.

@FxKu
Copy link
Member

FxKu commented Apr 24, 2020

I think I would rather add the nodePort field to the values file and check if the service type is set to "NodePort" instead of checking if nodePort field is set.

@marcusportmann
Copy link
Contributor Author

marcusportmann commented Apr 24, 2020

I have made the change you suggested. I think it is still important to see if a node port value is specified because a randomised value may be desired in some cases. If both the type is set to NodePort and the value is specified then it will be applied.

@FxKu
Copy link
Member

FxKu commented Apr 27, 2020

Could you still add the nodePart field in the values.yaml (and values-crd.yaml) without a value? Would it then receive a random port?

@marcusportmann
Copy link
Contributor Author

I have added a nodePort field to the values.yaml file with no value. This is for the postgres-operator-ui chart so there is no values-crd.yaml. If no value is specified for this field a random port is selected. If a value is specified for this field it is used as the NodePort port.

@FxKu
Copy link
Member

FxKu commented Apr 28, 2020

Will the nodePort field be ignored when the service is of type ClusterIP?

@FxKu FxKu added this to the 1.5 milestone Apr 28, 2020
@marcusportmann
Copy link
Contributor Author

marcusportmann commented Apr 28, 2020

Adding the nodePort field to the values.yaml file causes the Travis CI build to fail. I attempted to remove the conditional addition of the field in the Helm chart to remedy this but the build unfortunately still fails. Both scenarios work for me when I test the operator locally when the type of the service is NodePort. Further testing when the type of the service is ClusterIP causes the build to fail if the nodePort field is specified. As a result, I am reverting my changes since it feels wrong to add a field that is conditional to the values.yaml file when it is not applicable i.e. the type for the service is not NodeType. I will add the check back to the Helm chart and a commented out field to the values.yaml file to indicate the field does exist and can be specified when the type is NodePort.

@FxKu
Copy link
Member

FxKu commented Apr 28, 2020

The build error has nothing to do with this PR. Besides, the UI isn't really covered in our tests.
It's fine for me to have the blank nodePort field in the values.yaml. If it's ignored for ClusterIP service than we can save the conditional test in the service template. I like that.

Edit: Ok now I've read your edited message again. If it fails when the nodePort is specified then it's true that we have to check that the serviceType is not of ClusterIP. I would still keep that field in the values.yaml then.

@marcusportmann
Copy link
Contributor Author

Are you happy with having the nodePort field commented out in the values.yaml file with a comment describing its usage?

@FxKu
Copy link
Member

FxKu commented Apr 28, 2020

Why not add if type != clusterIP to the service template, similar to what you had before?

@marcusportmann
Copy link
Contributor Author

Because the field is only valid if the type is NodePort. Removing the check in the service.yaml demonstrated this as the deployment failed. I believe there is a difference between an optional field, for which an empty value is valid, and a conditional field that is only valid as a result of the value of some other field. Having it commented out with a comment explaining its usage makes it clear that just setting the value is not sufficient and that the type also needs to be set to NodePort.

@FxKu
Copy link
Member

FxKu commented Apr 28, 2020

👍

1 similar comment
@sdudoladov
Copy link
Member

👍

@sdudoladov sdudoladov merged commit 0016ebf into zalando:master Apr 29, 2020
@sdudoladov
Copy link
Member

@marcusportmann thank you for the contribution :)

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.

None yet

3 participants