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

k8s api: remove status documentation from CRD CiliumIdentity #24512

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 3 additions & 4 deletions cilium/cmd/preflight_identity_crd_migrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,10 +216,9 @@ func initK8s(ctx context.Context, clientset k8sClient.Clientset) (crdBackend all

// Create a CRD Backend
crdBackend, err := identitybackend.NewCRDBackend(identitybackend.CRDBackendConfiguration{
NodeName: "cilium-preflight",
Store: nil,
Client: clientset,
KeyFunc: (&cacheKey.GlobalIdentity{}).PutKeyFromMap,
Store: nil,
Client: clientset,
KeyFunc: (&cacheKey.GlobalIdentity{}).PutKeyFromMap,
})
if err != nil {
log.WithError(err).Fatal("Cannot create CRD identity backend")
Expand Down
7 changes: 3 additions & 4 deletions pkg/identity/cache/allocator.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,10 +184,9 @@ func (m *CachingIdentityAllocator) InitIdentityAllocator(client clientset.Interf
log.Warnf("Ignoring provided identityStore")
}
backend, err = identitybackend.NewCRDBackend(identitybackend.CRDBackendConfiguration{
NodeName: owner.GetNodeSuffix(),
Store: nil,
Client: client,
KeyFunc: (&key.GlobalIdentity{}).PutKeyFromMap,
Store: nil,
Client: client,
KeyFunc: (&key.GlobalIdentity{}).PutKeyFromMap,
})
if err != nil {
log.WithError(err).Fatal("Unable to initialize Kubernetes CRD backend for identity allocation")
Expand Down
10 changes: 3 additions & 7 deletions pkg/k8s/apis/cilium.io/client/crds/v2/ciliumidentities.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,18 +36,14 @@ spec:
by Cilium. It is intended as a backing store for identity allocation, acting
as the global coordination backend, and can be used in place of a KVStore
(such as etcd). The name of the CRD is the numeric identity and the labels
on the CRD object are the the kubernetes sourced labels seen by cilium.
This is currently the only label source possible when running under kubernetes.
on the CRD object are the kubernetes sourced labels seen by cilium. This
is currently the only label source possible when running under kubernetes.
Non-kubernetes labels are filtered but all labels, from all sources, are
places in the SecurityLabels field. These also include the source and are
used to define the identity. The labels under metav1.ObjectMeta can be used
when searching for CiliumIdentity instances that include particular labels.
This can be done with invocations such as: \n \tkubectl get ciliumid -l
'foo=bar' \n Each node using a ciliumidentity updates the status field with
it's name and a timestamp when it first allocates or uses an identity, and
periodically after that. It deletes its entry when no longer using this
identity. cilium-operator uses the list of nodes in status to reference
count users of this identity, and to expire stale usage."
'foo=bar'"
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
Expand Down
8 changes: 1 addition & 7 deletions pkg/k8s/apis/cilium.io/v2/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ type EndpointIdentity struct {
// global coordination backend, and can be used in place of a KVStore (such as
// etcd).
// The name of the CRD is the numeric identity and the labels on the CRD object
// are the the kubernetes sourced labels seen by cilium. This is currently the
// are the kubernetes sourced labels seen by cilium. This is currently the
// only label source possible when running under kubernetes. Non-kubernetes
// labels are filtered but all labels, from all sources, are places in the
// SecurityLabels field. These also include the source and are used to define
Expand All @@ -231,12 +231,6 @@ type EndpointIdentity struct {
// with invocations such as:
//
// kubectl get ciliumid -l 'foo=bar'
//
// Each node using a ciliumidentity updates the status field with it's name and
// a timestamp when it first allocates or uses an identity, and periodically
// after that. It deletes its entry when no longer using this identity.
// cilium-operator uses the list of nodes in status to reference count
// users of this identity, and to expire stale usage.
type CiliumIdentity struct {
// +deepequal-gen=false
metav1.TypeMeta `json:",inline"`
Expand Down
7 changes: 3 additions & 4 deletions pkg/k8s/identitybackend/identity.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,9 @@ func NewCRDBackend(c CRDBackendConfiguration) (allocator.Backend, error) {
}

type CRDBackendConfiguration struct {
NodeName string
Store cache.Indexer
Client clientset.Interface
KeyFunc func(map[string]string) allocator.AllocatorKey
Store cache.Indexer
Client clientset.Interface
KeyFunc func(map[string]string) allocator.AllocatorKey
}

type crdBackend struct {
Expand Down
7 changes: 3 additions & 4 deletions pkg/k8s/identitybackend/identity_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,10 +186,9 @@ func TestGetIdentity(t *testing.T) {
t.Run(tc.desc, func(t *testing.T) {
_, client := k8sClient.NewFakeClientset()
backend, err := NewCRDBackend(CRDBackendConfiguration{
NodeName: "some-node",
Store: nil,
Client: client,
KeyFunc: (&key.GlobalIdentity{}).PutKeyFromMap,
Store: nil,
Client: client,
KeyFunc: (&key.GlobalIdentity{}).PutKeyFromMap,
})
ctx := context.Background()
stopChan := make(chan struct{}, 1)
Expand Down