Skip to content

Commit

Permalink
atlas/schema: deploy changes with schema plan (#194)
Browse files Browse the repository at this point in the history
  • Loading branch information
giautm authored Oct 13, 2024
1 parent 4956de5 commit 6b613b6
Show file tree
Hide file tree
Showing 12 changed files with 855 additions and 27 deletions.
12 changes: 12 additions & 0 deletions api/v1alpha1/atlasschema_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ type (
ObservedHash string `json:"observed_hash"`
// LastApplied is the unix timestamp of the most recent successful schema apply operation.
LastApplied int64 `json:"last_applied"`
// PlanURL is the URL of the schema plan to apply.
// +optional
PlanURL string `json:"planURL"`
// PlanLink is the link to the schema plan on the Atlas Cloud.
// +optional
PlanLink string `json:"planLink"`
}
// AtlasSchemaSpec defines the desired state of AtlasSchema
AtlasSchemaSpec struct {
Expand Down Expand Up @@ -101,6 +107,9 @@ type (
// Lint defines the linting policies to apply before applying the schema.
Lint struct {
Destructive *CheckConfig `json:"destructive,omitempty"`
// Review defines the review policy to apply after linting the schema changes.
// +kubebuilder:default=ERROR
Review LintReview `json:"review,omitempty"`
}
// CheckConfig defines the configuration of a linting check.
CheckConfig struct {
Expand Down Expand Up @@ -153,6 +162,9 @@ type (
// TransactionMode
// +kubebuilder:validation:Enum=file;all;none
TransactionMode string
// LintReview defines the review policies to apply after linting the schema.
// +kubebuilder:validation:Enum=ALWAYS;WARNING;ERROR
LintReview string
)

func init() {
Expand Down
2 changes: 2 additions & 0 deletions api/v1alpha1/target.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ type (
Cloud struct {
// TokenFrom defines the reference to the secret key that contains the Atlas Cloud Token.
TokenFrom TokenFrom `json:"tokenFrom,omitempty"`
// Repo is the name of repository on the Atlas Cloud.
Repo string `json:"repo,omitempty"`
}
)

Expand Down
19 changes: 19 additions & 0 deletions charts/atlas-operator/templates/crds/crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,9 @@ spec:
cloud:
description: Cloud defines the Atlas Cloud configuration.
properties:
repo:
description: Repo is the name of repository on the Atlas Cloud.
type: string
tokenFrom:
description: TokenFrom defines the reference to the secret key
that contains the Atlas Cloud Token.
Expand Down Expand Up @@ -667,6 +670,15 @@ spec:
error:
type: boolean
type: object
review:
default: ERROR
description: Review defines the review policy to apply after
linting the schema changes.
enum:
- ALWAYS
- WARNING
- ERROR
type: string
type: object
type: object
schema:
Expand Down Expand Up @@ -812,6 +824,13 @@ spec:
description: ObservedHash is the hash of the most recently applied
schema.
type: string
planLink:
description: PlanLink is the link to the schema plan on the Atlas
Cloud.
type: string
planURL:
description: PlanURL is the URL of the schema plan to apply.
type: string
required:
- last_applied
- observed_hash
Expand Down
19 changes: 19 additions & 0 deletions config/crd/bases/db.atlasgo.io_atlasschemas.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ spec:
cloud:
description: Cloud defines the Atlas Cloud configuration.
properties:
repo:
description: Repo is the name of repository on the Atlas Cloud.
type: string
tokenFrom:
description: TokenFrom defines the reference to the secret key
that contains the Atlas Cloud Token.
Expand Down Expand Up @@ -284,6 +287,15 @@ spec:
error:
type: boolean
type: object
review:
default: ERROR
description: Review defines the review policy to apply after
linting the schema changes.
enum:
- ALWAYS
- WARNING
- ERROR
type: string
type: object
type: object
schema:
Expand Down Expand Up @@ -429,6 +441,13 @@ spec:
description: ObservedHash is the hash of the most recently applied
schema.
type: string
planLink:
description: PlanLink is the link to the schema plan on the Atlas
Cloud.
type: string
planURL:
description: PlanURL is the URL of the schema plan to apply.
type: string
required:
- last_applied
- observed_hash
Expand Down
Loading

0 comments on commit 6b613b6

Please sign in to comment.