Skip to content

Commit 88579de

Browse files
committed
create securityPolicy for collection test
1 parent 7a5f9b9 commit 88579de

13 files changed

+102
-24
lines changed
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
ack_generate_info:
2-
build_date: "2025-06-19T21:14:45Z"
3-
build_hash: 97e1ac99991554a8b5b15a3438a47d99b7a9fe5e
2+
build_date: "2025-07-10T18:26:15Z"
3+
build_hash: 49a32e72777469d874a917cf1da21809d988dccc
44
go_version: go1.24.4
5-
version: v0.48.0-1-g97e1ac9
6-
api_directory_checksum: 1ea4d7047f68b6a8dfbecdc4e58479448445ed9b
5+
version: v0.48.0-2-g49a32e7
6+
api_directory_checksum: dbc5ac7c558bed32e348e97ad5a24ba6a1d11663
77
api_version: v1alpha1
88
aws_sdk_go_version: v1.32.6
99
generator_config_info:
10-
file_checksum: 4ec896af7b28defebc9c43c5e76a318966558ba0
10+
file_checksum: 7a90e961a337ec92afdf159ec2eae7e86068cc85
1111
original_file_name: generator.yaml
1212
last_modification:
1313
reason: API generation

apis/v1alpha1/collection.go

Lines changed: 4 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apis/v1alpha1/generator.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ operations:
1717
BatchGetCollection:
1818
operation_type:
1919
- List
20+
output_wrapper_field_path: CollectionDetails
2021
resource_name: Collection
2122
resources:
2223
SecurityPolicy:
@@ -43,6 +44,12 @@ resources:
4344
fields:
4445
Type:
4546
go_tag: json:"type,omitempty"
47+
Name:
48+
is_immutable: true
49+
StandbyReplicas:
50+
is_immutable: true
51+
Type:
52+
is_immutable: true
4653
hooks:
4754
sdk_update_pre_build_request:
4855
template_path: hooks/collection/sdk_update_pre_build_request.go.tpl

config/crd/bases/opensearchserverless.services.k8s.aws_collections.yaml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,16 @@ spec:
4848
4949
Regex Pattern: `^[a-z][a-z0-9-]+$`
5050
type: string
51+
x-kubernetes-validations:
52+
- message: Value is immutable once set
53+
rule: self == oldSelf
5154
standbyReplicas:
5255
description: Indicates whether standby replicas should be used for
5356
a collection.
5457
type: string
58+
x-kubernetes-validations:
59+
- message: Value is immutable once set
60+
rule: self == oldSelf
5561
tags:
5662
description: |-
5763
An arbitrary set of tags (key–value pairs) to associate with the OpenSearch
@@ -66,9 +72,12 @@ spec:
6672
type: string
6773
type: object
6874
type: array
69-
type:
75+
type_:
7076
description: The type of collection.
7177
type: string
78+
x-kubernetes-validations:
79+
- message: Value is immutable once set
80+
rule: self == oldSelf
7281
required:
7382
- name
7483
type: object

generator.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ operations:
1717
BatchGetCollection:
1818
operation_type:
1919
- List
20+
output_wrapper_field_path: CollectionDetails
2021
resource_name: Collection
2122
resources:
2223
SecurityPolicy:
@@ -43,6 +44,12 @@ resources:
4344
fields:
4445
Type:
4546
go_tag: json:"type,omitempty"
47+
Name:
48+
is_immutable: true
49+
StandbyReplicas:
50+
is_immutable: true
51+
Type:
52+
is_immutable: true
4653
hooks:
4754
sdk_update_pre_build_request:
4855
template_path: hooks/collection/sdk_update_pre_build_request.go.tpl

helm/crds/opensearchserverless.services.k8s.aws_collections.yaml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,16 @@ spec:
4848
4949
Regex Pattern: `^[a-z][a-z0-9-]+$`
5050
type: string
51+
x-kubernetes-validations:
52+
- message: Value is immutable once set
53+
rule: self == oldSelf
5154
standbyReplicas:
5255
description: Indicates whether standby replicas should be used for
5356
a collection.
5457
type: string
58+
x-kubernetes-validations:
59+
- message: Value is immutable once set
60+
rule: self == oldSelf
5561
tags:
5662
description: |-
5763
An arbitrary set of tags (key–value pairs) to associate with the OpenSearch
@@ -66,9 +72,12 @@ spec:
6672
type: string
6773
type: object
6874
type: array
69-
type:
75+
type_:
7076
description: The type of collection.
7177
type: string
78+
x-kubernetes-validations:
79+
- message: Value is immutable once set
80+
rule: self == oldSelf
7281
required:
7382
- name
7483
type: object

pkg/resource/collection/hooks.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,20 @@
1414
package collection
1515

1616
import (
17+
svcsdktypes "github.com/aws/aws-sdk-go-v2/service/opensearchserverless/types"
18+
1719
"github.com/aws-controllers-k8s/opensearchserverless-controller/pkg/sync"
1820
)
1921

2022
var syncTags = sync.Tags
2123
var getTags = sync.GetTags
24+
25+
26+
// collectionIsActive returns true if the collection is active, or false if it is not active
27+
func collectionIsActive(desired *resource) bool {
28+
if desired.ko.Status.Status != nil && *desired.ko.Status.Status == string(svcsdktypes.CollectionStatusActive) {
29+
return true
30+
}
31+
32+
return false
33+
}

pkg/resource/collection/sdk.go

Lines changed: 8 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/sync/tags.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import (
2626
svcapitypes "github.com/aws-controllers-k8s/opensearchserverless-controller/apis/v1alpha1"
2727
)
2828

29-
// SyncTags examines the Tags in the supplied Resource and calls the
29+
// Tags examines the Tags in the supplied Resource and calls the
3030
// TagResource and UntagResource APIs to ensure that the set of
3131
// associated Tags stays in sync with the Resource.Spec.Tags
3232
func Tags(
Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
r.ko.Spec.Tags, err = getTags(ctx, string(*ko.Status.ACKResourceMetadata.ARN), rm.sdkapi, rm.metrics)
1+
ko.Spec.Tags, err = getTags(ctx, string(*ko.Status.ACKResourceMetadata.ARN), rm.sdkapi, rm.metrics)
22
if err != nil {
33
return &resource{ko}, err
4-
}
4+
}
5+
6+
if !collectionIsActive(&resource{ko}) {
7+
ackcondition.SetSynced(&resource{ko}, corev1.ConditionFalse, aws.String("collection is not active"), nil)
8+
}

0 commit comments

Comments
 (0)