diff --git a/CHANGELOG.md b/CHANGELOG.md index 9b5a2102ff1c..25a8cc43479c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,8 @@ # CHANGELOG ## master +* feat: expose CreationTime and modificationTime + [#677](https://github.com/Kong/kuma/pull/677) * feat: pagination in kumactl [#690](https://github.com/Kong/kuma/pull/690) * feat: secret management API diff --git a/app/kumactl/cmd/apply/apply_test.go b/app/kumactl/cmd/apply/apply_test.go index 8b9641a36980..d3628a0bebd1 100644 --- a/app/kumactl/cmd/apply/apply_test.go +++ b/app/kumactl/cmd/apply/apply_test.go @@ -38,7 +38,6 @@ var _ = Describe("kumactl apply", func() { var rootCtx *kumactl_cmd.RootContext var rootCmd *cobra.Command var store core_store.ResourceStore - BeforeEach(func() { rootCtx = &kumactl_cmd.RootContext{ Runtime: kumactl_cmd.RootRuntime{ @@ -374,7 +373,9 @@ var _ = Describe("kumactl apply", func() { // then Expect(buf.String()).To(Equal( - `mesh: default + `creationTime: "1970-01-01T05:30:00+05:30" +mesh: default +modificationTime: "1970-01-01T05:30:00+05:30" name: sample networking: address: 2.2.2.2 diff --git a/app/kumactl/cmd/get/get_dataplanes_test.go b/app/kumactl/cmd/get/get_dataplanes_test.go index 77ce0ae5dbf5..56149803eef9 100644 --- a/app/kumactl/cmd/get/get_dataplanes_test.go +++ b/app/kumactl/cmd/get/get_dataplanes_test.go @@ -30,8 +30,8 @@ import ( var _ = Describe("kumactl get dataplanes", func() { var dataplanes []*mesh_core.DataplaneResource - BeforeEach(func() { + // setup dataplanes = []*mesh_core.DataplaneResource{ { Meta: &test_model.ResourceMeta{ diff --git a/app/kumactl/cmd/get/get_fault_injections_test.go b/app/kumactl/cmd/get/get_fault_injections_test.go index e5a8c3983686..d5de5e206c13 100644 --- a/app/kumactl/cmd/get/get_fault_injections_test.go +++ b/app/kumactl/cmd/get/get_fault_injections_test.go @@ -112,7 +112,6 @@ var _ = Describe("kumactl get fault-injections", func() { var rootCmd *cobra.Command var buf *bytes.Buffer var store core_store.ResourceStore - BeforeEach(func() { // setup rootCtx = &kumactl_cmd.RootContext{ diff --git a/app/kumactl/cmd/get/get_healthchecks_test.go b/app/kumactl/cmd/get/get_healthchecks_test.go index f40bfce8f3da..4ea499b2f89f 100644 --- a/app/kumactl/cmd/get/get_healthchecks_test.go +++ b/app/kumactl/cmd/get/get_healthchecks_test.go @@ -29,7 +29,6 @@ import ( var _ = Describe("kumactl get healthchecks", func() { var sampleHealthChecks []*mesh_core.HealthCheckResource - BeforeEach(func() { sampleHealthChecks = []*mesh_core.HealthCheckResource{ { @@ -62,10 +61,8 @@ var _ = Describe("kumactl get healthchecks", func() { var rootCmd *cobra.Command var buf *bytes.Buffer var store core_store.ResourceStore - BeforeEach(func() { // setup - rootCtx = &kumactl_cmd.RootContext{ Runtime: kumactl_cmd.RootRuntime{ NewResourceStore: func(*config_proto.ControlPlaneCoordinates_ApiServer) (core_store.ResourceStore, error) { diff --git a/app/kumactl/cmd/get/get_meshes_test.go b/app/kumactl/cmd/get/get_meshes_test.go index 3a889196452a..e9388b2aa0d3 100644 --- a/app/kumactl/cmd/get/get_meshes_test.go +++ b/app/kumactl/cmd/get/get_meshes_test.go @@ -158,7 +158,6 @@ var _ = Describe("kumactl get meshes", func() { var rootCmd *cobra.Command var buf *bytes.Buffer var store core_store.ResourceStore - BeforeEach(func() { // setup rootCtx = &kumactl_cmd.RootContext{ diff --git a/app/kumactl/cmd/get/get_proxytemplates_test.go b/app/kumactl/cmd/get/get_proxytemplates_test.go index 527a9c060e86..2482a28c7c4d 100644 --- a/app/kumactl/cmd/get/get_proxytemplates_test.go +++ b/app/kumactl/cmd/get/get_proxytemplates_test.go @@ -60,10 +60,8 @@ var _ = Describe("kumactl get proxytemplates", func() { var rootCmd *cobra.Command var buf *bytes.Buffer var store core_store.ResourceStore - BeforeEach(func() { // setup - rootCtx = &kumactl_cmd.RootContext{ Runtime: kumactl_cmd.RootRuntime{ NewResourceStore: func(*config_proto.ControlPlaneCoordinates_ApiServer) (core_store.ResourceStore, error) { diff --git a/app/kumactl/cmd/get/get_single_resource_test.go b/app/kumactl/cmd/get/get_single_resource_test.go index 2fb4736baaed..042b92b2769f 100644 --- a/app/kumactl/cmd/get/get_single_resource_test.go +++ b/app/kumactl/cmd/get/get_single_resource_test.go @@ -6,7 +6,6 @@ import ( "io/ioutil" "path/filepath" "strings" - "time" "github.com/Kong/kuma/pkg/catalog" catalog_client "github.com/Kong/kuma/pkg/catalog/client" @@ -29,11 +28,9 @@ var _ = Describe("kumactl get [resource] NAME", func() { var rootCmd *cobra.Command var outbuf, errbuf *bytes.Buffer var store core_store.ResourceStore - BeforeEach(func() { rootCtx = &kumactl_cmd.RootContext{ Runtime: kumactl_cmd.RootRuntime{ - Now: time.Now, NewResourceStore: func(*config_proto.ControlPlaneCoordinates_ApiServer) (core_store.ResourceStore, error) { return store, nil }, diff --git a/app/kumactl/cmd/get/get_traffic_logs_test.go b/app/kumactl/cmd/get/get_traffic_logs_test.go index 2498497bb9d2..a294533a2fa8 100644 --- a/app/kumactl/cmd/get/get_traffic_logs_test.go +++ b/app/kumactl/cmd/get/get_traffic_logs_test.go @@ -90,7 +90,6 @@ var _ = Describe("kumactl get traffic-logs", func() { var rootCmd *cobra.Command var buf *bytes.Buffer var store core_store.ResourceStore - BeforeEach(func() { // setup rootCtx = &kumactl_cmd.RootContext{ diff --git a/app/kumactl/cmd/get/get_traffic_routes_test.go b/app/kumactl/cmd/get/get_traffic_routes_test.go index 4cae4910c95c..c71f03f39dbf 100644 --- a/app/kumactl/cmd/get/get_traffic_routes_test.go +++ b/app/kumactl/cmd/get/get_traffic_routes_test.go @@ -62,10 +62,8 @@ var _ = Describe("kumactl get traffic-routes", func() { var rootCmd *cobra.Command var buf *bytes.Buffer var store core_store.ResourceStore - BeforeEach(func() { // setup - rootCtx = &kumactl_cmd.RootContext{ Runtime: kumactl_cmd.RootRuntime{ NewResourceStore: func(*config_proto.ControlPlaneCoordinates_ApiServer) (core_store.ResourceStore, error) { diff --git a/app/kumactl/cmd/get/get_traffic_traces_test.go b/app/kumactl/cmd/get/get_traffic_traces_test.go index 7fe79d0ab3c3..b22b20881e03 100644 --- a/app/kumactl/cmd/get/get_traffic_traces_test.go +++ b/app/kumactl/cmd/get/get_traffic_traces_test.go @@ -74,7 +74,6 @@ var _ = Describe("kumactl get traffic-traces", func() { var rootCmd *cobra.Command var buf *bytes.Buffer var store core_store.ResourceStore - BeforeEach(func() { // setup rootCtx = &kumactl_cmd.RootContext{ diff --git a/app/kumactl/cmd/get/get_trafficpermissions_test.go b/app/kumactl/cmd/get/get_trafficpermissions_test.go index 262d1009d2e1..33fb447fd519 100644 --- a/app/kumactl/cmd/get/get_trafficpermissions_test.go +++ b/app/kumactl/cmd/get/get_trafficpermissions_test.go @@ -84,7 +84,6 @@ var _ = Describe("kumactl get traffic-permissions", func() { var rootCmd *cobra.Command var buf *bytes.Buffer var store core_store.ResourceStore - BeforeEach(func() { // setup rootCtx = &kumactl_cmd.RootContext{ diff --git a/app/kumactl/cmd/get/testdata/get-dataplane.golden.json b/app/kumactl/cmd/get/testdata/get-dataplane.golden.json index a78fa7924ba8..b3281836f372 100644 --- a/app/kumactl/cmd/get/testdata/get-dataplane.golden.json +++ b/app/kumactl/cmd/get/testdata/get-dataplane.golden.json @@ -2,6 +2,8 @@ "type": "Dataplane", "mesh": "default", "name": "dataplane-1", + "creationTime": "0001-01-01T00:00:00Z", + "modificationTime": "0001-01-01T00:00:00Z", "networking": { "address": "127.0.0.1", "inbound": [ diff --git a/app/kumactl/cmd/get/testdata/get-dataplane.golden.yaml b/app/kumactl/cmd/get/testdata/get-dataplane.golden.yaml index 654861212c53..9af81d72e299 100644 --- a/app/kumactl/cmd/get/testdata/get-dataplane.golden.yaml +++ b/app/kumactl/cmd/get/testdata/get-dataplane.golden.yaml @@ -1,5 +1,6 @@ ---- +creationTime: 0001-01-01T00:00:00Z mesh: default +modificationTime: 0001-01-01T00:00:00Z name: dataplane-1 networking: address: 127.0.0.1 diff --git a/app/kumactl/cmd/get/testdata/get-dataplanes.golden.json b/app/kumactl/cmd/get/testdata/get-dataplanes.golden.json index 87565ae7421a..320bd3146ff9 100644 --- a/app/kumactl/cmd/get/testdata/get-dataplanes.golden.json +++ b/app/kumactl/cmd/get/testdata/get-dataplanes.golden.json @@ -3,6 +3,8 @@ { "mesh": "default", "name": "experiment", + "creationTime": "0001-01-01T00:00:00Z", + "modificationTime": "0001-01-01T00:00:00Z", "networking": { "address": "127.0.0.1", "inbound": [ @@ -29,6 +31,8 @@ { "mesh": "default", "name": "example", + "creationTime": "0001-01-01T00:00:00Z", + "modificationTime": "0001-01-01T00:00:00Z", "networking": { "address": "127.0.0.2", "inbound": [ diff --git a/app/kumactl/cmd/get/testdata/get-dataplanes.golden.yaml b/app/kumactl/cmd/get/testdata/get-dataplanes.golden.yaml index 252d5bc67c96..5e30a8589136 100644 --- a/app/kumactl/cmd/get/testdata/get-dataplanes.golden.yaml +++ b/app/kumactl/cmd/get/testdata/get-dataplanes.golden.yaml @@ -1,5 +1,7 @@ items: -- mesh: default +- creationTime: 0001-01-01T00:00:00Z + mesh: default + modificationTime: 0001-01-01T00:00:00Z name: experiment networking: address: 127.0.0.1 @@ -15,7 +17,9 @@ items: service: metrics version: v1 type: Dataplane -- mesh: default +- creationTime: 0001-01-01T00:00:00Z + mesh: default + modificationTime: 0001-01-01T00:00:00Z name: example networking: address: 127.0.0.2 diff --git a/app/kumactl/cmd/get/testdata/get-fault-injection.golden.json b/app/kumactl/cmd/get/testdata/get-fault-injection.golden.json index 14e523668379..cd20b07c8f7f 100644 --- a/app/kumactl/cmd/get/testdata/get-fault-injection.golden.json +++ b/app/kumactl/cmd/get/testdata/get-fault-injection.golden.json @@ -2,6 +2,8 @@ "type": "FaultInjection", "mesh": "default", "name": "fault-injection-1", + "creationTime": "0001-01-01T00:00:00Z", + "modificationTime": "0001-01-01T00:00:00Z", "sources": [ { "match": { diff --git a/app/kumactl/cmd/get/testdata/get-fault-injection.golden.yaml b/app/kumactl/cmd/get/testdata/get-fault-injection.golden.yaml index aaaeeda364ec..7119d4d7811b 100644 --- a/app/kumactl/cmd/get/testdata/get-fault-injection.golden.yaml +++ b/app/kumactl/cmd/get/testdata/get-fault-injection.golden.yaml @@ -2,7 +2,9 @@ conf: abort: httpStatus: 500 percentage: 50 +creationTime: 0001-01-01T00:00:00Z mesh: default +modificationTime: 0001-01-01T00:00:00Z name: fault-injection-1 sources: - match: diff --git a/app/kumactl/cmd/get/testdata/get-fault-injections.golden.json b/app/kumactl/cmd/get/testdata/get-fault-injections.golden.json index 42ef7eac6546..5b25878ce1ea 100644 --- a/app/kumactl/cmd/get/testdata/get-fault-injections.golden.json +++ b/app/kumactl/cmd/get/testdata/get-fault-injections.golden.json @@ -4,6 +4,8 @@ "type": "FaultInjection", "mesh": "default", "name": "fi1", + "creationTime": "0001-01-01T00:00:00Z", + "modificationTime": "0001-01-01T00:00:00Z", "sources": [ { "match": { @@ -38,6 +40,8 @@ "type": "FaultInjection", "mesh": "default", "name": "fi2", + "creationTime": "0001-01-01T00:00:00Z", + "modificationTime": "0001-01-01T00:00:00Z", "sources": [ { "match": { diff --git a/app/kumactl/cmd/get/testdata/get-fault-injections.golden.yaml b/app/kumactl/cmd/get/testdata/get-fault-injections.golden.yaml index ffdea964086b..1f5745b65290 100644 --- a/app/kumactl/cmd/get/testdata/get-fault-injections.golden.yaml +++ b/app/kumactl/cmd/get/testdata/get-fault-injections.golden.yaml @@ -9,10 +9,12 @@ items: responseBandwidth: limit: 50 mbps percentage: 50 + creationTime: 0001-01-01T00:00:00Z destinations: - match: service: backend mesh: default + modificationTime: 0001-01-01T00:00:00Z name: fi1 sources: - match: @@ -29,10 +31,12 @@ items: responseBandwidth: limit: 50 mbps percentage: 50 + creationTime: 0001-01-01T00:00:00Z destinations: - match: service: redis mesh: default + modificationTime: 0001-01-01T00:00:00Z name: fi2 sources: - match: diff --git a/app/kumactl/cmd/get/testdata/get-healthcheck.golden.json b/app/kumactl/cmd/get/testdata/get-healthcheck.golden.json index 691d4bdb1d4c..0be225d2d9f2 100644 --- a/app/kumactl/cmd/get/testdata/get-healthcheck.golden.json +++ b/app/kumactl/cmd/get/testdata/get-healthcheck.golden.json @@ -2,6 +2,8 @@ "type": "HealthCheck", "mesh": "default", "name": "healthcheck-1", + "creationTime": "0001-01-01T00:00:00Z", + "modificationTime": "0001-01-01T00:00:00Z", "sources": [ { "match": { diff --git a/app/kumactl/cmd/get/testdata/get-healthcheck.golden.yaml b/app/kumactl/cmd/get/testdata/get-healthcheck.golden.yaml index a1401826162e..66d495d42adf 100644 --- a/app/kumactl/cmd/get/testdata/get-healthcheck.golden.yaml +++ b/app/kumactl/cmd/get/testdata/get-healthcheck.golden.yaml @@ -1,11 +1,3 @@ -mesh: default -name: healthcheck-1 -sources: - - match: - service: web -destinations: - - match: - service: backend conf: activeChecks: interval: 10s @@ -15,4 +7,14 @@ conf: passiveChecks: unhealthyThreshold: 3 penaltyInterval: 5s +creationTime: 0001-01-01T00:00:00Z +destinations: + - match: + service: backend +mesh: default +modificationTime: 0001-01-01T00:00:00Z +name: healthcheck-1 +sources: + - match: + service: web type: HealthCheck \ No newline at end of file diff --git a/app/kumactl/cmd/get/testdata/get-healthchecks.golden.json b/app/kumactl/cmd/get/testdata/get-healthchecks.golden.json index 64f644d46a72..211f69a7b8f8 100644 --- a/app/kumactl/cmd/get/testdata/get-healthchecks.golden.json +++ b/app/kumactl/cmd/get/testdata/get-healthchecks.golden.json @@ -3,12 +3,16 @@ { "mesh": "default", "name": "web-to-backend", - "type": "HealthCheck" + "type": "HealthCheck", + "creationTime": "0001-01-01T00:00:00Z", + "modificationTime": "0001-01-01T00:00:00Z" }, { "mesh": "default", "name": "backend-to-db", - "type": "HealthCheck" + "type": "HealthCheck", + "creationTime": "0001-01-01T00:00:00Z", + "modificationTime": "0001-01-01T00:00:00Z" } ], "next": null diff --git a/app/kumactl/cmd/get/testdata/get-healthchecks.golden.yaml b/app/kumactl/cmd/get/testdata/get-healthchecks.golden.yaml index 3c627c077ae2..0c4acd00a425 100644 --- a/app/kumactl/cmd/get/testdata/get-healthchecks.golden.yaml +++ b/app/kumactl/cmd/get/testdata/get-healthchecks.golden.yaml @@ -1,8 +1,12 @@ items: -- mesh: default +- creationTime: 0001-01-01T00:00:00Z + mesh: default + modificationTime: 0001-01-01T00:00:00Z name: web-to-backend type: HealthCheck -- mesh: default +- creationTime: 0001-01-01T00:00:00Z + mesh: default + modificationTime: 0001-01-01T00:00:00Z name: backend-to-db type: HealthCheck next: null diff --git a/app/kumactl/cmd/get/testdata/get-mesh.golden.json b/app/kumactl/cmd/get/testdata/get-mesh.golden.json index dd34a1a2b4c3..e5eb31eb3917 100644 --- a/app/kumactl/cmd/get/testdata/get-mesh.golden.json +++ b/app/kumactl/cmd/get/testdata/get-mesh.golden.json @@ -1,6 +1,8 @@ { "type": "Mesh", "name": "mesh-1", + "creationTime": "0001-01-01T00:00:00Z", + "modificationTime": "0001-01-01T00:00:00Z", "mtls": { "ca": { "provided": {} diff --git a/app/kumactl/cmd/get/testdata/get-mesh.golden.yaml b/app/kumactl/cmd/get/testdata/get-mesh.golden.yaml index fce51fa1cd4e..a4d1883ccd78 100644 --- a/app/kumactl/cmd/get/testdata/get-mesh.golden.yaml +++ b/app/kumactl/cmd/get/testdata/get-mesh.golden.yaml @@ -1,4 +1,4 @@ ---- +creationTime: 0001-01-01T00:00:00Z logging: backends: - name: logstash @@ -11,6 +11,7 @@ metrics: prometheus: path: /non-standard-path port: 1234 +modificationTime: 0001-01-01T00:00:00Z mtls: ca: provided: {} diff --git a/app/kumactl/cmd/get/testdata/get-meshes.golden.json b/app/kumactl/cmd/get/testdata/get-meshes.golden.json index c7b02529fa9d..c4b1c670aceb 100644 --- a/app/kumactl/cmd/get/testdata/get-meshes.golden.json +++ b/app/kumactl/cmd/get/testdata/get-meshes.golden.json @@ -8,7 +8,9 @@ } }, "name": "mesh1", - "type": "Mesh" + "type": "Mesh", + "creationTime": "0001-01-01T00:00:00Z", + "modificationTime": "0001-01-01T00:00:00Z" }, { "mtls": { @@ -18,7 +20,9 @@ } }, "name": "mesh2", - "type": "Mesh" + "type": "Mesh", + "creationTime": "0001-01-01T00:00:00Z", + "modificationTime": "0001-01-01T00:00:00Z" }, { "metrics": { @@ -65,7 +69,9 @@ } }, "name": "mesh3", - "type": "Mesh" + "type": "Mesh", + "creationTime": "0001-01-01T00:00:00Z", + "modificationTime": "0001-01-01T00:00:00Z" }, { "metrics": { @@ -86,7 +92,9 @@ } }, "name": "mesh4", - "type": "Mesh" + "type": "Mesh", + "creationTime": "0001-01-01T00:00:00Z", + "modificationTime": "0001-01-01T00:00:00Z" } ], "next": null diff --git a/app/kumactl/cmd/get/testdata/get-meshes.golden.yaml b/app/kumactl/cmd/get/testdata/get-meshes.golden.yaml index 931065761a59..4251f5359a2a 100644 --- a/app/kumactl/cmd/get/testdata/get-meshes.golden.yaml +++ b/app/kumactl/cmd/get/testdata/get-meshes.golden.yaml @@ -1,17 +1,22 @@ items: - - mtls: + - creationTime: 0001-01-01T00:00:00Z + modificationTime: 0001-01-01T00:00:00Z + mtls: enabled: true ca: builtin: {} name: mesh1 type: Mesh - - mtls: + - creationTime: 0001-01-01T00:00:00Z + modificationTime: 0001-01-01T00:00:00Z + mtls: enabled: true ca: provided: {} name: mesh2 type: Mesh - - logging: + - creationTime: 0001-01-01T00:00:00Z + logging: backends: - name: logstash tcp: @@ -23,6 +28,7 @@ items: prometheus: path: /non-standard-path port: 1234 + modificationTime: 0001-01-01T00:00:00Z mtls: ca: provided: {} @@ -36,12 +42,14 @@ items: zipkin: url: http://zipkin.eu:8080/v1/spans type: Mesh - - logging: + - creationTime: 0001-01-01T00:00:00Z + logging: backends: [] metrics: prometheus: path: /non-standard-path port: 1234 + modificationTime: 0001-01-01T00:00:00Z mtls: ca: provided: {} diff --git a/app/kumactl/cmd/get/testdata/get-proxytemplate.golden.json b/app/kumactl/cmd/get/testdata/get-proxytemplate.golden.json index 2ee071a8a7a1..7da0363ec8c2 100644 --- a/app/kumactl/cmd/get/testdata/get-proxytemplate.golden.json +++ b/app/kumactl/cmd/get/testdata/get-proxytemplate.golden.json @@ -2,6 +2,8 @@ "mesh": "default", "name": "proxytemplate-1", "type": "ProxyTemplate", + "creationTime": "0001-01-01T00:00:00Z", + "modificationTime": "0001-01-01T00:00:00Z", "selectors": [ { "match": { diff --git a/app/kumactl/cmd/get/testdata/get-proxytemplate.golden.yaml b/app/kumactl/cmd/get/testdata/get-proxytemplate.golden.yaml index bdc35e56563e..400b6ef71265 100644 --- a/app/kumactl/cmd/get/testdata/get-proxytemplate.golden.yaml +++ b/app/kumactl/cmd/get/testdata/get-proxytemplate.golden.yaml @@ -1,9 +1,11 @@ +conf: + imports: + - default-proxy +creationTime: 0001-01-01T00:00:00Z mesh: default +modificationTime: 0001-01-01T00:00:00Z name: proxytemplate-1 selectors: - match: service: "backend" -conf: - imports: - - default-proxy type: ProxyTemplate \ No newline at end of file diff --git a/app/kumactl/cmd/get/testdata/get-proxytemplates.golden.json b/app/kumactl/cmd/get/testdata/get-proxytemplates.golden.json index cffb324ce8d0..d89a77aed0b2 100644 --- a/app/kumactl/cmd/get/testdata/get-proxytemplates.golden.json +++ b/app/kumactl/cmd/get/testdata/get-proxytemplates.golden.json @@ -3,12 +3,16 @@ { "mesh": "default", "name": "custom-template", - "type": "ProxyTemplate" + "type": "ProxyTemplate", + "creationTime": "0001-01-01T00:00:00Z", + "modificationTime": "0001-01-01T00:00:00Z" }, { "mesh": "default", "name": "another-template", - "type": "ProxyTemplate" + "type": "ProxyTemplate", + "creationTime": "0001-01-01T00:00:00Z", + "modificationTime": "0001-01-01T00:00:00Z" } ], "next": null diff --git a/app/kumactl/cmd/get/testdata/get-proxytemplates.golden.yaml b/app/kumactl/cmd/get/testdata/get-proxytemplates.golden.yaml index efaddc6b03ae..81a18830e6ea 100644 --- a/app/kumactl/cmd/get/testdata/get-proxytemplates.golden.yaml +++ b/app/kumactl/cmd/get/testdata/get-proxytemplates.golden.yaml @@ -1,8 +1,12 @@ items: - - mesh: default + - creationTime: 0001-01-01T00:00:00Z + mesh: default + modificationTime: 0001-01-01T00:00:00Z name: custom-template type: ProxyTemplate - - mesh: default + - creationTime: 0001-01-01T00:00:00Z + mesh: default + modificationTime: 0001-01-01T00:00:00Z name: another-template type: ProxyTemplate next: null diff --git a/app/kumactl/cmd/get/testdata/get-traffic-log.golden.json b/app/kumactl/cmd/get/testdata/get-traffic-log.golden.json index f43615e51e9d..96079d047371 100644 --- a/app/kumactl/cmd/get/testdata/get-traffic-log.golden.json +++ b/app/kumactl/cmd/get/testdata/get-traffic-log.golden.json @@ -2,6 +2,8 @@ "type": "TrafficLog", "mesh": "default", "name": "traffic-log-1", + "creationTime": "0001-01-01T00:00:00Z", + "modificationTime": "0001-01-01T00:00:00Z", "sources": [ { "match": { diff --git a/app/kumactl/cmd/get/testdata/get-traffic-log.golden.yaml b/app/kumactl/cmd/get/testdata/get-traffic-log.golden.yaml index df2be58dba5d..810d21682965 100644 --- a/app/kumactl/cmd/get/testdata/get-traffic-log.golden.yaml +++ b/app/kumactl/cmd/get/testdata/get-traffic-log.golden.yaml @@ -1,13 +1,15 @@ -mesh: default -name: traffic-log-1 +conf: + backend: file +creationTime: 0001-01-01T00:00:00Z destinations: - match: env: dev service: backend1 +mesh: default +modificationTime: 0001-01-01T00:00:00Z +name: traffic-log-1 sources: - match: service: web1 version: "1.0" -conf: - backend: file type: TrafficLog \ No newline at end of file diff --git a/app/kumactl/cmd/get/testdata/get-traffic-logs.golden.json b/app/kumactl/cmd/get/testdata/get-traffic-logs.golden.json index 50d51d17bc29..75091be5a25f 100644 --- a/app/kumactl/cmd/get/testdata/get-traffic-logs.golden.json +++ b/app/kumactl/cmd/get/testdata/get-traffic-logs.golden.json @@ -3,6 +3,8 @@ { "mesh": "default", "name": "web1-to-backend1", + "creationTime": "0001-01-01T00:00:00Z", + "modificationTime": "0001-01-01T00:00:00Z", "sources": [ { "match": { @@ -27,6 +29,8 @@ { "mesh": "default", "name": "web2-to-backend2", + "creationTime": "0001-01-01T00:00:00Z", + "modificationTime": "0001-01-01T00:00:00Z", "sources": [ { "match": { diff --git a/app/kumactl/cmd/get/testdata/get-traffic-logs.golden.yaml b/app/kumactl/cmd/get/testdata/get-traffic-logs.golden.yaml index e49a105cbaff..99eae5f0506b 100644 --- a/app/kumactl/cmd/get/testdata/get-traffic-logs.golden.yaml +++ b/app/kumactl/cmd/get/testdata/get-traffic-logs.golden.yaml @@ -1,5 +1,7 @@ items: - - mesh: default + - creationTime: 0001-01-01T00:00:00Z + mesh: default + modificationTime: 0001-01-01T00:00:00Z name: web1-to-backend1 destinations: - match: @@ -12,7 +14,9 @@ items: conf: backend: file type: TrafficLog - - mesh: default + - creationTime: 0001-01-01T00:00:00Z + mesh: default + modificationTime: 0001-01-01T00:00:00Z name: web2-to-backend2 destinations: - match: diff --git a/app/kumactl/cmd/get/testdata/get-traffic-permission.golden.json b/app/kumactl/cmd/get/testdata/get-traffic-permission.golden.json index 31328686c96b..8da5c6a1cd26 100644 --- a/app/kumactl/cmd/get/testdata/get-traffic-permission.golden.json +++ b/app/kumactl/cmd/get/testdata/get-traffic-permission.golden.json @@ -1,21 +1,23 @@ { - "type": "TrafficPermission", - "mesh": "default", - "name": "traffic-permission-1", - "sources": [ - { - "match": { - "service": "web1", - "version": "1.0" - } + "type": "TrafficPermission", + "mesh": "default", + "name": "traffic-permission-1", + "creationTime": "0001-01-01T00:00:00Z", + "modificationTime": "0001-01-01T00:00:00Z", + "sources": [ + { + "match": { + "service": "web1", + "version": "1.0" } - ], - "destinations": [ - { - "match": { - "env": "dev", - "service": "backend1" - } + } + ], + "destinations": [ + { + "match": { + "env": "dev", + "service": "backend1" } - ] - } \ No newline at end of file + } + ] +} \ No newline at end of file diff --git a/app/kumactl/cmd/get/testdata/get-traffic-permission.golden.yaml b/app/kumactl/cmd/get/testdata/get-traffic-permission.golden.yaml index c75f30e87ffe..49f69b27f3cf 100644 --- a/app/kumactl/cmd/get/testdata/get-traffic-permission.golden.yaml +++ b/app/kumactl/cmd/get/testdata/get-traffic-permission.golden.yaml @@ -1,9 +1,11 @@ -mesh: default -name: traffic-permission-1 +creationTime: 0001-01-01T00:00:00Z destinations: - match: env: dev service: backend1 +mesh: default +modificationTime: 0001-01-01T00:00:00Z +name: traffic-permission-1 sources: - match: service: web1 diff --git a/app/kumactl/cmd/get/testdata/get-traffic-permissions.golden.json b/app/kumactl/cmd/get/testdata/get-traffic-permissions.golden.json index 031154570b17..ac4aa8153844 100644 --- a/app/kumactl/cmd/get/testdata/get-traffic-permissions.golden.json +++ b/app/kumactl/cmd/get/testdata/get-traffic-permissions.golden.json @@ -3,6 +3,8 @@ { "mesh": "default", "name": "web1-to-backend1", + "creationTime": "0001-01-01T00:00:00Z", + "modificationTime": "0001-01-01T00:00:00Z", "sources": [ { "match": { @@ -24,6 +26,8 @@ { "mesh": "default", "name": "web2-to-backend2", + "creationTime": "0001-01-01T00:00:00Z", + "modificationTime": "0001-01-01T00:00:00Z", "sources": [ { "match": { diff --git a/app/kumactl/cmd/get/testdata/get-traffic-permissions.golden.yaml b/app/kumactl/cmd/get/testdata/get-traffic-permissions.golden.yaml index 61524bec8b08..bdc960fa3cb9 100644 --- a/app/kumactl/cmd/get/testdata/get-traffic-permissions.golden.yaml +++ b/app/kumactl/cmd/get/testdata/get-traffic-permissions.golden.yaml @@ -1,5 +1,7 @@ items: - - mesh: default + - creationTime: 0001-01-01T00:00:00Z + mesh: default + modificationTime: 0001-01-01T00:00:00Z name: web1-to-backend1 destinations: - match: @@ -10,7 +12,9 @@ items: service: web1 version: "1.0" type: TrafficPermission - - mesh: default + - creationTime: 0001-01-01T00:00:00Z + mesh: default + modificationTime: 0001-01-01T00:00:00Z name: web2-to-backend2 destinations: - match: diff --git a/app/kumactl/cmd/get/testdata/get-traffic-route.golden.json b/app/kumactl/cmd/get/testdata/get-traffic-route.golden.json index e660273c728a..98b1faee4d97 100644 --- a/app/kumactl/cmd/get/testdata/get-traffic-route.golden.json +++ b/app/kumactl/cmd/get/testdata/get-traffic-route.golden.json @@ -2,6 +2,8 @@ "type": "TrafficRoute", "mesh": "default", "name": "traffic-route-1", + "creationTime": "0001-01-01T00:00:00Z", + "modificationTime": "0001-01-01T00:00:00Z", "sources": [ { "match": { diff --git a/app/kumactl/cmd/get/testdata/get-traffic-route.golden.yaml b/app/kumactl/cmd/get/testdata/get-traffic-route.golden.yaml index e5546f12b689..34a0dd1b2a98 100644 --- a/app/kumactl/cmd/get/testdata/get-traffic-route.golden.yaml +++ b/app/kumactl/cmd/get/testdata/get-traffic-route.golden.yaml @@ -1,14 +1,16 @@ -mesh: default -name: traffic-route-1 -sources: - - match: - service: backend -destinations: - - match: - service: redis conf: - weight: 90 destination: service: redis version: "1.0" +creationTime: 0001-01-01T00:00:00Z +destinations: + - match: + service: redis +mesh: default +modificationTime: 0001-01-01T00:00:00Z +name: traffic-route-1 +sources: + - match: + service: backend type: TrafficRoute \ No newline at end of file diff --git a/app/kumactl/cmd/get/testdata/get-traffic-routes.golden.json b/app/kumactl/cmd/get/testdata/get-traffic-routes.golden.json index bb5c942187c7..927a24902216 100644 --- a/app/kumactl/cmd/get/testdata/get-traffic-routes.golden.json +++ b/app/kumactl/cmd/get/testdata/get-traffic-routes.golden.json @@ -3,12 +3,16 @@ { "mesh": "default", "name": "web-to-backend", - "type": "TrafficRoute" + "type": "TrafficRoute", + "creationTime": "0001-01-01T00:00:00Z", + "modificationTime": "0001-01-01T00:00:00Z" }, { "mesh": "default", "name": "backend-to-db", - "type": "TrafficRoute" + "type": "TrafficRoute", + "creationTime": "0001-01-01T00:00:00Z", + "modificationTime": "0001-01-01T00:00:00Z" } ], "next": null diff --git a/app/kumactl/cmd/get/testdata/get-traffic-routes.golden.yaml b/app/kumactl/cmd/get/testdata/get-traffic-routes.golden.yaml index de0b9720e4ec..712886364b97 100644 --- a/app/kumactl/cmd/get/testdata/get-traffic-routes.golden.yaml +++ b/app/kumactl/cmd/get/testdata/get-traffic-routes.golden.yaml @@ -1,8 +1,12 @@ items: -- mesh: default +- creationTime: 0001-01-01T00:00:00Z + mesh: default + modificationTime: 0001-01-01T00:00:00Z name: web-to-backend type: TrafficRoute -- mesh: default +- creationTime: 0001-01-01T00:00:00Z + mesh: default + modificationTime: 0001-01-01T00:00:00Z name: backend-to-db type: TrafficRoute next: null diff --git a/app/kumactl/cmd/get/testdata/get-traffic-trace.golden.json b/app/kumactl/cmd/get/testdata/get-traffic-trace.golden.json index 46cb64e59712..6ff27b200c9b 100644 --- a/app/kumactl/cmd/get/testdata/get-traffic-trace.golden.json +++ b/app/kumactl/cmd/get/testdata/get-traffic-trace.golden.json @@ -2,6 +2,8 @@ "type": "TrafficTrace", "mesh": "default", "name": "traffic-trace-1", + "creationTime": "0001-01-01T00:00:00Z", + "modificationTime": "0001-01-01T00:00:00Z", "selectors": [ { "match": { diff --git a/app/kumactl/cmd/get/testdata/get-traffic-trace.golden.yaml b/app/kumactl/cmd/get/testdata/get-traffic-trace.golden.yaml index a6c86592ed9f..b2bae783969d 100644 --- a/app/kumactl/cmd/get/testdata/get-traffic-trace.golden.yaml +++ b/app/kumactl/cmd/get/testdata/get-traffic-trace.golden.yaml @@ -1,9 +1,11 @@ +conf: + backend: zipkin +creationTime: 0001-01-01T00:00:00Z mesh: default +modificationTime: 0001-01-01T00:00:00Z name: traffic-trace-1 selectors: - match: service: web1 version: "1.0" -conf: - backend: zipkin type: TrafficTrace \ No newline at end of file diff --git a/app/kumactl/cmd/get/testdata/get-traffic-traces.golden.json b/app/kumactl/cmd/get/testdata/get-traffic-traces.golden.json index 6445b5553a8b..8c7ab9d1d438 100644 --- a/app/kumactl/cmd/get/testdata/get-traffic-traces.golden.json +++ b/app/kumactl/cmd/get/testdata/get-traffic-traces.golden.json @@ -3,6 +3,8 @@ { "mesh": "default", "name": "web1", + "creationTime": "0001-01-01T00:00:00Z", + "modificationTime": "0001-01-01T00:00:00Z", "selectors": [ { "match": { @@ -19,6 +21,8 @@ { "mesh": "default", "name": "web2", + "creationTime": "0001-01-01T00:00:00Z", + "modificationTime": "0001-01-01T00:00:00Z", "selectors": [ { "match": { diff --git a/app/kumactl/cmd/get/testdata/get-traffic-traces.golden.yaml b/app/kumactl/cmd/get/testdata/get-traffic-traces.golden.yaml index 1e4668b8d00e..b0be7e7baa74 100644 --- a/app/kumactl/cmd/get/testdata/get-traffic-traces.golden.yaml +++ b/app/kumactl/cmd/get/testdata/get-traffic-traces.golden.yaml @@ -1,5 +1,6 @@ items: - mesh: default + modificationTime: 0001-01-01T00:00:00Z name: web1 selectors: - match: @@ -7,8 +8,10 @@ items: version: "1.0" conf: backend: zipkin + creationTime: 0001-01-01T00:00:00Z type: TrafficTrace - mesh: default + modificationTime: 0001-01-01T00:00:00Z name: web2 selectors: - match: @@ -16,5 +19,6 @@ items: version: "1.0" conf: backend: zipkin + creationTime: 0001-01-01T00:00:00Z type: TrafficTrace next: null diff --git a/app/kumactl/cmd/inspect/inspect_dataplanes_test.go b/app/kumactl/cmd/inspect/inspect_dataplanes_test.go index efb8efed91e7..38c80cf36002 100644 --- a/app/kumactl/cmd/inspect/inspect_dataplanes_test.go +++ b/app/kumactl/cmd/inspect/inspect_dataplanes_test.go @@ -55,8 +55,10 @@ var _ = Describe("kumactl inspect dataplanes", func() { sampleDataplaneOverview = []*mesh_core.DataplaneOverviewResource{ { Meta: &test_model.ResourceMeta{ - Mesh: "default", - Name: "experiment", + Mesh: "default", + Name: "experiment", + CreationTime: t1, + ModificationTime: now, }, Spec: mesh_proto.DataplaneOverview{ Dataplane: &mesh_proto.Dataplane{ @@ -112,8 +114,10 @@ var _ = Describe("kumactl inspect dataplanes", func() { }, { Meta: &test_model.ResourceMeta{ - Mesh: "default", - Name: "example", + Mesh: "default", + Name: "example", + CreationTime: t1, + ModificationTime: now, }, Spec: mesh_proto.DataplaneOverview{ Dataplane: &mesh_proto.Dataplane{ diff --git a/app/kumactl/cmd/inspect/testdata/inspect-dataplanes.golden.json b/app/kumactl/cmd/inspect/testdata/inspect-dataplanes.golden.json index 8908ff3fe9e0..21ce257e0e9d 100644 --- a/app/kumactl/cmd/inspect/testdata/inspect-dataplanes.golden.json +++ b/app/kumactl/cmd/inspect/testdata/inspect-dataplanes.golden.json @@ -52,6 +52,8 @@ }, "mesh": "default", "name": "experiment", + "creationTime": "2018-07-17T16:05:36.995Z", + "modificationTime": "2019-07-17T18:08:41Z", "type": "DataplaneOverview" }, { @@ -87,6 +89,8 @@ }, "mesh": "default", "name": "example", + "creationTime": "2018-07-17T16:05:36.995Z", + "modificationTime": "2019-07-17T18:08:41Z", "type": "DataplaneOverview" } ], diff --git a/app/kumactl/cmd/inspect/testdata/inspect-dataplanes.golden.yaml b/app/kumactl/cmd/inspect/testdata/inspect-dataplanes.golden.yaml index 41a3b9520a3d..29b214c72c54 100644 --- a/app/kumactl/cmd/inspect/testdata/inspect-dataplanes.golden.yaml +++ b/app/kumactl/cmd/inspect/testdata/inspect-dataplanes.golden.yaml @@ -1,5 +1,6 @@ items: - - dataplane: + - creationTime: 2018-07-17T16:05:36.995Z + dataplane: networking: address: 127.0.0.1 inbound: @@ -30,9 +31,11 @@ items: responsesRejected: "2" responsesSent: "20" mesh: default + modificationTime: "2019-07-17T18:08:41Z" name: experiment type: DataplaneOverview - - dataplane: + - creationTime: 2018-07-17T16:05:36.995Z + dataplane: networking: address: 127.0.0.1 inbound: @@ -49,6 +52,7 @@ items: - controlPlaneInstanceId: node-003 id: "3" mesh: default + modificationTime: "2019-07-17T18:08:41Z" name: example type: DataplaneOverview next: null diff --git a/app/kumactl/pkg/output/json/json_test.go b/app/kumactl/pkg/output/json/json_test.go index a9cbd649a36f..df50e8f42ac3 100644 --- a/app/kumactl/pkg/output/json/json_test.go +++ b/app/kumactl/pkg/output/json/json_test.go @@ -4,6 +4,7 @@ import ( "bytes" "io/ioutil" "path/filepath" + "time" . "github.com/onsi/ginkgo" . "github.com/onsi/ginkgo/extensions/table" @@ -21,7 +22,8 @@ var _ = Describe("printer", func() { var printer output.Printer var buf *bytes.Buffer - + t1, _ := time.Parse(time.RFC3339, "2018-07-17T16:05:36.995+00:00") + t2, _ := time.Parse(time.RFC3339, "2019-07-17T16:05:36.995+00:00") BeforeEach(func() { printer = json.NewPrinter() buf = &bytes.Buffer{} @@ -54,8 +56,10 @@ var _ = Describe("printer", func() { Entry("format response from Kuma REST API", testCase{ obj: &core_rest.Resource{ Meta: core_rest.ResourceMeta{ - Type: string(mesh_core.MeshType), - Name: "demo", + Type: string(mesh_core.MeshType), + Name: "demo", + CreationTime: t1, + ModificationTime: t2, }, Spec: &mesh_proto.Mesh{ Mtls: &mesh_proto.Mesh_Mtls{ diff --git a/app/kumactl/pkg/output/json/testdata/mesh.golden.json b/app/kumactl/pkg/output/json/testdata/mesh.golden.json index f31f007a3b89..e80763c873e4 100644 --- a/app/kumactl/pkg/output/json/testdata/mesh.golden.json +++ b/app/kumactl/pkg/output/json/testdata/mesh.golden.json @@ -1,6 +1,8 @@ { "type": "Mesh", "name": "demo", + "creationTime": "2018-07-17T16:05:36.995Z", + "modificationTime": "2019-07-17T16:05:36.995Z", "mtls": { "ca": { "builtin": {} diff --git a/app/kumactl/pkg/output/yaml/testdata/mesh.golden.yaml b/app/kumactl/pkg/output/yaml/testdata/mesh.golden.yaml index cbb21dda6ff8..5621d308b780 100644 --- a/app/kumactl/pkg/output/yaml/testdata/mesh.golden.yaml +++ b/app/kumactl/pkg/output/yaml/testdata/mesh.golden.yaml @@ -1,3 +1,5 @@ +creationTime: "2018-07-17T16:05:36.995Z" +modificationTime: "2019-07-17T16:05:36.995Z" mtls: ca: builtin: {} diff --git a/app/kumactl/pkg/output/yaml/yaml_test.go b/app/kumactl/pkg/output/yaml/yaml_test.go index 0a7b7d45388d..5c720f3fa95b 100644 --- a/app/kumactl/pkg/output/yaml/yaml_test.go +++ b/app/kumactl/pkg/output/yaml/yaml_test.go @@ -4,6 +4,7 @@ import ( "bytes" "io/ioutil" "path/filepath" + "time" . "github.com/onsi/ginkgo" . "github.com/onsi/ginkgo/extensions/table" @@ -21,7 +22,8 @@ var _ = Describe("printer", func() { var printer output.Printer var buf *bytes.Buffer - + t1, _ := time.Parse(time.RFC3339, "2018-07-17T16:05:36.995+00:00") + t2, _ := time.Parse(time.RFC3339, "2019-07-17T16:05:36.995+00:00") BeforeEach(func() { printer = yaml.NewPrinter() buf = &bytes.Buffer{} @@ -54,8 +56,10 @@ var _ = Describe("printer", func() { Entry("format response from Kuma REST API", testCase{ obj: &core_rest.Resource{ Meta: core_rest.ResourceMeta{ - Type: string(mesh_core.MeshType), - Name: "demo", + Type: string(mesh_core.MeshType), + Name: "demo", + CreationTime: t1, + ModificationTime: t2, }, Spec: &mesh_proto.Mesh{ Mtls: &mesh_proto.Mesh_Mtls{ diff --git a/pkg/api-server/dataplane_overview_endpoints_test.go b/pkg/api-server/dataplane_overview_endpoints_test.go index 3dbc81792550..4e3b467d9849 100644 --- a/pkg/api-server/dataplane_overview_endpoints_test.go +++ b/pkg/api-server/dataplane_overview_endpoints_test.go @@ -24,7 +24,7 @@ var _ = Describe("Dataplane Overview Endpoints", func() { var apiServer *api_server.ApiServer var resourceStore store.ResourceStore var stop chan struct{} - + t1, _ := time.Parse(time.RFC3339, "2018-07-17T16:05:36.995+00:00") BeforeEach(func() { resourceStore = memory.NewStore() apiServer = createTestApiServer(resourceStore, config.DefaultApiServerConfig()) @@ -46,7 +46,7 @@ var _ = Describe("Dataplane Overview Endpoints", func() { }) BeforeEach(func() { - err := resourceStore.Create(context.Background(), &mesh_core.MeshResource{}, store.CreateByKey("mesh1", "mesh1")) + err := resourceStore.Create(context.Background(), &mesh_core.MeshResource{}, store.CreateByKey("mesh1", "mesh1"), store.CreatedAt(t1)) Expect(err).ToNot(HaveOccurred()) }) @@ -74,7 +74,7 @@ var _ = Describe("Dataplane Overview Endpoints", func() { }, }, } - err := resourceStore.Create(context.Background(), &dpResource, store.CreateByKey("dp1", "mesh1")) + err := resourceStore.Create(context.Background(), &dpResource, store.CreateByKey("dp1", "mesh1"), store.CreatedAt(t1)) Expect(err).ToNot(HaveOccurred()) sampleTime, _ := time.Parse(time.RFC3339, "2019-07-01T00:00:00+00:00") @@ -99,6 +99,8 @@ var _ = Describe("Dataplane Overview Endpoints", func() { "type": "DataplaneOverview", "name": "dp1", "mesh": "mesh1", + "creationTime": "2018-07-17T16:05:36.995Z", + "modificationTime": "2018-07-17T16:05:36.995Z", "dataplane": { "networking": { "address": "127.0.0.1", diff --git a/pkg/api-server/fault_injection_endpoints_test.go b/pkg/api-server/fault_injection_endpoints_test.go index 737e44be1b47..84758ec73259 100644 --- a/pkg/api-server/fault_injection_endpoints_test.go +++ b/pkg/api-server/fault_injection_endpoints_test.go @@ -55,6 +55,7 @@ var _ = Describe("FaultInjection Endpoints", func() { given := ` type: FaultInjection name: web-to-backend + modificationTime: "0001-01-01T00:00:00Z" mesh: default sources: - match: @@ -64,6 +65,7 @@ var _ = Describe("FaultInjection Endpoints", func() { - match: service: backend protocol: http + creationTime: "0001-01-01T00:00:00Z" conf: abort: httpStatus: 500 diff --git a/pkg/api-server/health_check_endpoints_test.go b/pkg/api-server/health_check_endpoints_test.go index d259209ecc8b..dff621920fdd 100644 --- a/pkg/api-server/health_check_endpoints_test.go +++ b/pkg/api-server/health_check_endpoints_test.go @@ -56,6 +56,7 @@ var _ = Describe("HealthCheck Endpoints", func() { given := ` type: HealthCheck name: web-to-backend + modificationTime: "0001-01-01T00:00:00Z" mesh: default sources: - match: @@ -63,6 +64,7 @@ var _ = Describe("HealthCheck Endpoints", func() { destinations: - match: service: backend + creationTime: "0001-01-01T00:00:00Z" conf: activeChecks: interval: 10s diff --git a/pkg/api-server/mesh_endpoints_test.go b/pkg/api-server/mesh_endpoints_test.go index fdba6437f373..9e1809b0957d 100644 --- a/pkg/api-server/mesh_endpoints_test.go +++ b/pkg/api-server/mesh_endpoints_test.go @@ -4,6 +4,7 @@ import ( "context" "fmt" "io/ioutil" + "time" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" @@ -22,7 +23,7 @@ var _ = Describe("Resource Endpoints", func() { var resourceStore store.ResourceStore var client resourceApiClient var stop chan struct{} - + t1, _ := time.Parse(time.RFC3339, "2018-07-17T16:05:36.995+00:00") BeforeEach(func() { resourceStore = memory.NewStore() apiServer = createTestApiServer(resourceStore, config.DefaultApiServerConfig()) @@ -46,7 +47,7 @@ var _ = Describe("Resource Endpoints", func() { Describe("On GET", func() { It("should return an existing resource", func() { // given - putMeshIntoStore(resourceStore, "mesh-1") + putMeshIntoStore(resourceStore, "mesh-1", t1) // when response := client.get("mesh-1") @@ -58,7 +59,9 @@ var _ = Describe("Resource Endpoints", func() { json := ` { "type": "Mesh", - "name": "mesh-1" + "name": "mesh-1", + "creationTime": "2018-07-17T16:05:36.995Z", + "modificationTime": "2018-07-17T16:05:36.995Z" }` Expect(body).To(MatchJSON(json)) }) @@ -73,8 +76,8 @@ var _ = Describe("Resource Endpoints", func() { It("should list resources", func() { // given - putMeshIntoStore(resourceStore, "mesh-1") - putMeshIntoStore(resourceStore, "mesh-2") + putMeshIntoStore(resourceStore, "mesh-1", t1) + putMeshIntoStore(resourceStore, "mesh-2", t1) // when response := client.list() @@ -84,12 +87,16 @@ var _ = Describe("Resource Endpoints", func() { json1 := ` { "type": "Mesh", - "name": "mesh-1" + "name": "mesh-1", + "creationTime": "2018-07-17T16:05:36.995Z", + "modificationTime": "2018-07-17T16:05:36.995Z" }` json2 := ` { "type": "Mesh", - "name": "mesh-2" + "name": "mesh-2", + "creationTime": "2018-07-17T16:05:36.995Z", + "modificationTime": "2018-07-17T16:05:36.995Z" }` body, err := ioutil.ReadAll(response.Body) Expect(err).ToNot(HaveOccurred()) @@ -122,7 +129,7 @@ var _ = Describe("Resource Endpoints", func() { It("should update a resource when one already exist", func() { // given name := "mesh-1" - putMeshIntoStore(resourceStore, name) + putMeshIntoStore(resourceStore, name, t1) // when res := rest.Resource{ @@ -208,7 +215,7 @@ var _ = Describe("Resource Endpoints", func() { It("should delete existing resource", func() { // given name := "mesh-1" - putMeshIntoStore(resourceStore, name) + putMeshIntoStore(resourceStore, name, t1) // when response := client.delete(name) @@ -232,8 +239,8 @@ var _ = Describe("Resource Endpoints", func() { }) }) -func putMeshIntoStore(resourceStore store.ResourceStore, name string) { +func putMeshIntoStore(resourceStore store.ResourceStore, name string, createdAt time.Time) { resource := mesh.MeshResource{} - err := resourceStore.Create(context.Background(), &resource, store.CreateByKey(name, name)) + err := resourceStore.Create(context.Background(), &resource, store.CreateByKey(name, name), store.CreatedAt(createdAt)) Expect(err).NotTo(HaveOccurred()) } diff --git a/pkg/api-server/resource_endpoints_test.go b/pkg/api-server/resource_endpoints_test.go index 31d7ec53cda9..ba86f9a74146 100644 --- a/pkg/api-server/resource_endpoints_test.go +++ b/pkg/api-server/resource_endpoints_test.go @@ -75,6 +75,8 @@ var _ = Describe("Resource Endpoints", func() { "type": "SampleTrafficRoute", "name": "tr-1", "mesh": "default", + "creationTime": "0001-01-01T00:00:00Z", + "modificationTime": "0001-01-01T00:00:00Z", "path": "/sample-path" }` Expect(body).To(MatchJSON(json)) @@ -113,6 +115,8 @@ var _ = Describe("Resource Endpoints", func() { "type": "SampleTrafficRoute", "name": "tr-1", "mesh": "default", + "creationTime": "0001-01-01T00:00:00Z", + "modificationTime": "0001-01-01T00:00:00Z", "path": "/sample-path" }` json2 := ` @@ -120,6 +124,8 @@ var _ = Describe("Resource Endpoints", func() { "type": "SampleTrafficRoute", "name": "tr-2", "mesh": "default", + "creationTime": "0001-01-01T00:00:00Z", + "modificationTime": "0001-01-01T00:00:00Z", "path": "/sample-path" }` body, err := ioutil.ReadAll(response.Body) @@ -149,6 +155,8 @@ var _ = Describe("Resource Endpoints", func() { "type": "SampleTrafficRoute", "name": "tr-1", "mesh": "mesh-1", + "creationTime": "0001-01-01T00:00:00Z", + "modificationTime": "0001-01-01T00:00:00Z", "path": "/sample-path" }` json2 := ` @@ -156,6 +164,8 @@ var _ = Describe("Resource Endpoints", func() { "type": "SampleTrafficRoute", "name": "tr-2", "mesh": "mesh-2", + "creationTime": "0001-01-01T00:00:00Z", + "modificationTime": "0001-01-01T00:00:00Z", "path": "/sample-path" }` body, err := ioutil.ReadAll(response.Body) @@ -188,12 +198,16 @@ var _ = Describe("Resource Endpoints", func() { "type": "SampleTrafficRoute", "name": "tr-1", "mesh": "mesh-1", + "creationTime": "0001-01-01T00:00:00Z", + "modificationTime": "0001-01-01T00:00:00Z", "path": "/sample-path" }, { "type": "SampleTrafficRoute", "name": "tr-2", "mesh": "mesh-1", + "creationTime": "0001-01-01T00:00:00Z", + "modificationTime": "0001-01-01T00:00:00Z", "path": "/sample-path" } ], @@ -219,6 +233,8 @@ var _ = Describe("Resource Endpoints", func() { "type": "SampleTrafficRoute", "name": "tr-3", "mesh": "mesh-1", + "creationTime": "0001-01-01T00:00:00Z", + "modificationTime": "0001-01-01T00:00:00Z", "path": "/sample-path" } ], diff --git a/pkg/api-server/traffic_route_endpoints_test.go b/pkg/api-server/traffic_route_endpoints_test.go index 26c0cb12c62c..f3372bc4059e 100644 --- a/pkg/api-server/traffic_route_endpoints_test.go +++ b/pkg/api-server/traffic_route_endpoints_test.go @@ -56,6 +56,7 @@ var _ = Describe("TrafficRoute Endpoints", func() { given := ` type: TrafficRoute name: web-to-backend + modificationTime: "0001-01-01T00:00:00Z" mesh: default sources: - match: @@ -65,6 +66,7 @@ var _ = Describe("TrafficRoute Endpoints", func() { destinations: - match: service: backend + creationTime: "0001-01-01T00:00:00Z" conf: - weight: 90 destination: diff --git a/pkg/api-server/traffic_trace_endpoints_test.go b/pkg/api-server/traffic_trace_endpoints_test.go index a2ce04158778..1dbbd6bfb9d4 100644 --- a/pkg/api-server/traffic_trace_endpoints_test.go +++ b/pkg/api-server/traffic_trace_endpoints_test.go @@ -57,10 +57,12 @@ var _ = Describe("TrafficTrace Endpoints", func() { type: TrafficTrace name: backends-eu mesh: default + modificationTime: "0001-01-01T00:00:00Z" selectors: - match: service: backend region: eu + creationTime: "0001-01-01T00:00:00Z" conf: backend: zipkin-eu ` diff --git a/pkg/core/resources/manager/manager.go b/pkg/core/resources/manager/manager.go index 9135fc1cd247..9c3a11916b2e 100644 --- a/pkg/core/resources/manager/manager.go +++ b/pkg/core/resources/manager/manager.go @@ -47,13 +47,13 @@ func (r *resourcesManager) Create(ctx context.Context, resource model.Resource, if err := resource.Validate(); err != nil { return err } - opts := store.NewCreateOptions(append(fs, store.CreatedAt(time.Now()))...) + opts := store.NewCreateOptions(fs...) if resource.GetType() != mesh.MeshType { if err := r.ensureMeshExists(ctx, opts.Mesh); err != nil { return err } } - return r.Store.Create(ctx, resource, fs...) + return r.Store.Create(ctx, resource, append(fs, store.CreatedAt(time.Now()))...) } func (r *resourcesManager) ensureMeshExists(ctx context.Context, meshName string) error { diff --git a/pkg/core/resources/model/rest/converter.go b/pkg/core/resources/model/rest/converter.go index c3d0b2f93be8..3a2ba4162fbf 100644 --- a/pkg/core/resources/model/rest/converter.go +++ b/pkg/core/resources/model/rest/converter.go @@ -16,9 +16,11 @@ func (c *from) Resource(r model.Resource) *Resource { } return &Resource{ Meta: ResourceMeta{ - Mesh: meshName, - Type: string(r.GetType()), - Name: r.GetMeta().GetName(), + Mesh: meshName, + Type: string(r.GetType()), + Name: r.GetMeta().GetName(), + CreationTime: r.GetMeta().GetCreationTime(), + ModificationTime: r.GetMeta().GetModificationTime(), }, Spec: r.GetSpec(), } diff --git a/pkg/core/resources/model/rest/resource.go b/pkg/core/resources/model/rest/resource.go index 5e2f023ab93e..c61626972ee5 100644 --- a/pkg/core/resources/model/rest/resource.go +++ b/pkg/core/resources/model/rest/resource.go @@ -3,6 +3,7 @@ package rest import ( "bytes" "encoding/json" + "time" "github.com/golang/protobuf/jsonpb" "github.com/pkg/errors" @@ -11,9 +12,11 @@ import ( ) type ResourceMeta struct { - Type string `json:"type"` - Mesh string `json:"mesh,omitempty"` - Name string `json:"name"` + Type string `json:"type"` + Mesh string `json:"mesh,omitempty"` + Name string `json:"name"` + CreationTime time.Time `json:"creationTime"` + ModificationTime time.Time `json:"modificationTime"` } type Resource struct { diff --git a/pkg/core/resources/model/rest/resource_test.go b/pkg/core/resources/model/rest/resource_test.go index 64a1d914fd52..8afd68363b72 100644 --- a/pkg/core/resources/model/rest/resource_test.go +++ b/pkg/core/resources/model/rest/resource_test.go @@ -2,6 +2,7 @@ package rest_test import ( "encoding/json" + "time" . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" @@ -13,15 +14,22 @@ import ( ) var _ = Describe("Rest Resource", func() { + var t1, t2 time.Time + BeforeEach(func() { + t1, _ = time.Parse(time.RFC3339, "2018-07-17T16:05:36.995+00:00") + t2, _ = time.Parse(time.RFC3339, "2019-07-17T16:05:36.995+00:00") + }) Describe("Resource", func() { Describe("MarshalJSON", func() { It("should marshal JSON with proper field order", func() { // given res := &rest.Resource{ Meta: rest.ResourceMeta{ - Type: "TrafficRoute", - Mesh: "default", - Name: "one", + Type: "TrafficRoute", + Mesh: "default", + Name: "one", + CreationTime: t1, + ModificationTime: t2, }, Spec: &sample_proto.TrafficRoute{ Path: "/example", @@ -35,7 +43,7 @@ var _ = Describe("Rest Resource", func() { Expect(err).ToNot(HaveOccurred()) // and - expected := `{"type":"TrafficRoute","mesh":"default","name":"one","path":"/example"}` + expected := `{"type":"TrafficRoute","mesh":"default","name":"one","creationTime":"2018-07-17T16:05:36.995Z","modificationTime":"2019-07-17T16:05:36.995Z","path":"/example"}` Expect(string(bytes)).To(Equal(expected)) }) @@ -43,9 +51,11 @@ var _ = Describe("Rest Resource", func() { // given res := &rest.Resource{ Meta: rest.ResourceMeta{ - Type: "TrafficRoute", - Mesh: "default", - Name: "one", + Type: "TrafficRoute", + Mesh: "default", + Name: "one", + CreationTime: t1, + ModificationTime: t2, }, } @@ -56,7 +66,7 @@ var _ = Describe("Rest Resource", func() { Expect(err).ToNot(HaveOccurred()) // and - expected := `{"type":"TrafficRoute","mesh":"default","name":"one"}` + expected := `{"type":"TrafficRoute","mesh":"default","name":"one","creationTime":"2018-07-17T16:05:36.995Z","modificationTime":"2019-07-17T16:05:36.995Z"}` Expect(string(bytes)).To(Equal(expected)) }) }) diff --git a/pkg/plugins/resources/remote/store.go b/pkg/plugins/resources/remote/store.go index 610c02a6eddf..f06668feabbd 100644 --- a/pkg/plugins/resources/remote/store.go +++ b/pkg/plugins/resources/remote/store.go @@ -44,7 +44,6 @@ func (s *remoteStore) Create(ctx context.Context, res model.Resource, fs ...stor return nil } func (s *remoteStore) Update(ctx context.Context, res model.Resource, fs ...store.UpdateOptionsFunc) error { - _ = store.NewUpdateOptions(fs...) meta := rest.ResourceMeta{ Type: string(res.GetType()), Name: res.GetMeta().GetName(), diff --git a/pkg/plugins/resources/remote/store_test.go b/pkg/plugins/resources/remote/store_test.go index fdc8fa96f727..8548a7319780 100644 --- a/pkg/plugins/resources/remote/store_test.go +++ b/pkg/plugins/resources/remote/store_test.go @@ -9,6 +9,7 @@ import ( "os" "path/filepath" "strings" + "time" "github.com/Kong/kuma/api/mesh/v1alpha1" "github.com/Kong/kuma/pkg/core/resources/apis/mesh" @@ -29,8 +30,9 @@ import ( var _ = Describe("RemoteStore", func() { + creationTime, _ := time.Parse(time.RFC3339, "2018-07-17T16:05:36.995Z") + modificationTime, _ := time.Parse(time.RFC3339, "2019-07-17T16:05:36.995Z") type RequestAssertion = func(req *http.Request) - setupStore := func(file string, assertion RequestAssertion) core_store.ResourceStore { client := &http.Client{ Transport: RoundTripperFunc(func(req *http.Request) (*http.Response, error) { @@ -72,7 +74,6 @@ var _ = Describe("RemoteStore", func() { } return remote.NewStore(client, apis) } - Describe("Get()", func() { It("should get resource", func() { // setup @@ -91,6 +92,8 @@ var _ = Describe("RemoteStore", func() { Expect(resource.GetMeta().GetName()).To(Equal("res-1")) Expect(resource.GetMeta().GetMesh()).To(Equal("default")) + Expect(resource.GetMeta().GetCreationTime()).Should(Equal(creationTime)) + Expect(resource.GetMeta().GetModificationTime()).Should(Equal(modificationTime)) }) It("should get mesh resource", func() { @@ -108,6 +111,8 @@ var _ = Describe("RemoteStore", func() { Expect(resource.GetMeta().GetName()).To(Equal(meshName)) Expect(resource.GetMeta().GetMesh()).To(Equal(meshName)) + Expect(resource.GetMeta().GetCreationTime()).Should(Equal(creationTime)) + Expect(resource.GetMeta().GetModificationTime()).Should(Equal(modificationTime)) }) It("should parse kuma api server error", func() { @@ -158,7 +163,7 @@ var _ = Describe("RemoteStore", func() { Expect(req.URL.Path).To(Equal(fmt.Sprintf("/meshes/default/traffic-routes/%s", name))) bytes, err := ioutil.ReadAll(req.Body) Expect(err).ToNot(HaveOccurred()) - Expect(bytes).To(MatchJSON(`{"mesh":"default","name":"res-1","path":"/some-path","type":"SampleTrafficRoute"}`)) + Expect(bytes).To(MatchJSON(`{"mesh":"default","name":"res-1","path":"/some-path","type":"SampleTrafficRoute","creationTime": "0001-01-01T00:00:00Z","modificationTime": "0001-01-01T00:00:00Z"}`)) }) // when @@ -180,7 +185,7 @@ var _ = Describe("RemoteStore", func() { Expect(req.URL.Path).To(Equal(fmt.Sprintf("/meshes/%s", meshName))) bytes, err := ioutil.ReadAll(req.Body) Expect(err).ToNot(HaveOccurred()) - Expect(bytes).To(MatchJSON(`{"mesh":"someMesh","name":"someMesh","type":"Mesh"}`)) + Expect(bytes).To(MatchJSON(`{"mesh":"someMesh","name":"someMesh","type":"Mesh","creationTime": "0001-01-01T00:00:00Z","modificationTime": "0001-01-01T00:00:00Z"}`)) }) // when @@ -234,7 +239,7 @@ var _ = Describe("RemoteStore", func() { Expect(req.URL.Path).To(Equal(fmt.Sprintf("/meshes/default/traffic-routes/%s", name))) bytes, err := ioutil.ReadAll(req.Body) Expect(err).ToNot(HaveOccurred()) - Expect(bytes).To(MatchJSON(`{"mesh":"default","name":"res-1","path":"/some-path","type":"SampleTrafficRoute"}`)) + Expect(bytes).To(MatchJSON(`{"mesh":"default","name":"res-1","path":"/some-path","type":"SampleTrafficRoute","creationTime": "0001-01-01T00:00:00Z","modificationTime": "0001-01-01T00:00:00Z"}`)) }) // when @@ -260,7 +265,7 @@ var _ = Describe("RemoteStore", func() { Expect(req.URL.Path).To(Equal(fmt.Sprintf("/meshes/%s", meshName))) bytes, err := ioutil.ReadAll(req.Body) Expect(err).ToNot(HaveOccurred()) - Expect(bytes).To(MatchJSON(`{"mesh":"someMesh","mtls":{"ca":{"builtin":{}}},"name":"someMesh","type":"Mesh"}`)) + Expect(bytes).To(MatchJSON(`{"mesh":"someMesh","mtls":{"ca":{"builtin":{}}},"name":"someMesh","type":"Mesh","creationTime": "0001-01-01T00:00:00Z","modificationTime": "0001-01-01T00:00:00Z"}`)) }) // when @@ -370,11 +375,15 @@ var _ = Describe("RemoteStore", func() { Expect(rs.Items[0].Meta.GetMesh()).To(Equal("default")) Expect(rs.Items[0].Meta.GetVersion()).To(Equal("")) Expect(rs.Items[0].Spec.Path).To(Equal("/example")) + Expect(rs.Items[0].Meta.GetCreationTime()).Should(Equal(creationTime)) + Expect(rs.Items[0].Meta.GetModificationTime()).Should(Equal(modificationTime)) // and Expect(rs.Items[1].Meta.GetName()).To(Equal("two")) Expect(rs.Items[1].Meta.GetMesh()).To(Equal("demo")) Expect(rs.Items[1].Meta.GetVersion()).To(Equal("")) Expect(rs.Items[1].Spec.Path).To(Equal("/another")) + Expect(rs.Items[1].Meta.GetCreationTime()).Should(Equal(creationTime)) + Expect(rs.Items[1].Meta.GetModificationTime()).Should(Equal(modificationTime)) }) It("should list known resources using pagination", func() { @@ -397,6 +406,8 @@ var _ = Describe("RemoteStore", func() { Expect(rs.Items[0].Meta.GetMesh()).To(Equal("default")) Expect(rs.Items[0].Meta.GetVersion()).To(Equal("")) Expect(rs.Items[0].Spec.Path).To(Equal("/example")) + Expect(rs.Items[0].Meta.GetCreationTime()).Should(Equal(creationTime)) + Expect(rs.Items[0].Meta.GetModificationTime()).Should(Equal(modificationTime)) }) It("should list meshes", func() { @@ -415,9 +426,13 @@ var _ = Describe("RemoteStore", func() { Expect(meshes.Items[0].Meta.GetName()).To(Equal("mesh-1")) Expect(meshes.Items[0].Meta.GetMesh()).To(Equal("mesh-1")) + Expect(meshes.Items[0].Meta.GetCreationTime()).Should(Equal(creationTime)) + Expect(meshes.Items[0].Meta.GetModificationTime()).Should(Equal(modificationTime)) Expect(meshes.Items[1].Meta.GetName()).To(Equal("mesh-2")) Expect(meshes.Items[1].Meta.GetMesh()).To(Equal("mesh-2")) + Expect(meshes.Items[1].Meta.GetCreationTime()).Should(Equal(creationTime)) + Expect(meshes.Items[1].Meta.GetModificationTime()).Should(Equal(modificationTime)) }) It("should return error from the api server", func() { diff --git a/pkg/plugins/resources/remote/testdata/get-mesh.json b/pkg/plugins/resources/remote/testdata/get-mesh.json index b33f9bb67b0b..173312c3d14f 100644 --- a/pkg/plugins/resources/remote/testdata/get-mesh.json +++ b/pkg/plugins/resources/remote/testdata/get-mesh.json @@ -1,5 +1,7 @@ { "type": "Mesh", "mesh": "someMesh", - "name": "someMesh" + "name": "someMesh", + "creationTime": "2018-07-17T16:05:36.995Z", + "modificationTime": "2019-07-17T16:05:36.995Z" } \ No newline at end of file diff --git a/pkg/plugins/resources/remote/testdata/get.json b/pkg/plugins/resources/remote/testdata/get.json index dea432232b2b..a4c41aa5f86a 100644 --- a/pkg/plugins/resources/remote/testdata/get.json +++ b/pkg/plugins/resources/remote/testdata/get.json @@ -2,5 +2,7 @@ "type": "TrafficRoute", "mesh": "default", "name": "res-1", - "path": "/example" + "path": "/example", + "creationTime": "2018-07-17T16:05:36.995Z", + "modificationTime": "2019-07-17T16:05:36.995Z" } \ No newline at end of file diff --git a/pkg/plugins/resources/remote/testdata/list-meshes.json b/pkg/plugins/resources/remote/testdata/list-meshes.json index 9c98afdee98e..c0ef7ad8c120 100644 --- a/pkg/plugins/resources/remote/testdata/list-meshes.json +++ b/pkg/plugins/resources/remote/testdata/list-meshes.json @@ -3,12 +3,16 @@ { "type": "Meshes", "mesh": "mesh-1", - "name": "mesh-1" + "name": "mesh-1", + "creationTime": "2018-07-17T16:05:36.995Z", + "modificationTime": "2019-07-17T16:05:36.995Z" }, { "type": "Meshes", "mesh": "mesh-2", - "name": "mesh-2" + "name": "mesh-2", + "creationTime": "2018-07-17T16:05:36.995Z", + "modificationTime": "2019-07-17T16:05:36.995Z" } ] -} +} \ No newline at end of file diff --git a/pkg/plugins/resources/remote/testdata/list-pagination.json b/pkg/plugins/resources/remote/testdata/list-pagination.json index a84c818897ef..7160f8399e6f 100644 --- a/pkg/plugins/resources/remote/testdata/list-pagination.json +++ b/pkg/plugins/resources/remote/testdata/list-pagination.json @@ -4,8 +4,10 @@ "type": "TrafficRoute", "mesh": "default", "name": "one", - "path": "/example" + "path": "/example", + "creationTime": "2018-07-17T16:05:36.995Z", + "modificationTime": "2019-07-17T16:05:36.995Z" } ], "next": "http://localhost:5681/meshes/default/traffic-routes?size=1&offset=2" -} +} \ No newline at end of file diff --git a/pkg/plugins/resources/remote/testdata/list.json b/pkg/plugins/resources/remote/testdata/list.json index dd9a62b99d73..1a690d828c32 100644 --- a/pkg/plugins/resources/remote/testdata/list.json +++ b/pkg/plugins/resources/remote/testdata/list.json @@ -4,13 +4,17 @@ "type": "TrafficRoute", "mesh": "default", "name": "one", - "path": "/example" + "path": "/example", + "creationTime": "2018-07-17T16:05:36.995Z", + "modificationTime": "2019-07-17T16:05:36.995Z" }, { "type": "TrafficRoute", "mesh": "demo", "name": "two", - "path": "/another" + "path": "/another", + "creationTime": "2018-07-17T16:05:36.995Z", + "modificationTime": "2019-07-17T16:05:36.995Z" } ], "next": null diff --git a/pkg/plugins/resources/remote/unmarshalling.go b/pkg/plugins/resources/remote/unmarshalling.go index daf27c80e5dc..326ddf5b2967 100644 --- a/pkg/plugins/resources/remote/unmarshalling.go +++ b/pkg/plugins/resources/remote/unmarshalling.go @@ -46,10 +46,11 @@ func Unmarshal(b []byte, res model.Resource) error { return err } res.SetMeta(remoteMeta{ - Name: restResource.Meta.Name, - Mesh: restResource.Meta.Mesh, - Version: "", - // todo(jakubdyszkiewicz) creation and modification time is not set because it's not exposed in API yet + Name: restResource.Meta.Name, + Mesh: restResource.Meta.Mesh, + Version: "", + CreationTime: restResource.Meta.CreationTime, + ModificationTime: restResource.Meta.ModificationTime, }) return nil } @@ -67,10 +68,11 @@ func UnmarshalList(b []byte, rs model.ResourceList) error { return err } r.SetMeta(&remoteMeta{ - Name: ri.Meta.Name, - Mesh: ri.Meta.Mesh, - Version: "", - // todo(jakubdyszkiewicz) creation and modification time is not set because it's not exposed in API yet + Name: ri.Meta.Name, + Mesh: ri.Meta.Mesh, + Version: "", + CreationTime: ri.Meta.CreationTime, + ModificationTime: ri.Meta.ModificationTime, }) _ = rs.AddItem(r) }