robustness and logging.
This commit is contained in:
parent
e8d1c5b2ac
commit
965dfbf245
@ -10,6 +10,7 @@ import (
|
|||||||
"github.com/containerd/containerd/images"
|
"github.com/containerd/containerd/images"
|
||||||
"github.com/containerd/containerd/leases"
|
"github.com/containerd/containerd/leases"
|
||||||
"github.com/containerd/containerd/namespaces"
|
"github.com/containerd/containerd/namespaces"
|
||||||
|
"k8s.io/klog/v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Containerd implements ContainerRuntime interface
|
// Containerd implements ContainerRuntime interface
|
||||||
@ -44,6 +45,11 @@ func (m *Containerd) List() (map[string]bool, error) {
|
|||||||
return nil, fmt.Errorf("failed to list images: %w", err)
|
return nil, fmt.Errorf("failed to list images: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for _, image := range images {
|
||||||
|
klog.V(3).Infof("Image '%s' digest '%s'", image.Name,
|
||||||
|
image.Target.Digest.String())
|
||||||
|
}
|
||||||
|
|
||||||
// Get all leases
|
// Get all leases
|
||||||
leases, err := m.client.LeasesService().List(m.ctx)
|
leases, err := m.client.LeasesService().List(m.ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -139,7 +145,7 @@ func (m *Containerd) findLeases(imageRef string) ([]leases.Lease, error) {
|
|||||||
func (m *Containerd) Pull(imageRef string) error {
|
func (m *Containerd) Pull(imageRef string) error {
|
||||||
// Set up pull options
|
// Set up pull options
|
||||||
pullOpts := []containerd.RemoteOpt{
|
pullOpts := []containerd.RemoteOpt{
|
||||||
containerd.WithPlatform(""),
|
//containerd.WithPlatformMatcher(platforms.Default()),
|
||||||
containerd.WithPullUnpack,
|
containerd.WithPullUnpack,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@ package main
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
corev1 "k8s.io/api/core/v1"
|
corev1 "k8s.io/api/core/v1"
|
||||||
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
"k8s.io/apimachinery/pkg/fields"
|
"k8s.io/apimachinery/pkg/fields"
|
||||||
"k8s.io/apimachinery/pkg/types"
|
"k8s.io/apimachinery/pkg/types"
|
||||||
"k8s.io/client-go/kubernetes"
|
"k8s.io/client-go/kubernetes"
|
||||||
@ -86,7 +87,9 @@ func (watcher *Watcher) watchPods(
|
|||||||
watcher.serializer <- func() {
|
watcher.serializer <- func() {
|
||||||
pod := watcher.getPod(obj)
|
pod := watcher.getPod(obj)
|
||||||
klog.V(3).Infof("Delete %s/%s\n", pod.Namespace, pod.Name)
|
klog.V(3).Infof("Delete %s/%s\n", pod.Namespace, pod.Name)
|
||||||
watcher.pods[pod.UID].DeletionTimestamp.Time = time.Now()
|
now := metav1.NewTime(time.Now())
|
||||||
|
watcher.pods[pod.UID] = pod
|
||||||
|
pod.DeletionTimestamp = &now
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user