Skip to content

Commit

Permalink
feat(kuma-cp) exposing creationTime and modificationTime via API (#677)
Browse files Browse the repository at this point in the history
  • Loading branch information
tharun208 authored Apr 27, 2020
1 parent 161878d commit 7aa8726
Show file tree
Hide file tree
Showing 74 changed files with 361 additions and 157 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
5 changes: 3 additions & 2 deletions app/kumactl/cmd/apply/apply_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion app/kumactl/cmd/get/get_dataplanes_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
1 change: 0 additions & 1 deletion app/kumactl/cmd/get/get_fault_injections_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
3 changes: 0 additions & 3 deletions app/kumactl/cmd/get/get_healthchecks_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import (
var _ = Describe("kumactl get healthchecks", func() {

var sampleHealthChecks []*mesh_core.HealthCheckResource

BeforeEach(func() {
sampleHealthChecks = []*mesh_core.HealthCheckResource{
{
Expand Down Expand Up @@ -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) {
Expand Down
1 change: 0 additions & 1 deletion app/kumactl/cmd/get/get_meshes_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
2 changes: 0 additions & 2 deletions app/kumactl/cmd/get/get_proxytemplates_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
3 changes: 0 additions & 3 deletions app/kumactl/cmd/get/get_single_resource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
},
Expand Down
1 change: 0 additions & 1 deletion app/kumactl/cmd/get/get_traffic_logs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
2 changes: 0 additions & 2 deletions app/kumactl/cmd/get/get_traffic_routes_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
1 change: 0 additions & 1 deletion app/kumactl/cmd/get/get_traffic_traces_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
1 change: 0 additions & 1 deletion app/kumactl/cmd/get/get_trafficpermissions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
2 changes: 2 additions & 0 deletions app/kumactl/cmd/get/testdata/get-dataplane.golden.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand Down
3 changes: 2 additions & 1 deletion app/kumactl/cmd/get/testdata/get-dataplane.golden.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 4 additions & 0 deletions app/kumactl/cmd/get/testdata/get-dataplanes.golden.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand All @@ -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": [
Expand Down
8 changes: 6 additions & 2 deletions app/kumactl/cmd/get/testdata/get-dataplanes.golden.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down
2 changes: 2 additions & 0 deletions app/kumactl/cmd/get/testdata/get-fault-injection.golden.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
2 changes: 2 additions & 0 deletions app/kumactl/cmd/get/testdata/get-fault-injection.golden.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 4 additions & 0 deletions app/kumactl/cmd/get/testdata/get-fault-injections.golden.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
"type": "FaultInjection",
"mesh": "default",
"name": "fi1",
"creationTime": "0001-01-01T00:00:00Z",
"modificationTime": "0001-01-01T00:00:00Z",
"sources": [
{
"match": {
Expand Down Expand Up @@ -38,6 +40,8 @@
"type": "FaultInjection",
"mesh": "default",
"name": "fi2",
"creationTime": "0001-01-01T00:00:00Z",
"modificationTime": "0001-01-01T00:00:00Z",
"sources": [
{
"match": {
Expand Down
4 changes: 4 additions & 0 deletions app/kumactl/cmd/get/testdata/get-fault-injections.golden.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand Down
2 changes: 2 additions & 0 deletions app/kumactl/cmd/get/testdata/get-healthcheck.golden.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
18 changes: 10 additions & 8 deletions app/kumactl/cmd/get/testdata/get-healthcheck.golden.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
mesh: default
name: healthcheck-1
sources:
- match:
service: web
destinations:
- match:
service: backend
conf:
activeChecks:
interval: 10s
Expand All @@ -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
8 changes: 6 additions & 2 deletions app/kumactl/cmd/get/testdata/get-healthchecks.golden.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 6 additions & 2 deletions app/kumactl/cmd/get/testdata/get-healthchecks.golden.yaml
Original file line number Diff line number Diff line change
@@ -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
2 changes: 2 additions & 0 deletions app/kumactl/cmd/get/testdata/get-mesh.golden.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
{
"type": "Mesh",
"name": "mesh-1",
"creationTime": "0001-01-01T00:00:00Z",
"modificationTime": "0001-01-01T00:00:00Z",
"mtls": {
"ca": {
"provided": {}
Expand Down
3 changes: 2 additions & 1 deletion app/kumactl/cmd/get/testdata/get-mesh.golden.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
---
creationTime: 0001-01-01T00:00:00Z
logging:
backends:
- name: logstash
Expand All @@ -11,6 +11,7 @@ metrics:
prometheus:
path: /non-standard-path
port: 1234
modificationTime: 0001-01-01T00:00:00Z
mtls:
ca:
provided: {}
Expand Down
16 changes: 12 additions & 4 deletions app/kumactl/cmd/get/testdata/get-meshes.golden.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
}
},
"name": "mesh1",
"type": "Mesh"
"type": "Mesh",
"creationTime": "0001-01-01T00:00:00Z",
"modificationTime": "0001-01-01T00:00:00Z"
},
{
"mtls": {
Expand All @@ -18,7 +20,9 @@
}
},
"name": "mesh2",
"type": "Mesh"
"type": "Mesh",
"creationTime": "0001-01-01T00:00:00Z",
"modificationTime": "0001-01-01T00:00:00Z"
},
{
"metrics": {
Expand Down Expand Up @@ -65,7 +69,9 @@
}
},
"name": "mesh3",
"type": "Mesh"
"type": "Mesh",
"creationTime": "0001-01-01T00:00:00Z",
"modificationTime": "0001-01-01T00:00:00Z"
},
{
"metrics": {
Expand All @@ -86,7 +92,9 @@
}
},
"name": "mesh4",
"type": "Mesh"
"type": "Mesh",
"creationTime": "0001-01-01T00:00:00Z",
"modificationTime": "0001-01-01T00:00:00Z"
}
],
"next": null
Expand Down
Loading

0 comments on commit 7aa8726

Please sign in to comment.