Skip to content

Commit

Permalink
Fix #268 Move CreatedAt, UpdatedAt in status
Browse files Browse the repository at this point in the history
Fields CreatedAt, UpdatedAt – deprecated in Status
Fields CreatedAt, UpdatedAt are created at root level of objects. Their modification is responsibility of API Server
  • Loading branch information
vlad-tokarev committed Sep 15, 2020
1 parent e3d9668 commit f1cd00a
Show file tree
Hide file tree
Showing 29 changed files with 533 additions and 91 deletions.
2 changes: 1 addition & 1 deletion packages/operator/api/v1alpha1/modeldeployment_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ type ModelDeploymentStatus struct {
LastRevisionName string `json:"lastRevisionName,omitempty"`
// Time when credentials was updated
LastCredsUpdatedTime *metav1.Time `json:"lastUpdatedTime,omitempty"`
// Info about create and update
// DEPRECATED Info about create and update
//CreatedAt *metav1.Time `json:"createdAt,omitempty"`
//UpdatedAt *metav1.Time `json:"updatedAt,omitempty"`
Modifiable `json:",inline"`
Expand Down
2 changes: 1 addition & 1 deletion packages/operator/api/v1alpha1/modelpackaging_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ type ModelPackagingStatus struct {
Message *string `json:"message,omitempty"`
// List of packaing results
Results []ModelPackagingResult `json:"results,omitempty"`
// Info about create and update
// DEPRECATED Info about create and update
//CreatedAt *metav1.Time `json:"createdAt,omitempty"`
//UpdatedAt *metav1.Time `json:"updatedAt,omitempty"`
Modifiable `json:",inline"`
Expand Down
2 changes: 1 addition & 1 deletion packages/operator/api/v1alpha1/modeltraining_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ type ModelTrainingStatus struct {
Message *string `json:"message,omitempty"`
// List of training results
Artifacts []TrainingResult `json:"artifacts,omitempty"`
// Info about create and update
// DEPRECATED Info about create and update
//CreatedAt *metav1.Time `json:"createdAt,omitempty"`
//UpdatedAt *metav1.Time `json:"updatedAt,omitempty"`
Modifiable `json:",inline"`
Expand Down
28 changes: 24 additions & 4 deletions packages/operator/docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -1918,10 +1918,6 @@ var doc = `{
"type": "object",
"$ref": "#/definitions/APIBackendConfig"
},
"disableWorkers": {
"description": "If true then only webserver will be setup.\nWithout background workers responsible to monitor storage and call services",
"type": "boolean"
},
"port": {
"description": "API HTTP port",
"type": "integer"
Expand Down Expand Up @@ -2446,6 +2442,10 @@ var doc = `{
"ModelDeployment": {
"type": "object",
"properties": {
"createdAt": {
"description": "CreatedAt",
"type": "string"
},
"id": {
"description": "Model deployment id",
"type": "string"
Expand All @@ -2459,6 +2459,10 @@ var doc = `{
"description": "Model deployment status",
"type": "object",
"$ref": "#/definitions/ModelDeploymentStatus"
},
"updatedAt": {
"description": "UpdatedAt",
"type": "string"
}
}
},
Expand Down Expand Up @@ -2540,6 +2544,10 @@ var doc = `{
"ModelPackaging": {
"type": "object",
"properties": {
"createdAt": {
"description": "CreatedAt",
"type": "string"
},
"id": {
"description": "Model packaging id",
"type": "string"
Expand All @@ -2553,6 +2561,10 @@ var doc = `{
"description": "Model packaging status",
"type": "object",
"$ref": "#/definitions/ModelPackagingStatus"
},
"updatedAt": {
"description": "UpdatedAt",
"type": "string"
}
}
},
Expand Down Expand Up @@ -2764,6 +2776,10 @@ var doc = `{
"ModelTraining": {
"type": "object",
"properties": {
"createdAt": {
"description": "CreatedAt",
"type": "string"
},
"id": {
"description": "Model training ID",
"type": "string"
Expand All @@ -2777,6 +2793,10 @@ var doc = `{
"description": "Model training status",
"type": "object",
"$ref": "#/definitions/ModelTrainingStatus"
},
"updatedAt": {
"description": "UpdatedAt",
"type": "string"
}
}
},
Expand Down
30 changes: 25 additions & 5 deletions packages/operator/docs/swagger.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"swagger": "2.0",
"info": {
"description": "This is an API Gateway webServer.",
"description": "This is an API Gateway webServer",
"title": "API Gateway",
"termsOfService": "http://swagger.io/terms/",
"contact": {},
Expand Down Expand Up @@ -1902,10 +1902,6 @@
"type": "object",
"$ref": "#/definitions/APIBackendConfig"
},
"disableWorkers": {
"description": "If true then only webserver will be setup.\nWithout background workers responsible to monitor storage and call services",
"type": "boolean"
},
"port": {
"description": "API HTTP port",
"type": "integer"
Expand Down Expand Up @@ -2430,6 +2426,10 @@
"ModelDeployment": {
"type": "object",
"properties": {
"createdAt": {
"description": "CreatedAt",
"type": "string"
},
"id": {
"description": "Model deployment id",
"type": "string"
Expand All @@ -2443,6 +2443,10 @@
"description": "Model deployment status",
"type": "object",
"$ref": "#/definitions/ModelDeploymentStatus"
},
"updatedAt": {
"description": "UpdatedAt",
"type": "string"
}
}
},
Expand Down Expand Up @@ -2524,6 +2528,10 @@
"ModelPackaging": {
"type": "object",
"properties": {
"createdAt": {
"description": "CreatedAt",
"type": "string"
},
"id": {
"description": "Model packaging id",
"type": "string"
Expand All @@ -2537,6 +2545,10 @@
"description": "Model packaging status",
"type": "object",
"$ref": "#/definitions/ModelPackagingStatus"
},
"updatedAt": {
"description": "UpdatedAt",
"type": "string"
}
}
},
Expand Down Expand Up @@ -2748,6 +2760,10 @@
"ModelTraining": {
"type": "object",
"properties": {
"createdAt": {
"description": "CreatedAt",
"type": "string"
},
"id": {
"description": "Model training ID",
"type": "string"
Expand All @@ -2761,6 +2777,10 @@
"description": "Model training status",
"type": "object",
"$ref": "#/definitions/ModelTrainingStatus"
},
"updatedAt": {
"description": "UpdatedAt",
"type": "string"
}
}
},
Expand Down
23 changes: 18 additions & 5 deletions packages/operator/docs/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,6 @@ definitions:
backend:
$ref: '#/definitions/APIBackendConfig'
type: object
disableWorkers:
description: |-
If true then only webserver will be setup.
Without background workers responsible to monitor storage and call services
type: boolean
port:
description: API HTTP port
type: integer
Expand Down Expand Up @@ -407,6 +402,9 @@ definitions:
type: object
ModelDeployment:
properties:
createdAt:
description: CreatedAt
type: string
id:
description: Model deployment id
type: string
Expand All @@ -418,6 +416,9 @@ definitions:
$ref: '#/definitions/ModelDeploymentStatus'
description: Model deployment status
type: object
updatedAt:
description: UpdatedAt
type: string
type: object
ModelRoute:
properties:
Expand Down Expand Up @@ -475,6 +476,9 @@ definitions:
type: object
ModelPackaging:
properties:
createdAt:
description: CreatedAt
type: string
id:
description: Model packaging id
type: string
Expand All @@ -486,6 +490,9 @@ definitions:
$ref: '#/definitions/ModelPackagingStatus'
description: Model packaging status
type: object
updatedAt:
description: UpdatedAt
type: string
type: object
ModelPackagingSpec:
properties:
Expand Down Expand Up @@ -641,6 +648,9 @@ definitions:
type: object
ModelTraining:
properties:
createdAt:
description: CreatedAt
type: string
id:
description: Model training ID
type: string
Expand All @@ -652,6 +662,9 @@ definitions:
$ref: '#/definitions/ModelTrainingStatus'
description: Model training status
type: object
updatedAt:
description: UpdatedAt
type: string
type: object
ToolchainIntegration:
properties:
Expand Down
2 changes: 1 addition & 1 deletion packages/operator/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ require (
github.com/satori/go.uuid v1.2.0
github.com/spf13/cobra v1.0.0
github.com/spf13/viper v1.7.0
github.com/stretchr/testify v1.5.1
github.com/stretchr/testify v1.6.1
github.com/swaggo/swag v1.5.0
github.com/tektoncd/pipeline v0.13.0
github.com/ugorji/go v1.1.7 // indirect
Expand Down
5 changes: 5 additions & 0 deletions packages/operator/pkg/apis/deployment/model_deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,18 @@ package deployment

import (
"github.com/odahu/odahu-flow/packages/operator/api/v1alpha1"
"time"
)

type ModelDeployment struct {
// Model deployment id
ID string `json:"id"`
// Deletion mark
DeletionMark bool `json:"deletionMark,omitempty" swaggerignore:"true"`
// CreatedAt
CreatedAt time.Time `json:"createdAt,omitempty"`
// UpdatedAt
UpdatedAt time.Time `json:"updatedAt,omitempty"`
// Model deployment specification
Spec v1alpha1.ModelDeploymentSpec `json:"spec,omitempty"`
// Model deployment status
Expand Down
5 changes: 5 additions & 0 deletions packages/operator/pkg/apis/packaging/model_packaging.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,18 @@ import (
"encoding/json"
"errors"
"github.com/odahu/odahu-flow/packages/operator/api/v1alpha1"
"time"
)

type ModelPackaging struct {
// Model packaging id
ID string `json:"id"`
// Deletion mark
DeletionMark bool `json:"deletionMark,omitempty" swaggerignore:"true"`
// CreatedAt
CreatedAt time.Time `json:"createdAt,omitempty"`
// UpdatedAt
UpdatedAt time.Time `json:"updatedAt,omitempty"`
// Model packaging specification
Spec ModelPackagingSpec `json:"spec,omitempty"`
// Model packaging status
Expand Down
9 changes: 8 additions & 1 deletion packages/operator/pkg/apis/training/model_training.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,20 @@

package training

import "github.com/odahu/odahu-flow/packages/operator/api/v1alpha1"
import (
"github.com/odahu/odahu-flow/packages/operator/api/v1alpha1"
"time"
)

type ModelTraining struct {
// Model training ID
ID string `json:"id"`
// Deletion mark
DeletionMark bool `json:"deletionMark,omitempty" swaggerignore:"true"`
// CreatedAt
CreatedAt time.Time `json:"createdAt,omitempty"`
// UpdatedAt
UpdatedAt time.Time `json:"updatedAt,omitempty"`
// Model training specification
Spec v1alpha1.ModelTrainingSpec `json:"spec,omitempty"`
// Model training status
Expand Down
24 changes: 24 additions & 0 deletions packages/operator/pkg/database/migrations/postgres/bindata.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,24 @@ func _000004_deletionmark_up_sql() ([]byte, error) {
)
}

var __000005_created_updated_down_sql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x9c\xcd\x31\x0a\xc2\x50\x0c\x06\xe0\xdd\x53\xe4\x1e\xdd\x14\x91\x0e\xd5\xc5\xbd\xfc\xbe\x84\x5a\x7c\x4d\x42\xc8\x1b\xbc\xbd\x9b\x93\xa2\xed\x01\x3e\xbe\xfd\xf1\xd4\x9f\xbb\x1d\x6a\x4a\x50\xe2\x56\x85\x8c\x71\x6f\xa3\xb9\x04\xd2\x62\xcc\xc0\xac\xb3\x4e\xc4\x61\x4e\xc5\x6a\x5b\x94\x4a\x08\x52\x78\x3d\x6c\xce\x3f\xa1\xa3\x3c\x30\x6d\x29\x3f\xcb\x7f\x4e\x16\xaf\xf6\x5c\x44\x73\x75\xfa\x85\xbe\xd7\xc3\x65\x18\xfa\x6b\xf7\x0a\x00\x00\xff\xff\x24\xd4\x8a\xba\x6a\x01\x00\x00")

func _000005_created_updated_down_sql() ([]byte, error) {
return bindata_read(
__000005_created_updated_down_sql,
"000005_created_updated.down.sql",
)
}

var __000005_created_updated_up_sql = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\xa4\xce\x3d\x0e\x82\x40\x10\x05\xe0\x9e\x53\xcc\x3d\xe8\x34\xc6\x50\xa0\x8d\x3d\x79\x32\x13\xdc\xb8\x7f\x19\x1f\x85\x9e\xde\x03\x48\xb3\x72\x81\x2f\xdf\xe1\x74\x1e\x2e\x7d\x87\x48\x73\x21\xee\xd1\xa4\x28\x1e\xeb\x54\xaa\x39\x58\x7c\xa2\x23\xe4\x90\x97\x4e\x44\x04\xaa\x32\xbb\x81\xa6\xc2\x90\xec\x45\xa4\xca\x4f\x1b\xb0\x56\x6d\x02\x2a\xe6\x27\x96\x3d\x85\x5f\xa1\xf5\xa0\x56\x63\x79\x27\xcb\xfc\x3b\xb1\x41\x6c\x2e\x8e\xd7\x71\x1c\x6e\xfd\x37\x00\x00\xff\xff\x66\x6f\xf8\x11\x9a\x01\x00\x00")

func _000005_created_updated_up_sql() ([]byte, error) {
return bindata_read(
__000005_created_updated_up_sql,
"000005_created_updated.up.sql",
)
}

// Asset loads and returns the asset for the given name.
// It returns an error if the asset could not be found or
// could not be loaded.
Expand Down Expand Up @@ -127,6 +145,8 @@ var _bindata = map[string]func() ([]byte, error){
"000003_route.up.sql": _000003_route_up_sql,
"000004_deletionmark.down.sql": _000004_deletionmark_down_sql,
"000004_deletionmark.up.sql": _000004_deletionmark_up_sql,
"000005_created_updated.down.sql": _000005_created_updated_down_sql,
"000005_created_updated.up.sql": _000005_created_updated_up_sql,
}
// AssetDir returns the file names below a certain
// directory embedded in the file by go-bindata.
Expand Down Expand Up @@ -184,4 +204,8 @@ var _bintree = &_bintree_t{nil, map[string]*_bintree_t{
}},
"000004_deletionmark.up.sql": &_bintree_t{_000004_deletionmark_up_sql, map[string]*_bintree_t{
}},
"000005_created_updated.down.sql": &_bintree_t{_000005_created_updated_down_sql, map[string]*_bintree_t{
}},
"000005_created_updated.up.sql": &_bintree_t{_000005_created_updated_up_sql, map[string]*_bintree_t{
}},
}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
BEGIN;
alter table odahu_operator_training drop column created;
alter table odahu_operator_training drop column updated;
alter table odahu_operator_packaging drop column created;
alter table odahu_operator_packaging drop column updated;
alter table odahu_operator_deployment drop column created;
alter table odahu_operator_deployment drop column updated;
COMMIT;
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
BEGIN;
alter table odahu_operator_training
add created timestamptz;
alter table odahu_operator_training
add updated timestamptz;
alter table odahu_operator_packaging
add created timestamptz;
alter table odahu_operator_packaging
add updated timestamptz;
alter table odahu_operator_deployment
add created timestamptz;
alter table odahu_operator_deployment
add updated timestamptz;
COMMIT;
Loading

0 comments on commit f1cd00a

Please sign in to comment.