community icon indicating copy to clipboard operation
community copied to clipboard

Refactor `ackgenconfig` into 2 categories: Generate & API Inference

Open brycahta opened this issue 2 years ago • 5 comments

Summary

ackgenconfig is used and implemented in a variety of ways throughout the code-generator codebase. Due to this dispersion and inconsistency, it is becoming increasingly difficult to navigate and contribute to code-generator. The updated encapsulations as a result of splitting ackgenconfig into 2 categories will result in a cleaner, more intuitive codebase to alleviate these concerns.

Context

This is the parent issue to track and implement changes to categorize ackgenconfig. The proposal detailing the approach can be found here.

Implementation

  • [x] Move pkg/generate/config/config.go to pkg/config/config.go
  • [x] Migrate pkg/generate/config access to pkg/config package
  • [x] Align naming and return types for APIs in pkg/config package
  • [ ] Split pkg/config/config.go into pkg/config/generate.go and pkg/config/inference.go

brycahta avatar Feb 22 '22 18:02 brycahta

@brycahta spot on. let's do this!

jaypipes avatar Feb 23 '22 17:02 jaypipes

Initial Research on Config Cats 🐱

Inference/How to create CRD

  • GetAllRenames()
  • GetAPIVersions()
  • OperationIsIgnored()
  • GetResourcePrintOrderByName()
  • GetResourceShortNames()
  • GetResourceFieldByPath()
  • ResourceIsIgnored()

Generate/How to generate Go code

  • GetTerminalExceptionCodes()
  • ListOpMatchFieldNames()
  • GetOverrideValues()
  • GetCustomCheckRequiredFieldsMissingMethod()
  • GetCustomImplementation()
  • GetSetOutputCustomMethodName()
  • GetOutputWrapperFieldPath()
  • GetCustomUpdateMethodName()
  • GetReconcileRequeueOnSuccessSeconds()
  • ResourceDisplaysAgeColumn()
  • GetUpdateConditionsCustomMethodName()
  • GetCompareIgnoredFields()
  • GetResourceConfig()
  • ResourceSetsSingleAttribute()
  • ResourceDisplaysAgeColumn()
  • ResourceContainsAttributesMap()
  • ResourceIsAdoptable()
  • GetCustomListFieldMembers()

Both/Not a clear category

  • GetOperationConfig()
  • GetResourceFieldName()
  • GetResourceFields()

brycahta avatar Apr 28 '22 16:04 brycahta

Discussed with @jaypipes offline and putting the "splitting into categories" task on hold for now. After working on some of the code, I'm not convinced this abstraction makes the code any cleaner or more intuitive. I'll pivot to refactoring generate package and note any patterns with config use/access to see if a better pattern arises.

brycahta avatar Apr 28 '22 16:04 brycahta

Issues go stale after 90d of inactivity. Mark the issue as fresh with /remove-lifecycle stale. Stale issues rot after an additional 30d of inactivity and eventually close. If this issue is safe to close now please do so with /close. Provide feedback via https://github.com/aws-controllers-k8s/community. /lifecycle stale

ack-bot avatar Jul 27 '22 17:07 ack-bot

/lifecycle frozen

a-hilaly avatar Jul 28 '22 09:07 a-hilaly