tokers opened a new pull request #443:
URL: https://github.com/apache/apisix-ingress-controller/pull/443


   Please answer these questions before submitting a pull request
   
   This Pull Request refactored the process about annotations, it abstracts two 
interfaces:
   
   ```go
   // Extractor encapsulates some auxiliary methods to extract annotations.
   type Extractor interface {
        // GetStringAnnotation returns the string value of the target 
annotation.
        // When the target annoatation is missing, empty string will be given.
        GetStringAnnotation(string) string
        // GetStringsAnnotation returns a string slice which splits the value 
of target
        // annotation by the comma symbol. When the target annotation is 
missing, an empty
        // slice (not a nil slice) will be given.
        GetStringsAnnotation(string) []string
        // GetBoolAnnotation returns a boolean value from the given annotation.
        // When value is "true", true will be given, other values will be 
treated as
        // false.
        GetBoolAnnotation(string) bool
   }
   
   // Handler abstracts the behavior so that the apisix-ingress-controller knows
   // how to parse some annotations and convert them to APISIX plugins.
   type Handler interface {
        // Handle parses the target annotation and converts it to the 
type-agnostic structure.
        // The return value might be nil since some features have an explicit 
switch, users should
        // judge whether Handle is failed by the second error value.
        Handle(Extractor) (interface{}, error)
        // PluginName returns a string which indicates the target plugin name 
in APISIX.
        PluginName() string
   }
   ```
   
   With the help of these two interfaces, each annotation handler can be 
implemented independently and hide its details. Also, now annotations process 
is also integrated into Ingress.
   
   - Why submit this pull request?
   - [ ] Bugfix
   - [ ] New feature provided
   - [x] Improve performance
   - [ ] Backport patches
   
   - Related issues
   https://github.com/apache/apisix-ingress-controller/issues/442
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to