Skip to content

CLOUDP-356692: Support for exporting Atlas resources using auto-generated CRDs#175

Open
helderjs wants to merge 13 commits intomainfrom
export-generated-resource
Open

CLOUDP-356692: Support for exporting Atlas resources using auto-generated CRDs#175
helderjs wants to merge 13 commits intomainfrom
export-generated-resource

Conversation

@helderjs
Copy link
Copy Markdown
Collaborator

Proposed changes

This PR introduces support for exporting Atlas resources using auto-generated CRDs.

Important notes

  1. Since the generated CRDs are not yet publicly released, we cannot fetch them from the AKO GitHub releases like we do for the existing CRDs. Instead, we've introduced an Embedded CRD Provider that bundles the CRD definitions directly into the binary using Go's embed package.
  2. The resource exporters (GroupExporter, ClusterExporter, FlexClusterExporter, DatabaseUserExporter) reference types from the crapi testdata samples package. This is a temporary path because the generated CRD types are still internal to AKO and not yet published as a public API. Once the types are promoted to a public package, these imports will need to be updated.
  3. The go.mod currently points to the AKO main branch. This is necessary because the crapi translator and generated types are only available in unreleased commits. Once AKO cuts a new release containing these changes, we should update to point to the stable release version.

Jira ticket: CLOUDP-356692

Checklist

  • I have signed the MongoDB CLA
  • I have added tests that prove my fix is effective or that my feature works
  • I have added any necessary documentation in the document requirements section listed in CONTRIBUTING.md (if appropriate)
  • I have addressed the @mongodb/docs-cloud-team comments (if appropriate)
  • I have run make fmt and formatted my code

@helderjs helderjs requested a review from a team as a code owner February 11, 2026 16:56
if opts.operatorVersion == "" {
image := operatorDeployment.Spec.Template.Spec.Containers[0].Image
hasContainerImageRepo := strings.Contains(image, containerImage + ":")
hasContainerImageRepo := strings.Contains(image, containerImage+":")
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

q: Is this gofmt compliant? just curious

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

It passed CI

Comment on lines +105 to +109
crd := &apiextensionsv1.CustomResourceDefinition{}
if err := k8syaml.Unmarshal(doc, crd); err != nil {
// Skip non-CRD documents (e.g., comments)
continue
}
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

q: interesting! this is a new way of parsing using k8syaml right?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

No, it's nothing new. It came as same approach used in by other kube projects.
see https://github.com/kubernetes-sigs/controller-runtime/blob/679fb347b532c2278ee0e30469e322c96b75c091/pkg/envtest/crd.go#L424

Copy link
Copy Markdown
Collaborator

@josvazg josvazg left a comment

Choose a reason for hiding this comment

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

q: is this properly disabled for now?

@helderjs
Copy link
Copy Markdown
Collaborator Author

q: is this properly disabled for now?

No, I raised the question about put PR on hold vs feature flag.

@josvazg
Copy link
Copy Markdown
Collaborator

josvazg commented Feb 13, 2026

q: is this properly disabled for now?

No, I raised the question about put PR on hold vs feature flag.

IMO we should make this an experimental feature only enabled with a compile time flag. Similar to the experimental support already have in the AKO repo. If you agree I could setup that up in a separate PR and let you rebase on top later.
WDYT?

We will basically need to compile with a flag to get the experimental features and this would we one of them. we could try the UX manually or run e2e tests that leverage it.

@helderjs helderjs force-pushed the export-generated-resource branch from 70ee936 to 82def59 Compare March 20, 2026 12:05
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.

2 participants