Skip to content

Commit 0fffc55

Browse files
committed
Merge remote-tracking branch 'origin/release-v2-dev' into test/adc_test
Signed-off-by: Ashing Zheng <[email protected]>
2 parents 7aa01d8 + c7a09b1 commit 0fffc55

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+1670
-764
lines changed

api/adc/types.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -725,3 +725,24 @@ func (s *StringOrSlice) UnmarshalJSON(p []byte) error {
725725
}
726726
return json.Unmarshal(p, &s.StrVal)
727727
}
728+
729+
type Config struct {
730+
Name string
731+
ServerAddrs []string
732+
Token string
733+
TlsVerify bool
734+
}
735+
736+
// MarshalJSON implements custom JSON marshaling for adcConfig
737+
// It excludes the Token field for security reasons
738+
func (c Config) MarshalJSON() ([]byte, error) {
739+
return json.Marshal(struct {
740+
Name string `json:"name"`
741+
ServerAddrs []string `json:"serverAddrs"`
742+
TlsVerify bool `json:"tlsVerify"`
743+
}{
744+
Name: c.Name,
745+
ServerAddrs: c.ServerAddrs,
746+
TlsVerify: c.TlsVerify,
747+
})
748+
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

internal/provider/adc/store.go renamed to internal/adc/cache/store.go

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
// specific language governing permissions and limitations
1616
// under the License.
1717

18-
package adc
18+
package cache
1919

2020
import (
2121
"fmt"
@@ -27,37 +27,36 @@ import (
2727

2828
adctypes "github.com/apache/apisix-ingress-controller/api/adc"
2929
"github.com/apache/apisix-ingress-controller/internal/controller/label"
30-
"github.com/apache/apisix-ingress-controller/internal/provider/adc/cache"
3130
)
3231

3332
type Store struct {
34-
cacheMap map[string]cache.Cache
33+
cacheMap map[string]Cache
3534
pluginMetadataMap map[string]adctypes.PluginMetadata
3635

3736
sync.Mutex
3837
}
3938

4039
func NewStore() *Store {
4140
return &Store{
42-
cacheMap: make(map[string]cache.Cache),
41+
cacheMap: make(map[string]Cache),
4342
pluginMetadataMap: make(map[string]adctypes.PluginMetadata),
4443
}
4544
}
4645

47-
func (s *Store) Insert(name string, resourceTypes []string, resources adctypes.Resources, Labels map[string]string) error {
46+
func (s *Store) Insert(name string, resourceTypes []string, resources *adctypes.Resources, Labels map[string]string) error {
4847
s.Lock()
4948
defer s.Unlock()
5049
targetCache, ok := s.cacheMap[name]
5150
if !ok {
52-
db, err := cache.NewMemDBCache()
51+
db, err := NewMemDBCache()
5352
if err != nil {
5453
return err
5554
}
5655
s.cacheMap[name] = db
5756
targetCache = s.cacheMap[name]
5857
}
5958
log.Debugw("Inserting resources into cache for", zap.String("name", name))
60-
selector := &cache.KindLabelSelector{
59+
selector := &KindLabelSelector{
6160
Kind: Labels[label.LabelKind],
6261
Name: Labels[label.LabelName],
6362
Namespace: Labels[label.LabelNamespace],
@@ -153,7 +152,7 @@ func (s *Store) Delete(name string, resourceTypes []string, Labels map[string]st
153152
if !ok {
154153
return nil
155154
}
156-
selector := &cache.KindLabelSelector{
155+
selector := &KindLabelSelector{
157156
Kind: Labels[label.LabelKind],
158157
Name: Labels[label.LabelName],
159158
Namespace: Labels[label.LabelNamespace],

0 commit comments

Comments
 (0)