Skip to content

Commit

Permalink
DONOTMERGE: Initial new api
Browse files Browse the repository at this point in the history
  • Loading branch information
joestringer committed May 10, 2022
1 parent 77abb43 commit 690dd50
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions pkg/ipcache/ipcache.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,17 @@
package ipcache

import (
"errors"
"net"

"github.com/sirupsen/logrus"

"github.com/cilium/cilium/pkg/controller"
"github.com/cilium/cilium/pkg/identity"
"github.com/cilium/cilium/pkg/identity/cache"
"github.com/cilium/cilium/pkg/ipcache/types"
ipcacheTypes "github.com/cilium/cilium/pkg/ipcache/types"
"github.com/cilium/cilium/pkg/labels"
"github.com/cilium/cilium/pkg/lock"
"github.com/cilium/cilium/pkg/logging/logfields"
"github.com/cilium/cilium/pkg/option"
Expand Down Expand Up @@ -411,6 +414,45 @@ func (ipc *IPCache) DumpToListener(listener IPIdentityMappingListener) {
ipc.RUnlock()
}

func (ipc *IPCache) UpsertIdentity(cidr string, id identity.Identity) error {
return errors.New("not implemented")
}
func (ipc *IPCache) UpsertEncryptKey(cidr string, key uint8) error {
return errors.New("not implemented")
}
func (ipc *IPCache) UpsertK8sMetadata(cidr string, k8sMeta *K8sMetadata) error {
return errors.New("not implemented")
}

// TODO: Figure out what kind of mechanism we need to report that this operation was completed
func (ipc *IPCache) UpsertLabels(cidr string, lbls labels.Labels, src source.Source, name types.ResourceID) error {
ipc.UpsertMetadata(cidr, lbls, src, name)
ipc.TriggerLabelInjection()

return errors.New("not implemented")
}

// TODO: Figure out what kind of mechanism we need to report that this operation was completed
func (ipc *IPCache) RemoveLabels(cidr string, lbls labels.Labels, name types.ResourceID) error {
ipc.metadata.Lock()
ipc.removeLabels(cidr, lbls, name)
ipc.metadata.Unlock()

ipc.TriggerLabelInjection()

return errors.New("not implemented")
}

//func (ipc *IPcache) UpsertCIDRs(cidrs []string) error {
// ipc.Lock()
// defer ipc.Unlock()
//
// for c := cidrs {
// // insert into the tree
// }
// ipc.TriggerLabelInjection()
//}

// DumpToListenerLocked dumps the entire contents of the IPCache by triggering
// the listener's "OnIPIdentityCacheChange" method for each entry in the cache.
// The caller *MUST* grab the IPCache.Lock for reading before calling this
Expand Down

0 comments on commit 690dd50

Please sign in to comment.