-
Notifications
You must be signed in to change notification settings - Fork 4
feat: new CRD to manage multiple PowerDNS #204
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
base: develop
Are you sure you want to change the base?
Conversation
9468d02 to
612e8f5
Compare
84fe1d4 to
66329c8
Compare
|
@mydoomfr What about |
66329c8 to
0c51f6b
Compare
0c51f6b to
65d64e7
Compare
Signed-off-by: Benjamin Pinchon <[email protected]>
65d64e7 to
9ed6413
Compare
|
@antrema Ready to be reviewed and merged into develop. Tests are passing and the code is running well, but we should double-check with more YAML samples. PS: Renaming the CRD from Cluster to PDNSProvider was a real pain in the ass and I didn't expect that. |
antrema
left a comment
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.
Well done, some remarks regarding terminology, after validating them, we should validate the PR and merge into develop, we will further add tests, metrics regarding new resource
|
|
||
| // +kubebuilder:object:root=true | ||
| // +kubebuilder:subresource:status | ||
| // +kubebuilder:resource:scope=Cluster |
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.
| // Namespace is the namespace of the Secret | ||
| // If not specified, defaults to the PDNSProvider resource namespace | ||
| // +optional | ||
| Namespace *string `json:"namespace,omitempty"` |
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.
Does it still make sense to consider a namespace if PDNSProvider becomes a namespace-scoped resource, I don't have a strong opinion
|
|
||
| // PDNSProviderTLSConfig defines TLS configuration for PowerDNS API connection | ||
| type PDNSProviderTLSConfig struct { | ||
| // Insecure enables insecure connections to PowerDNS API (skip TLS verification) |
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.
| // Insecure enables insecure connections to PowerDNS API (skip TLS verification) | |
| // Enables insecure connections to PowerDNS API (skip TLS verification), default to false |
| // +optional | ||
| Insecure *bool `json:"insecure,omitempty"` | ||
|
|
||
| // CABundleRef is a reference to a ConfigMap or Secret containing a CA bundle |
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.
| // CABundleRef is a reference to a ConfigMap or Secret containing a CA bundle | |
| // Reference to a ConfigMap or Secret containing a CA bundle |
| // +kubebuilder:validation:Required | ||
| Name string `json:"name"` | ||
|
|
||
| // Namespace is the namespace of the ConfigMap or Secret |
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.
| // Namespace is the namespace of the ConfigMap or Secret | |
| // Namespace containing the ConfigMap or Secret |
| @@ -0,0 +1,64 @@ | |||
| --- | |||
| # Specific Catalog | |||
| apiVersion: dns.cav.enablers.ob/v1alpha2 | |||
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.
| apiVersion: dns.cav.enablers.ob/v1alpha2 | |
| apiVersion: dns.cav.enablers.ob/v1alpha3 |
|
|
||
| --- | ||
| # Specific SOA_EDIT_API | ||
| apiVersion: dns.cav.enablers.ob/v1alpha2 |
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.
| apiVersion: dns.cav.enablers.ob/v1alpha2 | |
| apiVersion: dns.cav.enablers.ob/v1alpha3 |
|
|
||
| --- | ||
| # Fake Zone | ||
| apiVersion: dns.cav.enablers.ob/v1alpha2 |
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.
| apiVersion: dns.cav.enablers.ob/v1alpha2 | |
| apiVersion: dns.cav.enablers.ob/v1alpha3 |
|
|
||
| --- | ||
| # Fake Zone | ||
| apiVersion: dns.cav.enablers.ob/v1alpha2 |
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.
| apiVersion: dns.cav.enablers.ob/v1alpha2 | |
| apiVersion: dns.cav.enablers.ob/v1alpha3 |
| ## Append samples of your project ## | ||
| resources: | ||
| - dns_v1alpha2_zone.yaml | ||
| - dns_v1alpha2_rrset.yaml |
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.
Any interest to keep "v1alpha2" sample resources ?
Missing v1alpha3 sample resources
antrema
left a comment
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.
Well done, some remarks regarding terminology, after validating them, we should validate the PR and merge into develop, we will further add tests, metrics regarding new resource
Don't know what are these statistics but aren't there metrics ? |
antrema
left a comment
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.
Today is another day, it comes with more comments ... Have a nice week-end ;-)
|
|
||
| // First reconcile might fail due to finalizer addition, retry if needed | ||
| const retryDelay = 100 * time.Millisecond | ||
| result, err := controllerReconciler.Reconcile(ctx, reconcile.Request{ |
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.
Why calling Reconcile function whereas PDNSProviderReconciler has been started on suite_test.go:
err = (&PDNSProviderReconciler{
Client: k8sManager.GetClient(),
Scheme: k8sManager.GetScheme(),
}).SetupWithManager(k8sManager)
Expect(err).ToNot(HaveOccurred())
| // PDNSProvider is cluster-scoped, so no namespace | ||
| } | ||
|
|
||
| Context("When reconciling a resource", func() { |
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.
In other tests, we used to have Context after BeforeEach and AfterEach, I think we should have the same structure for all tests
| // +kubebuilder:rbac:groups=dns.cav.enablers.ob,resources=pdnsproviders,verbs=get;list;watch;create;update;patch;delete | ||
| // +kubebuilder:rbac:groups=dns.cav.enablers.ob,resources=pdnsproviders/status,verbs=get;update;patch | ||
| // +kubebuilder:rbac:groups=dns.cav.enablers.ob,resources=pdnsproviders/finalizers,verbs=update | ||
| // +kubebuilder:rbac:groups="",resources=secrets,verbs=get;list;watch |
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 it is missing access to ConfigMap for CABundle stored as ConfigMap
| Namespace: namespace, | ||
| } | ||
|
|
||
| if kind == "Secret" { |
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.
"if/else" or "switch" structure ? I have no strong opinion
| return err == nil && updatedProvider.Status.Conditions != nil && len(updatedProvider.Status.Conditions) > 0 | ||
| }, timeout, interval).Should(BeTrue()) | ||
|
|
||
| _ = result // Use the result to avoid unused variable warnings |
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 prefer the variable not to have been created instead
Manage multiple PowerDNS instances
Issue: #197
PDNSProviderCRD to manage multiple PowerDNS instances..spec.providerRef(mandatory) property toZoneandClusterZone.CRD
Remarks & Questions
cluster.status? https://github.com/joeig/go-powerdns/blob/main/statistics.goDo we want to keepClusterCRD name?Cluster(controller) to check the connectivity to PowerDNS. This could be misunderstood as "how often Zones/RRsets are reconciled for this specific PowerDNS instance". We should make this explicit in the documentation. Also I'd like to rely on thisintervalas a kind of health check to prevent subresources reconciliation when the PowerDNS API is unavailable, usingcluster.IsConnectionHealthy().Should we keep the legacy configuration to avoid a breaking change? It adds a lot of code + documentation overhead and forcesclusterRefto remainoptional, even thoughZone/ClusterZonerequires it.I rebased
developso we can merge this PR on it, then iterate with futur PR until we have something stable.I'll squash my commits before merge.