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

ExternalDNS Resource Creation Refactor #308

Merged
merged 18 commits into from
Nov 13, 2024

Conversation

jaiveerk
Copy link
Collaborator

@jaiveerk jaiveerk commented Nov 1, 2024

Description

Refactoring how we create ExternalDNS resources to parameterize serviceaccount, namespace, and identity. It will be necessary to not couple these to the cluster conf fed in at application start time to allow for externaldns resource creation via crds/to allow for workload identity support.

Fixes # (issue)
Feature # (details)

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

Tests have been adjusted.

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration. Is it a breaking change which will impact consuming tool(s)?

  • Test A
  • Test B

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@jaiveerk
Copy link
Collaborator Author

jaiveerk commented Nov 1, 2024

/ok-to-test sha=abc88e7

@jaiveerk
Copy link
Collaborator Author

jaiveerk commented Nov 6, 2024

/ok-to-test sha=305acc1

for _, dnsConfig := range externalDnsConfigs {
// Can safely assume the namespace exists if using kube-system
if dnsConfig.Namespace != "" && dnsConfig.Namespace != "kube-system" {
Copy link
Collaborator

Choose a reason for hiding this comment

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

where do we default to a namespace in dnsConfig?

we the default should be conf.NS (that's the old behavior)

Copy link
Collaborator

Choose a reason for hiding this comment

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

we should really control the constructor for the externalDns configs within this package to prevent misuse

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I agree with the use of the constructor - i'll make the type private and add a public constructor, so that there's no need to default on a namespace

OliverMKing
OliverMKing previously approved these changes Nov 6, 2024
@jaiveerk
Copy link
Collaborator Author

jaiveerk commented Nov 7, 2024

/ok-to-test sha=faa277e

}
func publicConfigForIngress(conf *config.Config) *manifests.ExternalDnsConfig {
return manifests.NewExternalDNSConfig(
conf,
Copy link
Collaborator

Choose a reason for hiding this comment

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

we are passing in so many arguments here. should use a struct as input instead, it's too long.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

resolving per offline discussion re: correct usage of params

Copy link
Collaborator

Choose a reason for hiding this comment

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

I still think taking in a struct param is better. this is a lot of args

Copy link
Collaborator Author

@jaiveerk jaiveerk Nov 12, 2024

Choose a reason for hiding this comment

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

so we'd have one externaldnsconfig that's visible to the controllers and one internally? that just seems like a confusing pattern.

Either we declare the type in the controller, which would create a cyclical dependency, or we expose the fields in the public type - but that violates the initial premise of forming the constructor (ie to prevent incorrect usage/assignment of the fields/to abstract them away from the controllers).

We could also create a third type within manifests but that seems excessive

OliverMKing
OliverMKing previously approved these changes Nov 12, 2024
OliverMKing
OliverMKing previously approved these changes Nov 12, 2024
@jaiveerk
Copy link
Collaborator Author

/ok-to-test sha=c920ec5

@jaiveerk
Copy link
Collaborator Author

/ok-to-test sha=7f7ff6d

@OliverMKing OliverMKing merged commit fbe2861 into Azure:main Nov 13, 2024
3 of 5 checks passed
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.

3 participants