-
Notifications
You must be signed in to change notification settings - Fork 324
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
ServiceRouter support #332
Conversation
3bc8f60
to
2eb9fa3
Compare
return r.syncSuccessful(ctx, crdCtrl, configEntry) | ||
} else if configEntry.SyncedConditionStatus() == corev1.ConditionTrue { | ||
} else if configEntry.SyncedConditionStatus() != corev1.ConditionTrue { |
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.
This was a bug that was introduced during refactoring. I've fixed it here and added a test for it.
10a84f0
to
d50ab58
Compare
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.
This looks great. Rebasing with master might require a little bit of work to fold in some of these renames into ProxyDefaults as well unfortunately
}, | ||
Spec: v1alpha1.ServiceDefaultsSpec{ | ||
Protocol: "http", | ||
}, |
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.
We could explicitly set the Synced status here to unknown
? It makes the test case feel more explicit. Also, you might need to add a case for proxydefaults
subcommand/controller/command.go
Outdated
if err = (&controllers.ServiceRouterController{ | ||
ConfigEntryController: configEntryReconciler, | ||
Client: mgr.GetClient(), | ||
Log: ctrl.Log.WithName("controller").WithName("servicerouter"), |
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.
you can pull servicerouter
into the common package which should be available once you rebase crd-controller-base
ProxyDefaults potentially still says "controllers" as well
d50ab58
to
822f15e
Compare
@@ -94,11 +92,18 @@ func (in *ServiceDefaults) SetSyncedCondition(status corev1.ConditionStatus, rea | |||
|
|||
func (in *ServiceDefaults) SyncedCondition() (status corev1.ConditionStatus, reason string, message string) { | |||
cond := in.Status.GetCondition(ConditionSynced) | |||
if cond == nil { |
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.
Fixing nil pointer exception
@@ -27,85 +27,66 @@ spec: | |||
description: ProxyDefaults is the Schema for the proxydefaults API |
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.
The yaml files are autogenerated so no need to review. The descriptions come from the struct tags so they can be reviewed there.
@@ -371,7 +371,7 @@ func (h *Handler) Mutate(req *v1beta1.AdmissionRequest) *v1beta1.AdmissionRespon | |||
// all patches are created to guarantee no errors were encountered in | |||
// that process before modifying the Consul cluster. | |||
if h.EnableNamespaces { | |||
if err := namespaces.EnsureExists(h.ConsulClient, h.consulNamespace(req.Namespace), h.CrossNamespaceACLPolicy); err != nil { | |||
if _, err := namespaces.EnsureExists(h.ConsulClient, h.consulNamespace(req.Namespace), h.CrossNamespaceACLPolicy); err != nil { |
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.
EnsureExists
now returns (bool, err)
so we can log when a namespace gets created (vs already existed)
@@ -140,6 +181,11 @@ func TestConfigEntryControllers_createsConfigEntry(t *testing.T) { | |||
Address: consul.HTTPAddr, | |||
}) | |||
req.NoError(err) | |||
if c.consulPrereq != nil { |
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.
Needed to add consulPrereq
to all the tests because service-router
(and service-splitter
) require the protocol of the service to be set (which requires service-defaults
)
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.
It looks like we are inconsistent in the usage of "controllers" and "controller" in controller/command.go
. A quick cmd+f cmd+r should fix that. Looks beautiful otherwise.
Nice catch, I switched to |
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.
Looks great!!
Changes proposed in this PR:
service-router
servicedefaults
andserviceresolver
config entriesSyncedCondition()
andSyncedConditionStatus()
methodsHow I've tested this PR:
How I expect reviewers to test this PR:
Checklist: