-
Notifications
You must be signed in to change notification settings - Fork 86
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
Move clusterIP and clusterDomain spec fields to status #77
Conversation
@openshift/sig-network-edge PTAL |
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 In addition, what do you think about enabling the |
There was a problem hiding this 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?
pkg/apis/dns/v1alpha1/types.go
Outdated
|
||
// ClusterDNSStatus defines the observed state of ClusterDNS | ||
type ClusterDNSStatus struct { | ||
// ClusterIP is the service IP reserved for cluster DNS service | ||
ClusterIP *string `json:"clusterIP"` |
There was a problem hiding this comment.
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?
73f1d4d
to
7df9f2d
Compare
if dns.Spec.ClusterIP != nil { | ||
s.Spec.ClusterIP = *dns.Spec.ClusterIP | ||
if len(clusterIP) > 0 { | ||
s.Spec.ClusterIP = clusterIP |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
pkg/stub/handler.go
Outdated
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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo: "getch".
pkg/stub/handler.go
Outdated
// TODO: fetch this from higher level openshift resource when it is exposed | ||
clusterDomain := "cluster.local" | ||
|
||
if dns.Name == "default" { |
There was a problem hiding this comment.
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?
pkg/stub/handler.go
Outdated
|
||
unstructObj, err := k8sutil.UnstructuredFromRuntimeObject(dns) | ||
if err != nil { | ||
return fmt.Errorf("failed to get unstructed obj from runtime: %v", err) |
There was a problem hiding this comment.
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") |
There was a problem hiding this comment.
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.
7df9f2d
to
18d5643
Compare
18d5643
to
85324ae
Compare
@openshift/sig-network-edge ready for review/merge, PTAL |
/lgtm |
[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 |
https://jira.coreos.com/browse/NE-160