Skip to content

Commit

Permalink
Remove allow_auto_create option
Browse files Browse the repository at this point in the history
Signed-off-by: Prudhvi Godithi <pgodithi@amazon.com>
  • Loading branch information
prudhvigodithi committed Mar 28, 2024
1 parent fb50c19 commit 03ad9c2
Show file tree
Hide file tree
Showing 13 changed files with 13 additions and 28 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docker-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- name: Setup go
uses: actions/setup-go@v3
with:
go-version: '1.19'
go-version: '1.23.0'
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Docker Build
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/functional-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
- name: Setup go
uses: actions/setup-go@v3
with:
go-version: '1.19'
go-version: '1.23.0'
- uses: nolar/setup-k3d-k3s@v1
with:
version: v1
Expand Down Expand Up @@ -49,7 +49,7 @@ jobs:
- name: Setup go
uses: actions/setup-go@v3
with:
go-version: '1.19'
go-version: '1.23.0'
- uses: nolar/setup-k3d-k3s@v1
with:
version: v1
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/linting.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
- name: Setup go
uses: actions/setup-go@v3
with:
go-version: '1.19'
go-version: '1.23.0'
- name: golangci-lint go
uses: golangci/golangci-lint-action@v3
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- name: Setup go
uses: actions/setup-go@v3
with:
go-version: '1.19'
go-version: '1.23.0'
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: set Env
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/testing.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
- name: Setup go
uses: actions/setup-go@v3
with:
go-version: '1.19'
go-version: '1.23.0'
- name: Test
run: |
cd opensearch-operator
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,6 @@ spec:
_meta:
description: Optional user metadata about the component template
x-kubernetes-preserve-unknown-fields: true
allowAutoCreate:
description: If true, then indices can be automatically created using
this template
type: boolean
name:
description: The name of the component template. Defaults to metadata.name
type: string
Expand Down
3 changes: 1 addition & 2 deletions docs/userguide/main.md
Original file line number Diff line number Diff line change
Expand Up @@ -1283,7 +1283,7 @@ The namespace of the `OpensearchISMPolicy` must be the namespace the OpenSearch
The operator provides the OpensearchIndexTemplate and OpensearchComponentTemplate CRDs, which is used for managing index and component templates respectively.

The two CRD specifications attempts to be as close as possible to what the OpenSearch API expects, with some changes from snake_case to camelCase.
The fields that have been changed, is `index_patterns` to `indexPatterns` (OpensearchIndexTemplate only), `composed_of` to `composedOf` (OpensearchIndexTemplate only), `allow_auto_create` to `allowAutoCreate` (OpensearchComponentTemplate only), and `template.aliases.<alias>.is_write_index` to `template.aliases.<alias>.isWriteIndex`.
The fields that have been changed, is `index_patterns` to `indexPatterns` (OpensearchIndexTemplate only), `composed_of` to `composedOf` (OpensearchIndexTemplate only) and `template.aliases.<alias>.is_write_index` to `template.aliases.<alias>.isWriteIndex`.

The following example creates a component template for setting the number of shards and replicas, together with specifying a specific time format for documents:

Expand All @@ -1310,7 +1310,6 @@ spec:
value:
type: double
version: 1 # optional
allowAutoCreate: false # optional
_meta: # optional
description: example description
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,6 @@ type OpensearchComponentTemplateSpec struct {
// Version number used to manage the component template externally
Version int `json:"version,omitempty"`

// If true, then indices can be automatically created using this template
AllowAutoCreate bool `json:"allowAutoCreate,omitempty"`

// Optional user metadata about the component template
Meta *apiextensionsv1.JSON `json:"_meta,omitempty"`
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,6 @@ spec:
_meta:
description: Optional user metadata about the component template
x-kubernetes-preserve-unknown-fields: true
allowAutoCreate:
description: If true, then indices can be automatically created using
this template
type: boolean
name:
description: The name of the component template. Defaults to metadata.name
type: string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,5 @@ spec:
value:
type: double
version: 1 # optional
allowAutoCreate: false # optional
_meta: # optional
description: example description
2 changes: 1 addition & 1 deletion opensearch-operator/go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/Opster/opensearch-k8s-operator/opensearch-operator

go 1.19
go 1.23.0

require (
github.com/Masterminds/semver v1.5.0
Expand Down
7 changes: 3 additions & 4 deletions opensearch-operator/opensearch-gateway/requests/Templates.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@ type IndexTemplate struct {
}

type ComponentTemplate struct {
Template Index `json:"template"`
Version int `json:"version,omitempty"`
AllowAutoCreate bool `json:"allow_auto_create,omitempty"`
Meta *apiextensionsv1.JSON `json:"_meta,omitempty"`
Template Index `json:"template"`
Version int `json:"version,omitempty"`
Meta *apiextensionsv1.JSON `json:"_meta,omitempty"`
}

type Index struct {
Expand Down
5 changes: 2 additions & 3 deletions opensearch-operator/pkg/helpers/translate.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,8 @@ func TranslateIndexTemplateToRequest(spec v1.OpensearchIndexTemplateSpec) reques
// TranslateComponentTemplateToRequest rewrites the CRD format to the gateway format
func TranslateComponentTemplateToRequest(spec v1.OpensearchComponentTemplateSpec) requests.ComponentTemplate {
request := requests.ComponentTemplate{
AllowAutoCreate: spec.AllowAutoCreate,
Template: TranslateIndexToRequest(spec.Template),
Version: spec.Version,
Template: TranslateIndexToRequest(spec.Template),
Version: spec.Version,
}
if spec.Meta.Size() > 0 {
request.Meta = spec.Meta
Expand Down

0 comments on commit 03ad9c2

Please sign in to comment.