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

Move clusterIP and clusterDomain spec fields to status #77

Merged

Conversation

pravisankar
Copy link

@pravisankar pravisankar commented Feb 12, 2019

@openshift-ci-robot openshift-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Feb 12, 2019
@pravisankar
Copy link
Author

@openshift/sig-network-edge PTAL

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Feb 12, 2019
@Miciah
Copy link
Contributor

Miciah commented Feb 12, 2019

Initializing status in the factory method seems wrong: the responsibility of the factory should be to provide a resource with metadata and spec, and it should be up to the reconciliation logic (perhaps ensureCoreDNSForClusterDNS, or some new method that the reconcile loop would invoke) to update the status; does that seem reasonable?

In addition, what do you think about enabling the /status subresource on the CRD in order to get correct semantics for updates to the resource metadata and spec versus updates to its status?

Copy link
Contributor

@ironcladlou ironcladlou left a comment

Choose a reason for hiding this comment

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

I think we can use value types for the status field and then even further simplify the code?


// ClusterDNSStatus defines the observed state of ClusterDNS
type ClusterDNSStatus struct {
// ClusterIP is the service IP reserved for cluster DNS service
ClusterIP *string `json:"clusterIP"`
Copy link
Contributor

Choose a reason for hiding this comment

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

Should these still be pointers?

@openshift-ci-robot openshift-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Feb 19, 2019
@pravisankar pravisankar changed the title Move clusterIP and clusterDomain spec fields to status [WIP] Move clusterIP and clusterDomain spec fields to status Feb 19, 2019
@openshift-ci-robot openshift-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Feb 19, 2019
if dns.Spec.ClusterIP != nil {
s.Spec.ClusterIP = *dns.Spec.ClusterIP
if len(clusterIP) > 0 {
s.Spec.ClusterIP = clusterIP
Copy link
Contributor

Choose a reason for hiding this comment

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

I must be missing something, didn't Spec get deleted? surprised this compiles

Copy link
Contributor

Choose a reason for hiding this comment

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

That's setting .spec.clusterIP on the service, not the clusterdns.

var err error
clusterIP, err = getClusterIPFromNetworkConfig()
if err != nil {
return fmt.Errorf("failed to getch cluster IP from network config for clusterdns %s, %v", dns.Name, err)
Copy link
Contributor

Choose a reason for hiding this comment

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

Typo: "getch".

// TODO: fetch this from higher level openshift resource when it is exposed
clusterDomain := "cluster.local"

if dns.Name == "default" {
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm ambivalent about special-casing on the clusterdns's name. For now, clusterdns is a singleton, right? Does it make sense to special-case the name now? Will it make sense to special-case the name in the future, if we expand the API to support multiple clusterdnses?


unstructObj, err := k8sutil.UnstructuredFromRuntimeObject(dns)
if err != nil {
return fmt.Errorf("failed to get unstructed obj from runtime: %v", err)
Copy link
Contributor

Choose a reason for hiding this comment

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

Typo: "unstructed" should be "unstructured". (In 2f85300#diff-f33ebabd902db5bc0032360e4c24c3c8R97, I used the phrasing "failed to convert"—not sure what phrasing most useful in the logs.)

}

if len(networkConfig.Status.ServiceNetwork) == 0 {
return "", fmt.Errorf("no service networks found in cluster network config")
Copy link
Contributor

Choose a reason for hiding this comment

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

👍, adding this check is good.

@pravisankar pravisankar changed the title [WIP] Move clusterIP and clusterDomain spec fields to status Move clusterIP and clusterDomain spec fields to status Feb 20, 2019
@openshift-ci-robot openshift-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Feb 20, 2019
@pravisankar
Copy link
Author

@openshift/sig-network-edge ready for review/merge, PTAL

@Miciah
Copy link
Contributor

Miciah commented Feb 20, 2019

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Feb 20, 2019
@openshift-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Miciah, pravisankar

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

@openshift-merge-robot openshift-merge-robot merged commit ffb04ae into openshift:master Feb 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants