-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
253 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# 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: resource.streamnative.io/v1alpha1 | ||
kind: Secret | ||
metadata: | ||
name: test-secret | ||
namespace: default | ||
spec: | ||
apiServerRef: | ||
name: test-connection | ||
type: Opaque | ||
data: | ||
key: value | ||
location: "useast1" | ||
instanceName: "test-instance" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
# Secret | ||
|
||
## Overview | ||
|
||
The `Secret` resource defines a secret in StreamNative Cloud. It allows you to create and manage secrets in StreamNative Cloud that can be referenced and used by other resources, such as ComputeFlinkDeployment. | ||
|
||
## Specifications | ||
|
||
| Field | Description | Required | | ||
|-------|-------------|----------| | ||
| `apiServerRef` | Reference to the StreamNativeCloudConnection resource for API server access | Yes | | ||
| `instanceName` | Name of the instance this secret is for (e.g. pulsar-instance) | No | | ||
| `location` | Location of the secret | No | | ||
| `data` | Secret data, values should be base64 encoded | No* | | ||
| `secretRef` | Reference to a Kubernetes secret. When secretRef is set, it will be used to fetch the secret data, and data field will be ignored | No* | | ||
| `poolMemberName` | Pool member to deploy the secret | No | | ||
| `tolerations` | Tolerations for the secret | No | | ||
| `type` | Used to facilitate programmatic handling of secret data | No | | ||
|
||
*Note: Either `data` or `secretRef` must be specified. | ||
|
||
### KubernetesSecretReference Structure | ||
|
||
| Field | Description | Required | | ||
|-------|-------------|----------| | ||
| `namespace` | Namespace of the Kubernetes secret | Yes | | ||
| `name` | Name of the Kubernetes secret | Yes | | ||
|
||
### Toleration Structure | ||
|
||
| Field | Description | Required | | ||
|-------|-------------|----------| | ||
| `key` | Taint key that the toleration applies to. Empty means match all taint keys | No | | ||
| `operator` | Represents a key's relationship to the value. Valid operators are Exists and Equal. Defaults to Equal | No | | ||
| `value` | Taint value the toleration matches to | No | | ||
| `effect` | Indicates the taint effect to match. Empty means match all taint effects | No | | ||
|
||
## Status | ||
|
||
| Field | Description | | ||
|-------|-------------| | ||
| `conditions` | List of status conditions for the secret | | ||
| `observedGeneration` | The last observed generation of the resource | | ||
|
||
## Example | ||
|
||
1. Create a Secret resource with direct data: | ||
|
||
```yaml | ||
apiVersion: resource.streamnative.io/v1alpha1 | ||
kind: Secret | ||
metadata: | ||
name: resource-operator-secret | ||
namespace: default | ||
spec: | ||
apiServerRef: | ||
name: test-connection | ||
data: | ||
test-key: test-value | ||
instanceName: wstest | ||
location: us-central1 | ||
``` | ||
2. Create a Secret resource with Kubernetes Secret reference: | ||
```yaml | ||
apiVersion: resource.streamnative.io/v1alpha1 | ||
kind: Secret | ||
metadata: | ||
name: resource-operator-secret-docker-hub | ||
namespace: default | ||
spec: | ||
apiServerRef: | ||
name: test-connection | ||
secretRef: | ||
name: regcred | ||
namespace: default | ||
instanceName: wstest | ||
location: us-central1 | ||
``` | ||
3. Apply the YAML file: | ||
```shell | ||
kubectl apply -f secret.yaml | ||
``` | ||
|
||
4. Check the secret status: | ||
|
||
```shell | ||
kubectl get secret.resource.streamnative.io resource-operator-secret | ||
``` | ||
|
||
The secret is ready when the Ready condition is True: | ||
|
||
```shell | ||
NAME READY AGE | ||
resource-operator-secret True 1m | ||
``` | ||
|
||
## Update Secret | ||
|
||
You can update the secret by modifying the YAML file and reapplying it. Most fields can be updated, including: | ||
- Secret data | ||
- Kubernetes secret reference | ||
- Tolerations | ||
|
||
After applying changes, verify the status to ensure the secret is configured properly. | ||
|
||
## Delete Secret | ||
|
||
To delete a Secret resource: | ||
|
||
```shell | ||
kubectl delete secret.resource.streamnative.io resource-operator-secret | ||
``` | ||
|
||
Note that deleting the secret will affect any resources that depend on it, such as ComputeFlinkDeployments. Make sure to handle any dependent resources appropriately before deletion. |