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

POC | feat: break common repo into sub modules #40

Closed

Conversation

ciaranRoche
Copy link
Collaborator

Problem

Since we introduced aws sdk v2 into ROSA CLI and subsequently ocm-common as part of the unified CI efforts we have created a dependency issue between ROSA CLI, OCM-Common and CAPA, as CAPA is still on aws sdk v1.

Solution

This POC proposes splitting the current common repo in sub modules, to enable clients to selectively import the package they require with out taking on the extra dependency bloat.

The current struct looks like

├── CONTRIBUTING.md
├── go.mod
├── go.sum
├── Makefile
├── modules
│   ├── aws
│   │   ├── aws_client
│   │   │   ├── client.go
│   │   │   ├── eip.go
│   │   │   ├── elb.go
│   │   │   ├── env.go
│   │   │   ├── image.go
│   │   │   ├── instance.go
│   │   │   ├── internet_gateway.go
│   │   │   ├── key_pair.go
│   │   │   ├── kms.go
│   │   │   ├── nat_gateway.go
│   │   │   ├── network_acl.go
│   │   │   ├── network_interface.go
│   │   │   ├── oidc.go
│   │   │   ├── policy.go
│   │   │   ├── resource.go
│   │   │   ├── role.go
│   │   │   ├── route53.go
│   │   │   ├── route_table.go
│   │   │   ├── security_group.go
│   │   │   ├── subnet.go
│   │   │   ├── tag.go
│   │   │   ├── volume.go
│   │   │   └── vpc.go
│   │   ├── consts
│   │   │   └── consts.go
│   │   ├── errors
│   │   │   ├── errors.go
│   │   │   ├── errors_test.go
│   │   │   └── validation_suite_test.go
│   │   ├── go.mod
│   │   ├── go.sum
│   │   ├── log
│   │   │   └── logger.go
│   │   ├── test
│   │   │   └── vpc_client
│   │   │       ├── bastion.go
│   │   │       ├── cidr.go
│   │   │       ├── elb.go
│   │   │       ├── helper.go
│   │   │       ├── instance.go
│   │   │       ├── internet_gateway.go
│   │   │       ├── key_pair.go
│   │   │       ├── nat_gateway.go
│   │   │       ├── network_acl.go
│   │   │       ├── network_interface.go
│   │   │       ├── proxy.go
│   │   │       ├── route_table.go
│   │   │       ├── security_group.go
│   │   │       ├── ssh.go
│   │   │       ├── subnet.go
│   │   │       ├── types.go
│   │   │       └── vpc.go
│   │   ├── utils
│   │   │   ├── utils.go
│   │   │   ├── utils_suite_test.go
│   │   │   └── utils_test.go
│   │   └── validations
│   │       ├── iam_helpers.go
│   │       ├── iam_helpers_test.go
│   │       ├── tags.go
│   │       └── validation_suite_test.go
│   ├── ocm
│   │   ├── client
│   │   │   ├── clusterautoscaler_client.go
│   │   │   ├── kubeletconfig_client.go
│   │   │   ├── machinepool_client.go
│   │   │   ├── nodepool_client.go
│   │   │   ├── test
│   │   │   │   ├── matchers.go
│   │   │   │   ├── matchers_test.go
│   │   │   │   ├── mock_clusterautoscaler_client.go
│   │   │   │   ├── mock_kubeletconfig_client.go
│   │   │   │   ├── mock_machinepool_client.go
│   │   │   │   ├── mock_nodepool_client.go
│   │   │   │   ├── ocm_client_test.go
│   │   │   │   ├── types.go
│   │   │   │   └── types_test.go
│   │   │   └── types.go
│   │   ├── consts
│   │   │   └── consts.go
│   │   ├── go.mod
│   │   ├── go.sum
│   │   ├── utils
│   │   │   ├── password.go
│   │   │   ├── password_test.go
│   │   │   ├── utils_suite_test.go
│   │   │   ├── versions.go
│   │   │   └── versions_test.go
│   │   └── validations
│   │       ├── cluster_node.go
│   │       ├── cluster_node_test.go
│   │       ├── disk_size.go
│   │       ├── disk_size_test.go
│   │       ├── helpers.go
│   │       ├── helpers_test.go
│   │       ├── kms_arn_regex.go
│   │       ├── kms_arn_regex_test.go
│   │       ├── password.go
│   │       ├── password_test.go
│   │       └── validation_suite_test.go
│   └── rosa
│       ├── accountroles
│       │   ├── accountroles.go
│       │   ├── accountroles_suite_test.go
│       │   └── accountroles_test.go
│       ├── go.mod
│       ├── go.sum
│       └── oidcconfigs
│           └── oidcconfigs.go
├── pkg
│   └── utils
│       ├── const.go
│       ├── utils.go
│       ├── utils_suite_test.go
│       └── utils_test.go
├── README.md
└── version.go

This splits the current pkg into 3 sub modules and one parent module:

  • aws
    • Client shared functionality scoped to the AWS SDK
  • ocm
    • Client shared functionality scoped to OCM SDK
  • rosa
    • Client shared functionality sharing scope of both AWS and OCM SDK's
      The project also maintains a parent module, currently is only scoped to utility functions shared across modules, to reduce the need of sub modules importing each other. It is important to keep submodules from being dependant on each other.

Versioning of sub modules will be following what it outlined in go-modules-by-example - https://github.com/go-modules-by-example/index/blob/master/009_submodules/README.md

@muraee
Copy link

muraee commented Apr 17, 2024

nice! LGTM

@xueli181114
Copy link
Contributor

Not much impact to unified CI. LGTM from QE.

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