diff --git a/controllers/events/event_controller.go b/controllers/events/event_controller.go index 2a525ec..a7b8155 100644 --- a/controllers/events/event_controller.go +++ b/controllers/events/event_controller.go @@ -17,8 +17,10 @@ import ( apierrors "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/api/meta" "k8s.io/apimachinery/pkg/runtime" + "k8s.io/client-go/dynamic" ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/client" + "sigs.k8s.io/controller-runtime/pkg/client/apiutil" "sigs.k8s.io/controller-runtime/pkg/metrics" "github.com/weaveworks-experiments/kspan/pkg/mtime" @@ -39,6 +41,7 @@ type EventWatcher struct { startTime time.Time recent *recentInfoStore pending []*corev1.Event + watcher *watchManager resources map[source]*resource.Resource outgoing *outgoing scheme *runtime.Scheme @@ -170,7 +173,11 @@ func (r *EventWatcher) emitSpanFromEvent(ctx context.Context, log logr.Logger, e if !success { involved, err = getObject(ctx, r.Client, apiVersion, ref.object.Kind, ref.object.Namespace, ref.object.Name) if err == nil { - r.captureObject(involved, "initial") + err = r.watcher.watch(ctx, involved, r) + if err != nil { + return false, err + } + // If our rules tell us to map this event immediately to a context, do that. success, remoteContext, err = mapEventDirectlyToContext(ctx, r.Client, event, involved) if err != nil { @@ -191,7 +198,10 @@ func (r *EventWatcher) emitSpanFromEvent(ctx context.Context, log logr.Logger, e if ref.actor.Name != "" { involved, err = getObject(ctx, r.Client, event.InvolvedObject.APIVersion, ref.actor.Kind, ref.actor.Namespace, ref.actor.Name) if err == nil { - r.captureObject(involved, "initial") + err = r.watcher.watch(ctx, involved, r) + if err != nil { + return false, err + } remoteContext, err = recentSpanContextFromObject(ctx, involved, r.recent) if err != nil { return false, err @@ -273,7 +283,10 @@ func (r *EventWatcher) makeSpanContextFromObject(ctx context.Context, obj runtim if err != nil { return noTrace, err } - r.captureObject(owner, "initial") + err = r.watcher.watch(ctx, owner, r) // watch everything in the chain for in-object events + if err != nil { + return noTrace, err + } remoteContext, err := r.makeSpanContextFromObject(ctx, owner, eventTime) if err != nil { return noTrace, err @@ -312,13 +325,14 @@ func (r *EventWatcher) runTicker() { } } -func (r *EventWatcher) initialize(scheme *runtime.Scheme) { +func (r *EventWatcher) initialize(scheme *runtime.Scheme, kubeClient dynamic.Interface, mapper meta.RESTMapper) { r.Lock() r.startTime = mtime.Now() r.scheme = scheme r.recent = newRecentInfoStore() r.resources = make(map[source]*resource.Resource) r.outgoing = newOutgoing() + r.watcher = newWatchManager(kubeClient, mapper) r.Unlock() go r.runTicker() } @@ -331,7 +345,16 @@ func (r *EventWatcher) stop() { // SetupWithManager to set up the watcher func (r *EventWatcher) SetupWithManager(mgr ctrl.Manager) error { - r.initialize(mgr.GetScheme()) + kubeClient, err := dynamic.NewForConfig(mgr.GetConfig()) + if err != nil { + return err + } + mapper, err := apiutil.NewDynamicRESTMapper(mgr.GetConfig()) + if err != nil { + return err + } + + r.initialize(mgr.GetScheme(), kubeClient, mapper) return ctrl.NewControllerManagedBy(mgr). For(&corev1.Event{}). Complete(r) diff --git a/controllers/events/event_controller_test.go b/controllers/events/event_controller_test.go index 8dfdfca..4c1547d 100644 --- a/controllers/events/event_controller_test.go +++ b/controllers/events/event_controller_test.go @@ -94,25 +94,32 @@ func Test2PodDeploymentRollout(t *testing.T) { filename: "testdata/deployment-2-pods.yaml", wantTraces: []string{ "0: kubectl-client-side-apply Deployment.Update ", - "1: deployment-controller Deployment.ScalingReplicaSet (0) Scaled up replica set px-5d567cc74c to 1", - "2: replicaset-controller ReplicaSet.SuccessfulCreate (1) Created pod: px-5d567cc74c-ss4lb", - "3: default-scheduler Pod.Scheduled (2) Successfully assigned default/px-5d567cc74c-ss4lb to kind-control-plane", - "4: kubelet Pod.Pulling (2) Pulling image \"ghcr.io/stefanprodan/podinfo:5.0.0\"", - "5: kubelet Pod.Pulled (2) Successfully pulled image \"ghcr.io/stefanprodan/podinfo:5.0.0\" in 5.870196872s", - "6: kubelet Pod.Created (2) Created container podinfo", - "7: kubelet Pod.Started (2) Started container podinfo", - "8: replicaset-controller ReplicaSet.SuccessfulDelete (0) Deleted pod: px-7df978b9bf-jm22q", - "9: kubelet Pod.Killing (8) Stopping container podinfo", - "10: deployment-controller Deployment.ScalingReplicaSet (0) Scaled down replica set px-7df978b9bf to 1", - "11: deployment-controller Deployment.ScalingReplicaSet (0) Scaled up replica set px-5d567cc74c to 2", - "12: replicaset-controller ReplicaSet.SuccessfulCreate (11) Created pod: px-5d567cc74c-pmvzr", - "13: kubelet Pod.Pulled (12) Container image \"ghcr.io/stefanprodan/podinfo:5.0.0\" already present on machine", - "14: kubelet Pod.Created (12) Created container podinfo", - "15: kubelet Pod.Started (12) Started container podinfo", - "16: default-scheduler Pod.Scheduled (12) Successfully assigned default/px-5d567cc74c-pmvzr to kind-control-plane", - "17: deployment-controller Deployment.ScalingReplicaSet (0) Scaled down replica set px-7df978b9bf to 0", - "18: replicaset-controller ReplicaSet.SuccessfulDelete (17) Deleted pod: px-7df978b9bf-bfdrj", - "19: kubelet Pod.Killing (18) Stopping container podinfo", + "1: kube-controller-manager Deployment.MinimumReplicasUnavailable (0) Deployment does not have minimum availability.", + "2: kube-controller-manager Deployment.ReplicaSetUpdated (0) ReplicaSet \"px-5f87d8856c\" is progressing.", + "3: deployment-controller Deployment.ScalingReplicaSet (0) Scaled up replica set px-5f87d8856c to 2", + "4: replicaset-controller ReplicaSet.SuccessfulCreate (3) Created pod: px-5f87d8856c-8f6bk", + // next one is 'unknown' because there is no entry in managedFields for this condition. + "5: unknown Pod.PodScheduled (4) PodScheduled True", + "6: default-scheduler Pod.Scheduled (4) Successfully assigned default/px-5f87d8856c-8f6bk to kind-control-plane", + "7: kubelet Pod.Pulling (4) Pulling image \"ghcr.io/stefanprodan/podinfo:5.1.1\"", + "8: kubelet Pod.Pulled (4) Successfully pulled image \"ghcr.io/stefanprodan/podinfo:5.1.1\" in 6.055782903s", + "9: kubelet Pod.Created (4) Created container podinfo", + "10: kubelet Pod.Started (4) Started container podinfo", + "11: kubelet Pod.Ready (4) Ready True", + "12: kubelet Pod.ContainersReady (4) ContainersReady True", + "13: replicaset-controller ReplicaSet.SuccessfulCreate (3) Created pod: px-5f87d8856c-c29hj", + "14: kubelet Pod.Initialized (13) Initialized True", + "15: kubelet Pod.ContainersNotReady (13) containers with unready status: [podinfo]", + "16: kubelet Pod.ContainersNotReady (13) containers with unready status: [podinfo]", + "17: kubelet Pod.PodScheduled (13) PodScheduled True", + "18: default-scheduler Pod.Scheduled (13) Successfully assigned default/px-5f87d8856c-c29hj to kind-control-plane", + "19: kubelet Pod.Pulling (13) Pulling image \"ghcr.io/stefanprodan/podinfo:5.1.1\"", + "20: kubelet Pod.Pulled (13) Successfully pulled image \"ghcr.io/stefanprodan/podinfo:5.1.1\" in 5.510339507s", + "21: kubelet Pod.Created (13) Created container podinfo", + "22: kubelet Pod.Started (13) Started container podinfo", + "23: kubelet Pod.Ready (13) Ready True", + "24: kubelet Pod.ContainersReady (13) ContainersReady True", + "25: kube-controller-manager Deployment.MinimumReplicasAvailable (0) Deployment has minimum availability.", }, }, } diff --git a/controllers/events/mocks_for_test.go b/controllers/events/mocks_for_test.go index a4273ae..69b05be 100644 --- a/controllers/events/mocks_for_test.go +++ b/controllers/events/mocks_for_test.go @@ -10,12 +10,32 @@ import ( tracesdk "go.opentelemetry.io/otel/sdk/export/trace" "go.opentelemetry.io/otel/semconv" "go.opentelemetry.io/otel/trace" + "k8s.io/apimachinery/pkg/api/meta" "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + dynamicFake "k8s.io/client-go/dynamic/fake" clientgoscheme "k8s.io/client-go/kubernetes/scheme" + "k8s.io/client-go/rest" + "sigs.k8s.io/controller-runtime/pkg/client/apiutil" "sigs.k8s.io/controller-runtime/pkg/client/fake" //nolint:staticcheck "sigs.k8s.io/controller-runtime/pkg/log/zap" ) +func newMockRESTMapper() meta.RESTMapper { + cfg := &rest.Config{} + mapper, _ := apiutil.NewDynamicRESTMapper(cfg, apiutil.WithCustomMapper(func() (meta.RESTMapper, error) { + baseMapper := meta.NewDefaultRESTMapper(nil) + // Add the object kinds that we use in fixtures. + baseMapper.Add(schema.GroupVersionKind{Group: "apps", Version: "v1", Kind: "Deployment"}, meta.RESTScopeNamespace) + baseMapper.Add(schema.GroupVersionKind{Group: "apps", Version: "v1", Kind: "ReplicaSet"}, meta.RESTScopeNamespace) + baseMapper.Add(schema.GroupVersionKind{Group: "apps", Version: "v1", Kind: "StatefulSet"}, meta.RESTScopeNamespace) + baseMapper.Add(schema.GroupVersionKind{Group: "", Version: "v1", Kind: "Pod"}, meta.RESTScopeNamespace) + + return baseMapper, nil + })) + return mapper +} + // Initialize an EventWatcher, context and logger ready for testing func newTestEventWatcher(initObjs ...runtime.Object) (context.Context, *EventWatcher, *fakeExporter, logr.Logger) { ctx := context.Background() @@ -32,7 +52,9 @@ func newTestEventWatcher(initObjs ...runtime.Object) (context.Context, *EventWat Exporter: exporter, } - r.initialize(scheme) + fakeDynamic := dynamicFake.NewSimpleDynamicClient(scheme) + mockRESTMapper := newMockRESTMapper() + r.initialize(scheme, fakeDynamic, mockRESTMapper) return ctx, r, exporter, log } diff --git a/controllers/events/pending.go b/controllers/events/pending.go index 6986fec..54201a0 100644 --- a/controllers/events/pending.go +++ b/controllers/events/pending.go @@ -106,7 +106,6 @@ func (r *EventWatcher) makeSpanContextFromEvent(ctx context.Context, client clie } return } - r.captureObject(involved, "initial") // See if we can map this object to a trace remoteContext, err = r.makeSpanContextFromObject(ctx, involved, eventTime(event)) diff --git a/controllers/events/playback.go b/controllers/events/playback.go index 2fb6527..9bfe631 100644 --- a/controllers/events/playback.go +++ b/controllers/events/playback.go @@ -134,6 +134,21 @@ func playback(ctx context.Context, r *EventWatcher, filename string) error { err = r.handleEvent(ctx, &ev) mtime.NowReset() return err + case "watch": + dec := yaml.NewYAMLToJSONDecoder(bytes.NewBuffer(doc)) + var u unstructured.Unstructured + err := dec.Decode(&u) + if err != nil { + return fmt.Errorf("error parsing: %v", err) + } + mtime.NowForce(details.Timestamp) + wi, err := r.watcher.getWatch(&u) + if err != nil { + return err + } + err = wi.checkConditionUpdates(&u, r) + mtime.NowReset() + return err default: return fmt.Errorf("style not recognized: %q", string(details.Style)) } diff --git a/controllers/events/testdata/deployment-2-pods.yaml b/controllers/events/testdata/deployment-2-pods.yaml index 7188e2a..7936898 100644 --- a/controllers/events/testdata/deployment-2-pods.yaml +++ b/controllers/events/testdata/deployment-2-pods.yaml @@ -1,21 +1,21 @@ --- -# {"time":"2021-05-19T09:42:58.640117041Z","style":"event","kind":"Event"} +# {"time":"2021-05-05T16:22:15.808165851Z","style":"event","kind":"Event"} apiVersion: v1 count: 1 eventTime: null -firstTimestamp: "2021-05-19T09:42:58Z" +firstTimestamp: "2021-05-05T16:22:15Z" involvedObject: apiVersion: apps/v1 kind: Deployment name: px namespace: default - resourceVersion: "5361638" + resourceVersion: "2852437" uid: 71c42017-61a7-418e-8e2c-897cf237d6e3 kind: Event -lastTimestamp: "2021-05-19T09:42:58Z" -message: Scaled up replica set px-5d567cc74c to 1 +lastTimestamp: "2021-05-05T16:22:15Z" +message: Scaled up replica set px-5f87d8856c to 2 metadata: - creationTimestamp: "2021-05-19T09:42:58Z" + creationTimestamp: "2021-05-05T16:22:15Z" managedFields: - apiVersion: v1 fieldsType: FieldsV1 @@ -37,12 +37,12 @@ metadata: f:type: {} manager: kube-controller-manager operation: Update - time: "2021-05-19T09:42:58Z" - name: px.16806e83e5b82d63 + time: "2021-05-05T16:22:15Z" + name: px.167c382de9cb6e93 namespace: default - resourceVersion: "5361642" - selfLink: /api/v1/namespaces/default/events/px.16806e83e5b82d63 - uid: e8acdb85-7a28-4ce1-9c5d-1d89467a17b6 + resourceVersion: "2852440" + selfLink: /api/v1/namespaces/default/events/px.167c382de9cb6e93 + uid: 535f12a0-78a9-474c-aa0a-c846844d3d66 reason: ScalingReplicaSet reportingComponent: "" reportingInstance: "" @@ -50,19 +50,19 @@ source: component: deployment-controller type: Normal --- -# {"time":"2021-05-19T09:42:58.650959062Z","style":"initial","kind":"ReplicaSet"} +# {"time":"2021-05-05T16:22:15.817719479Z","style":"initial","kind":"ReplicaSet"} apiVersion: apps/v1 kind: ReplicaSet metadata: annotations: deployment.kubernetes.io/desired-replicas: "2" deployment.kubernetes.io/max-replicas: "3" - deployment.kubernetes.io/revision: "3" - creationTimestamp: "2021-05-19T09:42:58Z" + deployment.kubernetes.io/revision: "1" + creationTimestamp: "2021-05-05T16:22:15Z" generation: 1 labels: app: podinfo - pod-template-hash: 5d567cc74c + pod-template-hash: 5f87d8856c managedFields: - apiVersion: apps/v1 fieldsType: FieldsV1 @@ -115,12 +115,10 @@ metadata: f:schedulerName: {} f:securityContext: {} f:terminationGracePeriodSeconds: {} - f:status: - f:observedGeneration: {} manager: kube-controller-manager operation: Update - time: "2021-05-19T09:42:58Z" - name: px-5d567cc74c + time: "2021-05-05T16:22:15Z" + name: px-5f87d8856c namespace: default ownerReferences: - apiVersion: apps/v1 @@ -129,24 +127,24 @@ metadata: kind: Deployment name: px uid: 71c42017-61a7-418e-8e2c-897cf237d6e3 - resourceVersion: "5361644" - selfLink: /apis/apps/v1/namespaces/default/replicasets/px-5d567cc74c - uid: 0d562fec-2485-4f88-b09e-596783c0d0a2 + resourceVersion: "2852438" + selfLink: /apis/apps/v1/namespaces/default/replicasets/px-5f87d8856c + uid: 9b7a04bf-811e-483e-826e-82c7b9e81ca7 spec: - replicas: 1 + replicas: 2 selector: matchLabels: app: podinfo - pod-template-hash: 5d567cc74c + pod-template-hash: 5f87d8856c template: metadata: creationTimestamp: null labels: app: podinfo - pod-template-hash: 5d567cc74c + pod-template-hash: 5f87d8856c spec: containers: - - image: ghcr.io/stefanprodan/podinfo:5.0.0 + - image: ghcr.io/stefanprodan/podinfo:5.1.1 imagePullPolicy: IfNotPresent name: podinfo resources: {} @@ -158,19 +156,18 @@ spec: securityContext: {} terminationGracePeriodSeconds: 30 status: - observedGeneration: 1 replicas: 0 --- -# {"time":"2021-05-19T09:42:58.655577144Z","style":"initial","kind":"Deployment"} +# {"time":"2021-05-05T16:22:15.831578925Z","style":"initial","kind":"Deployment"} apiVersion: apps/v1 kind: Deployment metadata: annotations: - deployment.kubernetes.io/revision: "3" + deployment.kubernetes.io/revision: "1" kubectl.kubernetes.io/last-applied-configuration: | - {"apiVersion":"apps/v1","kind":"Deployment","metadata":{"annotations":{},"name":"px","namespace":"default"},"spec":{"replicas":2,"selector":{"matchLabels":{"app":"podinfo"}},"template":{"metadata":{"labels":{"app":"podinfo"}},"spec":{"containers":[{"image":"ghcr.io/stefanprodan/podinfo:5.0.0","name":"podinfo"}]}}}} + {"apiVersion":"apps/v1","kind":"Deployment","metadata":{"annotations":{},"name":"px","namespace":"default"},"spec":{"replicas":2,"selector":{"matchLabels":{"app":"podinfo"}},"template":{"metadata":{"labels":{"app":"podinfo"}},"spec":{"containers":[{"image":"ghcr.io/stefanprodan/podinfo:5.1.1","name":"podinfo"}]}}}} creationTimestamp: "2021-05-05T16:22:15Z" - generation: 3 + generation: 1 managedFields: - apiVersion: apps/v1 fieldsType: FieldsV1 @@ -179,7 +176,6 @@ metadata: f:annotations: f:deployment.kubernetes.io/revision: {} f:status: - f:availableReplicas: {} f:conditions: .: {} k:{"type":"Available"}: @@ -199,12 +195,10 @@ metadata: f:status: {} f:type: {} f:observedGeneration: {} - f:readyReplicas: {} - f:replicas: {} f:unavailableReplicas: {} manager: kube-controller-manager operation: Update - time: "2021-05-19T09:42:58Z" + time: "2021-05-05T16:22:15Z" - apiVersion: apps/v1 fieldsType: FieldsV1 fieldsV1: @@ -248,10 +242,10 @@ metadata: f:terminationGracePeriodSeconds: {} manager: kubectl-client-side-apply operation: Update - time: "2021-05-19T09:42:58Z" + time: "2021-05-05T16:22:15Z" name: px namespace: default - resourceVersion: "5361645" + resourceVersion: "2852444" selfLink: /apis/apps/v1/namespaces/default/deployments/px uid: 71c42017-61a7-418e-8e2c-897cf237d6e3 spec: @@ -273,7 +267,7 @@ spec: app: podinfo spec: containers: - - image: ghcr.io/stefanprodan/podinfo:5.0.0 + - image: ghcr.io/stefanprodan/podinfo:5.1.1 imagePullPolicy: IfNotPresent name: podinfo resources: {} @@ -285,42 +279,39 @@ spec: securityContext: {} terminationGracePeriodSeconds: 30 status: - availableReplicas: 2 conditions: - - lastTransitionTime: "2021-05-05T16:22:23Z" - lastUpdateTime: "2021-05-05T16:22:23Z" - message: Deployment has minimum availability. - reason: MinimumReplicasAvailable - status: "True" - type: Available - lastTransitionTime: "2021-05-05T16:22:15Z" - lastUpdateTime: "2021-05-19T09:42:58Z" - message: Created new replica set "px-5d567cc74c" + lastUpdateTime: "2021-05-05T16:22:15Z" + message: Created new replica set "px-5f87d8856c" reason: NewReplicaSetCreated status: "True" type: Progressing - observedGeneration: 3 - readyReplicas: 2 - replicas: 2 - unavailableReplicas: 1 + - lastTransitionTime: "2021-05-05T16:22:15Z" + lastUpdateTime: "2021-05-05T16:22:15Z" + message: Deployment does not have minimum availability. + reason: MinimumReplicasUnavailable + status: "False" + type: Available + observedGeneration: 1 + unavailableReplicas: 2 --- -# {"time":"2021-05-19T09:42:58.656696998Z","style":"event","kind":"Event"} +# {"time":"2021-05-05T16:22:15.833205872Z","style":"event","kind":"Event"} apiVersion: v1 count: 1 eventTime: null -firstTimestamp: "2021-05-19T09:42:58Z" +firstTimestamp: "2021-05-05T16:22:15Z" involvedObject: apiVersion: apps/v1 kind: ReplicaSet - name: px-5d567cc74c + name: px-5f87d8856c namespace: default - resourceVersion: "5361639" - uid: 0d562fec-2485-4f88-b09e-596783c0d0a2 + resourceVersion: "2852438" + uid: 9b7a04bf-811e-483e-826e-82c7b9e81ca7 kind: Event -lastTimestamp: "2021-05-19T09:42:58Z" -message: 'Created pod: px-5d567cc74c-ss4lb' +lastTimestamp: "2021-05-05T16:22:15Z" +message: 'Created pod: px-5f87d8856c-8f6bk' metadata: - creationTimestamp: "2021-05-19T09:42:58Z" + creationTimestamp: "2021-05-05T16:22:15Z" managedFields: - apiVersion: v1 fieldsType: FieldsV1 @@ -342,12 +333,12 @@ metadata: f:type: {} manager: kube-controller-manager operation: Update - time: "2021-05-19T09:42:58Z" - name: px-5d567cc74c.16806e83e61d2e11 + time: "2021-05-05T16:22:15Z" + name: px-5f87d8856c.167c382deae0542a namespace: default - resourceVersion: "5361646" - selfLink: /api/v1/namespaces/default/events/px-5d567cc74c.16806e83e61d2e11 - uid: 487fd125-37da-4f78-aff7-914868d6ee16 + resourceVersion: "2852443" + selfLink: /api/v1/namespaces/default/events/px-5f87d8856c.167c382deae0542a + uid: bfc72744-0951-4013-bfbf-32c374d448cf reason: SuccessfulCreate reportingComponent: "" reportingInstance: "" @@ -355,15 +346,15 @@ source: component: replicaset-controller type: Normal --- -# {"time":"2021-05-19T09:42:58.664843487Z","style":"initial","kind":"Pod"} +# {"time":"2021-05-05T16:22:15.845590129Z","style":"initial","kind":"Pod"} apiVersion: v1 kind: Pod metadata: - creationTimestamp: "2021-05-19T09:42:58Z" - generateName: px-5d567cc74c- + creationTimestamp: "2021-05-05T16:22:15Z" + generateName: px-5f87d8856c- labels: app: podinfo - pod-template-hash: 5d567cc74c + pod-template-hash: 5f87d8856c managedFields: - apiVersion: v1 fieldsType: FieldsV1 @@ -376,7 +367,7 @@ metadata: f:pod-template-hash: {} f:ownerReferences: .: {} - k:{"uid":"0d562fec-2485-4f88-b09e-596783c0d0a2"}: + k:{"uid":"9b7a04bf-811e-483e-826e-82c7b9e81ca7"}: .: {} f:apiVersion: {} f:blockOwnerDeletion: {} @@ -402,22 +393,22 @@ metadata: f:terminationGracePeriodSeconds: {} manager: kube-controller-manager operation: Update - time: "2021-05-19T09:42:58Z" - name: px-5d567cc74c-ss4lb + time: "2021-05-05T16:22:15Z" + name: px-5f87d8856c-8f6bk namespace: default ownerReferences: - apiVersion: apps/v1 blockOwnerDeletion: true controller: true kind: ReplicaSet - name: px-5d567cc74c - uid: 0d562fec-2485-4f88-b09e-596783c0d0a2 - resourceVersion: "5361643" - selfLink: /api/v1/namespaces/default/pods/px-5d567cc74c-ss4lb - uid: 18eddc1d-87e8-4f02-8a13-f1e52db52e61 + name: px-5f87d8856c + uid: 9b7a04bf-811e-483e-826e-82c7b9e81ca7 + resourceVersion: "2852441" + selfLink: /api/v1/namespaces/default/pods/px-5f87d8856c-8f6bk + uid: cdf6bfe3-ee3e-4c1b-9b9b-44ddc5230bff spec: containers: - - image: ghcr.io/stefanprodan/podinfo:5.0.0 + - image: ghcr.io/stefanprodan/podinfo:5.1.1 imagePullPolicy: IfNotPresent name: podinfo resources: {} @@ -429,7 +420,6 @@ spec: readOnly: true dnsPolicy: ClusterFirst enableServiceLinks: true - nodeName: kind-control-plane preemptionPolicy: PreemptLowerPriority priority: 0 restartPolicy: Always @@ -453,81 +443,132 @@ spec: defaultMode: 420 secretName: default-token-kx75m status: - conditions: - - lastProbeTime: null - lastTransitionTime: "2021-05-19T09:42:58Z" - status: "True" - type: PodScheduled phase: Pending qosClass: BestEffort --- -# {"time":"2021-05-19T09:42:58.675382292Z","style":"event","kind":"Event"} -action: Binding +# {"time":"2021-05-05T16:22:15.857177422Z","style":"watch","kind":"Pod"} apiVersion: v1 -eventTime: "2021-05-19T09:42:58.638469Z" -firstTimestamp: null -involvedObject: - apiVersion: v1 - kind: Pod - name: px-5d567cc74c-ss4lb - namespace: default - resourceVersion: "5361641" - uid: 18eddc1d-87e8-4f02-8a13-f1e52db52e61 -kind: Event -lastTimestamp: null -message: Successfully assigned default/px-5d567cc74c-ss4lb to kind-control-plane +kind: Pod metadata: - creationTimestamp: "2021-05-19T09:42:58Z" + creationTimestamp: "2021-05-05T16:22:15Z" + generateName: px-5f87d8856c- + labels: + app: podinfo + pod-template-hash: 5f87d8856c managedFields: - - apiVersion: events.k8s.io/v1 + - apiVersion: v1 fieldsType: FieldsV1 fieldsV1: - f:action: {} - f:eventTime: {} - f:note: {} - f:reason: {} - f:regarding: - f:apiVersion: {} - f:kind: {} - f:name: {} - f:namespace: {} - f:resourceVersion: {} - f:uid: {} - f:reportingController: {} - f:reportingInstance: {} - f:type: {} - manager: kube-scheduler + f:metadata: + f:generateName: {} + f:labels: + .: {} + f:app: {} + f:pod-template-hash: {} + f:ownerReferences: + .: {} + k:{"uid":"9b7a04bf-811e-483e-826e-82c7b9e81ca7"}: + .: {} + f:apiVersion: {} + f:blockOwnerDeletion: {} + f:controller: {} + f:kind: {} + f:name: {} + f:uid: {} + f:spec: + f:containers: + k:{"name":"podinfo"}: + .: {} + f:image: {} + f:imagePullPolicy: {} + f:name: {} + f:resources: {} + f:terminationMessagePath: {} + f:terminationMessagePolicy: {} + f:dnsPolicy: {} + f:enableServiceLinks: {} + f:restartPolicy: {} + f:schedulerName: {} + f:securityContext: {} + f:terminationGracePeriodSeconds: {} + manager: kube-controller-manager operation: Update - time: "2021-05-19T09:42:58Z" - name: px-5d567cc74c-ss4lb.16806e83e6642682 + time: "2021-05-05T16:22:15Z" + name: px-5f87d8856c-8f6bk namespace: default - resourceVersion: "5361647" - selfLink: /api/v1/namespaces/default/events/px-5d567cc74c-ss4lb.16806e83e6642682 - uid: 264fc251-9856-4f85-b282-5306c9baa65d -reason: Scheduled -reportingComponent: default-scheduler -reportingInstance: default-scheduler-kind-control-plane -source: {} -type: Normal + ownerReferences: + - apiVersion: apps/v1 + blockOwnerDeletion: true + controller: true + kind: ReplicaSet + name: px-5f87d8856c + uid: 9b7a04bf-811e-483e-826e-82c7b9e81ca7 + resourceVersion: "2852448" + selfLink: /api/v1/namespaces/default/pods/px-5f87d8856c-8f6bk + uid: cdf6bfe3-ee3e-4c1b-9b9b-44ddc5230bff +spec: + containers: + - image: ghcr.io/stefanprodan/podinfo:5.1.1 + imagePullPolicy: IfNotPresent + name: podinfo + resources: {} + terminationMessagePath: /dev/termination-log + terminationMessagePolicy: File + volumeMounts: + - mountPath: /var/run/secrets/kubernetes.io/serviceaccount + name: default-token-kx75m + readOnly: true + dnsPolicy: ClusterFirst + enableServiceLinks: true + nodeName: kind-control-plane + preemptionPolicy: PreemptLowerPriority + priority: 0 + restartPolicy: Always + schedulerName: default-scheduler + securityContext: {} + serviceAccount: default + serviceAccountName: default + terminationGracePeriodSeconds: 30 + tolerations: + - effect: NoExecute + key: node.kubernetes.io/not-ready + operator: Exists + tolerationSeconds: 300 + - effect: NoExecute + key: node.kubernetes.io/unreachable + operator: Exists + tolerationSeconds: 300 + volumes: + - name: default-token-kx75m + secret: + defaultMode: 420 + secretName: default-token-kx75m +status: + conditions: + - lastProbeTime: null + lastTransitionTime: "2021-05-05T16:22:15Z" + status: "True" + type: PodScheduled + phase: Pending + qosClass: BestEffort --- -# {"time":"2021-05-19T09:42:59.20271856Z","style":"event","kind":"Event"} +# {"time":"2021-05-05T16:22:15.860620081Z","style":"event","kind":"Event"} apiVersion: v1 count: 1 eventTime: null -firstTimestamp: "2021-05-19T09:42:59Z" +firstTimestamp: "2021-05-05T16:22:15Z" involvedObject: - apiVersion: v1 - fieldPath: spec.containers{podinfo} - kind: Pod - name: px-5d567cc74c-ss4lb + apiVersion: apps/v1 + kind: ReplicaSet + name: px-5f87d8856c namespace: default - resourceVersion: "5361643" - uid: 18eddc1d-87e8-4f02-8a13-f1e52db52e61 + resourceVersion: "2852438" + uid: 9b7a04bf-811e-483e-826e-82c7b9e81ca7 kind: Event -lastTimestamp: "2021-05-19T09:42:59Z" -message: Pulling image "ghcr.io/stefanprodan/podinfo:5.0.0" +lastTimestamp: "2021-05-05T16:22:15Z" +message: 'Created pod: px-5f87d8856c-c29hj' metadata: - creationTimestamp: "2021-05-19T09:42:59Z" + creationTimestamp: "2021-05-05T16:22:15Z" managedFields: - apiVersion: v1 fieldsType: FieldsV1 @@ -536,7 +577,6 @@ metadata: f:firstTimestamp: {} f:involvedObject: f:apiVersion: {} - f:fieldPath: {} f:kind: {} f:name: {} f:namespace: {} @@ -547,251 +587,172 @@ metadata: f:reason: {} f:source: f:component: {} - f:host: {} f:type: {} - manager: kubelet + manager: kube-controller-manager operation: Update - time: "2021-05-19T09:42:59Z" - name: px-5d567cc74c-ss4lb.16806e8407b4b2a2 + time: "2021-05-05T16:22:15Z" + name: px-5f87d8856c.167c382deb4f867d namespace: default - resourceVersion: "5361653" - selfLink: /api/v1/namespaces/default/events/px-5d567cc74c-ss4lb.16806e8407b4b2a2 - uid: 8d24b1a4-c688-411c-9bea-ecfe0dea987c -reason: Pulling + resourceVersion: "2852445" + selfLink: /api/v1/namespaces/default/events/px-5f87d8856c.167c382deb4f867d + uid: 2b5e2981-36c0-405f-9cad-a94df41d789e +reason: SuccessfulCreate reportingComponent: "" reportingInstance: "" source: - component: kubelet - host: kind-control-plane + component: replicaset-controller type: Normal --- -# {"time":"2021-05-19T09:43:05.070173525Z","style":"event","kind":"Event"} -apiVersion: v1 -count: 1 -eventTime: null -firstTimestamp: "2021-05-19T09:43:05Z" -involvedObject: - apiVersion: v1 - fieldPath: spec.containers{podinfo} - kind: Pod - name: px-5d567cc74c-ss4lb - namespace: default - resourceVersion: "5361643" - uid: 18eddc1d-87e8-4f02-8a13-f1e52db52e61 -kind: Event -lastTimestamp: "2021-05-19T09:43:05Z" -message: Successfully pulled image "ghcr.io/stefanprodan/podinfo:5.0.0" in 5.870196872s +# {"time":"2021-05-05T16:22:15.86511964Z","style":"watch","kind":"Deployment"} +apiVersion: apps/v1 +kind: Deployment metadata: - creationTimestamp: "2021-05-19T09:43:05Z" + annotations: + deployment.kubernetes.io/revision: "1" + kubectl.kubernetes.io/last-applied-configuration: | + {"apiVersion":"apps/v1","kind":"Deployment","metadata":{"annotations":{},"name":"px","namespace":"default"},"spec":{"replicas":2,"selector":{"matchLabels":{"app":"podinfo"}},"template":{"metadata":{"labels":{"app":"podinfo"}},"spec":{"containers":[{"image":"ghcr.io/stefanprodan/podinfo:5.1.1","name":"podinfo"}]}}}} + creationTimestamp: "2021-05-05T16:22:15Z" + generation: 1 managedFields: - - apiVersion: v1 + - apiVersion: apps/v1 fieldsType: FieldsV1 fieldsV1: - f:count: {} - f:firstTimestamp: {} - f:involvedObject: - f:apiVersion: {} - f:fieldPath: {} - f:kind: {} - f:name: {} - f:namespace: {} - f:resourceVersion: {} - f:uid: {} - f:lastTimestamp: {} - f:message: {} - f:reason: {} - f:source: - f:component: {} - f:host: {} - f:type: {} - manager: kubelet + f:metadata: + f:annotations: + f:deployment.kubernetes.io/revision: {} + f:status: + f:conditions: + .: {} + k:{"type":"Available"}: + .: {} + f:lastTransitionTime: {} + f:lastUpdateTime: {} + f:message: {} + f:reason: {} + f:status: {} + f:type: {} + k:{"type":"Progressing"}: + .: {} + f:lastTransitionTime: {} + f:lastUpdateTime: {} + f:message: {} + f:reason: {} + f:status: {} + f:type: {} + f:observedGeneration: {} + f:replicas: {} + f:unavailableReplicas: {} + f:updatedReplicas: {} + manager: kube-controller-manager operation: Update - time: "2021-05-19T09:43:05Z" - name: px-5d567cc74c-ss4lb.16806e856598efd4 - namespace: default - resourceVersion: "5361669" - selfLink: /api/v1/namespaces/default/events/px-5d567cc74c-ss4lb.16806e856598efd4 - uid: ee3767ba-caae-4d37-a7d5-4e0975d0d327 -reason: Pulled -reportingComponent: "" -reportingInstance: "" -source: - component: kubelet - host: kind-control-plane -type: Normal ---- -# {"time":"2021-05-19T09:43:05.278784076Z","style":"event","kind":"Event"} -apiVersion: v1 -count: 1 -eventTime: null -firstTimestamp: "2021-05-19T09:43:05Z" -involvedObject: - apiVersion: v1 - fieldPath: spec.containers{podinfo} - kind: Pod - name: px-5d567cc74c-ss4lb - namespace: default - resourceVersion: "5361643" - uid: 18eddc1d-87e8-4f02-8a13-f1e52db52e61 -kind: Event -lastTimestamp: "2021-05-19T09:43:05Z" -message: Created container podinfo -metadata: - creationTimestamp: "2021-05-19T09:43:05Z" - managedFields: - - apiVersion: v1 + time: "2021-05-05T16:22:15Z" + - apiVersion: apps/v1 fieldsType: FieldsV1 fieldsV1: - f:count: {} - f:firstTimestamp: {} - f:involvedObject: - f:apiVersion: {} - f:fieldPath: {} - f:kind: {} - f:name: {} - f:namespace: {} - f:resourceVersion: {} - f:uid: {} - f:lastTimestamp: {} - f:message: {} - f:reason: {} - f:source: - f:component: {} - f:host: {} - f:type: {} - manager: kubelet - operation: Update - time: "2021-05-19T09:43:05Z" - name: px-5d567cc74c-ss4lb.16806e8572001c74 - namespace: default - resourceVersion: "5361670" - selfLink: /api/v1/namespaces/default/events/px-5d567cc74c-ss4lb.16806e8572001c74 - uid: 68fe3453-bea6-4998-8fca-c64776de2ce5 -reason: Created -reportingComponent: "" -reportingInstance: "" -source: - component: kubelet - host: kind-control-plane -type: Normal ---- -# {"time":"2021-05-19T09:43:05.385591121Z","style":"event","kind":"Event"} -apiVersion: v1 -count: 1 -eventTime: null -firstTimestamp: "2021-05-19T09:43:05Z" -involvedObject: - apiVersion: v1 - fieldPath: spec.containers{podinfo} - kind: Pod - name: px-5d567cc74c-ss4lb - namespace: default - resourceVersion: "5361643" - uid: 18eddc1d-87e8-4f02-8a13-f1e52db52e61 -kind: Event -lastTimestamp: "2021-05-19T09:43:05Z" -message: Started container podinfo -metadata: - creationTimestamp: "2021-05-19T09:43:05Z" - managedFields: - - apiVersion: v1 - fieldsType: FieldsV1 - fieldsV1: - f:count: {} - f:firstTimestamp: {} - f:involvedObject: - f:apiVersion: {} - f:fieldPath: {} - f:kind: {} - f:name: {} - f:namespace: {} - f:resourceVersion: {} - f:uid: {} - f:lastTimestamp: {} - f:message: {} - f:reason: {} - f:source: - f:component: {} - f:host: {} - f:type: {} - manager: kubelet - operation: Update - time: "2021-05-19T09:43:05Z" - name: px-5d567cc74c-ss4lb.16806e857858a068 - namespace: default - resourceVersion: "5361671" - selfLink: /api/v1/namespaces/default/events/px-5d567cc74c-ss4lb.16806e857858a068 - uid: ff6a4c2b-37af-45aa-9604-69e0f1711001 -reason: Started -reportingComponent: "" -reportingInstance: "" -source: - component: kubelet - host: kind-control-plane -type: Normal ---- -# {"time":"2021-05-19T09:43:06.201341985Z","style":"event","kind":"Event"} -apiVersion: v1 -count: 1 -eventTime: null -firstTimestamp: "2021-05-19T09:43:06Z" -involvedObject: - apiVersion: apps/v1 - kind: ReplicaSet - name: px-7df978b9bf - namespace: default - resourceVersion: "5361678" - uid: e8a3abe0-ab69-48f7-9d18-6c0d6c562aab -kind: Event -lastTimestamp: "2021-05-19T09:43:06Z" -message: 'Deleted pod: px-7df978b9bf-jm22q' -metadata: - creationTimestamp: "2021-05-19T09:43:06Z" - managedFields: - - apiVersion: v1 - fieldsType: FieldsV1 - fieldsV1: - f:count: {} - f:firstTimestamp: {} - f:involvedObject: - f:apiVersion: {} - f:kind: {} - f:name: {} - f:namespace: {} - f:resourceVersion: {} - f:uid: {} - f:lastTimestamp: {} - f:message: {} - f:reason: {} - f:source: - f:component: {} - f:type: {} - manager: kube-controller-manager + f:metadata: + f:annotations: + .: {} + f:kubectl.kubernetes.io/last-applied-configuration: {} + f:spec: + f:progressDeadlineSeconds: {} + f:replicas: {} + f:revisionHistoryLimit: {} + f:selector: + f:matchLabels: + .: {} + f:app: {} + f:strategy: + f:rollingUpdate: + .: {} + f:maxSurge: {} + f:maxUnavailable: {} + f:type: {} + f:template: + f:metadata: + f:labels: + .: {} + f:app: {} + f:spec: + f:containers: + k:{"name":"podinfo"}: + .: {} + f:image: {} + f:imagePullPolicy: {} + f:name: {} + f:resources: {} + f:terminationMessagePath: {} + f:terminationMessagePolicy: {} + f:dnsPolicy: {} + f:restartPolicy: {} + f:schedulerName: {} + f:securityContext: {} + f:terminationGracePeriodSeconds: {} + manager: kubectl-client-side-apply operation: Update - time: "2021-05-19T09:43:06Z" - name: px-7df978b9bf.16806e85a8636752 + time: "2021-05-05T16:22:15Z" + name: px namespace: default - resourceVersion: "5361682" - selfLink: /api/v1/namespaces/default/events/px-7df978b9bf.16806e85a8636752 - uid: 009a57af-14cb-4110-9f1b-28737fa14f5b -reason: SuccessfulDelete -reportingComponent: "" -reportingInstance: "" -source: - component: replicaset-controller -type: Normal + resourceVersion: "2852450" + selfLink: /apis/apps/v1/namespaces/default/deployments/px + uid: 71c42017-61a7-418e-8e2c-897cf237d6e3 +spec: + progressDeadlineSeconds: 600 + replicas: 2 + revisionHistoryLimit: 10 + selector: + matchLabels: + app: podinfo + strategy: + rollingUpdate: + maxSurge: 25% + maxUnavailable: 25% + type: RollingUpdate + template: + metadata: + creationTimestamp: null + labels: + app: podinfo + spec: + containers: + - image: ghcr.io/stefanprodan/podinfo:5.1.1 + imagePullPolicy: IfNotPresent + name: podinfo + resources: {} + terminationMessagePath: /dev/termination-log + terminationMessagePolicy: File + dnsPolicy: ClusterFirst + restartPolicy: Always + schedulerName: default-scheduler + securityContext: {} + terminationGracePeriodSeconds: 30 +status: + conditions: + - lastTransitionTime: "2021-05-05T16:22:15Z" + lastUpdateTime: "2021-05-05T16:22:15Z" + message: Deployment does not have minimum availability. + reason: MinimumReplicasUnavailable + status: "False" + type: Available + - lastTransitionTime: "2021-05-05T16:22:15Z" + lastUpdateTime: "2021-05-05T16:22:15Z" + message: ReplicaSet "px-5f87d8856c" is progressing. + reason: ReplicaSetUpdated + status: "True" + type: Progressing + observedGeneration: 1 + replicas: 2 + unavailableReplicas: 2 + updatedReplicas: 2 --- -# {"time":"2021-05-19T09:43:06.205375953Z","style":"initial","kind":"Pod"} +# {"time":"2021-05-05T16:22:15.882039335Z","style":"initial","kind":"Pod"} apiVersion: v1 kind: Pod metadata: - creationTimestamp: "2021-05-18T17:10:50Z" - deletionGracePeriodSeconds: 30 - deletionTimestamp: "2021-05-19T09:43:36Z" - generateName: px-7df978b9bf- + creationTimestamp: "2021-05-05T16:22:15Z" + generateName: px-5f87d8856c- labels: app: podinfo - pod-template-hash: 7df978b9bf + pod-template-hash: 5f87d8856c managedFields: - apiVersion: v1 fieldsType: FieldsV1 @@ -804,7 +765,7 @@ metadata: f:pod-template-hash: {} f:ownerReferences: .: {} - k:{"uid":"e8a3abe0-ab69-48f7-9d18-6c0d6c562aab"}: + k:{"uid":"9b7a04bf-811e-483e-826e-82c7b9e81ca7"}: .: {} f:apiVersion: {} f:blockOwnerDeletion: {} @@ -830,58 +791,22 @@ metadata: f:terminationGracePeriodSeconds: {} manager: kube-controller-manager operation: Update - time: "2021-05-18T17:10:50Z" - - apiVersion: v1 - fieldsType: FieldsV1 - fieldsV1: - f:status: - f:conditions: - k:{"type":"ContainersReady"}: - .: {} - f:lastProbeTime: {} - f:lastTransitionTime: {} - f:status: {} - f:type: {} - k:{"type":"Initialized"}: - .: {} - f:lastProbeTime: {} - f:lastTransitionTime: {} - f:status: {} - f:type: {} - k:{"type":"Ready"}: - .: {} - f:lastProbeTime: {} - f:lastTransitionTime: {} - f:status: {} - f:type: {} - f:containerStatuses: {} - f:hostIP: {} - f:phase: {} - f:podIP: {} - f:podIPs: - .: {} - k:{"ip":"10.244.0.8"}: - .: {} - f:ip: {} - f:startTime: {} - manager: kubelet - operation: Update - time: "2021-05-18T17:10:51Z" - name: px-7df978b9bf-jm22q + time: "2021-05-05T16:22:15Z" + name: px-5f87d8856c-c29hj namespace: default ownerReferences: - apiVersion: apps/v1 blockOwnerDeletion: true controller: true kind: ReplicaSet - name: px-7df978b9bf - uid: e8a3abe0-ab69-48f7-9d18-6c0d6c562aab - resourceVersion: "5361679" - selfLink: /api/v1/namespaces/default/pods/px-7df978b9bf-jm22q - uid: ac780302-1895-43b1-89e0-80f85c8e5457 + name: px-5f87d8856c + uid: 9b7a04bf-811e-483e-826e-82c7b9e81ca7 + resourceVersion: "2852449" + selfLink: /api/v1/namespaces/default/pods/px-5f87d8856c-c29hj + uid: 2d2ae783-5bc3-46ae-9f2b-a89aa0fdbcf7 spec: containers: - - image: ghcr.io/stefanprodan/podinfo:5.1.3 + - image: ghcr.io/stefanprodan/podinfo:5.1.1 imagePullPolicy: IfNotPresent name: podinfo resources: {} @@ -919,376 +844,287 @@ spec: status: conditions: - lastProbeTime: null - lastTransitionTime: "2021-05-18T17:10:50Z" - status: "True" - type: Initialized - - lastProbeTime: null - lastTransitionTime: "2021-05-18T17:10:51Z" - status: "True" - type: Ready - - lastProbeTime: null - lastTransitionTime: "2021-05-18T17:10:51Z" - status: "True" - type: ContainersReady - - lastProbeTime: null - lastTransitionTime: "2021-05-18T17:10:50Z" + lastTransitionTime: "2021-05-05T16:22:15Z" status: "True" type: PodScheduled - containerStatuses: - - containerID: containerd://4f0072b3f51e88b2da583f0fc039968865ae60c60a81452a37828f6238a2e359 - image: ghcr.io/stefanprodan/podinfo:5.1.3 - imageID: ghcr.io/stefanprodan/podinfo@sha256:1cf7ad3ac4b7fc05773ec5deebbdf325566ee04483390688e09b53163ebb5bfd - lastState: {} - name: podinfo - ready: true - restartCount: 0 - started: true - state: - running: - startedAt: "2021-05-18T17:10:51Z" - hostIP: 172.18.0.2 - phase: Running - podIP: 10.244.0.8 - podIPs: - - ip: 10.244.0.8 + phase: Pending qosClass: BestEffort - startTime: "2021-05-18T17:10:50Z" --- -# {"time":"2021-05-19T09:43:06.225314506Z","style":"initial","kind":"ReplicaSet"} -apiVersion: apps/v1 -kind: ReplicaSet -metadata: - annotations: - deployment.kubernetes.io/desired-replicas: "2" - deployment.kubernetes.io/max-replicas: "3" - deployment.kubernetes.io/revision: "2" - creationTimestamp: "2021-05-18T17:10:49Z" - generation: 3 - labels: - app: podinfo - pod-template-hash: 7df978b9bf - managedFields: - - apiVersion: apps/v1 - fieldsType: FieldsV1 - fieldsV1: - f:metadata: - f:annotations: - .: {} - f:deployment.kubernetes.io/desired-replicas: {} - f:deployment.kubernetes.io/max-replicas: {} - f:deployment.kubernetes.io/revision: {} - f:labels: - .: {} - f:app: {} - f:pod-template-hash: {} - f:ownerReferences: - .: {} - k:{"uid":"71c42017-61a7-418e-8e2c-897cf237d6e3"}: - .: {} - f:apiVersion: {} - f:blockOwnerDeletion: {} - f:controller: {} - f:kind: {} - f:name: {} - f:uid: {} - f:spec: - f:replicas: {} - f:selector: - f:matchLabels: - .: {} - f:app: {} - f:pod-template-hash: {} - f:template: - f:metadata: - f:labels: - .: {} - f:app: {} - f:pod-template-hash: {} - f:spec: - f:containers: - k:{"name":"podinfo"}: - .: {} - f:image: {} - f:imagePullPolicy: {} - f:name: {} - f:resources: {} - f:terminationMessagePath: {} - f:terminationMessagePolicy: {} - f:dnsPolicy: {} - f:restartPolicy: {} - f:schedulerName: {} - f:securityContext: {} - f:terminationGracePeriodSeconds: {} - f:status: - f:availableReplicas: {} - f:fullyLabeledReplicas: {} - f:observedGeneration: {} - f:readyReplicas: {} - f:replicas: {} - manager: kube-controller-manager - operation: Update - time: "2021-05-19T09:43:06Z" - name: px-7df978b9bf - namespace: default - ownerReferences: - - apiVersion: apps/v1 - blockOwnerDeletion: true - controller: true - kind: Deployment - name: px - uid: 71c42017-61a7-418e-8e2c-897cf237d6e3 - resourceVersion: "5361680" - selfLink: /apis/apps/v1/namespaces/default/replicasets/px-7df978b9bf - uid: e8a3abe0-ab69-48f7-9d18-6c0d6c562aab -spec: - replicas: 1 - selector: - matchLabels: - app: podinfo - pod-template-hash: 7df978b9bf - template: - metadata: - creationTimestamp: null - labels: - app: podinfo - pod-template-hash: 7df978b9bf - spec: - containers: - - image: ghcr.io/stefanprodan/podinfo:5.1.3 - imagePullPolicy: IfNotPresent - name: podinfo - resources: {} - terminationMessagePath: /dev/termination-log - terminationMessagePolicy: File - dnsPolicy: ClusterFirst - restartPolicy: Always - schedulerName: default-scheduler - securityContext: {} - terminationGracePeriodSeconds: 30 -status: - availableReplicas: 2 - fullyLabeledReplicas: 2 - observedGeneration: 3 - readyReplicas: 2 - replicas: 2 ---- -# {"time":"2021-05-19T09:43:06.227373365Z","style":"event","kind":"Event"} +# {"time":"2021-05-05T16:22:15.892097396Z","style":"event","kind":"Event"} +action: Binding apiVersion: v1 -count: 1 -eventTime: null -firstTimestamp: "2021-05-19T09:43:06Z" +eventTime: "2021-05-05T16:22:15.851372Z" +firstTimestamp: null involvedObject: - apiVersion: apps/v1 - kind: Deployment - name: px + apiVersion: v1 + kind: Pod + name: px-5f87d8856c-8f6bk namespace: default - resourceVersion: "5361649" - uid: 71c42017-61a7-418e-8e2c-897cf237d6e3 + resourceVersion: "2852441" + uid: cdf6bfe3-ee3e-4c1b-9b9b-44ddc5230bff kind: Event -lastTimestamp: "2021-05-19T09:43:06Z" -message: Scaled down replica set px-7df978b9bf to 1 +lastTimestamp: null +message: Successfully assigned default/px-5f87d8856c-8f6bk to kind-control-plane metadata: - creationTimestamp: "2021-05-19T09:43:06Z" + creationTimestamp: "2021-05-05T16:22:15Z" managedFields: - - apiVersion: v1 + - apiVersion: events.k8s.io/v1 fieldsType: FieldsV1 fieldsV1: - f:count: {} - f:firstTimestamp: {} - f:involvedObject: + f:action: {} + f:eventTime: {} + f:note: {} + f:reason: {} + f:regarding: f:apiVersion: {} f:kind: {} f:name: {} f:namespace: {} f:resourceVersion: {} f:uid: {} - f:lastTimestamp: {} - f:message: {} - f:reason: {} - f:source: - f:component: {} + f:reportingController: {} + f:reportingInstance: {} f:type: {} - manager: kube-controller-manager + manager: kube-scheduler operation: Update - time: "2021-05-19T09:43:06Z" - name: px.16806e85a868c41d + time: "2021-05-05T16:22:15Z" + name: px-5f87d8856c-8f6bk.167c382ded658dc4 namespace: default - resourceVersion: "5361683" - selfLink: /api/v1/namespaces/default/events/px.16806e85a868c41d - uid: e5614efd-c63c-43f2-bb57-3823aa0d841d -reason: ScalingReplicaSet -reportingComponent: "" -reportingInstance: "" -source: - component: deployment-controller + resourceVersion: "2852451" + selfLink: /api/v1/namespaces/default/events/px-5f87d8856c-8f6bk.167c382ded658dc4 + uid: c438e23f-4bc7-45e9-927f-53d9b5d8a025 +reason: Scheduled +reportingComponent: default-scheduler +reportingInstance: default-scheduler-kind-control-plane +source: {} type: Normal --- -# {"time":"2021-05-19T09:43:06.228091735Z","style":"event","kind":"Event"} +# {"time":"2021-05-05T16:22:15.898237525Z","style":"event","kind":"Event"} +action: Binding apiVersion: v1 -count: 1 -eventTime: null -firstTimestamp: "2021-05-19T09:43:06Z" +eventTime: "2021-05-05T16:22:15.860466Z" +firstTimestamp: null involvedObject: apiVersion: v1 - fieldPath: spec.containers{podinfo} kind: Pod - name: px-7df978b9bf-jm22q + name: px-5f87d8856c-c29hj namespace: default - resourceVersion: "5201920" - uid: ac780302-1895-43b1-89e0-80f85c8e5457 + resourceVersion: "2852442" + uid: 2d2ae783-5bc3-46ae-9f2b-a89aa0fdbcf7 kind: Event -lastTimestamp: "2021-05-19T09:43:06Z" -message: Stopping container podinfo +lastTimestamp: null +message: Successfully assigned default/px-5f87d8856c-c29hj to kind-control-plane metadata: - creationTimestamp: "2021-05-19T09:43:06Z" + creationTimestamp: "2021-05-05T16:22:15Z" managedFields: - - apiVersion: v1 + - apiVersion: events.k8s.io/v1 fieldsType: FieldsV1 fieldsV1: - f:count: {} - f:firstTimestamp: {} - f:involvedObject: + f:action: {} + f:eventTime: {} + f:note: {} + f:reason: {} + f:regarding: f:apiVersion: {} - f:fieldPath: {} f:kind: {} f:name: {} f:namespace: {} f:resourceVersion: {} f:uid: {} - f:lastTimestamp: {} - f:message: {} - f:reason: {} - f:source: - f:component: {} - f:host: {} + f:reportingController: {} + f:reportingInstance: {} f:type: {} - manager: kubelet + manager: kube-scheduler operation: Update - time: "2021-05-19T09:43:06Z" - name: px-7df978b9bf-jm22q.16806e85a86a0e56 + time: "2021-05-05T16:22:15Z" + name: px-5f87d8856c-c29hj.167c382dedc72a80 namespace: default - resourceVersion: "5361684" - selfLink: /api/v1/namespaces/default/events/px-7df978b9bf-jm22q.16806e85a86a0e56 - uid: c5a00f97-3191-4f3f-a9be-ef7f0f58370e -reason: Killing -reportingComponent: "" -reportingInstance: "" -source: - component: kubelet - host: kind-control-plane + resourceVersion: "2852452" + selfLink: /api/v1/namespaces/default/events/px-5f87d8856c-c29hj.167c382dedc72a80 + uid: 191c1319-43ed-473c-bca9-fa006001717e +reason: Scheduled +reportingComponent: default-scheduler +reportingInstance: default-scheduler-kind-control-plane +source: {} type: Normal --- -# {"time":"2021-05-19T09:43:06.245058316Z","style":"event","kind":"Event"} +# {"time":"2021-05-05T16:22:15.909580167Z","style":"watch","kind":"Pod"} apiVersion: v1 -count: 1 -eventTime: null -firstTimestamp: "2021-05-19T09:43:06Z" -involvedObject: - apiVersion: apps/v1 - kind: Deployment - name: px - namespace: default - resourceVersion: "5361681" - uid: 71c42017-61a7-418e-8e2c-897cf237d6e3 -kind: Event -lastTimestamp: "2021-05-19T09:43:06Z" -message: Scaled up replica set px-5d567cc74c to 2 +kind: Pod metadata: - creationTimestamp: "2021-05-19T09:43:06Z" + creationTimestamp: "2021-05-05T16:22:15Z" + generateName: px-5f87d8856c- + labels: + app: podinfo + pod-template-hash: 5f87d8856c managedFields: - apiVersion: v1 fieldsType: FieldsV1 fieldsV1: - f:count: {} - f:firstTimestamp: {} - f:involvedObject: - f:apiVersion: {} - f:kind: {} - f:name: {} - f:namespace: {} - f:resourceVersion: {} - f:uid: {} - f:lastTimestamp: {} - f:message: {} - f:reason: {} - f:source: - f:component: {} - f:type: {} - manager: kube-controller-manager - operation: Update - time: "2021-05-19T09:43:06Z" - name: px.16806e85a9bbc38b - namespace: default - resourceVersion: "5361687" - selfLink: /api/v1/namespaces/default/events/px.16806e85a9bbc38b - uid: 67716c18-4c32-40d4-9ca1-d78c3819b2c5 -reason: ScalingReplicaSet -reportingComponent: "" -reportingInstance: "" -source: - component: deployment-controller -type: Normal ---- -# {"time":"2021-05-19T09:43:06.245873474Z","style":"event","kind":"Event"} -apiVersion: v1 -count: 1 -eventTime: null -firstTimestamp: "2021-05-19T09:43:06Z" -involvedObject: - apiVersion: apps/v1 - kind: ReplicaSet - name: px-5d567cc74c - namespace: default - resourceVersion: "5361685" - uid: 0d562fec-2485-4f88-b09e-596783c0d0a2 -kind: Event -lastTimestamp: "2021-05-19T09:43:06Z" -message: 'Created pod: px-5d567cc74c-pmvzr' -metadata: - creationTimestamp: "2021-05-19T09:43:06Z" - managedFields: + f:metadata: + f:generateName: {} + f:labels: + .: {} + f:app: {} + f:pod-template-hash: {} + f:ownerReferences: + .: {} + k:{"uid":"9b7a04bf-811e-483e-826e-82c7b9e81ca7"}: + .: {} + f:apiVersion: {} + f:blockOwnerDeletion: {} + f:controller: {} + f:kind: {} + f:name: {} + f:uid: {} + f:spec: + f:containers: + k:{"name":"podinfo"}: + .: {} + f:image: {} + f:imagePullPolicy: {} + f:name: {} + f:resources: {} + f:terminationMessagePath: {} + f:terminationMessagePolicy: {} + f:dnsPolicy: {} + f:enableServiceLinks: {} + f:restartPolicy: {} + f:schedulerName: {} + f:securityContext: {} + f:terminationGracePeriodSeconds: {} + manager: kube-controller-manager + operation: Update + time: "2021-05-05T16:22:15Z" - apiVersion: v1 fieldsType: FieldsV1 fieldsV1: - f:count: {} - f:firstTimestamp: {} - f:involvedObject: - f:apiVersion: {} - f:kind: {} - f:name: {} - f:namespace: {} - f:resourceVersion: {} - f:uid: {} - f:lastTimestamp: {} - f:message: {} - f:reason: {} - f:source: - f:component: {} - f:type: {} - manager: kube-controller-manager + f:status: + f:conditions: + k:{"type":"ContainersReady"}: + .: {} + f:lastProbeTime: {} + f:lastTransitionTime: {} + f:message: {} + f:reason: {} + f:status: {} + f:type: {} + k:{"type":"Initialized"}: + .: {} + f:lastProbeTime: {} + f:lastTransitionTime: {} + f:status: {} + f:type: {} + k:{"type":"Ready"}: + .: {} + f:lastProbeTime: {} + f:lastTransitionTime: {} + f:message: {} + f:reason: {} + f:status: {} + f:type: {} + f:containerStatuses: {} + f:hostIP: {} + f:startTime: {} + manager: kubelet operation: Update - time: "2021-05-19T09:43:06Z" - name: px-5d567cc74c.16806e85a9ffbf53 + time: "2021-05-05T16:22:15Z" + name: px-5f87d8856c-8f6bk namespace: default - resourceVersion: "5361690" - selfLink: /api/v1/namespaces/default/events/px-5d567cc74c.16806e85a9ffbf53 - uid: 94b6e861-4c67-43c9-9c54-e829dec8637d -reason: SuccessfulCreate -reportingComponent: "" -reportingInstance: "" -source: - component: replicaset-controller -type: Normal + ownerReferences: + - apiVersion: apps/v1 + blockOwnerDeletion: true + controller: true + kind: ReplicaSet + name: px-5f87d8856c + uid: 9b7a04bf-811e-483e-826e-82c7b9e81ca7 + resourceVersion: "2852453" + selfLink: /api/v1/namespaces/default/pods/px-5f87d8856c-8f6bk + uid: cdf6bfe3-ee3e-4c1b-9b9b-44ddc5230bff +spec: + containers: + - image: ghcr.io/stefanprodan/podinfo:5.1.1 + imagePullPolicy: IfNotPresent + name: podinfo + resources: {} + terminationMessagePath: /dev/termination-log + terminationMessagePolicy: File + volumeMounts: + - mountPath: /var/run/secrets/kubernetes.io/serviceaccount + name: default-token-kx75m + readOnly: true + dnsPolicy: ClusterFirst + enableServiceLinks: true + nodeName: kind-control-plane + preemptionPolicy: PreemptLowerPriority + priority: 0 + restartPolicy: Always + schedulerName: default-scheduler + securityContext: {} + serviceAccount: default + serviceAccountName: default + terminationGracePeriodSeconds: 30 + tolerations: + - effect: NoExecute + key: node.kubernetes.io/not-ready + operator: Exists + tolerationSeconds: 300 + - effect: NoExecute + key: node.kubernetes.io/unreachable + operator: Exists + tolerationSeconds: 300 + volumes: + - name: default-token-kx75m + secret: + defaultMode: 420 + secretName: default-token-kx75m +status: + conditions: + - lastProbeTime: null + lastTransitionTime: "2021-05-05T16:22:15Z" + status: "True" + type: Initialized + - lastProbeTime: null + lastTransitionTime: "2021-05-05T16:22:15Z" + message: 'containers with unready status: [podinfo]' + reason: ContainersNotReady + status: "False" + type: Ready + - lastProbeTime: null + lastTransitionTime: "2021-05-05T16:22:15Z" + message: 'containers with unready status: [podinfo]' + reason: ContainersNotReady + status: "False" + type: ContainersReady + - lastProbeTime: null + lastTransitionTime: "2021-05-05T16:22:15Z" + status: "True" + type: PodScheduled + containerStatuses: + - image: ghcr.io/stefanprodan/podinfo:5.1.1 + imageID: "" + lastState: {} + name: podinfo + ready: false + restartCount: 0 + started: false + state: + waiting: + reason: ContainerCreating + hostIP: 172.18.0.2 + phase: Pending + qosClass: BestEffort + startTime: "2021-05-05T16:22:15Z" --- -# {"time":"2021-05-19T09:43:06.253973869Z","style":"initial","kind":"Pod"} +# {"time":"2021-05-05T16:22:15.917871568Z","style":"watch","kind":"Pod"} apiVersion: v1 kind: Pod metadata: - creationTimestamp: "2021-05-19T09:43:06Z" - generateName: px-5d567cc74c- + creationTimestamp: "2021-05-05T16:22:15Z" + generateName: px-5f87d8856c- labels: app: podinfo - pod-template-hash: 5d567cc74c + pod-template-hash: 5f87d8856c managedFields: - apiVersion: v1 fieldsType: FieldsV1 @@ -1301,7 +1137,7 @@ metadata: f:pod-template-hash: {} f:ownerReferences: .: {} - k:{"uid":"0d562fec-2485-4f88-b09e-596783c0d0a2"}: + k:{"uid":"9b7a04bf-811e-483e-826e-82c7b9e81ca7"}: .: {} f:apiVersion: {} f:blockOwnerDeletion: {} @@ -1327,7 +1163,7 @@ metadata: f:terminationGracePeriodSeconds: {} manager: kube-controller-manager operation: Update - time: "2021-05-19T09:43:06Z" + time: "2021-05-05T16:22:15Z" - apiVersion: v1 fieldsType: FieldsV1 fieldsV1: @@ -1360,22 +1196,22 @@ metadata: f:startTime: {} manager: kubelet operation: Update - time: "2021-05-19T09:43:06Z" - name: px-5d567cc74c-pmvzr + time: "2021-05-05T16:22:15Z" + name: px-5f87d8856c-c29hj namespace: default ownerReferences: - apiVersion: apps/v1 blockOwnerDeletion: true controller: true kind: ReplicaSet - name: px-5d567cc74c - uid: 0d562fec-2485-4f88-b09e-596783c0d0a2 - resourceVersion: "5361695" - selfLink: /api/v1/namespaces/default/pods/px-5d567cc74c-pmvzr - uid: 57a7a797-6d5b-45cd-8f54-8fa73f62316f + name: px-5f87d8856c + uid: 9b7a04bf-811e-483e-826e-82c7b9e81ca7 + resourceVersion: "2852454" + selfLink: /api/v1/namespaces/default/pods/px-5f87d8856c-c29hj + uid: 2d2ae783-5bc3-46ae-9f2b-a89aa0fdbcf7 spec: containers: - - image: ghcr.io/stefanprodan/podinfo:5.0.0 + - image: ghcr.io/stefanprodan/podinfo:5.1.1 imagePullPolicy: IfNotPresent name: podinfo resources: {} @@ -1413,27 +1249,27 @@ spec: status: conditions: - lastProbeTime: null - lastTransitionTime: "2021-05-19T09:43:06Z" + lastTransitionTime: "2021-05-05T16:22:15Z" status: "True" type: Initialized - lastProbeTime: null - lastTransitionTime: "2021-05-19T09:43:06Z" + lastTransitionTime: "2021-05-05T16:22:15Z" message: 'containers with unready status: [podinfo]' reason: ContainersNotReady status: "False" type: Ready - lastProbeTime: null - lastTransitionTime: "2021-05-19T09:43:06Z" + lastTransitionTime: "2021-05-05T16:22:15Z" message: 'containers with unready status: [podinfo]' reason: ContainersNotReady status: "False" type: ContainersReady - lastProbeTime: null - lastTransitionTime: "2021-05-19T09:43:06Z" + lastTransitionTime: "2021-05-05T16:22:15Z" status: "True" type: PodScheduled containerStatuses: - - image: ghcr.io/stefanprodan/podinfo:5.0.0 + - image: ghcr.io/stefanprodan/podinfo:5.1.1 imageID: "" lastState: {} name: podinfo @@ -1446,75 +1282,246 @@ status: hostIP: 172.18.0.2 phase: Pending qosClass: BestEffort - startTime: "2021-05-19T09:43:06Z" + startTime: "2021-05-05T16:22:15Z" --- -# {"time":"2021-05-19T09:43:06.257797688Z","style":"event","kind":"Event"} -action: Binding +# {"time":"2021-05-05T16:22:16.600490417Z","style":"event","kind":"Event"} apiVersion: v1 -eventTime: "2021-05-19T09:43:06.232051Z" -firstTimestamp: null +count: 1 +eventTime: null +firstTimestamp: "2021-05-05T16:22:16Z" +involvedObject: + apiVersion: v1 + fieldPath: spec.containers{podinfo} + kind: Pod + name: px-5f87d8856c-c29hj + namespace: default + resourceVersion: "2852449" + uid: 2d2ae783-5bc3-46ae-9f2b-a89aa0fdbcf7 +kind: Event +lastTimestamp: "2021-05-05T16:22:16Z" +message: Pulling image "ghcr.io/stefanprodan/podinfo:5.1.1" +metadata: + creationTimestamp: "2021-05-05T16:22:16Z" + managedFields: + - apiVersion: v1 + fieldsType: FieldsV1 + fieldsV1: + f:count: {} + f:firstTimestamp: {} + f:involvedObject: + f:apiVersion: {} + f:fieldPath: {} + f:kind: {} + f:name: {} + f:namespace: {} + f:resourceVersion: {} + f:uid: {} + f:lastTimestamp: {} + f:message: {} + f:reason: {} + f:source: + f:component: {} + f:host: {} + f:type: {} + manager: kubelet + operation: Update + time: "2021-05-05T16:22:16Z" + name: px-5f87d8856c-c29hj.167c382e198001ea + namespace: default + resourceVersion: "2852460" + selfLink: /api/v1/namespaces/default/events/px-5f87d8856c-c29hj.167c382e198001ea + uid: d968220d-181c-4e1a-9639-8deeba36421c +reason: Pulling +reportingComponent: "" +reportingInstance: "" +source: + component: kubelet + host: kind-control-plane +type: Normal +--- +# {"time":"2021-05-05T16:22:16.622938578Z","style":"event","kind":"Event"} +apiVersion: v1 +count: 1 +eventTime: null +firstTimestamp: "2021-05-05T16:22:16Z" +involvedObject: + apiVersion: v1 + fieldPath: spec.containers{podinfo} + kind: Pod + name: px-5f87d8856c-8f6bk + namespace: default + resourceVersion: "2852448" + uid: cdf6bfe3-ee3e-4c1b-9b9b-44ddc5230bff +kind: Event +lastTimestamp: "2021-05-05T16:22:16Z" +message: Pulling image "ghcr.io/stefanprodan/podinfo:5.1.1" +metadata: + creationTimestamp: "2021-05-05T16:22:16Z" + managedFields: + - apiVersion: v1 + fieldsType: FieldsV1 + fieldsV1: + f:count: {} + f:firstTimestamp: {} + f:involvedObject: + f:apiVersion: {} + f:fieldPath: {} + f:kind: {} + f:name: {} + f:namespace: {} + f:resourceVersion: {} + f:uid: {} + f:lastTimestamp: {} + f:message: {} + f:reason: {} + f:source: + f:component: {} + f:host: {} + f:type: {} + manager: kubelet + operation: Update + time: "2021-05-05T16:22:16Z" + name: px-5f87d8856c-8f6bk.167c382e1b102a87 + namespace: default + resourceVersion: "2852461" + selfLink: /api/v1/namespaces/default/events/px-5f87d8856c-8f6bk.167c382e1b102a87 + uid: db1a7b6f-e01e-4167-8439-19d3d6bd9a2e +reason: Pulling +reportingComponent: "" +reportingInstance: "" +source: + component: kubelet + host: kind-control-plane +type: Normal +--- +# {"time":"2021-05-05T16:22:22.106974029Z","style":"event","kind":"Event"} +apiVersion: v1 +count: 1 +eventTime: null +firstTimestamp: "2021-05-05T16:22:22Z" +involvedObject: + apiVersion: v1 + fieldPath: spec.containers{podinfo} + kind: Pod + name: px-5f87d8856c-c29hj + namespace: default + resourceVersion: "2852449" + uid: 2d2ae783-5bc3-46ae-9f2b-a89aa0fdbcf7 +kind: Event +lastTimestamp: "2021-05-05T16:22:22Z" +message: Successfully pulled image "ghcr.io/stefanprodan/podinfo:5.1.1" in 5.510339507s +metadata: + creationTimestamp: "2021-05-05T16:22:22Z" + managedFields: + - apiVersion: v1 + fieldsType: FieldsV1 + fieldsV1: + f:count: {} + f:firstTimestamp: {} + f:involvedObject: + f:apiVersion: {} + f:fieldPath: {} + f:kind: {} + f:name: {} + f:namespace: {} + f:resourceVersion: {} + f:uid: {} + f:lastTimestamp: {} + f:message: {} + f:reason: {} + f:source: + f:component: {} + f:host: {} + f:type: {} + manager: kubelet + operation: Update + time: "2021-05-05T16:22:22Z" + name: px-5f87d8856c-c29hj.167c382f61f520ed + namespace: default + resourceVersion: "2852474" + selfLink: /api/v1/namespaces/default/events/px-5f87d8856c-c29hj.167c382f61f520ed + uid: 18486786-53dd-4782-ade6-11b053cf995d +reason: Pulled +reportingComponent: "" +reportingInstance: "" +source: + component: kubelet + host: kind-control-plane +type: Normal +--- +# {"time":"2021-05-05T16:22:22.321359105Z","style":"event","kind":"Event"} +apiVersion: v1 +count: 1 +eventTime: null +firstTimestamp: "2021-05-05T16:22:22Z" involvedObject: apiVersion: v1 + fieldPath: spec.containers{podinfo} kind: Pod - name: px-5d567cc74c-pmvzr + name: px-5f87d8856c-c29hj namespace: default - resourceVersion: "5361686" - uid: 57a7a797-6d5b-45cd-8f54-8fa73f62316f + resourceVersion: "2852449" + uid: 2d2ae783-5bc3-46ae-9f2b-a89aa0fdbcf7 kind: Event -lastTimestamp: null -message: Successfully assigned default/px-5d567cc74c-pmvzr to kind-control-plane +lastTimestamp: "2021-05-05T16:22:22Z" +message: Created container podinfo metadata: - creationTimestamp: "2021-05-19T09:43:06Z" + creationTimestamp: "2021-05-05T16:22:22Z" managedFields: - - apiVersion: events.k8s.io/v1 + - apiVersion: v1 fieldsType: FieldsV1 fieldsV1: - f:action: {} - f:eventTime: {} - f:note: {} - f:reason: {} - f:regarding: + f:count: {} + f:firstTimestamp: {} + f:involvedObject: f:apiVersion: {} + f:fieldPath: {} f:kind: {} f:name: {} f:namespace: {} f:resourceVersion: {} f:uid: {} - f:reportingController: {} - f:reportingInstance: {} + f:lastTimestamp: {} + f:message: {} + f:reason: {} + f:source: + f:component: {} + f:host: {} f:type: {} - manager: kube-scheduler + manager: kubelet operation: Update - time: "2021-05-19T09:43:06Z" - name: px-5d567cc74c-pmvzr.16806e85ab010be0 + time: "2021-05-05T16:22:22Z" + name: px-5f87d8856c-c29hj.167c382f6ebb9e75 namespace: default - resourceVersion: "5361693" - selfLink: /api/v1/namespaces/default/events/px-5d567cc74c-pmvzr.16806e85ab010be0 - uid: 2e881a1f-b194-41c1-a19e-feba8d816ffd -reason: Scheduled -reportingComponent: default-scheduler -reportingInstance: default-scheduler-kind-control-plane -source: {} + resourceVersion: "2852479" + selfLink: /api/v1/namespaces/default/events/px-5f87d8856c-c29hj.167c382f6ebb9e75 + uid: 2b22d68a-539c-4af1-b630-2f67ce105375 +reason: Created +reportingComponent: "" +reportingInstance: "" +source: + component: kubelet + host: kind-control-plane type: Normal --- -# {"time":"2021-05-19T09:43:06.698881964Z","style":"event","kind":"Event"} +# {"time":"2021-05-05T16:22:22.426415245Z","style":"event","kind":"Event"} apiVersion: v1 count: 1 eventTime: null -firstTimestamp: "2021-05-19T09:43:06Z" +firstTimestamp: "2021-05-05T16:22:22Z" involvedObject: apiVersion: v1 fieldPath: spec.containers{podinfo} kind: Pod - name: px-5d567cc74c-pmvzr + name: px-5f87d8856c-c29hj namespace: default - resourceVersion: "5361691" - uid: 57a7a797-6d5b-45cd-8f54-8fa73f62316f + resourceVersion: "2852449" + uid: 2d2ae783-5bc3-46ae-9f2b-a89aa0fdbcf7 kind: Event -lastTimestamp: "2021-05-19T09:43:06Z" -message: Container image "ghcr.io/stefanprodan/podinfo:5.0.0" already present on machine +lastTimestamp: "2021-05-05T16:22:22Z" +message: Started container podinfo metadata: - creationTimestamp: "2021-05-19T09:43:06Z" + creationTimestamp: "2021-05-05T16:22:22Z" managedFields: - apiVersion: v1 fieldsType: FieldsV1 @@ -1538,13 +1545,13 @@ metadata: f:type: {} manager: kubelet operation: Update - time: "2021-05-19T09:43:06Z" - name: px-5d567cc74c-pmvzr.16806e85c6a00dfe + time: "2021-05-05T16:22:22Z" + name: px-5f87d8856c-c29hj.167c382f74ff5e15 namespace: default - resourceVersion: "5361698" - selfLink: /api/v1/namespaces/default/events/px-5d567cc74c-pmvzr.16806e85c6a00dfe - uid: a2f78777-39fc-4059-a4c7-52231ae1ba93 -reason: Pulled + resourceVersion: "2852481" + selfLink: /api/v1/namespaces/default/events/px-5f87d8856c-c29hj.167c382f74ff5e15 + uid: 0ca00477-61ba-4ca5-b6ef-49a1ae564aa0 +reason: Started reportingComponent: "" reportingInstance: "" source: @@ -1552,24 +1559,24 @@ source: host: kind-control-plane type: Normal --- -# {"time":"2021-05-19T09:43:06.73097871Z","style":"event","kind":"Event"} +# {"time":"2021-05-05T16:22:22.679954476Z","style":"event","kind":"Event"} apiVersion: v1 count: 1 eventTime: null -firstTimestamp: "2021-05-19T09:43:06Z" +firstTimestamp: "2021-05-05T16:22:22Z" involvedObject: apiVersion: v1 fieldPath: spec.containers{podinfo} kind: Pod - name: px-5d567cc74c-pmvzr + name: px-5f87d8856c-8f6bk namespace: default - resourceVersion: "5361691" - uid: 57a7a797-6d5b-45cd-8f54-8fa73f62316f + resourceVersion: "2852448" + uid: cdf6bfe3-ee3e-4c1b-9b9b-44ddc5230bff kind: Event -lastTimestamp: "2021-05-19T09:43:06Z" -message: Created container podinfo +lastTimestamp: "2021-05-05T16:22:22Z" +message: Successfully pulled image "ghcr.io/stefanprodan/podinfo:5.1.1" in 6.055782903s metadata: - creationTimestamp: "2021-05-19T09:43:06Z" + creationTimestamp: "2021-05-05T16:22:22Z" managedFields: - apiVersion: v1 fieldsType: FieldsV1 @@ -1593,13 +1600,13 @@ metadata: f:type: {} manager: kubelet operation: Update - time: "2021-05-19T09:43:06Z" - name: px-5d567cc74c-pmvzr.16806e85c88e64f1 + time: "2021-05-05T16:22:22Z" + name: px-5f87d8856c-8f6bk.167c382f84044300 namespace: default - resourceVersion: "5361699" - selfLink: /api/v1/namespaces/default/events/px-5d567cc74c-pmvzr.16806e85c88e64f1 - uid: c200779e-2483-470a-8e6c-d9f99012da04 -reason: Created + resourceVersion: "2852482" + selfLink: /api/v1/namespaces/default/events/px-5f87d8856c-8f6bk.167c382f84044300 + uid: 7ad025eb-0790-4769-a67a-901dbf313b1d +reason: Pulled reportingComponent: "" reportingInstance: "" source: @@ -1607,24 +1614,24 @@ source: host: kind-control-plane type: Normal --- -# {"time":"2021-05-19T09:43:06.808479495Z","style":"event","kind":"Event"} +# {"time":"2021-05-05T16:22:22.707601507Z","style":"event","kind":"Event"} apiVersion: v1 count: 1 eventTime: null -firstTimestamp: "2021-05-19T09:43:06Z" +firstTimestamp: "2021-05-05T16:22:22Z" involvedObject: apiVersion: v1 fieldPath: spec.containers{podinfo} kind: Pod - name: px-5d567cc74c-pmvzr + name: px-5f87d8856c-8f6bk namespace: default - resourceVersion: "5361691" - uid: 57a7a797-6d5b-45cd-8f54-8fa73f62316f + resourceVersion: "2852448" + uid: cdf6bfe3-ee3e-4c1b-9b9b-44ddc5230bff kind: Event -lastTimestamp: "2021-05-19T09:43:06Z" -message: Started container podinfo +lastTimestamp: "2021-05-05T16:22:22Z" +message: Created container podinfo metadata: - creationTimestamp: "2021-05-19T09:43:06Z" + creationTimestamp: "2021-05-05T16:22:22Z" managedFields: - apiVersion: v1 fieldsType: FieldsV1 @@ -1648,13 +1655,13 @@ metadata: f:type: {} manager: kubelet operation: Update - time: "2021-05-19T09:43:06Z" - name: px-5d567cc74c-pmvzr.16806e85cd2f0f0a + time: "2021-05-05T16:22:22Z" + name: px-5f87d8856c-8f6bk.167c382f85ac394b namespace: default - resourceVersion: "5361700" - selfLink: /api/v1/namespaces/default/events/px-5d567cc74c-pmvzr.16806e85cd2f0f0a - uid: e88edc6d-666b-4f4c-a332-0deb1b264c82 -reason: Started + resourceVersion: "2852483" + selfLink: /api/v1/namespaces/default/events/px-5f87d8856c-8f6bk.167c382f85ac394b + uid: ca7c04f2-775a-4a13-9ea6-1d8bc903e033 +reason: Created reportingComponent: "" reportingInstance: "" source: @@ -1662,23 +1669,24 @@ source: host: kind-control-plane type: Normal --- -# {"time":"2021-05-19T09:43:07.176274411Z","style":"event","kind":"Event"} +# {"time":"2021-05-05T16:22:22.789254188Z","style":"event","kind":"Event"} apiVersion: v1 count: 1 eventTime: null -firstTimestamp: "2021-05-19T09:43:07Z" +firstTimestamp: "2021-05-05T16:22:22Z" involvedObject: - apiVersion: apps/v1 - kind: Deployment - name: px + apiVersion: v1 + fieldPath: spec.containers{podinfo} + kind: Pod + name: px-5f87d8856c-8f6bk namespace: default - resourceVersion: "5361696" - uid: 71c42017-61a7-418e-8e2c-897cf237d6e3 + resourceVersion: "2852448" + uid: cdf6bfe3-ee3e-4c1b-9b9b-44ddc5230bff kind: Event -lastTimestamp: "2021-05-19T09:43:07Z" -message: Scaled down replica set px-7df978b9bf to 0 +lastTimestamp: "2021-05-05T16:22:22Z" +message: Started container podinfo metadata: - creationTimestamp: "2021-05-19T09:43:07Z" + creationTimestamp: "2021-05-05T16:22:22Z" managedFields: - apiVersion: v1 fieldsType: FieldsV1 @@ -1687,6 +1695,7 @@ metadata: f:firstTimestamp: {} f:involvedObject: f:apiVersion: {} + f:fieldPath: {} f:kind: {} f:name: {} f:namespace: {} @@ -1697,84 +1706,349 @@ metadata: f:reason: {} f:source: f:component: {} + f:host: {} f:type: {} - manager: kube-controller-manager + manager: kubelet operation: Update - time: "2021-05-19T09:43:07Z" - name: px.16806e85e3233164 + time: "2021-05-05T16:22:22Z" + name: px-5f87d8856c-8f6bk.167c382f8a9b37e6 namespace: default - resourceVersion: "5361705" - selfLink: /api/v1/namespaces/default/events/px.16806e85e3233164 - uid: 396a77cf-b74a-4f8e-98d5-41a0756b6b31 -reason: ScalingReplicaSet + resourceVersion: "2852484" + selfLink: /api/v1/namespaces/default/events/px-5f87d8856c-8f6bk.167c382f8a9b37e6 + uid: 31142fbb-715e-445f-8c7a-f390cb5bc797 +reason: Started reportingComponent: "" reportingInstance: "" source: - component: deployment-controller + component: kubelet + host: kind-control-plane type: Normal --- -# {"time":"2021-05-19T09:43:07.190240066Z","style":"event","kind":"Event"} +# {"time":"2021-05-05T16:22:23.228695906Z","style":"watch","kind":"Pod"} apiVersion: v1 -count: 1 -eventTime: null -firstTimestamp: "2021-05-19T09:43:07Z" -involvedObject: - apiVersion: apps/v1 - kind: ReplicaSet - name: px-7df978b9bf - namespace: default - resourceVersion: "5361704" - uid: e8a3abe0-ab69-48f7-9d18-6c0d6c562aab -kind: Event -lastTimestamp: "2021-05-19T09:43:07Z" -message: 'Deleted pod: px-7df978b9bf-bfdrj' +kind: Pod metadata: - creationTimestamp: "2021-05-19T09:43:07Z" + creationTimestamp: "2021-05-05T16:22:15Z" + generateName: px-5f87d8856c- + labels: + app: podinfo + pod-template-hash: 5f87d8856c managedFields: - apiVersion: v1 fieldsType: FieldsV1 fieldsV1: - f:count: {} - f:firstTimestamp: {} - f:involvedObject: - f:apiVersion: {} - f:kind: {} - f:name: {} - f:namespace: {} - f:resourceVersion: {} - f:uid: {} - f:lastTimestamp: {} - f:message: {} - f:reason: {} - f:source: - f:component: {} - f:type: {} + f:metadata: + f:generateName: {} + f:labels: + .: {} + f:app: {} + f:pod-template-hash: {} + f:ownerReferences: + .: {} + k:{"uid":"9b7a04bf-811e-483e-826e-82c7b9e81ca7"}: + .: {} + f:apiVersion: {} + f:blockOwnerDeletion: {} + f:controller: {} + f:kind: {} + f:name: {} + f:uid: {} + f:spec: + f:containers: + k:{"name":"podinfo"}: + .: {} + f:image: {} + f:imagePullPolicy: {} + f:name: {} + f:resources: {} + f:terminationMessagePath: {} + f:terminationMessagePolicy: {} + f:dnsPolicy: {} + f:enableServiceLinks: {} + f:restartPolicy: {} + f:schedulerName: {} + f:securityContext: {} + f:terminationGracePeriodSeconds: {} + manager: kube-controller-manager + operation: Update + time: "2021-05-05T16:22:15Z" + - apiVersion: v1 + fieldsType: FieldsV1 + fieldsV1: + f:status: + f:conditions: + k:{"type":"ContainersReady"}: + .: {} + f:lastProbeTime: {} + f:lastTransitionTime: {} + f:status: {} + f:type: {} + k:{"type":"Initialized"}: + .: {} + f:lastProbeTime: {} + f:lastTransitionTime: {} + f:status: {} + f:type: {} + k:{"type":"Ready"}: + .: {} + f:lastProbeTime: {} + f:lastTransitionTime: {} + f:status: {} + f:type: {} + f:containerStatuses: {} + f:hostIP: {} + f:phase: {} + f:podIP: {} + f:podIPs: + .: {} + k:{"ip":"10.244.0.14"}: + .: {} + f:ip: {} + f:startTime: {} + manager: kubelet + operation: Update + time: "2021-05-05T16:22:23Z" + name: px-5f87d8856c-8f6bk + namespace: default + ownerReferences: + - apiVersion: apps/v1 + blockOwnerDeletion: true + controller: true + kind: ReplicaSet + name: px-5f87d8856c + uid: 9b7a04bf-811e-483e-826e-82c7b9e81ca7 + resourceVersion: "2852485" + selfLink: /api/v1/namespaces/default/pods/px-5f87d8856c-8f6bk + uid: cdf6bfe3-ee3e-4c1b-9b9b-44ddc5230bff +spec: + containers: + - image: ghcr.io/stefanprodan/podinfo:5.1.1 + imagePullPolicy: IfNotPresent + name: podinfo + resources: {} + terminationMessagePath: /dev/termination-log + terminationMessagePolicy: File + volumeMounts: + - mountPath: /var/run/secrets/kubernetes.io/serviceaccount + name: default-token-kx75m + readOnly: true + dnsPolicy: ClusterFirst + enableServiceLinks: true + nodeName: kind-control-plane + preemptionPolicy: PreemptLowerPriority + priority: 0 + restartPolicy: Always + schedulerName: default-scheduler + securityContext: {} + serviceAccount: default + serviceAccountName: default + terminationGracePeriodSeconds: 30 + tolerations: + - effect: NoExecute + key: node.kubernetes.io/not-ready + operator: Exists + tolerationSeconds: 300 + - effect: NoExecute + key: node.kubernetes.io/unreachable + operator: Exists + tolerationSeconds: 300 + volumes: + - name: default-token-kx75m + secret: + defaultMode: 420 + secretName: default-token-kx75m +status: + conditions: + - lastProbeTime: null + lastTransitionTime: "2021-05-05T16:22:15Z" + status: "True" + type: Initialized + - lastProbeTime: null + lastTransitionTime: "2021-05-05T16:22:23Z" + status: "True" + type: Ready + - lastProbeTime: null + lastTransitionTime: "2021-05-05T16:22:23Z" + status: "True" + type: ContainersReady + - lastProbeTime: null + lastTransitionTime: "2021-05-05T16:22:15Z" + status: "True" + type: PodScheduled + containerStatuses: + - containerID: containerd://9352479029aec43f681ec92a1b71058572a07ec6a0e3d3c29f41df38e0be6b00 + image: ghcr.io/stefanprodan/podinfo:5.1.1 + imageID: ghcr.io/stefanprodan/podinfo@sha256:6a28873d153df6859caa1e071fc8dee1baf7afe84b9d34e1d9774c8e66b633d5 + lastState: {} + name: podinfo + ready: true + restartCount: 0 + started: true + state: + running: + startedAt: "2021-05-05T16:22:22Z" + hostIP: 172.18.0.2 + phase: Running + podIP: 10.244.0.14 + podIPs: + - ip: 10.244.0.14 + qosClass: BestEffort + startTime: "2021-05-05T16:22:15Z" +--- +# {"time":"2021-05-05T16:22:23.257404165Z","style":"watch","kind":"Deployment"} +apiVersion: apps/v1 +kind: Deployment +metadata: + annotations: + deployment.kubernetes.io/revision: "1" + kubectl.kubernetes.io/last-applied-configuration: | + {"apiVersion":"apps/v1","kind":"Deployment","metadata":{"annotations":{},"name":"px","namespace":"default"},"spec":{"replicas":2,"selector":{"matchLabels":{"app":"podinfo"}},"template":{"metadata":{"labels":{"app":"podinfo"}},"spec":{"containers":[{"image":"ghcr.io/stefanprodan/podinfo:5.1.1","name":"podinfo"}]}}}} + creationTimestamp: "2021-05-05T16:22:15Z" + generation: 1 + managedFields: + - apiVersion: apps/v1 + fieldsType: FieldsV1 + fieldsV1: + f:metadata: + f:annotations: + .: {} + f:kubectl.kubernetes.io/last-applied-configuration: {} + f:spec: + f:progressDeadlineSeconds: {} + f:replicas: {} + f:revisionHistoryLimit: {} + f:selector: + f:matchLabels: + .: {} + f:app: {} + f:strategy: + f:rollingUpdate: + .: {} + f:maxSurge: {} + f:maxUnavailable: {} + f:type: {} + f:template: + f:metadata: + f:labels: + .: {} + f:app: {} + f:spec: + f:containers: + k:{"name":"podinfo"}: + .: {} + f:image: {} + f:imagePullPolicy: {} + f:name: {} + f:resources: {} + f:terminationMessagePath: {} + f:terminationMessagePolicy: {} + f:dnsPolicy: {} + f:restartPolicy: {} + f:schedulerName: {} + f:securityContext: {} + f:terminationGracePeriodSeconds: {} + manager: kubectl-client-side-apply + operation: Update + time: "2021-05-05T16:22:15Z" + - apiVersion: apps/v1 + fieldsType: FieldsV1 + fieldsV1: + f:metadata: + f:annotations: + f:deployment.kubernetes.io/revision: {} + f:status: + f:availableReplicas: {} + f:conditions: + .: {} + k:{"type":"Available"}: + .: {} + f:lastTransitionTime: {} + f:lastUpdateTime: {} + f:message: {} + f:reason: {} + f:status: {} + f:type: {} + k:{"type":"Progressing"}: + .: {} + f:lastTransitionTime: {} + f:lastUpdateTime: {} + f:message: {} + f:reason: {} + f:status: {} + f:type: {} + f:observedGeneration: {} + f:readyReplicas: {} + f:replicas: {} + f:unavailableReplicas: {} + f:updatedReplicas: {} manager: kube-controller-manager operation: Update - time: "2021-05-19T09:43:07Z" - name: px-7df978b9bf.16806e85e3cf5f3c + time: "2021-05-05T16:22:23Z" + name: px namespace: default - resourceVersion: "5361709" - selfLink: /api/v1/namespaces/default/events/px-7df978b9bf.16806e85e3cf5f3c - uid: 7ffcfc99-a056-46a0-a3c0-78dd8aa49172 -reason: SuccessfulDelete -reportingComponent: "" -reportingInstance: "" -source: - component: replicaset-controller -type: Normal + resourceVersion: "2852487" + selfLink: /apis/apps/v1/namespaces/default/deployments/px + uid: 71c42017-61a7-418e-8e2c-897cf237d6e3 +spec: + progressDeadlineSeconds: 600 + replicas: 2 + revisionHistoryLimit: 10 + selector: + matchLabels: + app: podinfo + strategy: + rollingUpdate: + maxSurge: 25% + maxUnavailable: 25% + type: RollingUpdate + template: + metadata: + creationTimestamp: null + labels: + app: podinfo + spec: + containers: + - image: ghcr.io/stefanprodan/podinfo:5.1.1 + imagePullPolicy: IfNotPresent + name: podinfo + resources: {} + terminationMessagePath: /dev/termination-log + terminationMessagePolicy: File + dnsPolicy: ClusterFirst + restartPolicy: Always + schedulerName: default-scheduler + securityContext: {} + terminationGracePeriodSeconds: 30 +status: + availableReplicas: 1 + conditions: + - lastTransitionTime: "2021-05-05T16:22:15Z" + lastUpdateTime: "2021-05-05T16:22:15Z" + message: Deployment does not have minimum availability. + reason: MinimumReplicasUnavailable + status: "False" + type: Available + - lastTransitionTime: "2021-05-05T16:22:15Z" + lastUpdateTime: "2021-05-05T16:22:23Z" + message: ReplicaSet "px-5f87d8856c" is progressing. + reason: ReplicaSetUpdated + status: "True" + type: Progressing + observedGeneration: 1 + readyReplicas: 1 + replicas: 2 + unavailableReplicas: 1 + updatedReplicas: 2 --- -# {"time":"2021-05-19T09:43:07.199181099Z","style":"initial","kind":"Pod"} +# {"time":"2021-05-05T16:22:23.261361194Z","style":"watch","kind":"Pod"} apiVersion: v1 kind: Pod metadata: - creationTimestamp: "2021-05-18T17:10:49Z" - deletionGracePeriodSeconds: 30 - deletionTimestamp: "2021-05-19T09:43:37Z" - generateName: px-7df978b9bf- + creationTimestamp: "2021-05-05T16:22:15Z" + generateName: px-5f87d8856c- labels: app: podinfo - pod-template-hash: 7df978b9bf + pod-template-hash: 5f87d8856c managedFields: - apiVersion: v1 fieldsType: FieldsV1 @@ -1787,7 +2061,7 @@ metadata: f:pod-template-hash: {} f:ownerReferences: .: {} - k:{"uid":"e8a3abe0-ab69-48f7-9d18-6c0d6c562aab"}: + k:{"uid":"9b7a04bf-811e-483e-826e-82c7b9e81ca7"}: .: {} f:apiVersion: {} f:blockOwnerDeletion: {} @@ -1813,7 +2087,7 @@ metadata: f:terminationGracePeriodSeconds: {} manager: kube-controller-manager operation: Update - time: "2021-05-18T17:10:49Z" + time: "2021-05-05T16:22:15Z" - apiVersion: v1 fieldsType: FieldsV1 fieldsV1: @@ -1843,28 +2117,28 @@ metadata: f:podIP: {} f:podIPs: .: {} - k:{"ip":"10.244.0.7"}: + k:{"ip":"10.244.0.13"}: .: {} f:ip: {} f:startTime: {} manager: kubelet operation: Update - time: "2021-05-18T17:10:50Z" - name: px-7df978b9bf-bfdrj + time: "2021-05-05T16:22:23Z" + name: px-5f87d8856c-c29hj namespace: default ownerReferences: - apiVersion: apps/v1 blockOwnerDeletion: true controller: true kind: ReplicaSet - name: px-7df978b9bf - uid: e8a3abe0-ab69-48f7-9d18-6c0d6c562aab - resourceVersion: "5361707" - selfLink: /api/v1/namespaces/default/pods/px-7df978b9bf-bfdrj - uid: 50418ee7-d53b-4c03-93ac-444b94fb98d2 + name: px-5f87d8856c + uid: 9b7a04bf-811e-483e-826e-82c7b9e81ca7 + resourceVersion: "2852488" + selfLink: /api/v1/namespaces/default/pods/px-5f87d8856c-c29hj + uid: 2d2ae783-5bc3-46ae-9f2b-a89aa0fdbcf7 spec: containers: - - image: ghcr.io/stefanprodan/podinfo:5.1.3 + - image: ghcr.io/stefanprodan/podinfo:5.1.1 imagePullPolicy: IfNotPresent name: podinfo resources: {} @@ -1902,25 +2176,25 @@ spec: status: conditions: - lastProbeTime: null - lastTransitionTime: "2021-05-18T17:10:49Z" + lastTransitionTime: "2021-05-05T16:22:15Z" status: "True" type: Initialized - lastProbeTime: null - lastTransitionTime: "2021-05-18T17:10:50Z" + lastTransitionTime: "2021-05-05T16:22:23Z" status: "True" type: Ready - lastProbeTime: null - lastTransitionTime: "2021-05-18T17:10:50Z" + lastTransitionTime: "2021-05-05T16:22:23Z" status: "True" type: ContainersReady - lastProbeTime: null - lastTransitionTime: "2021-05-18T17:10:49Z" + lastTransitionTime: "2021-05-05T16:22:15Z" status: "True" type: PodScheduled containerStatuses: - - containerID: containerd://cf553c322fd2165e0bd0ab36bc970c7c5786aeafbd8e2c28807d9d93aff1ed54 - image: ghcr.io/stefanprodan/podinfo:5.1.3 - imageID: ghcr.io/stefanprodan/podinfo@sha256:1cf7ad3ac4b7fc05773ec5deebbdf325566ee04483390688e09b53163ebb5bfd + - containerID: containerd://67d9f85ff8d810e6b32ce4bc8d0f1c3a2a7f748d49ef82bb4276346950585e64 + image: ghcr.io/stefanprodan/podinfo:5.1.1 + imageID: ghcr.io/stefanprodan/podinfo@sha256:6a28873d153df6859caa1e071fc8dee1baf7afe84b9d34e1d9774c8e66b633d5 lastState: {} name: podinfo ready: true @@ -1928,66 +2202,154 @@ status: started: true state: running: - startedAt: "2021-05-18T17:10:49Z" + startedAt: "2021-05-05T16:22:22Z" hostIP: 172.18.0.2 phase: Running - podIP: 10.244.0.7 + podIP: 10.244.0.13 podIPs: - - ip: 10.244.0.7 + - ip: 10.244.0.13 qosClass: BestEffort - startTime: "2021-05-18T17:10:49Z" + startTime: "2021-05-05T16:22:15Z" --- -# {"time":"2021-05-19T09:43:07.204574676Z","style":"event","kind":"Event"} -apiVersion: v1 -count: 1 -eventTime: null -firstTimestamp: "2021-05-19T09:43:07Z" -involvedObject: - apiVersion: v1 - fieldPath: spec.containers{podinfo} - kind: Pod - name: px-7df978b9bf-bfdrj - namespace: default - resourceVersion: "5201896" - uid: 50418ee7-d53b-4c03-93ac-444b94fb98d2 -kind: Event -lastTimestamp: "2021-05-19T09:43:07Z" -message: Stopping container podinfo +# {"time":"2021-05-05T16:22:23.274694998Z","style":"watch","kind":"Deployment"} +apiVersion: apps/v1 +kind: Deployment metadata: - creationTimestamp: "2021-05-19T09:43:07Z" + annotations: + deployment.kubernetes.io/revision: "1" + kubectl.kubernetes.io/last-applied-configuration: | + {"apiVersion":"apps/v1","kind":"Deployment","metadata":{"annotations":{},"name":"px","namespace":"default"},"spec":{"replicas":2,"selector":{"matchLabels":{"app":"podinfo"}},"template":{"metadata":{"labels":{"app":"podinfo"}},"spec":{"containers":[{"image":"ghcr.io/stefanprodan/podinfo:5.1.1","name":"podinfo"}]}}}} + creationTimestamp: "2021-05-05T16:22:15Z" + generation: 1 managedFields: - - apiVersion: v1 + - apiVersion: apps/v1 fieldsType: FieldsV1 fieldsV1: - f:count: {} - f:firstTimestamp: {} - f:involvedObject: - f:apiVersion: {} - f:fieldPath: {} - f:kind: {} - f:name: {} - f:namespace: {} - f:resourceVersion: {} - f:uid: {} - f:lastTimestamp: {} - f:message: {} - f:reason: {} - f:source: - f:component: {} - f:host: {} - f:type: {} - manager: kubelet + f:metadata: + f:annotations: + .: {} + f:kubectl.kubernetes.io/last-applied-configuration: {} + f:spec: + f:progressDeadlineSeconds: {} + f:replicas: {} + f:revisionHistoryLimit: {} + f:selector: + f:matchLabels: + .: {} + f:app: {} + f:strategy: + f:rollingUpdate: + .: {} + f:maxSurge: {} + f:maxUnavailable: {} + f:type: {} + f:template: + f:metadata: + f:labels: + .: {} + f:app: {} + f:spec: + f:containers: + k:{"name":"podinfo"}: + .: {} + f:image: {} + f:imagePullPolicy: {} + f:name: {} + f:resources: {} + f:terminationMessagePath: {} + f:terminationMessagePolicy: {} + f:dnsPolicy: {} + f:restartPolicy: {} + f:schedulerName: {} + f:securityContext: {} + f:terminationGracePeriodSeconds: {} + manager: kubectl-client-side-apply + operation: Update + time: "2021-05-05T16:22:15Z" + - apiVersion: apps/v1 + fieldsType: FieldsV1 + fieldsV1: + f:metadata: + f:annotations: + f:deployment.kubernetes.io/revision: {} + f:status: + f:availableReplicas: {} + f:conditions: + .: {} + k:{"type":"Available"}: + .: {} + f:lastTransitionTime: {} + f:lastUpdateTime: {} + f:message: {} + f:reason: {} + f:status: {} + f:type: {} + k:{"type":"Progressing"}: + .: {} + f:lastTransitionTime: {} + f:lastUpdateTime: {} + f:message: {} + f:reason: {} + f:status: {} + f:type: {} + f:observedGeneration: {} + f:readyReplicas: {} + f:replicas: {} + f:updatedReplicas: {} + manager: kube-controller-manager operation: Update - time: "2021-05-19T09:43:07Z" - name: px-7df978b9bf-bfdrj.16806e85e3b71865 + time: "2021-05-05T16:22:23Z" + name: px namespace: default - resourceVersion: "5361710" - selfLink: /api/v1/namespaces/default/events/px-7df978b9bf-bfdrj.16806e85e3b71865 - uid: da54dfde-35b5-4e29-817b-fdbfa03302b5 -reason: Killing -reportingComponent: "" -reportingInstance: "" -source: - component: kubelet - host: kind-control-plane -type: Normal + resourceVersion: "2852490" + selfLink: /apis/apps/v1/namespaces/default/deployments/px + uid: 71c42017-61a7-418e-8e2c-897cf237d6e3 +spec: + progressDeadlineSeconds: 600 + replicas: 2 + revisionHistoryLimit: 10 + selector: + matchLabels: + app: podinfo + strategy: + rollingUpdate: + maxSurge: 25% + maxUnavailable: 25% + type: RollingUpdate + template: + metadata: + creationTimestamp: null + labels: + app: podinfo + spec: + containers: + - image: ghcr.io/stefanprodan/podinfo:5.1.1 + imagePullPolicy: IfNotPresent + name: podinfo + resources: {} + terminationMessagePath: /dev/termination-log + terminationMessagePolicy: File + dnsPolicy: ClusterFirst + restartPolicy: Always + schedulerName: default-scheduler + securityContext: {} + terminationGracePeriodSeconds: 30 +status: + availableReplicas: 2 + conditions: + - lastTransitionTime: "2021-05-05T16:22:23Z" + lastUpdateTime: "2021-05-05T16:22:23Z" + message: Deployment has minimum availability. + reason: MinimumReplicasAvailable + status: "True" + type: Available + - lastTransitionTime: "2021-05-05T16:22:15Z" + lastUpdateTime: "2021-05-05T16:22:23Z" + message: ReplicaSet "px-5f87d8856c" has successfully progressed. + reason: NewReplicaSetAvailable + status: "True" + type: Progressing + observedGeneration: 1 + readyReplicas: 2 + replicas: 2 + updatedReplicas: 2 diff --git a/controllers/events/watcher.go b/controllers/events/watcher.go new file mode 100644 index 0000000..fe91e2c --- /dev/null +++ b/controllers/events/watcher.go @@ -0,0 +1,221 @@ +package events + +import ( + "context" + "fmt" + "sync" + "time" + + corev1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/meta" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" + "k8s.io/apimachinery/pkg/fields" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/apimachinery/pkg/types" + "k8s.io/apimachinery/pkg/watch" + "k8s.io/client-go/dynamic" + + "github.com/weaveworks-experiments/kspan/pkg/mtime" +) + +// Take out watches on individual objects, and notify changes in Conditions back as synthetic Events +type watchManager struct { + sync.Mutex + client dynamic.Interface + mapper meta.RESTMapper + + watches map[objectReference]*watchInfo +} + +type watchInfo struct { + watch watch.Interface + lastEvent time.Time + serial int +} + +func newWatchManager(kubeClient dynamic.Interface, mapper meta.RESTMapper) *watchManager { + return &watchManager{ + client: kubeClient, + mapper: mapper, + watches: make(map[objectReference]*watchInfo), + } +} + +// local interface to insulate from EventWatcher type +type eventNotifier interface { + handleEvent(ctx context.Context, event *corev1.Event) error + captureObject(runtime.Object, string) +} + +func (m *watchManager) watch(ctx context.Context, obj runtime.Object, ew eventNotifier) error { + ma, _ := meta.Accessor(obj) + var wi *watchInfo + { + ref := refFromObject(ma) + m.Lock() + if _, exists := m.watches[ref]; exists { + m.Unlock() + return nil + } + wi = &watchInfo{ + lastEvent: mtime.Now().Add(-defaultRecentWindow), // TODO: maybe this can be done more cleanly + } + m.watches[ref] = wi + m.Unlock() + } + + gvk := obj.GetObjectKind().GroupVersionKind() + r, err := m.getResourceInterface(gvk, ma.GetNamespace()) + if err != nil { + return err + } + listOptions := v1.ListOptions{ + FieldSelector: fields.OneTermEqualSelector("metadata.name", ma.GetName()).String(), + ResourceVersion: ma.GetResourceVersion(), + } + wi.watch, err = r.Watch(ctx, listOptions) + if err != nil { + return fmt.Errorf("object watch failed: %w", err) + } + + ew.captureObject(obj, "initial") + + go wi.run(ew) + + return nil +} + +func (m *watchManager) getResourceInterface(gvk schema.GroupVersionKind, ns string) (dynamic.ResourceInterface, error) { + mapping, err := m.mapper.RESTMapping(gvk.GroupKind(), gvk.Version) + if err != nil { + return nil, fmt.Errorf("resource mapping failed: %w", err) + } + if mapping.Scope.Name() == meta.RESTScopeNameRoot { + return m.client.Resource(mapping.Resource), nil + } + return m.client.Resource(mapping.Resource).Namespace(ns), nil +} + +func (m *watchManager) getWatch(obj runtime.Object) (*watchInfo, error) { + ma, _ := meta.Accessor(obj) + ref := refFromObject(ma) + m.Lock() + wi := m.watches[ref] + m.Unlock() + if wi == nil { + return nil, fmt.Errorf("watcher not found for object %q", ref) + } + return wi, nil +} + +func (w *watchInfo) run(ew eventNotifier) { + for e := range w.watch.ResultChan() { + obj, ok := e.Object.(*unstructured.Unstructured) + if !ok { + continue + } + _ = w.checkConditionUpdates(obj, ew) + } +} + +// Given an object, walk through all its conditions and notify any new ones as Events +func (w *watchInfo) checkConditionUpdates(obj *unstructured.Unstructured, ew eventNotifier) error { + conditions, found, err := unstructured.NestedSlice(obj.Object, "status", "conditions") + if err != nil { + return err + } + if !found { + return nil + } + + ew.captureObject(obj, "watch") + + var latest time.Time + for _, conditionUncast := range conditions { + condition, ok := conditionUncast.(map[string]interface{}) + if !ok { + continue + } + // Check if this condition changed since last time we looked + lastTransitionStr, found, err := unstructured.NestedString(condition, "lastTransitionTime") + if !found || err != nil { + continue + } + lastTransitionTime, err := time.Parse(time.RFC3339, lastTransitionStr) + if err != nil { + continue + } + if !lastTransitionTime.After(w.lastEvent) { + continue + } + + w.serial++ + + name, _, _ := unstructured.NestedString(condition, "type") + status, _, _ := unstructured.NestedString(condition, "status") + message, _, _ := unstructured.NestedString(condition, "message") + reason, _, _ := unstructured.NestedString(condition, "reason") + + // See if we can find a managedFields entry for this condition + source, operation, ts := getUpdateSource(obj, "f:status", "f:conditions", `k:{"type":"`+name+`"}`) + if ts.IsZero() { + // Look for a manager of 'conditions' as a whole + source, operation, ts = getUpdateSource(obj, "f:status", "f:conditions") + } + + if reason == "" { + if name != "" { + reason = name + } else if operation != "" { + reason = operation + } else { + reason = "Unknown" + } + } + + if message == "" { + message = name + " " + status + } + + ma, _ := meta.Accessor(obj) + gvk := obj.GetObjectKind().GroupVersionKind() + ref := corev1.ObjectReference{ + Kind: gvk.Kind, + Namespace: ma.GetNamespace(), + Name: ma.GetName(), + APIVersion: gvk.Group + "/" + gvk.Version, + } + // synthesise an Event which we will use to generate a Span with all relevant information + event := corev1.Event{ + ObjectMeta: v1.ObjectMeta{ + Namespace: ma.GetNamespace(), + Name: fmt.Sprintf("%s-%d", ma.GetName(), w.serial), + UID: types.UID(fmt.Sprintf("%s/%s-%d", ma.GetNamespace(), ma.GetName(), w.serial)), + }, + Source: corev1.EventSource{ + Component: source, + }, + EventTime: v1.NewMicroTime(lastTransitionTime), + Type: corev1.EventTypeNormal, + InvolvedObject: ref, + Message: message, + Reason: reason, + } + adjustEventTime(&event, mtime.Now()) + + err = ew.handleEvent(context.TODO(), &event) + if err != nil { + continue + } + + if lastTransitionTime.After(latest) { + latest = lastTransitionTime + } + } + if !latest.IsZero() { + w.lastEvent = latest + } + return nil +}