Skip to content

Commit

Permalink
mark the configs optional for function (#221)
Browse files Browse the repository at this point in the history
* mark the configs optional for function

* fix CryptoConfig

* revert chart Changes
  • Loading branch information
freeznet authored Jul 24, 2024
1 parent 75b3510 commit fcb5781
Show file tree
Hide file tree
Showing 14 changed files with 94 additions and 238 deletions.
81 changes: 60 additions & 21 deletions api/v1alpha1/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,40 +98,79 @@ type PackageContentRef struct {

// Resources indicates the resources for the pulsar functions and connectors
type Resources struct {
CPU string `json:"cpu"`
Disk int64 `json:"disk"`
RAM int64 `json:"ram"`
// +optional
CPU string `json:"cpu,omitempty"`

// +optional
Disk int64 `json:"disk,omitempty"`

// +optional
RAM int64 `json:"ram,omitempty"`
}

// ProducerConfig represents the configuration for the producer of the pulsar functions and connectors
type ProducerConfig struct {
MaxPendingMessages int `json:"maxPendingMessages" yaml:"maxPendingMessages"`
MaxPendingMessagesAcrossPartitions int `json:"maxPendingMessagesAcrossPartitions" yaml:"maxPendingMessagesAcrossPartitions"`
// +optional
MaxPendingMessages int `json:"maxPendingMessages,omitempty" yaml:"maxPendingMessages"`

// +optional
MaxPendingMessagesAcrossPartitions int `json:"maxPendingMessagesAcrossPartitions,omitempty" yaml:"maxPendingMessagesAcrossPartitions"`

// +optional
UseThreadLocalProducers bool `json:"useThreadLocalProducers,omitempty" yaml:"useThreadLocalProducers"`

UseThreadLocalProducers bool `json:"useThreadLocalProducers" yaml:"useThreadLocalProducers"`
CryptoConfig *CryptoConfig `json:"cryptoConfig" yaml:"cryptoConfig"`
BatchBuilder string `json:"batchBuilder" yaml:"batchBuilder"`
CompressionType string `json:"compressionType" yaml:"compressionType"`
// +optional
CryptoConfig *CryptoConfig `json:"cryptoConfig,omitempty" yaml:"cryptoConfig"`

// +optional
BatchBuilder string `json:"batchBuilder,omitempty" yaml:"batchBuilder"`

// +optional
CompressionType string `json:"compressionType,omitempty" yaml:"compressionType"`
}

// ConsumerConfig represents the configuration for the consumer of the pulsar functions and connectors
type ConsumerConfig struct {
SchemaType string `json:"schemaType,omitempty" yaml:"schemaType"`
SerdeClassName string `json:"serdeClassName,omitempty" yaml:"serdeClassName"`
RegexPattern bool `json:"regexPattern,omitempty" yaml:"regexPattern"`
ReceiverQueueSize int `json:"receiverQueueSize,omitempty" yaml:"receiverQueueSize"`
SchemaProperties map[string]string `json:"schemaProperties,omitempty" yaml:"schemaProperties"`
// +optional
SchemaType string `json:"schemaType,omitempty" yaml:"schemaType"`

// +optional
SerdeClassName string `json:"serdeClassName,omitempty" yaml:"serdeClassName"`

// +optional
RegexPattern bool `json:"regexPattern,omitempty" yaml:"regexPattern"`

// +optional
ReceiverQueueSize int `json:"receiverQueueSize,omitempty" yaml:"receiverQueueSize"`

// +optional
SchemaProperties map[string]string `json:"schemaProperties,omitempty" yaml:"schemaProperties"`

// +optional
ConsumerProperties map[string]string `json:"consumerProperties,omitempty" yaml:"consumerProperties"`
CryptoConfig *CryptoConfig `json:"cryptoConfig,omitempty" yaml:"cryptoConfig"`
PoolMessages bool `json:"poolMessages,omitempty" yaml:"poolMessages"`

// +optional
CryptoConfig *CryptoConfig `json:"cryptoConfig,omitempty" yaml:"cryptoConfig"`

// +optional
PoolMessages bool `json:"poolMessages,omitempty" yaml:"poolMessages"`
}

// CryptoConfig represents the configuration for the crypto of the pulsar functions and connectors
type CryptoConfig struct {
CryptoKeyReaderClassName string `json:"cryptoKeyReaderClassName" yaml:"cryptoKeyReaderClassName"`
CryptoKeyReaderConfig map[string]string `json:"cryptoKeyReaderConfig" yaml:"cryptoKeyReaderConfig"`

EncryptionKeys []string `json:"encryptionKeys" yaml:"encryptionKeys"`
ProducerCryptoFailureAction string `json:"producerCryptoFailureAction" yaml:"producerCryptoFailureAction"`
ConsumerCryptoFailureAction string `json:"consumerCryptoFailureAction" yaml:"consumerCryptoFailureAction"`
// +optional
CryptoKeyReaderClassName string `json:"cryptoKeyReaderClassName,omitempty" yaml:"cryptoKeyReaderClassName"`

// +optional
CryptoKeyReaderConfig map[string]string `json:"cryptoKeyReaderConfig,omitempty" yaml:"cryptoKeyReaderConfig"`

// +optional
EncryptionKeys []string `json:"encryptionKeys,omitempty" yaml:"encryptionKeys"`

// +optional
ProducerCryptoFailureAction string `json:"producerCryptoFailureAction,omitempty" yaml:"producerCryptoFailureAction"`

// +optional
ConsumerCryptoFailureAction string `json:"consumerCryptoFailureAction,omitempty" yaml:"consumerCryptoFailureAction"`
}
39 changes: 29 additions & 10 deletions api/v1alpha1/pulsarfunction_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,16 +206,35 @@ type PulsarFunctionSpec struct {

// WindowConfig defines the window config of the function
type WindowConfig struct {
WindowLengthCount *int `json:"windowLengthCount" yaml:"windowLengthCount"`
WindowLengthDurationMs *int64 `json:"windowLengthDurationMs" yaml:"windowLengthDurationMs"`
SlidingIntervalCount *int `json:"slidingIntervalCount" yaml:"slidingIntervalCount"`
SlidingIntervalDurationMs *int64 `json:"slidingIntervalDurationMs" yaml:"slidingIntervalDurationMs"`
LateDataTopic *string `json:"lateDataTopic" yaml:"lateDataTopic"`
MaxLagMs *int64 `json:"maxLagMs" yaml:"maxLagMs"`
WatermarkEmitIntervalMs *int64 `json:"watermarkEmitIntervalMs" yaml:"watermarkEmitIntervalMs"`
TimestampExtractorClassName *string `json:"timestampExtractorClassName" yaml:"timestampExtractorClassName"`
ActualWindowFunctionClassName *string `json:"actualWindowFunctionClassName" yaml:"actualWindowFunctionClassName"`
ProcessingGuarantees *string `json:"processingGuarantees" yaml:"processingGuarantees"`
// +optional
WindowLengthCount *int `json:"windowLengthCount,omitempty" yaml:"windowLengthCount"`

// +optional
WindowLengthDurationMs *int64 `json:"windowLengthDurationMs,omitempty" yaml:"windowLengthDurationMs"`

// +optional
SlidingIntervalCount *int `json:"slidingIntervalCount,omitempty" yaml:"slidingIntervalCount"`

// +optional
SlidingIntervalDurationMs *int64 `json:"slidingIntervalDurationMs,omitempty" yaml:"slidingIntervalDurationMs"`

// +optional
LateDataTopic *string `json:"lateDataTopic,omitempty" yaml:"lateDataTopic"`

// +optional
MaxLagMs *int64 `json:"maxLagMs,omitempty" yaml:"maxLagMs"`

// +optional
WatermarkEmitIntervalMs *int64 `json:"watermarkEmitIntervalMs,omitempty" yaml:"watermarkEmitIntervalMs"`

// +optional
TimestampExtractorClassName *string `json:"timestampExtractorClassName,omitempty" yaml:"timestampExtractorClassName"`

// +optional
ActualWindowFunctionClassName *string `json:"actualWindowFunctionClassName,omitempty" yaml:"actualWindowFunctionClassName"`

// +optional
ProcessingGuarantees *string `json:"processingGuarantees,omitempty" yaml:"processingGuarantees"`
}

// PulsarFunctionStatus defines the observed state of PulsarFunction
Expand Down
6 changes: 4 additions & 2 deletions api/v1alpha1/pulsarsource_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,11 @@ type PulsarSourceSpec struct {

// BatchSourceConfig represents the batch source config of the PulsarSource
type BatchSourceConfig struct {
DiscoveryTriggererClassName string `json:"discoveryTriggererClassName" yaml:"discoveryTriggererClassName"`
// +optional
DiscoveryTriggererClassName string `json:"discoveryTriggererClassName,omitempty" yaml:"discoveryTriggererClassName"`

DiscoveryTriggererConfig *apiextensionsv1.JSON `json:"discoveryTriggererConfig" yaml:"discoveryTriggererConfig"`
// +optional
DiscoveryTriggererConfig *apiextensionsv1.JSON `json:"discoveryTriggererConfig,omitempty" yaml:"discoveryTriggererConfig"`
}

// PulsarSourceStatus defines the observed state of PulsarSource
Expand Down
2 changes: 1 addition & 1 deletion api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 0 additions & 14 deletions config/crd/bases/resource.streamnative.io_pulsarconnections.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,3 @@
# Copyright 2024 StreamNative
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
Expand Down
48 changes: 0 additions & 48 deletions config/crd/bases/resource.streamnative.io_pulsarfunctions.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,3 @@
# Copyright 2024 StreamNative
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
Expand Down Expand Up @@ -162,12 +148,6 @@ spec:
type: array
producerCryptoFailureAction:
type: string
required:
- consumerCryptoFailureAction
- cryptoKeyReaderClassName
- cryptoKeyReaderConfig
- encryptionKeys
- producerCryptoFailureAction
type: object
poolMessages:
type: boolean
Expand Down Expand Up @@ -272,26 +252,13 @@ spec:
type: array
producerCryptoFailureAction:
type: string
required:
- consumerCryptoFailureAction
- cryptoKeyReaderClassName
- cryptoKeyReaderConfig
- encryptionKeys
- producerCryptoFailureAction
type: object
maxPendingMessages:
type: integer
maxPendingMessagesAcrossPartitions:
type: integer
useThreadLocalProducers:
type: boolean
required:
- batchBuilder
- compressionType
- cryptoConfig
- maxPendingMessages
- maxPendingMessagesAcrossPartitions
- useThreadLocalProducers
type: object
py:
description: Py is the py of the function
Expand All @@ -310,10 +277,6 @@ spec:
ram:
format: int64
type: integer
required:
- cpu
- disk
- ram
type: object
retainKeyOrdering:
description: RetainKeyOrdering is the flag to indicate whether the
Expand Down Expand Up @@ -392,17 +355,6 @@ spec:
windowLengthDurationMs:
format: int64
type: integer
required:
- actualWindowFunctionClassName
- lateDataTopic
- maxLagMs
- processingGuarantees
- slidingIntervalCount
- slidingIntervalDurationMs
- timestampExtractorClassName
- watermarkEmitIntervalMs
- windowLengthCount
- windowLengthDurationMs
type: object
required:
- connectionRef
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,3 @@
# Copyright 2024 StreamNative
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
Expand Down
14 changes: 0 additions & 14 deletions config/crd/bases/resource.streamnative.io_pulsarnamespaces.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,3 @@
# Copyright 2024 StreamNative
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
Expand Down
14 changes: 0 additions & 14 deletions config/crd/bases/resource.streamnative.io_pulsarpackages.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,3 @@
# Copyright 2024 StreamNative
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
Expand Down
14 changes: 0 additions & 14 deletions config/crd/bases/resource.streamnative.io_pulsarpermissions.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,3 @@
# Copyright 2024 StreamNative
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
Expand Down
24 changes: 0 additions & 24 deletions config/crd/bases/resource.streamnative.io_pulsarsinks.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,3 @@
# Copyright 2024 StreamNative
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
Expand Down Expand Up @@ -136,12 +122,6 @@ spec:
type: array
producerCryptoFailureAction:
type: string
required:
- consumerCryptoFailureAction
- cryptoKeyReaderClassName
- cryptoKeyReaderConfig
- encryptionKeys
- producerCryptoFailureAction
type: object
poolMessages:
type: boolean
Expand Down Expand Up @@ -206,10 +186,6 @@ spec:
ram:
format: int64
type: integer
required:
- cpu
- disk
- ram
type: object
retainKeyOrdering:
description: RetainKeyOrdering is the flag to enable or disable the
Expand Down
Loading

0 comments on commit fcb5781

Please sign in to comment.