Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion docs/data-sources/app.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ output "app_api_key" {

### Read-Only

- `api_key` (String, Sensitive) The API key for the app.
- `cluster_id` (String) The Kubernetes cluster identifier where the app is deployed.
- `cname` (String) The region identifier (cname) for the app.
- `created_at` (String) The timestamp when the app was created.
Comment on lines 67 to 71
Expand Down
1 change: 0 additions & 1 deletion docs/data-sources/apps.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ output "found_app_id" {

Read-Only:

- `api_key` (String, Sensitive) The API key for the app.
- `cluster_id` (String) The Kubernetes cluster identifier where the app is deployed.
- `cname` (String) The region identifier (cname) for the app.
- `created_at` (String) The timestamp when the app was created.
Expand Down
68 changes: 66 additions & 2 deletions docs/resources/app.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,26 +158,90 @@ resource "spiceai_app" "with_region_lookup" {
### Optional

- `description` (String) A description of the app.
- `executor` (Attributes) Executor container configuration. (see [below for nested schema](#nestedatt--executor))
- `image` (String) Image name for the spiced container.
- `image_tag` (String) The Spice.ai runtime image tag to use for deployments (e.g., `latest`, `v0.18.0`).
- `node_group` (String) The node group for the app deployment.
- `production_branch` (String) The production branch for the app. Used for git-based deployments.
- `region` (String) The region for the app deployment.
- `registry` (String) Registry for the spiced image.
- `replicas` (Number) The number of replicas for the app. Must be between 0 and 10.
- `resources` (Attributes) Resource requests and limits for the app container. (see [below for nested schema](#nestedatt--resources))
- `spicepod` (String) The spicepod configuration as a YAML or JSON string. This defines the datasets, models, and other spicepod settings for the app.
- `storage_claim_size_gb` (Number) The storage claim size in GB for the app.
- `tags` (Map of String) Key-value tags for the app.
- `update_channel` (String) Update channel for the spicepod. Valid values are `stable`, `nightly`, `internal`, `internal-sandbox`.
- `update_channel` (String) Update channel for the spicepod. Valid values are `stable`, `preview`, `nightly`, and `internal`.
- `visibility` (String) The visibility of the app. Valid values are `public` or `private`. Defaults to `private`.

### Read-Only

- `api_key` (String, Sensitive) The API key for the app. This is used to authenticate requests to the app's endpoints.
- `cluster_id` (String) The Kubernetes cluster identifier where the app is deployed.
- `created_at` (String) The timestamp when the app was created.
- `id` (String) The unique identifier of the app.

<a id="nestedatt--executor"></a>
### Nested Schema for `executor`

Optional:

- `replicas` (Number) Number of executor replicas.
- `resources` (Attributes) (see [below for nested schema](#nestedatt--executor--resources))

<a id="nestedatt--executor--resources"></a>
### Nested Schema for `executor.resources`

Optional:

- `limits` (Attributes) (see [below for nested schema](#nestedatt--executor--resources--limits))
- `requests` (Attributes) (see [below for nested schema](#nestedatt--executor--resources--requests))

<a id="nestedatt--executor--resources--limits"></a>
### Nested Schema for `executor.resources.limits`

Optional:

- `cpu` (String) Whole-number vCPU limit, or `-` for no CPU limit.
- `ephemeral_storage` (String) Ephemeral storage limit in Gi (for example, `8Gi`).
- `memory` (String) Memory limit in Gi (for example, `16Gi`).


<a id="nestedatt--executor--resources--requests"></a>
### Nested Schema for `executor.resources.requests`

Optional:

- `cpu` (String)
- `memory` (String)




<a id="nestedatt--resources"></a>
### Nested Schema for `resources`

Optional:

- `limits` (Attributes) (see [below for nested schema](#nestedatt--resources--limits))
- `requests` (Attributes) (see [below for nested schema](#nestedatt--resources--requests))

<a id="nestedatt--resources--limits"></a>
### Nested Schema for `resources.limits`

Optional:

- `cpu` (String) Whole-number vCPU limit, or `-` for no CPU limit.
- `ephemeral_storage` (String) Ephemeral storage limit in Gi (for example, `8Gi`).
- `memory` (String) Memory limit in Gi (for example, `16Gi`).


<a id="nestedatt--resources--requests"></a>
### Nested Schema for `resources.requests`

Optional:

- `cpu` (String)
- `memory` (String)

## Import

Import is supported using the following syntax:
Expand Down
1 change: 1 addition & 0 deletions docs/resources/deployment.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ resource "spiceai_deployment" "production" {
### Optional

- `branch` (String) Git branch name associated with this deployment. Changing this forces a new deployment to be created.
- `channel` (String) Override the deployment channel for this deployment. Valid values are `stable`. Changing this forces a new deployment to be created.
- `commit_message` (String) Git commit message associated with this deployment. Changing this forces a new deployment to be created.
- `commit_sha` (String) Git commit SHA associated with this deployment. Changing this forces a new deployment to be created.
- `debug` (Boolean) Enable debug mode for this deployment. Changing this forces a new deployment to be created.
Expand Down
87 changes: 60 additions & 27 deletions internal/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,41 +168,48 @@ type App struct {

// AppConfig represents the configuration of an app.
type AppConfig struct {
Spicepod interface{} `json:"spicepod,omitempty"`
Registry string `json:"registry,omitempty"`
Image string `json:"image,omitempty"`
ImageTag string `json:"image_tag,omitempty"`
UpdateChannel string `json:"update_channel,omitempty"`
Replicas int `json:"replicas,omitempty"`
Region string `json:"region,omitempty"`
NodeGroup string `json:"node_group,omitempty"`
StorageClaimSizeGB float64 `json:"storage_claim_size_gb,omitempty"`
Spicepod interface{} `json:"spicepod,omitempty"`
Registry string `json:"registry,omitempty"`
Image string `json:"image,omitempty"`
ImageTag string `json:"image_tag,omitempty"`
UpdateChannel string `json:"update_channel,omitempty"`
Replicas int `json:"replicas,omitempty"`
Resources *ContainerResources `json:"resources,omitempty"`
Executor *ExecutorConfig `json:"executor,omitempty"`
Region string `json:"region,omitempty"`
NodeGroup string `json:"node_group,omitempty"`
StorageClaimSizeGB float64 `json:"storage_claim_size_gb,omitempty"`
}

// CreateAppRequest represents the request to create an app.
type CreateAppRequest struct {
Name string `json:"name"`
Cname string `json:"cname"`
Description string `json:"description,omitempty"`
Visibility string `json:"visibility,omitempty"`
Tags map[string]string `json:"tags,omitempty"`
Name string `json:"name"`
Cname string `json:"cname"`
Description string `json:"description,omitempty"`
Visibility string `json:"visibility,omitempty"`
Tags map[string]string `json:"tags,omitempty"`
Replicas *int `json:"replicas,omitempty"`
Resources *ContainerResources `json:"resources,omitempty"`
Executor *ExecutorConfig `json:"executor,omitempty"`
}

// UpdateAppRequest represents the request to update an app.
type UpdateAppRequest struct {
Description string `json:"description,omitempty"`
Visibility string `json:"visibility,omitempty"`
ProductionBranch string `json:"production_branch,omitempty"`
Tags map[string]string `json:"tags,omitempty"`
Spicepod interface{} `json:"spicepod,omitempty"`
Registry string `json:"registry,omitempty"`
Image string `json:"image,omitempty"`
ImageTag string `json:"image_tag,omitempty"`
UpdateChannel string `json:"update_channel,omitempty"`
Replicas *int `json:"replicas,omitempty"`
NodeGroup string `json:"node_group,omitempty"`
Region string `json:"region,omitempty"`
StorageClaimSizeGB *float64 `json:"storage_claim_size_gb,omitempty"`
Description string `json:"description,omitempty"`
Visibility string `json:"visibility,omitempty"`
ProductionBranch string `json:"production_branch,omitempty"`
Tags map[string]string `json:"tags,omitempty"`
Spicepod interface{} `json:"spicepod,omitempty"`
Registry string `json:"registry,omitempty"`
Image string `json:"image,omitempty"`
ImageTag string `json:"image_tag,omitempty"`
UpdateChannel string `json:"update_channel,omitempty"`
Replicas *int `json:"replicas,omitempty"`
Resources *ContainerResources `json:"resources,omitempty"`
Executor *ExecutorConfig `json:"executor,omitempty"`
NodeGroup string `json:"node_group,omitempty"`
Region string `json:"region,omitempty"`
StorageClaimSizeGB *float64 `json:"storage_claim_size_gb,omitempty"`
}

// Deployment represents a Spice.ai deployment.
Expand All @@ -223,9 +230,35 @@ type Deployment struct {
CreatedBy int64 `json:"created_by,omitempty"`
}

// ResourceRequests represents requested container resources.
type ResourceRequests struct {
CPU string `json:"cpu,omitempty"`
Memory string `json:"memory,omitempty"`
}

// ResourceLimits represents container resource limits.
type ResourceLimits struct {
CPU string `json:"cpu,omitempty"`
Memory string `json:"memory,omitempty"`
EphemeralStorage string `json:"ephemeral-storage,omitempty"`
}

// ContainerResources represents resource requests and limits for a container.
type ContainerResources struct {
Limits *ResourceLimits `json:"limits,omitempty"`
Requests *ResourceRequests `json:"requests,omitempty"`
}

// ExecutorConfig represents executor container configuration.
type ExecutorConfig struct {
Replicas *int `json:"replicas,omitempty"`
Resources *ContainerResources `json:"resources,omitempty"`
}

// CreateDeploymentRequest represents the request to create a deployment.
type CreateDeploymentRequest struct {
ImageTag string `json:"image_tag,omitempty"`
Channel string `json:"channel,omitempty"`
Replicas *int `json:"replicas,omitempty"`
Branch string `json:"branch,omitempty"`
CommitSHA string `json:"commit_sha,omitempty"`
Expand Down
7 changes: 0 additions & 7 deletions internal/provider/datasource_app.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ type AppDataSourceModel struct {
// Read-only attributes
CreatedAt types.String `tfsdk:"created_at"`
ClusterID types.String `tfsdk:"cluster_id"`
APIKey types.String `tfsdk:"api_key"`
}

func (d *AppDataSource) Metadata(ctx context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) {
Expand Down Expand Up @@ -153,11 +152,6 @@ func (d *AppDataSource) Schema(ctx context.Context, req datasource.SchemaRequest
MarkdownDescription: "The Kubernetes cluster identifier where the app is deployed.",
Computed: true,
},
"api_key": schema.StringAttribute{
MarkdownDescription: "The API key for the app.",
Computed: true,
Sensitive: true,
},
},
}
}
Expand Down Expand Up @@ -236,7 +230,6 @@ func (d *AppDataSource) mapAppToModel(data *AppDataSourceModel, app *client.App)

data.CreatedAt = types.StringValue(app.CreatedAt)
data.ClusterID = types.StringValue(app.ClusterID)
data.APIKey = types.StringValue(app.APIKey)

// Map cname
if app.Cname != "" {
Expand Down
7 changes: 0 additions & 7 deletions internal/provider/datasource_apps.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ type AppModel struct {
// Read-only attributes
CreatedAt types.String `tfsdk:"created_at"`
ClusterID types.String `tfsdk:"cluster_id"`
APIKey types.String `tfsdk:"api_key"`
}

func (d *AppsDataSource) Metadata(ctx context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse) {
Expand Down Expand Up @@ -163,11 +162,6 @@ func (d *AppsDataSource) Schema(ctx context.Context, req datasource.SchemaReques
MarkdownDescription: "The Kubernetes cluster identifier where the app is deployed.",
Computed: true,
},
"api_key": schema.StringAttribute{
MarkdownDescription: "The API key for the app.",
Computed: true,
Sensitive: true,
},
},
},
},
Expand Down Expand Up @@ -229,7 +223,6 @@ func (d *AppsDataSource) mapAppToModel(app *client.App) AppModel {
ProductionBranch: types.StringValue(app.ProductionBranch),
CreatedAt: types.StringValue(app.CreatedAt),
ClusterID: types.StringValue(app.ClusterID),
APIKey: types.StringValue(app.APIKey),
}

// Map tags
Expand Down
Loading
Loading