diff --git a/pkg/resourceinterpreter/default/thirdparty/README.md b/pkg/resourceinterpreter/default/thirdparty/README.md new file mode 100644 index 000000000000..7e42a71ae18f --- /dev/null +++ b/pkg/resourceinterpreter/default/thirdparty/README.md @@ -0,0 +1,116 @@ +# Thirdparty Resource Interpreter + +This directory contains third-party resource interpreters for Karmada. These interpreters define how Karmada should handle custom resources from various third-party applications and operators. + +## Files + +- `thirdparty.go` - Main implementation of the third-party resource interpreter +- `thirdparty_test.go` - Test suite for validating resource interpreter customizations +- `resourcecustomizations/` - Directory containing resource customization definitions organized by API version and kind + +## Directory Structure + +The resource customizations are organized in the following structure: + +``` +resourcecustomizations/ +├── / +│ └── / +│ └── / +│ ├── customizations.yaml # Resource interpreter customization rules +│ └── testdata/ # Test input and expected output files +│ ├── aggregatestatus-test.yaml # test case for AggregateStatus operation +│ ├── interpretcomponent-test.yaml # test case for InterpretComponent operation +│ ├── interprethealth-test.yaml # test case for InterpretHealth operation +│ ├── ... +``` + +## How to test + +### Running Tests + +To run all third-party resource interpreter tests: + +```bash +cd pkg/resourceinterpreter/default/thirdparty +go test -v +``` + +### Creating Test Cases + +#### 1. Create Test Structure + +For a new resource type, create the directory structure: + +```bash +mkdir -p resourcecustomizations////testdata +``` + +#### 2. Create Test Data Files + +Test data files are divided by operation type. Each file contains different test cases for the corresponding operation. The naming convention for test data files is `-test.yaml`. + +For example: +```markdown +aggregatestatus-test.yaml # test case for AggregateStatus operation +interpretcomponent-test.yaml # test case for InterpretComponent operation +interprethealth-test.yaml # test case for InterpretHealth operation +``` + +#### 3. Add Test Cases + +The test case structure is as follows: +```go +type IndividualTest struct { + Name string `yaml:"name"` // the name of individual test + Description string `yaml:"description,omitempty"` // the description of individual test + DesiredObj *unstructured.Unstructured `yaml:"desiredObj,omitempty"` // the desired object + ObservedObj *unstructured.Unstructured `yaml:"observedObj,omitempty"` // the observed object + StatusItems []workv1alpha2.AggregatedStatusItem `yaml:"statusItems,omitempty"` // the status items of aggregated status + InputReplicas int64 `yaml:"inputReplicas,omitempty"` // the input replicas for revise operation + Operation string `yaml:"operation"` // the operation of resource interpreter + Output map[string]interface{} `yaml:"output,omitempty"` // the expected output results +} +``` + +Where: +- `Output` The output are key-value mapping where the key is the field name of the expected result and the value is the expected result. The keys in output for different operations correspond to the Name field of the results returned by the corresponding resource interpreter operation `RuleResult.Results`. + +For example: +```go +func (h *healthInterpretationRule) Run(interpreter *declarative.ConfigurableInterpreter, args RuleArgs) *RuleResult { + obj, err := args.getObjectOrError() + if err != nil { + return newRuleResultWithError(err) + } + healthy, enabled, err := interpreter.InterpretHealth(obj) + if err != nil { + return newRuleResultWithError(err) + } + if !enabled { + return newRuleResultWithError(fmt.Errorf("rule is not enabled")) + } + return newRuleResult().add("healthy", healthy) +} +``` + +The output for operation `InterpretHealth` should contain the `healthy` key. + +For more examples of test cases, refer to the existing test data files in this directory. + +### Supported Operations + +The test framework supports the following operations: + +- `InterpretReplica` - Extract replica count from resource +- `InterpretComponent` - Extract component information from resource +- `ReviseReplica` - Modify replica count in resource +- `InterpretStatus` - Extract status information +- `InterpretHealth` - Determine resource health status +- `InterpretDependency` - Extract resource dependencies +- `AggregateStatus` - Aggregate status from multiple clusters +- `Retain` - Retain the desired resource template. + +> NOTE: Not all operations need to be implemented for every resource type. Implement only the operations relevant to your resource. + +For more information about resource interpreter customizations, see the [Karmada documentation](https://karmada.io/docs/userguide/globalview/customizing-resource-interpreter/). diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/AdvancedCronJob/customizations_tests.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/AdvancedCronJob/customizations_tests.yaml deleted file mode 100644 index 31feb05ad4b6..000000000000 --- a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/AdvancedCronJob/customizations_tests.yaml +++ /dev/null @@ -1,6 +0,0 @@ -tests: - - desiredInputPath: testdata/desired-acj-nginx.yaml - statusInputPath: testdata/status-file.yaml - operation: AggregateStatus - - desiredInputPath: testdata/desired-acj-nginx.yaml - operation: InterpretDependency diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/AdvancedCronJob/testdata/aggregatestatus-test.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/AdvancedCronJob/testdata/aggregatestatus-test.yaml new file mode 100644 index 000000000000..82ab8332534d --- /dev/null +++ b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/AdvancedCronJob/testdata/aggregatestatus-test.yaml @@ -0,0 +1,73 @@ +# test case for aggregating status of AdvancedCronJob +# case1. AdvancedCronJob with two status items + +name: "AdvancedCronJob with two status items" +description: "Test aggregating status of AdvancedCronJob with two status items" +desiredObj: + apiVersion: apps.kruise.io/v1alpha1 + kind: AdvancedCronJob + metadata: + labels: + app: sample + name: sample + namespace: test-acj + spec: + schedule: "*/2 * * * *" + template: + broadcastJobTemplate: + spec: + template: + metadata: + labels: + app: sample + spec: + restartPolicy: Never + volumes: + - name: configmap + configMap: + name: my-sample-config + containers: + - name: nginx + image: nginx:alpine + env: + - name: logData + valueFrom: + configMapKeyRef: + name: mysql-config + key: log + - name: lowerData + valueFrom: + configMapKeyRef: + name: mysql-config + key: lower + completionPolicy: + type: Never +statusItems: + - applied: true + clusterName: member1 + health: Healthy + status: + active: + - apiVersion: apps.kruise.io/v1alpha1 + kind: BroadcastJob + name: sample-1681378080 + namespace: test-acj + resourceVersion: "3636404" + uid: f96013ef-2869-49d7-adf3-8f7231cc5e2a + lastScheduleTime: "2023-04-13T09:30:00Z" + type: BroadcastJob + - applied: true + clusterName: member3 + health: Healthy + status: + active: + - apiVersion: apps.kruise.io/v1alpha1 + kind: BroadcastJob + name: sample-1681378080 + namespace: test-acj + resourceVersion: "3635081" + uid: d1f3c194-d650-4cce-b23d-307a445bb92e + lastScheduleTime: "2023-04-13T09:30:00Z" + type: BroadcastJob +operation: AggregateStatus +output: diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/AdvancedCronJob/testdata/desired-acj-nginx.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/AdvancedCronJob/testdata/desired-acj-nginx.yaml deleted file mode 100644 index a449170379e3..000000000000 --- a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/AdvancedCronJob/testdata/desired-acj-nginx.yaml +++ /dev/null @@ -1,38 +0,0 @@ -apiVersion: apps.kruise.io/v1alpha1 -kind: AdvancedCronJob -metadata: - labels: - app: sample - name: sample - namespace: test-acj -spec: - schedule: "*/2 * * * *" - template: - broadcastJobTemplate: - spec: - template: - metadata: - labels: - app: sample - spec: - restartPolicy: Never - volumes: - - name: configmap - configMap: - name: my-sample-config - containers: - - name: nginx - image: nginx:alpine - env: - - name: logData - valueFrom: - configMapKeyRef: - name: mysql-config - key: log - - name: lowerData - valueFrom: - configMapKeyRef: - name: mysql-config - key: lower - completionPolicy: - type: Never diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/AdvancedCronJob/testdata/interpretdependency-test.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/AdvancedCronJob/testdata/interpretdependency-test.yaml new file mode 100644 index 000000000000..f0a22f9a3c52 --- /dev/null +++ b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/AdvancedCronJob/testdata/interpretdependency-test.yaml @@ -0,0 +1,46 @@ +# test case for interpreting dependency of AdvancedCronJob +# case1. AdvancedCronJob with configmap dependency + +name: "AdvancedCronJob with configmap dependency" +description: "Test interpreting dependency of AdvancedCronJob with configmap dependency" +desiredObj: + apiVersion: apps.kruise.io/v1alpha1 + kind: AdvancedCronJob + metadata: + labels: + app: sample + name: sample + namespace: test-acj + spec: + schedule: "*/2 * * * *" + template: + broadcastJobTemplate: + spec: + template: + metadata: + labels: + app: sample + spec: + restartPolicy: Never + volumes: + - name: configmap + configMap: + name: my-sample-config + containers: + - name: nginx + image: nginx:alpine + env: + - name: logData + valueFrom: + configMapKeyRef: + name: mysql-config + key: log + - name: lowerData + valueFrom: + configMapKeyRef: + name: mysql-config + key: lower + completionPolicy: + type: Never +operation: InterpretDependency +output: diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/AdvancedCronJob/testdata/observed-acj-nginx.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/AdvancedCronJob/testdata/observed-acj-nginx.yaml deleted file mode 100644 index 14df790925b8..000000000000 --- a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/AdvancedCronJob/testdata/observed-acj-nginx.yaml +++ /dev/null @@ -1,48 +0,0 @@ -apiVersion: apps.kruise.io/v1alpha1 -kind: AdvancedCronJob -metadata: - labels: - app: sample - name: sample - namespace: test-acj -spec: - schedule: "*/2 * * * *" - template: - broadcastJobTemplate: - spec: - template: - metadata: - labels: - app: sample - spec: - restartPolicy: Never - volumes: - - name: configmap - configMap: - name: my-sample-config - containers: - - name: nginx - image: nginx:alpine - env: - - name: logData - valueFrom: - configMapKeyRef: - name: mysql-config - key: log - - name: lowerData - valueFrom: - configMapKeyRef: - name: mysql-config - key: lower - completionPolicy: - type: Never -status: - active: - - apiVersion: apps.kruise.io/v1alpha1 - kind: BroadcastJob - name: sample-1681378080 - namespace: test-acj - resourceVersion: "3635081" - uid: d1f3c194-d650-4cce-b23d-307a445bb92e - lastScheduleTime: "2023-04-13T09:28:00Z" - type: BroadcastJob diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/AdvancedCronJob/testdata/status-file.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/AdvancedCronJob/testdata/status-file.yaml deleted file mode 100644 index adf7db3fd808..000000000000 --- a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/AdvancedCronJob/testdata/status-file.yaml +++ /dev/null @@ -1,27 +0,0 @@ -applied: true -clusterName: member1 -health: Healthy -status: - active: - - apiVersion: apps.kruise.io/v1alpha1 - kind: BroadcastJob - name: sample-1681378080 - namespace: test-acj - resourceVersion: "3636404" - uid: f96013ef-2869-49d7-adf3-8f7231cc5e2a - lastScheduleTime: "2023-04-13T09:30:00Z" - type: BroadcastJob ---- -applied: true -clusterName: member3 -health: Healthy -status: - active: - - apiVersion: apps.kruise.io/v1alpha1 - kind: BroadcastJob - name: sample-1681378080 - namespace: test-acj - resourceVersion: "3635081" - uid: d1f3c194-d650-4cce-b23d-307a445bb92e - lastScheduleTime: "2023-04-13T09:30:00Z" - type: BroadcastJob diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/BroadcastJob/customizations_tests.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/BroadcastJob/customizations_tests.yaml deleted file mode 100644 index 2cd9bf995ff2..000000000000 --- a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/BroadcastJob/customizations_tests.yaml +++ /dev/null @@ -1,18 +0,0 @@ -tests: - - desiredInputPath: testdata/desired-bcj-nginx.yaml - statusInputPath: testdata/status-file.yaml - operation: AggregateStatus - - desiredInputPath: testdata/desired-bcj-nginx.yaml - operation: InterpretDependency - - observedInputPath: testdata/observed-bcj-nginx.yaml - operation: InterpretReplica - - desiredInputPath: testdata/desired-bcj-nginx.yaml - observedInputPath: testdata/observed-bcj-nginx.yaml - operation: Retain - - observedInputPath: testdata/observed-bcj-nginx.yaml - operation: InterpretHealth - - observedInputPath: testdata/observed-bcj-nginx.yaml - operation: InterpretStatus - - observedInputPath: testdata/observed-bcj-nginx.yaml - operation: ReviseReplica - desiredReplicas: 1 diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/BroadcastJob/testdata/aggregatestatus-test.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/BroadcastJob/testdata/aggregatestatus-test.yaml new file mode 100644 index 000000000000..051e5024b06d --- /dev/null +++ b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/BroadcastJob/testdata/aggregatestatus-test.yaml @@ -0,0 +1,81 @@ +# test case for aggregating status of BroadcastJob +# case1. BroadcastJob with two status items + +name: "BroadcastJob with two status items" +description: "Test aggregating status of BroadcastJob with two status items" +desiredObj: + apiVersion: apps.kruise.io/v1alpha1 + kind: BroadcastJob + metadata: + labels: + app: sample + name: sample + namespace: test-bcj + spec: + parallelism: 1 + template: + metadata: + labels: + app: sample + spec: + restartPolicy: Never + volumes: + - name: configmap + configMap: + name: my-sample-config + containers: + - name: nginx + image: nginx:alpine + env: + - name: logData + valueFrom: + configMapKeyRef: + name: mysql-config + key: log + - name: lowerData + valueFrom: + configMapKeyRef: + name: mysql-config + key: lower + completionPolicy: + type: Always + activeDeadlineSeconds: 10 +statusItems: + - applied: true + clusterName: member1 + health: Healthy + status: + active: 0 + completionTime: "2023-04-06T15:01:47Z" + conditions: + - lastProbeTime: "2023-04-06T15:01:47Z" + lastTransitionTime: "2023-04-06T15:01:47Z" + message: Job test-bcj/sample was active longer than specified deadline + reason: Failed + status: "True" + type: Failed + desired: 1 + failed: 1 + phase: failed + startTime: "2023-04-06T15:01:37Z" + succeeded: 0 + - applied: true + clusterName: member3 + health: Healthy + status: + active: 0 + completionTime: "2023-04-06T15:01:47Z" + conditions: + - lastProbeTime: "2023-04-06T15:01:47Z" + lastTransitionTime: "2023-04-06T15:01:47Z" + message: Job test-bcj/sample was active longer than specified deadline + reason: Failed + status: "True" + type: Failed + desired: 1 + failed: 1 + phase: failed + startTime: "2023-04-06T15:01:37Z" + succeeded: 0 +operation: AggregateStatus +output: diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/BroadcastJob/testdata/desired-bcj-nginx.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/BroadcastJob/testdata/desired-bcj-nginx.yaml deleted file mode 100644 index 3cb86673dabc..000000000000 --- a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/BroadcastJob/testdata/desired-bcj-nginx.yaml +++ /dev/null @@ -1,36 +0,0 @@ -apiVersion: apps.kruise.io/v1alpha1 -kind: BroadcastJob -metadata: - labels: - app: sample - name: sample - namespace: test-bcj -spec: - parallelism: 1 - template: - metadata: - labels: - app: sample - spec: - restartPolicy: Never - volumes: - - name: configmap - configMap: - name: my-sample-config - containers: - - name: nginx - image: nginx:alpine - env: - - name: logData - valueFrom: - configMapKeyRef: - name: mysql-config - key: log - - name: lowerData - valueFrom: - configMapKeyRef: - name: mysql-config - key: lower - completionPolicy: - type: Always - activeDeadlineSeconds: 10 diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/BroadcastJob/testdata/interpretdependency-test.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/BroadcastJob/testdata/interpretdependency-test.yaml new file mode 100644 index 000000000000..8353ad68dc16 --- /dev/null +++ b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/BroadcastJob/testdata/interpretdependency-test.yaml @@ -0,0 +1,44 @@ +# test case for interpreting dependency of BroadcastJob +# case1. BroadcastJob with configmap dependency + +name: "BroadcastJob with configmap dependency" +description: "Test interpreting dependency of BroadcastJob with configmap dependency" +desiredObj: + apiVersion: apps.kruise.io/v1alpha1 + kind: BroadcastJob + metadata: + labels: + app: sample + name: sample + namespace: test-bcj + spec: + parallelism: 1 + template: + metadata: + labels: + app: sample + spec: + restartPolicy: Never + volumes: + - name: configmap + configMap: + name: my-sample-config + containers: + - name: nginx + image: nginx:alpine + env: + - name: logData + valueFrom: + configMapKeyRef: + name: mysql-config + key: log + - name: lowerData + valueFrom: + configMapKeyRef: + name: mysql-config + key: lower + completionPolicy: + type: Always + activeDeadlineSeconds: 10 +operation: InterpretDependency +output: diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/BroadcastJob/testdata/interprethealth-test.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/BroadcastJob/testdata/interprethealth-test.yaml new file mode 100644 index 000000000000..1491cf1de1df --- /dev/null +++ b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/BroadcastJob/testdata/interprethealth-test.yaml @@ -0,0 +1,60 @@ +# test case for interpreting health of BroadcastJob +# case1. BroadcastJob with failed phase should be Unhealthy + +name: "BroadcastJob with failed phase should be Unhealthy" +description: "Test interpreting health of BroadcastJob with failed phase" +observedObj: + apiVersion: apps.kruise.io/v1alpha1 + kind: BroadcastJob + metadata: + labels: + app: sample + name: sample + namespace: test-bcj + spec: + parallelism: 1 + template: + metadata: + labels: + app: sample + spec: + restartPolicy: Never + volumes: + - name: configmap + configMap: + name: my-sample-config + containers: + - name: nginx + image: nginx:alpine + env: + - name: logData + valueFrom: + configMapKeyRef: + name: mysql-config + key: log + - name: lowerData + valueFrom: + configMapKeyRef: + name: mysql-config + key: lower + completionPolicy: + type: Always + activeDeadlineSeconds: 10 + status: + active: 0 + completionTime: "2023-04-06T15:01:47Z" + conditions: + - lastProbeTime: "2023-04-06T15:01:47Z" + lastTransitionTime: "2023-04-06T15:01:47Z" + message: Job test-bcj/sample was active longer than specified deadline + reason: Failed + status: "True" + type: Failed + desired: 1 + failed: 1 + phase: failed + startTime: "2023-04-06T15:01:37Z" + succeeded: 0 +operation: InterpretHealth +output: + health: false diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/BroadcastJob/testdata/interpretreplica-test.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/BroadcastJob/testdata/interpretreplica-test.yaml new file mode 100644 index 000000000000..81b8bebe5e87 --- /dev/null +++ b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/BroadcastJob/testdata/interpretreplica-test.yaml @@ -0,0 +1,43 @@ +# test case for interpreting replica of BroadcastJob +# case1. BroadcastJob with parallelism set to 1 + +name: "BroadcastJob with parallelism set to 1" +description: "Test interpreting replica of BroadcastJob with parallelism set to 1" +desiredObj: + apiVersion: apps.kruise.io/v1alpha1 + kind: BroadcastJob + metadata: + labels: + app: sample + name: sample + namespace: test-bcj + spec: + parallelism: 1 + template: + metadata: + labels: + app: sample + spec: + restartPolicy: Never + volumes: + - name: configmap + configMap: + name: my-sample-config + containers: + - name: nginx + image: nginx:alpine + env: + - name: logData + valueFrom: + configMapKeyRef: + name: mysql-config + key: log + - name: lowerData + valueFrom: + configMapKeyRef: + name: mysql-config + key: lower + completionPolicy: + type: Always + activeDeadlineSeconds: 10 +operation: InterpretReplica diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/BroadcastJob/testdata/interpretstatus-test.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/BroadcastJob/testdata/interpretstatus-test.yaml new file mode 100644 index 000000000000..0f4a1226074c --- /dev/null +++ b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/BroadcastJob/testdata/interpretstatus-test.yaml @@ -0,0 +1,59 @@ +# test case for interpreting status of BroadcastJob +# case1. BroadcastJob: interpret status test + +name: "BroadcastJob: interpret status test" +description: "Test interpreting status for BroadcastJob" +observedObj: + apiVersion: apps.kruise.io/v1alpha1 + kind: BroadcastJob + metadata: + labels: + app: sample + name: sample + namespace: test-bcj + spec: + parallelism: 1 + template: + metadata: + labels: + app: sample + spec: + restartPolicy: Never + volumes: + - name: configmap + configMap: + name: my-sample-config + containers: + - name: nginx + image: nginx:alpine + env: + - name: logData + valueFrom: + configMapKeyRef: + name: mysql-config + key: log + - name: lowerData + valueFrom: + configMapKeyRef: + name: mysql-config + key: lower + completionPolicy: + type: Always + activeDeadlineSeconds: 10 + status: + active: 0 + completionTime: "2023-04-06T15:01:47Z" + conditions: + - lastProbeTime: "2023-04-06T15:01:47Z" + lastTransitionTime: "2023-04-06T15:01:47Z" + message: Job test-bcj/sample was active longer than specified deadline + reason: Failed + status: "True" + type: Failed + desired: 1 + failed: 1 + phase: failed + startTime: "2023-04-06T15:01:37Z" + succeeded: 0 +operation: InterpretStatus +output: diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/BroadcastJob/testdata/observed-bcj-nginx.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/BroadcastJob/testdata/observed-bcj-nginx.yaml deleted file mode 100644 index f958eecc061a..000000000000 --- a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/BroadcastJob/testdata/observed-bcj-nginx.yaml +++ /dev/null @@ -1,51 +0,0 @@ -apiVersion: apps.kruise.io/v1alpha1 -kind: BroadcastJob -metadata: - labels: - app: sample - name: sample - namespace: test-bcj -spec: - parallelism: 1 - template: - metadata: - labels: - app: sample - spec: - restartPolicy: Never - volumes: - - name: configmap - configMap: - name: my-sample-config - containers: - - name: nginx - image: nginx:alpine - env: - - name: logData - valueFrom: - configMapKeyRef: - name: mysql-config - key: log - - name: lowerData - valueFrom: - configMapKeyRef: - name: mysql-config - key: lower - completionPolicy: - type: Always - activeDeadlineSeconds: 10 -status: - active: 0 - completionTime: "2023-04-06T15:01:47Z" - conditions: - - lastProbeTime: "2023-04-06T15:01:47Z" - lastTransitionTime: "2023-04-06T15:01:47Z" - message: Job test-bcj/sample was active longer than specified deadline - reason: Failed - status: "True" - type: Failed - desired: 1 - failed: 1 - phase: failed - startTime: "2023-04-06T15:01:37Z" - succeeded: 0 diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/BroadcastJob/testdata/retain-test.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/BroadcastJob/testdata/retain-test.yaml new file mode 100644 index 000000000000..767d588c5807 --- /dev/null +++ b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/BroadcastJob/testdata/retain-test.yaml @@ -0,0 +1,96 @@ +# test case for retaining BroadcastJob +# case1. BroadcastJob: retain test + +name: "BroadcastJob: retain test" +description: "Test retaining BroadcastJob" +desiredObj: + apiVersion: apps.kruise.io/v1alpha1 + kind: BroadcastJob + metadata: + labels: + app: sample + name: sample + namespace: test-bcj + spec: + parallelism: 1 + template: + metadata: + labels: + app: sample + spec: + restartPolicy: Never + volumes: + - name: configmap + configMap: + name: my-sample-config + containers: + - name: nginx + image: nginx:alpine + env: + - name: logData + valueFrom: + configMapKeyRef: + name: mysql-config + key: log + - name: lowerData + valueFrom: + configMapKeyRef: + name: mysql-config + key: lower + completionPolicy: + type: Always + activeDeadlineSeconds: 10 +observedObj: + apiVersion: apps.kruise.io/v1alpha1 + kind: BroadcastJob + metadata: + labels: + app: sample + name: sample + namespace: test-bcj + spec: + parallelism: 1 + template: + metadata: + labels: + app: sample + spec: + restartPolicy: Never + volumes: + - name: configmap + configMap: + name: my-sample-config + containers: + - name: nginx + image: nginx:alpine + env: + - name: logData + valueFrom: + configMapKeyRef: + name: mysql-config + key: log + - name: lowerData + valueFrom: + configMapKeyRef: + name: mysql-config + key: lower + completionPolicy: + type: Always + activeDeadlineSeconds: 10 + status: + active: 0 + completionTime: "2023-04-06T15:01:47Z" + conditions: + - lastProbeTime: "2023-04-06T15:01:47Z" + lastTransitionTime: "2023-04-06T15:01:47Z" + message: Job test-bcj/sample was active longer than specified deadline + reason: Failed + status: "True" + type: Failed + desired: 1 + failed: 1 + phase: failed + startTime: "2023-04-06T15:01:37Z" + succeeded: 0 +operation: Retain +output: diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/BroadcastJob/testdata/revisereplica-test.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/BroadcastJob/testdata/revisereplica-test.yaml new file mode 100644 index 000000000000..7748228b5bfd --- /dev/null +++ b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/BroadcastJob/testdata/revisereplica-test.yaml @@ -0,0 +1,45 @@ +# test case for revise replica +# case1. BroadcastJob: revise replica test + +name: "BroadcastJob: revise replica test" +description: "Test revising replica of BroadcastJob" +desiredObj: + apiVersion: apps.kruise.io/v1alpha1 + kind: BroadcastJob + metadata: + labels: + app: sample + name: sample + namespace: test-bcj + spec: + parallelism: 1 + template: + metadata: + labels: + app: sample + spec: + restartPolicy: Never + volumes: + - name: configmap + configMap: + name: my-sample-config + containers: + - name: nginx + image: nginx:alpine + env: + - name: logData + valueFrom: + configMapKeyRef: + name: mysql-config + key: log + - name: lowerData + valueFrom: + configMapKeyRef: + name: mysql-config + key: lower + completionPolicy: + type: Always + activeDeadlineSeconds: 10 +inputReplicas: 1 +operation: ReviseReplica +output: diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/BroadcastJob/testdata/status-file.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/BroadcastJob/testdata/status-file.yaml deleted file mode 100644 index d1615137dfe3..000000000000 --- a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/BroadcastJob/testdata/status-file.yaml +++ /dev/null @@ -1,37 +0,0 @@ -applied: true -clusterName: member1 -health: Healthy -status: - active: 0 - completionTime: "2023-04-06T15:01:47Z" - conditions: - - lastProbeTime: "2023-04-06T15:01:47Z" - lastTransitionTime: "2023-04-06T15:01:47Z" - message: Job test-bcj/sample was active longer than specified deadline - reason: Failed - status: "True" - type: Failed - desired: 1 - failed: 1 - phase: failed - startTime: "2023-04-06T15:01:37Z" - succeeded: 0 ---- -applied: true -clusterName: member3 -health: Healthy -status: - active: 0 - completionTime: "2023-04-06T15:01:47Z" - conditions: - - lastProbeTime: "2023-04-06T15:01:47Z" - lastTransitionTime: "2023-04-06T15:01:47Z" - message: Job test-bcj/sample was active longer than specified deadline - reason: Failed - status: "True" - type: Failed - desired: 1 - failed: 1 - phase: failed - startTime: "2023-04-06T15:01:37Z" - succeeded: 0 diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/CloneSet/customizations_tests.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/CloneSet/customizations_tests.yaml deleted file mode 100644 index 67b367953b30..000000000000 --- a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/CloneSet/customizations_tests.yaml +++ /dev/null @@ -1,15 +0,0 @@ -tests: - - desiredInputPath: testdata/desired-cloneset-nginx.yaml - statusInputPath: testdata/status-file.yaml - operation: AggregateStatus - - desiredInputPath: testdata/desired-cloneset-nginx.yaml - operation: InterpretDependency - - observedInputPath: testdata/observed-cloneset-nginx.yaml - operation: InterpretReplica - - observedInputPath: testdata/observed-cloneset-nginx.yaml - operation: InterpretHealth - - observedInputPath: testdata/observed-cloneset-nginx.yaml - operation: InterpretStatus - - observedInputPath: testdata/observed-cloneset-nginx.yaml - operation: ReviseReplica - desiredReplicas: 1 diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/CloneSet/testdata/aggregatestatus-test.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/CloneSet/testdata/aggregatestatus-test.yaml new file mode 100644 index 000000000000..4b057631e424 --- /dev/null +++ b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/CloneSet/testdata/aggregatestatus-test.yaml @@ -0,0 +1,79 @@ +# test case for aggregating status of CloneSet +# case1. CloneSet with two status items + +name: "CloneSet with two status items" +description: "Test aggregating status of CloneSet with two status items" +desiredObj: + apiVersion: apps.kruise.io/v1alpha1 + kind: CloneSet + metadata: + labels: + app: sample + name: sample + namespace: test-cloneset + generation: 1 + spec: + replicas: 4 + selector: + matchLabels: + app: sample + test: cloneset + template: + metadata: + labels: + app: sample + test: cloneset + spec: + volumes: + - name: configmap + configMap: + name: my-sample-config + containers: + - name: nginx + image: nginx:alpine + env: + - name: logData + valueFrom: + configMapKeyRef: + name: mysql-config + key: log + - name: lowerData + valueFrom: + configMapKeyRef: + name: mysql-config + key: lower +statusItems: + - applied: true + clusterName: member1 + health: Healthy + status: + availableReplicas: 2 + currentRevision: sample-59df6bd888 + expectedUpdatedReplicas: 2 + labelSelector: app=sample,test=cloneset + observedGeneration: 1 + readyReplicas: 2 + replicas: 2 + updateRevision: sample-59df6bd888 + updatedReadyReplicas: 2 + updatedReplicas: 2 + generation: 1 + resourceTemplateGeneration: 1 + - applied: true + clusterName: member3 + health: Healthy + status: + availableReplicas: 2 + currentRevision: sample-59df6bd888 + expectedUpdatedReplicas: 2 + labelSelector: app=sample,test=cloneset + observedGeneration: 1 + readyReplicas: 2 + replicas: 2 + updateRevision: sample-59df6bd888 + updatedReadyReplicas: 2 + updatedReplicas: 2 + generation: 1 + resourceTemplateGeneration: 1 +operation: AggregateStatus +output: diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/CloneSet/testdata/desired-cloneset-nginx.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/CloneSet/testdata/desired-cloneset-nginx.yaml deleted file mode 100644 index bb2871ab2939..000000000000 --- a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/CloneSet/testdata/desired-cloneset-nginx.yaml +++ /dev/null @@ -1,38 +0,0 @@ -apiVersion: apps.kruise.io/v1alpha1 -kind: CloneSet -metadata: - labels: - app: sample - name: sample - namespace: test-cloneset - generation: 1 -spec: - replicas: 4 - selector: - matchLabels: - app: sample - test: cloneset - template: - metadata: - labels: - app: sample - test: cloneset - spec: - volumes: - - name: configmap - configMap: - name: my-sample-config - containers: - - name: nginx - image: nginx:alpine - env: - - name: logData - valueFrom: - configMapKeyRef: - name: mysql-config - key: log - - name: lowerData - valueFrom: - configMapKeyRef: - name: mysql-config - key: lower diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/CloneSet/testdata/interpretdependency-test.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/CloneSet/testdata/interpretdependency-test.yaml new file mode 100644 index 000000000000..6d10fa81077c --- /dev/null +++ b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/CloneSet/testdata/interpretdependency-test.yaml @@ -0,0 +1,46 @@ +# test case for interpreting dependency of CloneSet +# case1. CloneSet with configmap dependency + +name: "CloneSet with configmap dependency" +description: "Test interpreting dependency of CloneSet with configmap dependency" +desiredObj: + apiVersion: apps.kruise.io/v1alpha1 + kind: CloneSet + metadata: + labels: + app: sample + name: sample + namespace: test-cloneset + generation: 1 + spec: + replicas: 4 + selector: + matchLabels: + app: sample + test: cloneset + template: + metadata: + labels: + app: sample + test: cloneset + spec: + volumes: + - name: configmap + configMap: + name: my-sample-config + containers: + - name: nginx + image: nginx:alpine + env: + - name: logData + valueFrom: + configMapKeyRef: + name: mysql-config + key: log + - name: lowerData + valueFrom: + configMapKeyRef: + name: mysql-config + key: lower +operation: InterpretDependency +output: diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/CloneSet/testdata/interprethealth-test.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/CloneSet/testdata/interprethealth-test.yaml new file mode 100644 index 000000000000..96b58626d28d --- /dev/null +++ b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/CloneSet/testdata/interprethealth-test.yaml @@ -0,0 +1,60 @@ +# test case for interpreting health of CloneSet +# case1. CloneSet interpreting health test + +name: "CloneSet interpreting health test" +description: "Test interpreting health of CloneSet" +observedObj: + apiVersion: apps.kruise.io/v1alpha1 + kind: CloneSet + metadata: + annotations: + resourcetemplate.karmada.io/generation: "1" + labels: + app: sample + name: sample + namespace: test-cloneset + generation: 1 + spec: + replicas: 2 + selector: + matchLabels: + app: sample + test: cloneset + template: + metadata: + labels: + app: sample + test: cloneset + spec: + volumes: + - name: configmap + configMap: + name: my-sample-config + containers: + - name: nginx + image: nginx:alpine + env: + - name: logData + valueFrom: + configMapKeyRef: + name: mysql-config + key: log + - name: lowerData + valueFrom: + configMapKeyRef: + name: mysql-config + key: lower + status: + availableReplicas: 2 + collisionCount: 0 + currentRevision: sample-59df6bd888 + expectedUpdatedReplicas: 2 + labelSelector: app=sample,test=cloneset + observedGeneration: 1 + readyReplicas: 2 + replicas: 2 + updateRevision: sample-59df6bd888 + updatedReadyReplicas: 2 + updatedReplicas: 2 +operation: InterpretHealth +output: diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/CloneSet/testdata/interpretreplica-test.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/CloneSet/testdata/interpretreplica-test.yaml new file mode 100644 index 000000000000..e196983a93ba --- /dev/null +++ b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/CloneSet/testdata/interpretreplica-test.yaml @@ -0,0 +1,45 @@ +# test case for interpreting replica of CloneSet +# case1. CloneSet with replicas set to 4 + +name: "CloneSet with replicas set to 4" +description: "Test interpreting replica of CloneSet with replicas set to 4" +desiredObj: + apiVersion: apps.kruise.io/v1alpha1 + kind: CloneSet + metadata: + labels: + app: sample + name: sample + namespace: test-cloneset + generation: 1 + spec: + replicas: 4 + selector: + matchLabels: + app: sample + test: cloneset + template: + metadata: + labels: + app: sample + test: cloneset + spec: + volumes: + - name: configmap + configMap: + name: my-sample-config + containers: + - name: nginx + image: nginx:alpine + env: + - name: logData + valueFrom: + configMapKeyRef: + name: mysql-config + key: log + - name: lowerData + valueFrom: + configMapKeyRef: + name: mysql-config + key: lower +operation: InterpretReplica diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/CloneSet/testdata/interpretstatus-test.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/CloneSet/testdata/interpretstatus-test.yaml new file mode 100644 index 000000000000..7d965ec83d15 --- /dev/null +++ b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/CloneSet/testdata/interpretstatus-test.yaml @@ -0,0 +1,60 @@ +# test case for interpreting status of CloneSet +# case1. CloneSet: interpret status test + +name: "CloneSet: interpret status test" +description: "Test interpreting status for CloneSet" +observedObj: + apiVersion: apps.kruise.io/v1alpha1 + kind: CloneSet + metadata: + annotations: + resourcetemplate.karmada.io/generation: "1" + labels: + app: sample + name: sample + namespace: test-cloneset + generation: 1 + spec: + replicas: 2 + selector: + matchLabels: + app: sample + test: cloneset + template: + metadata: + labels: + app: sample + test: cloneset + spec: + volumes: + - name: configmap + configMap: + name: my-sample-config + containers: + - name: nginx + image: nginx:alpine + env: + - name: logData + valueFrom: + configMapKeyRef: + name: mysql-config + key: log + - name: lowerData + valueFrom: + configMapKeyRef: + name: mysql-config + key: lower + status: + availableReplicas: 2 + collisionCount: 0 + currentRevision: sample-59df6bd888 + expectedUpdatedReplicas: 2 + labelSelector: app=sample,test=cloneset + observedGeneration: 1 + readyReplicas: 2 + replicas: 2 + updateRevision: sample-59df6bd888 + updatedReadyReplicas: 2 + updatedReplicas: 2 +operation: InterpretStatus +output: diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/CloneSet/testdata/observed-cloneset-nginx.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/CloneSet/testdata/observed-cloneset-nginx.yaml deleted file mode 100644 index 4b8ffeda67d1..000000000000 --- a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/CloneSet/testdata/observed-cloneset-nginx.yaml +++ /dev/null @@ -1,52 +0,0 @@ -apiVersion: apps.kruise.io/v1alpha1 -kind: CloneSet -metadata: - annotations: - resourcetemplate.karmada.io/generation: "1" - labels: - app: sample - name: sample - namespace: test-cloneset - generation: 1 -spec: - replicas: 2 - selector: - matchLabels: - app: sample - test: cloneset - template: - metadata: - labels: - app: sample - test: cloneset - spec: - volumes: - - name: configmap - configMap: - name: my-sample-config - containers: - - name: nginx - image: nginx:alpine - env: - - name: logData - valueFrom: - configMapKeyRef: - name: mysql-config - key: log - - name: lowerData - valueFrom: - configMapKeyRef: - name: mysql-config - key: lower -status: - availableReplicas: 2 - collisionCount: 0 - currentRevision: sample-59df6bd888 - expectedUpdatedReplicas: 2 - labelSelector: app=sample,test=cloneset - observedGeneration: 1 - readyReplicas: 2 - replicas: 2 - updateRevision: sample-59df6bd888 - updatedReadyReplicas: 2 - updatedReplicas: 2 diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/CloneSet/testdata/revisereplica-test.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/CloneSet/testdata/revisereplica-test.yaml new file mode 100644 index 000000000000..844452b6a13c --- /dev/null +++ b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/CloneSet/testdata/revisereplica-test.yaml @@ -0,0 +1,47 @@ +# test case for revise replica +# case1. CloneSet: revise replica test + +name: "CloneSet: revise replica test" +description: "Test revising replica of CloneSet" +desiredObj: + apiVersion: apps.kruise.io/v1alpha1 + kind: CloneSet + metadata: + labels: + app: sample + name: sample + namespace: test-cloneset + generation: 1 + spec: + replicas: 4 + selector: + matchLabels: + app: sample + test: cloneset + template: + metadata: + labels: + app: sample + test: cloneset + spec: + volumes: + - name: configmap + configMap: + name: my-sample-config + containers: + - name: nginx + image: nginx:alpine + env: + - name: logData + valueFrom: + configMapKeyRef: + name: mysql-config + key: log + - name: lowerData + valueFrom: + configMapKeyRef: + name: mysql-config + key: lower +inputReplicas: 1 +operation: ReviseReplica +output: diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/CloneSet/testdata/status-file.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/CloneSet/testdata/status-file.yaml deleted file mode 100644 index 526e901fc12a..000000000000 --- a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/CloneSet/testdata/status-file.yaml +++ /dev/null @@ -1,33 +0,0 @@ -applied: true -clusterName: member1 -health: Healthy -status: - availableReplicas: 2 - currentRevision: sample-59df6bd888 - expectedUpdatedReplicas: 2 - labelSelector: app=sample,test=cloneset - observedGeneration: 1 - readyReplicas: 2 - replicas: 2 - updateRevision: sample-59df6bd888 - updatedReadyReplicas: 2 - updatedReplicas: 2 - generation: 1 - resourceTemplateGeneration: 1 ---- -applied: true -clusterName: member3 -health: Healthy -status: - availableReplicas: 2 - currentRevision: sample-59df6bd888 - expectedUpdatedReplicas: 2 - labelSelector: app=sample,test=cloneset - observedGeneration: 1 - readyReplicas: 2 - replicas: 2 - updateRevision: sample-59df6bd888 - updatedReadyReplicas: 2 - updatedReplicas: 2 - generation: 1 - resourceTemplateGeneration: 1 diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/DaemonSet/customizations_tests.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/DaemonSet/customizations_tests.yaml deleted file mode 100644 index 50226cc24f53..000000000000 --- a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/DaemonSet/customizations_tests.yaml +++ /dev/null @@ -1,10 +0,0 @@ -tests: - - desiredInputPath: testdata/desired-daemonset-nginx.yaml - statusInputPath: testdata/status-file.yaml - operation: AggregateStatus - - desiredInputPath: testdata/desired-daemonset-nginx.yaml - operation: InterpretDependency - - observedInputPath: testdata/observed-daemonset-nginx.yaml - operation: InterpretHealth - - observedInputPath: testdata/observed-daemonset-nginx.yaml - operation: InterpretStatus diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/DaemonSet/testdata/aggregatestatus-test.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/DaemonSet/testdata/aggregatestatus-test.yaml new file mode 100644 index 000000000000..9c0b054b8f1d --- /dev/null +++ b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/DaemonSet/testdata/aggregatestatus-test.yaml @@ -0,0 +1,72 @@ +# test case for aggregating status of DaemonSet +# case1. DaemonSet with two status items + +name: "DaemonSet with two status items" +description: "Test aggregating status of DaemonSet with two status items" +desiredObj: + apiVersion: apps.kruise.io/v1alpha1 + kind: DaemonSet + metadata: + labels: + app: sample-daemonset + name: sample + namespace: test-kruise-daemonset + generation: 1 + spec: + selector: + matchLabels: + app: sample-daemonset + template: + metadata: + labels: + app: sample-daemonset + spec: + volumes: + - name: configmap + configMap: + name: my-sample-config + containers: + - name: nginx + image: nginx:alpine + env: + - name: logData + valueFrom: + configMapKeyRef: + name: mysql-config + key: log + - name: lowerData + valueFrom: + configMapKeyRef: + name: mysql-config + key: lower +statusItems: + - applied: true + clusterName: member1 + health: Healthy + status: + currentNumberScheduled: 1 + daemonSetHash: 7dd59cf749 + desiredNumberScheduled: 1 + numberAvailable: 1 + numberMisscheduled: 0 + numberReady: 1 + observedGeneration: 1 + updatedNumberScheduled: 1 + generation: 1 + resourceTemplateGeneration: 1 + - applied: true + clusterName: member3 + health: Healthy + status: + currentNumberScheduled: 1 + daemonSetHash: 7dd59cf749 + desiredNumberScheduled: 1 + numberAvailable: 1 + numberMisscheduled: 0 + numberReady: 1 + observedGeneration: 1 + updatedNumberScheduled: 1 + generation: 1 + resourceTemplateGeneration: 1 +operation: AggregateStatus +output: diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/DaemonSet/testdata/desired-daemonset-nginx.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/DaemonSet/testdata/desired-daemonset-nginx.yaml deleted file mode 100644 index dc31ede123f0..000000000000 --- a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/DaemonSet/testdata/desired-daemonset-nginx.yaml +++ /dev/null @@ -1,35 +0,0 @@ -apiVersion: apps.kruise.io/v1alpha1 -kind: DaemonSet -metadata: - labels: - app: sample-daemonset - name: sample - namespace: test-kruise-daemonset - generation: 1 -spec: - selector: - matchLabels: - app: sample-daemonset - template: - metadata: - labels: - app: sample-daemonset - spec: - volumes: - - name: configmap - configMap: - name: my-sample-config - containers: - - name: nginx - image: nginx:alpine - env: - - name: logData - valueFrom: - configMapKeyRef: - name: mysql-config - key: log - - name: lowerData - valueFrom: - configMapKeyRef: - name: mysql-config - key: lower diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/DaemonSet/testdata/interpretdependency-test.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/DaemonSet/testdata/interpretdependency-test.yaml new file mode 100644 index 000000000000..3c68edf63b9c --- /dev/null +++ b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/DaemonSet/testdata/interpretdependency-test.yaml @@ -0,0 +1,43 @@ +# test case for interpreting dependency of DaemonSet +# case1. DaemonSet with configmap dependency + +name: "DaemonSet with configmap dependency" +description: "Test interpreting dependency of DaemonSet with configmap dependency" +desiredObj: + apiVersion: apps.kruise.io/v1alpha1 + kind: DaemonSet + metadata: + labels: + app: sample-daemonset + name: sample + namespace: test-kruise-daemonset + generation: 1 + spec: + selector: + matchLabels: + app: sample-daemonset + template: + metadata: + labels: + app: sample-daemonset + spec: + volumes: + - name: configmap + configMap: + name: my-sample-config + containers: + - name: nginx + image: nginx:alpine + env: + - name: logData + valueFrom: + configMapKeyRef: + name: mysql-config + key: log + - name: lowerData + valueFrom: + configMapKeyRef: + name: mysql-config + key: lower +operation: InterpretDependency +output: diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/DaemonSet/testdata/interprethealth-test.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/DaemonSet/testdata/interprethealth-test.yaml new file mode 100644 index 000000000000..10ea9c0167c2 --- /dev/null +++ b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/DaemonSet/testdata/interprethealth-test.yaml @@ -0,0 +1,54 @@ +# test case for interpreting health of DaemonSet +# case1. DaemonSet interpreting health test + +name: "DaemonSet interpreting health test" +description: "Test interpreting health of DaemonSet" +observedObj: + apiVersion: apps.kruise.io/v1alpha1 + kind: DaemonSet + metadata: + annotations: + resourcetemplate.karmada.io/generation: "1" + labels: + app: sample-daemonset + name: sample + namespace: test-kruise-daemonset + generation: 1 + spec: + selector: + matchLabels: + app: sample-daemonset + template: + metadata: + labels: + app: sample-daemonset + spec: + volumes: + - name: configmap + configMap: + name: my-sample-config + containers: + - name: nginx + image: nginx:alpine + env: + - name: logData + valueFrom: + configMapKeyRef: + name: mysql-config + key: log + - name: lowerData + valueFrom: + configMapKeyRef: + name: mysql-config + key: lower + status: + currentNumberScheduled: 1 + daemonSetHash: 7dd59cf749 + desiredNumberScheduled: 1 + numberAvailable: 1 + numberMisscheduled: 0 + numberReady: 1 + observedGeneration: 1 + updatedNumberScheduled: 1 +operation: InterpretHealth +output: diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/DaemonSet/testdata/interpretstatus-test.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/DaemonSet/testdata/interpretstatus-test.yaml new file mode 100644 index 000000000000..8cb71151e5f0 --- /dev/null +++ b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/DaemonSet/testdata/interpretstatus-test.yaml @@ -0,0 +1,54 @@ +# test case for interpreting status of DaemonSet +# case1. DaemonSet: interpret status test + +name: "DaemonSet: interpret status test" +description: "Test interpreting status for DaemonSet" +observedObj: + apiVersion: apps.kruise.io/v1alpha1 + kind: DaemonSet + metadata: + annotations: + resourcetemplate.karmada.io/generation: "1" + labels: + app: sample-daemonset + name: sample + namespace: test-kruise-daemonset + generation: 1 + spec: + selector: + matchLabels: + app: sample-daemonset + template: + metadata: + labels: + app: sample-daemonset + spec: + volumes: + - name: configmap + configMap: + name: my-sample-config + containers: + - name: nginx + image: nginx:alpine + env: + - name: logData + valueFrom: + configMapKeyRef: + name: mysql-config + key: log + - name: lowerData + valueFrom: + configMapKeyRef: + name: mysql-config + key: lower + status: + currentNumberScheduled: 1 + daemonSetHash: 7dd59cf749 + desiredNumberScheduled: 1 + numberAvailable: 1 + numberMisscheduled: 0 + numberReady: 1 + observedGeneration: 1 + updatedNumberScheduled: 1 +operation: InterpretStatus +output: diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/DaemonSet/testdata/observed-daemonset-nginx.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/DaemonSet/testdata/observed-daemonset-nginx.yaml deleted file mode 100644 index 99422e9d4b3a..000000000000 --- a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/DaemonSet/testdata/observed-daemonset-nginx.yaml +++ /dev/null @@ -1,46 +0,0 @@ -apiVersion: apps.kruise.io/v1alpha1 -kind: DaemonSet -metadata: - annotations: - resourcetemplate.karmada.io/generation: "1" - labels: - app: sample-daemonset - name: sample - namespace: test-kruise-daemonset - generation: 1 -spec: - selector: - matchLabels: - app: sample-daemonset - template: - metadata: - labels: - app: sample-daemonset - spec: - volumes: - - name: configmap - configMap: - name: my-sample-config - containers: - - name: nginx - image: nginx:alpine - env: - - name: logData - valueFrom: - configMapKeyRef: - name: mysql-config - key: log - - name: lowerData - valueFrom: - configMapKeyRef: - name: mysql-config - key: lower -status: - currentNumberScheduled: 1 - daemonSetHash: 7dd59cf749 - desiredNumberScheduled: 1 - numberAvailable: 1 - numberMisscheduled: 0 - numberReady: 1 - observedGeneration: 1 - updatedNumberScheduled: 1 diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/DaemonSet/testdata/status-file.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/DaemonSet/testdata/status-file.yaml deleted file mode 100644 index f127f5f69c2a..000000000000 --- a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/DaemonSet/testdata/status-file.yaml +++ /dev/null @@ -1,29 +0,0 @@ -applied: true -clusterName: member1 -health: Healthy -status: - currentNumberScheduled: 1 - daemonSetHash: 7dd59cf749 - desiredNumberScheduled: 1 - numberAvailable: 1 - numberMisscheduled: 0 - numberReady: 1 - observedGeneration: 1 - updatedNumberScheduled: 1 - generation: 1 - resourceTemplateGeneration: 1 ---- -applied: true -clusterName: member3 -health: Healthy -status: - currentNumberScheduled: 1 - daemonSetHash: 7dd59cf749 - desiredNumberScheduled: 1 - numberAvailable: 1 - numberMisscheduled: 0 - numberReady: 1 - observedGeneration: 1 - updatedNumberScheduled: 1 - generation: 1 - resourceTemplateGeneration: 1 diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/SidecarSet/customizations_tests.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/SidecarSet/customizations_tests.yaml deleted file mode 100644 index 3d52b2f38936..000000000000 --- a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/SidecarSet/customizations_tests.yaml +++ /dev/null @@ -1,12 +0,0 @@ -tests: - - desiredInputPath: testdata/desired-sidecarset-nginx.yaml - statusInputPath: testdata/status-file.yaml - operation: AggregateStatus - - desiredInputPath: testdata/desired-sidecarset-nginx.yaml - operation: InterpretDependency - - observedInputPath: testdata/observed-sidecarset-nginx.yaml - operation: InterpretReplica - - observedInputPath: testdata/observed-sidecarset-nginx.yaml - operation: InterpretHealth - - observedInputPath: testdata/observed-sidecarset-nginx.yaml - operation: InterpretStatus diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/SidecarSet/testdata/aggregatestatus-test.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/SidecarSet/testdata/aggregatestatus-test.yaml new file mode 100644 index 000000000000..eff28aea8592 --- /dev/null +++ b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/SidecarSet/testdata/aggregatestatus-test.yaml @@ -0,0 +1,64 @@ +# test case for aggregating status of SidecarSet +# case1. SidecarSet with two status items + +name: "SidecarSet with two status items" +description: "Test aggregating status of SidecarSet with two status items" +desiredObj: + apiVersion: apps.kruise.io/v1alpha1 + kind: SidecarSet + metadata: + labels: + app: sample + name: sample-sidecarset + namespace: test-sidecarset + generation: 1 + spec: + selector: + matchLabels: + app: sample + test: sidecarset + containers: + - name: sidecar + image: busybox:latest + env: + - name: CONFIG_DATA + valueFrom: + configMapKeyRef: + name: sidecar-config + key: config + - name: SECRET_DATA + valueFrom: + secretKeyRef: + name: sidecar-secret + key: secret + injectionStrategy: BeforeAppContainer + volumes: + - name: configmap + configMap: + name: sidecar-config + - name: secret + secret: + secretName: sidecar-secret +statusItems: + - apiVersion: apps.kruise.io/v1alpha1 + kind: SidecarSet + metadata: + name: sample-sidecarset + namespace: test-sidecarset + clusterName: member1 + status: + matchedPods: 2 + updatedPods: 2 + readyPods: 2 + - apiVersion: apps.kruise.io/v1alpha1 + kind: SidecarSet + metadata: + name: sample-sidecarset + namespace: test-sidecarset + clusterName: member2 + status: + matchedPods: 1 + updatedPods: 1 + readyPods: 1 +operation: AggregateStatus +output: diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/SidecarSet/testdata/desired-sidecarset-nginx.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/SidecarSet/testdata/desired-sidecarset-nginx.yaml deleted file mode 100644 index 6f4d60874ea0..000000000000 --- a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/SidecarSet/testdata/desired-sidecarset-nginx.yaml +++ /dev/null @@ -1,35 +0,0 @@ -apiVersion: apps.kruise.io/v1alpha1 -kind: SidecarSet -metadata: - labels: - app: sample - name: sample-sidecarset - namespace: test-sidecarset - generation: 1 -spec: - selector: - matchLabels: - app: sample - test: sidecarset - containers: - - name: sidecar - image: busybox:latest - env: - - name: CONFIG_DATA - valueFrom: - configMapKeyRef: - name: sidecar-config - key: config - - name: SECRET_DATA - valueFrom: - secretKeyRef: - name: sidecar-secret - key: secret - injectionStrategy: BeforeAppContainer - volumes: - - name: configmap - configMap: - name: sidecar-config - - name: secret - secret: - secretName: sidecar-secret diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/SidecarSet/testdata/interpretdependency-test.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/SidecarSet/testdata/interpretdependency-test.yaml new file mode 100644 index 000000000000..b394ca658b73 --- /dev/null +++ b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/SidecarSet/testdata/interpretdependency-test.yaml @@ -0,0 +1,43 @@ +# test case for interpreting dependency of SidecarSet +# case1. SidecarSet with configmap and secret dependency + +name: "SidecarSet with configmap and secret dependency" +description: "Test interpreting dependency of SidecarSet with configmap and secret dependency" +desiredObj: + apiVersion: apps.kruise.io/v1alpha1 + kind: SidecarSet + metadata: + labels: + app: sample + name: sample-sidecarset + namespace: test-sidecarset + generation: 1 + spec: + selector: + matchLabels: + app: sample + test: sidecarset + containers: + - name: sidecar + image: busybox:latest + env: + - name: CONFIG_DATA + valueFrom: + configMapKeyRef: + name: sidecar-config + key: config + - name: SECRET_DATA + valueFrom: + secretKeyRef: + name: sidecar-secret + key: secret + injectionStrategy: BeforeAppContainer + volumes: + - name: configmap + configMap: + name: sidecar-config + - name: secret + secret: + secretName: sidecar-secret +operation: InterpretDependency +output: diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/SidecarSet/testdata/interprethealth-test.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/SidecarSet/testdata/interprethealth-test.yaml new file mode 100644 index 000000000000..7a827f5b2d58 --- /dev/null +++ b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/SidecarSet/testdata/interprethealth-test.yaml @@ -0,0 +1,47 @@ +# test case for interpreting health of SidecarSet +# case1. SidecarSet interpreting health test + +name: "SidecarSet interpreting health test" +description: "Test interpreting health of SidecarSet" +observedObj: + apiVersion: apps.kruise.io/v1alpha1 + kind: SidecarSet + metadata: + labels: + app: sample + name: sample-sidecarset + namespace: test-sidecarset + generation: 1 + spec: + selector: + matchLabels: + app: sample + test: sidecarset + containers: + - name: sidecar + image: busybox:latest + env: + - name: CONFIG_DATA + valueFrom: + configMapKeyRef: + name: sidecar-config + key: config + - name: SECRET_DATA + valueFrom: + secretKeyRef: + name: sidecar-secret + key: secret + injectionStrategy: BeforeAppContainer + volumes: + - name: configmap + configMap: + name: sidecar-config + - name: secret + secret: + secretName: sidecar-secret + status: + matchedPods: 3 + updatedPods: 3 + readyPods: 3 +operation: InterpretHealth +output: diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/SidecarSet/testdata/interpretreplica-test.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/SidecarSet/testdata/interpretreplica-test.yaml new file mode 100644 index 000000000000..882c6bca424d --- /dev/null +++ b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/SidecarSet/testdata/interpretreplica-test.yaml @@ -0,0 +1,42 @@ +# test case for interpreting replica of SidecarSet +# case1. SidecarSet replicas should always be 0 + +name: "SidecarSet replicas should always be 0" +description: "Test interpreting replica of SidecarSet" +desiredObj: + apiVersion: apps.kruise.io/v1alpha1 + kind: SidecarSet + metadata: + labels: + app: sample + name: sample-sidecarset + namespace: test-sidecarset + generation: 1 + spec: + selector: + matchLabels: + app: sample + test: sidecarset + containers: + - name: sidecar + image: busybox:latest + env: + - name: CONFIG_DATA + valueFrom: + configMapKeyRef: + name: sidecar-config + key: config + - name: SECRET_DATA + valueFrom: + secretKeyRef: + name: sidecar-secret + key: secret + injectionStrategy: BeforeAppContainer + volumes: + - name: configmap + configMap: + name: sidecar-config + - name: secret + secret: + secretName: sidecar-secret +operation: InterpretReplica diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/SidecarSet/testdata/interpretstatus-test.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/SidecarSet/testdata/interpretstatus-test.yaml new file mode 100644 index 000000000000..40b71db66a8e --- /dev/null +++ b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/SidecarSet/testdata/interpretstatus-test.yaml @@ -0,0 +1,47 @@ +# test case for interpreting status of SidecarSet +# case1. SidecarSet: interpret status test + +name: "SidecarSet: interpret status test" +description: "Test interpreting status for SidecarSet" +observedObj: + apiVersion: apps.kruise.io/v1alpha1 + kind: SidecarSet + metadata: + labels: + app: sample + name: sample-sidecarset + namespace: test-sidecarset + generation: 1 + spec: + selector: + matchLabels: + app: sample + test: sidecarset + containers: + - name: sidecar + image: busybox:latest + env: + - name: CONFIG_DATA + valueFrom: + configMapKeyRef: + name: sidecar-config + key: config + - name: SECRET_DATA + valueFrom: + secretKeyRef: + name: sidecar-secret + key: secret + injectionStrategy: BeforeAppContainer + volumes: + - name: configmap + configMap: + name: sidecar-config + - name: secret + secret: + secretName: sidecar-secret + status: + matchedPods: 3 + updatedPods: 3 + readyPods: 3 +operation: InterpretStatus +output: diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/SidecarSet/testdata/observed-sidecarset-nginx.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/SidecarSet/testdata/observed-sidecarset-nginx.yaml deleted file mode 100644 index 6161bc6f8ffe..000000000000 --- a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/SidecarSet/testdata/observed-sidecarset-nginx.yaml +++ /dev/null @@ -1,39 +0,0 @@ -apiVersion: apps.kruise.io/v1alpha1 -kind: SidecarSet -metadata: - labels: - app: sample - name: sample-sidecarset - namespace: test-sidecarset - generation: 1 -spec: - selector: - matchLabels: - app: sample - test: sidecarset - containers: - - name: sidecar - image: busybox:latest - env: - - name: CONFIG_DATA - valueFrom: - configMapKeyRef: - name: sidecar-config - key: config - - name: SECRET_DATA - valueFrom: - secretKeyRef: - name: sidecar-secret - key: secret - injectionStrategy: BeforeAppContainer - volumes: - - name: configmap - configMap: - name: sidecar-config - - name: secret - secret: - secretName: sidecar-secret -status: - matchedPods: 3 - updatedPods: 3 - readyPods: 3 diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/SidecarSet/testdata/status-file.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/SidecarSet/testdata/status-file.yaml deleted file mode 100644 index 189393e65905..000000000000 --- a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/SidecarSet/testdata/status-file.yaml +++ /dev/null @@ -1,21 +0,0 @@ -apiVersion: apps.kruise.io/v1alpha1 -kind: SidecarSet -metadata: - name: sample-sidecarset - namespace: test-sidecarset - clusterName: member1 -status: - matchedPods: 2 - updatedPods: 2 - readyPods: 2 ---- -apiVersion: apps.kruise.io/v1alpha1 -kind: SidecarSet -metadata: - name: sample-sidecarset - namespace: test-sidecarset - clusterName: member2 -status: - matchedPods: 1 - updatedPods: 1 - readyPods: 1 diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/UnitedDeployment/customizations_tests.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/UnitedDeployment/customizations_tests.yaml deleted file mode 100644 index 98fc209fac0c..000000000000 --- a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/UnitedDeployment/customizations_tests.yaml +++ /dev/null @@ -1,15 +0,0 @@ -tests: - - desiredInputPath: testdata/desired-uniteddeployment.yaml - statusInputPath: testdata/status-file.yaml - operation: AggregateStatus - - desiredInputPath: testdata/desired-uniteddeployment.yaml - operation: InterpretDependency - - observedInputPath: testdata/observed-uniteddeployment.yaml - operation: InterpretReplica - - observedInputPath: testdata/observed-uniteddeployment.yaml - operation: ReviseReplica - desiredReplicas: 1 - - observedInputPath: testdata/observed-uniteddeployment.yaml - operation: InterpretHealth - - observedInputPath: testdata/observed-uniteddeployment.yaml - operation: InterpretStatus diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/UnitedDeployment/testdata/aggregatestatus-test.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/UnitedDeployment/testdata/aggregatestatus-test.yaml new file mode 100644 index 000000000000..867514965026 --- /dev/null +++ b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/UnitedDeployment/testdata/aggregatestatus-test.yaml @@ -0,0 +1,75 @@ +# test case for aggregating status of UnitedDeployment +# case1. UnitedDeployment with two status items + +name: "UnitedDeployment with two status items" +description: "Test aggregating status of UnitedDeployment with two status items" +desiredObj: + apiVersion: apps.kruise.io/v1alpha1 + kind: UnitedDeployment + metadata: + name: sample-uniteddeployment + namespace: test-namespace + generation: 1 + spec: + replicas: 3 + selector: + matchLabels: + app: sample + template: + metadata: + labels: + app: sample + spec: + containers: + - name: nginx + image: nginx:latest + env: + - name: CONFIG_DATA + valueFrom: + configMapKeyRef: + name: app-config + key: config + - name: SECRET_DATA + valueFrom: + secretKeyRef: + name: app-secret + key: token + volumeMounts: + - name: config-volume + mountPath: /etc/config + volumes: + - name: config-volume + configMap: + name: app-config + topologySpread: + - topologyKey: kubernetes.io/hostname + maxSkew: 1 +statusItems: + - apiVersion: apps.kruise.io/v1alpha1 + kind: UnitedDeployment + metadata: + name: sample-uniteddeployment + namespace: test-namespace + clusterName: member1 + status: + replicas: 2 + readyReplicas: 2 + updatedReplicas: 2 + availableReplicas: 2 + collisionCount: 0 + observedGeneration: 1 + - apiVersion: apps.kruise.io/v1alpha1 + kind: UnitedDeployment + metadata: + name: sample-uniteddeployment + namespace: test-namespace + clusterName: member2 + status: + replicas: 1 + readyReplicas: 1 + updatedReplicas: 1 + availableReplicas: 1 + collisionCount: 0 + observedGeneration: 1 +operation: AggregateStatus +output: diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/UnitedDeployment/testdata/desired-uniteddeployment.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/UnitedDeployment/testdata/desired-uniteddeployment.yaml deleted file mode 100644 index fe35563e209a..000000000000 --- a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/UnitedDeployment/testdata/desired-uniteddeployment.yaml +++ /dev/null @@ -1,40 +0,0 @@ -apiVersion: apps.kruise.io/v1alpha1 -kind: UnitedDeployment -metadata: - name: sample-uniteddeployment - namespace: test-namespace - generation: 1 -spec: - replicas: 3 - selector: - matchLabels: - app: sample - template: - metadata: - labels: - app: sample - spec: - containers: - - name: nginx - image: nginx:latest - env: - - name: CONFIG_DATA - valueFrom: - configMapKeyRef: - name: app-config - key: config - - name: SECRET_DATA - valueFrom: - secretKeyRef: - name: app-secret - key: token - volumeMounts: - - name: config-volume - mountPath: /etc/config - volumes: - - name: config-volume - configMap: - name: app-config - topologySpread: - - topologyKey: kubernetes.io/hostname - maxSkew: 1 diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/UnitedDeployment/testdata/interpretdependency-test.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/UnitedDeployment/testdata/interpretdependency-test.yaml new file mode 100644 index 000000000000..f8bfe3dbd85e --- /dev/null +++ b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/UnitedDeployment/testdata/interpretdependency-test.yaml @@ -0,0 +1,48 @@ +# test case for interpreting dependency of UnitedDeployment +# case1. UnitedDeployment with configmap and secret dependency + +name: "UnitedDeployment with configmap and secret dependency" +description: "Test interpreting dependency of UnitedDeployment with configmap and secret dependency" +desiredObj: + apiVersion: apps.kruise.io/v1alpha1 + kind: UnitedDeployment + metadata: + name: sample-uniteddeployment + namespace: test-namespace + generation: 1 + spec: + replicas: 3 + selector: + matchLabels: + app: sample + template: + metadata: + labels: + app: sample + spec: + containers: + - name: nginx + image: nginx:latest + env: + - name: CONFIG_DATA + valueFrom: + configMapKeyRef: + name: app-config + key: config + - name: SECRET_DATA + valueFrom: + secretKeyRef: + name: app-secret + key: token + volumeMounts: + - name: config-volume + mountPath: /etc/config + volumes: + - name: config-volume + configMap: + name: app-config + topologySpread: + - topologyKey: kubernetes.io/hostname + maxSkew: 1 +operation: InterpretDependency +output: diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/UnitedDeployment/testdata/interprethealth-test.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/UnitedDeployment/testdata/interprethealth-test.yaml new file mode 100644 index 000000000000..86af8f026781 --- /dev/null +++ b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/UnitedDeployment/testdata/interprethealth-test.yaml @@ -0,0 +1,69 @@ +# test case for interpreting health of UnitedDeployment +# case1. UnitedDeployment interpreting health test + +name: "UnitedDeployment interpreting health test" +description: "Test interpreting health of UnitedDeployment" +observedObj: + apiVersion: apps.kruise.io/v1alpha1 + kind: UnitedDeployment + metadata: + name: sample-uniteddeployment + namespace: test-namespace + generation: 1 + resourceVersion: "12345" + uid: "a1b2c3d4-5678-90ef-ghij-klmnopqrstuv" + spec: + replicas: 3 + selector: + matchLabels: + app: sample + template: + metadata: + labels: + app: sample + spec: + containers: + - name: nginx + image: nginx:latest + env: + - name: CONFIG_DATA + valueFrom: + configMapKeyRef: + name: app-config + key: config + - name: SECRET_DATA + valueFrom: + secretKeyRef: + name: app-secret + key: token + volumeMounts: + - name: config-volume + mountPath: /etc/config + volumes: + - name: config-volume + configMap: + name: app-config + topologySpread: + - topologyKey: kubernetes.io/hostname + maxSkew: 1 + status: + replicas: 3 + readyReplicas: 3 + updatedReplicas: 3 + availableReplicas: 3 + collisionCount: 0 + observedGeneration: 1 + conditions: + - type: Available + status: "True" + lastTransitionTime: "2023-01-01T00:00:00Z" + reason: MinimumReplicasAvailable + message: Deployment has minimum availability. + - type: Progressing + status: "True" + lastTransitionTime: "2023-01-01T00:00:00Z" + reason: NewReplicaSetAvailable + message: ReplicaSet has successfully progressed. +operation: InterpretHealth +output: + health: false diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/UnitedDeployment/testdata/interpretreplica-test.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/UnitedDeployment/testdata/interpretreplica-test.yaml new file mode 100644 index 000000000000..09b9d3ece678 --- /dev/null +++ b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/UnitedDeployment/testdata/interpretreplica-test.yaml @@ -0,0 +1,47 @@ +# test case for interpreting replica of UnitedDeployment +# case1. UnitedDeployment with replicas set to 3 + +name: "UnitedDeployment with replicas set to 3" +description: "Test interpreting replica of UnitedDeployment with replicas set to 3" +desiredObj: + apiVersion: apps.kruise.io/v1alpha1 + kind: UnitedDeployment + metadata: + name: sample-uniteddeployment + namespace: test-namespace + generation: 1 + spec: + replicas: 3 + selector: + matchLabels: + app: sample + template: + metadata: + labels: + app: sample + spec: + containers: + - name: nginx + image: nginx:latest + env: + - name: CONFIG_DATA + valueFrom: + configMapKeyRef: + name: app-config + key: config + - name: SECRET_DATA + valueFrom: + secretKeyRef: + name: app-secret + key: token + volumeMounts: + - name: config-volume + mountPath: /etc/config + volumes: + - name: config-volume + configMap: + name: app-config + topologySpread: + - topologyKey: kubernetes.io/hostname + maxSkew: 1 +operation: InterpretReplica diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/UnitedDeployment/testdata/interpretstatus-test.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/UnitedDeployment/testdata/interpretstatus-test.yaml new file mode 100644 index 000000000000..6955255439ab --- /dev/null +++ b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/UnitedDeployment/testdata/interpretstatus-test.yaml @@ -0,0 +1,68 @@ +# test case for interpreting status of UnitedDeployment +# case1. UnitedDeployment: interpret status test + +name: "UnitedDeployment: interpret status test" +description: "Test interpreting status for UnitedDeployment" +observedObj: + apiVersion: apps.kruise.io/v1alpha1 + kind: UnitedDeployment + metadata: + name: sample-uniteddeployment + namespace: test-namespace + generation: 1 + resourceVersion: "12345" + uid: "a1b2c3d4-5678-90ef-ghij-klmnopqrstuv" + spec: + replicas: 3 + selector: + matchLabels: + app: sample + template: + metadata: + labels: + app: sample + spec: + containers: + - name: nginx + image: nginx:latest + env: + - name: CONFIG_DATA + valueFrom: + configMapKeyRef: + name: app-config + key: config + - name: SECRET_DATA + valueFrom: + secretKeyRef: + name: app-secret + key: token + volumeMounts: + - name: config-volume + mountPath: /etc/config + volumes: + - name: config-volume + configMap: + name: app-config + topologySpread: + - topologyKey: kubernetes.io/hostname + maxSkew: 1 + status: + replicas: 3 + readyReplicas: 3 + updatedReplicas: 3 + availableReplicas: 3 + collisionCount: 0 + observedGeneration: 1 + conditions: + - type: Available + status: "True" + lastTransitionTime: "2023-01-01T00:00:00Z" + reason: MinimumReplicasAvailable + message: Deployment has minimum availability. + - type: Progressing + status: "True" + lastTransitionTime: "2023-01-01T00:00:00Z" + reason: NewReplicaSetAvailable + message: ReplicaSet has successfully progressed. +operation: InterpretStatus +output: diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/UnitedDeployment/testdata/observed-uniteddeployment.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/UnitedDeployment/testdata/observed-uniteddeployment.yaml deleted file mode 100644 index ccf3cbca255c..000000000000 --- a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/UnitedDeployment/testdata/observed-uniteddeployment.yaml +++ /dev/null @@ -1,60 +0,0 @@ -apiVersion: apps.kruise.io/v1alpha1 -kind: UnitedDeployment -metadata: - name: sample-uniteddeployment - namespace: test-namespace - generation: 1 - resourceVersion: "12345" - uid: "a1b2c3d4-5678-90ef-ghij-klmnopqrstuv" -spec: - replicas: 3 - selector: - matchLabels: - app: sample - template: - metadata: - labels: - app: sample - spec: - containers: - - name: nginx - image: nginx:latest - env: - - name: CONFIG_DATA - valueFrom: - configMapKeyRef: - name: app-config - key: config - - name: SECRET_DATA - valueFrom: - secretKeyRef: - name: app-secret - key: token - volumeMounts: - - name: config-volume - mountPath: /etc/config - volumes: - - name: config-volume - configMap: - name: app-config - topologySpread: - - topologyKey: kubernetes.io/hostname - maxSkew: 1 -status: - replicas: 3 - readyReplicas: 3 - updatedReplicas: 3 - availableReplicas: 3 - collisionCount: 0 - observedGeneration: 1 - conditions: - - type: Available - status: "True" - lastTransitionTime: "2023-01-01T00:00:00Z" - reason: MinimumReplicasAvailable - message: Deployment has minimum availability. - - type: Progressing - status: "True" - lastTransitionTime: "2023-01-01T00:00:00Z" - reason: NewReplicaSetAvailable - message: ReplicaSet has successfully progressed. diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/UnitedDeployment/testdata/revisereplica-test.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/UnitedDeployment/testdata/revisereplica-test.yaml new file mode 100644 index 000000000000..1735659fdea3 --- /dev/null +++ b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/UnitedDeployment/testdata/revisereplica-test.yaml @@ -0,0 +1,49 @@ +# test case for revise replica +# case1. UnitedDeployment: revise replica test + +name: "UnitedDeployment: revise replica test" +description: "Test revising replica of UnitedDeployment" +desiredObj: + apiVersion: apps.kruise.io/v1alpha1 + kind: UnitedDeployment + metadata: + name: sample-uniteddeployment + namespace: test-namespace + generation: 1 + spec: + replicas: 3 + selector: + matchLabels: + app: sample + template: + metadata: + labels: + app: sample + spec: + containers: + - name: nginx + image: nginx:latest + env: + - name: CONFIG_DATA + valueFrom: + configMapKeyRef: + name: app-config + key: config + - name: SECRET_DATA + valueFrom: + secretKeyRef: + name: app-secret + key: token + volumeMounts: + - name: config-volume + mountPath: /etc/config + volumes: + - name: config-volume + configMap: + name: app-config + topologySpread: + - topologyKey: kubernetes.io/hostname + maxSkew: 1 +inputReplicas: 1 +operation: ReviseReplica +output: diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/UnitedDeployment/testdata/status-file.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/UnitedDeployment/testdata/status-file.yaml deleted file mode 100644 index 769d9f49dc45..000000000000 --- a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1alpha1/UnitedDeployment/testdata/status-file.yaml +++ /dev/null @@ -1,27 +0,0 @@ -apiVersion: apps.kruise.io/v1alpha1 -kind: UnitedDeployment -metadata: - name: sample-uniteddeployment - namespace: test-namespace - clusterName: member1 -status: - replicas: 2 - readyReplicas: 2 - updatedReplicas: 2 - availableReplicas: 2 - collisionCount: 0 - observedGeneration: 1 ---- -apiVersion: apps.kruise.io/v1alpha1 -kind: UnitedDeployment -metadata: - name: sample-uniteddeployment - namespace: test-namespace - clusterName: member2 -status: - replicas: 1 - readyReplicas: 1 - updatedReplicas: 1 - availableReplicas: 1 - collisionCount: 0 - observedGeneration: 1 diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1beta1/StatefulSet/customizations_tests.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1beta1/StatefulSet/customizations_tests.yaml deleted file mode 100644 index 7ea208843d71..000000000000 --- a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1beta1/StatefulSet/customizations_tests.yaml +++ /dev/null @@ -1,15 +0,0 @@ -tests: - - desiredInputPath: testdata/desired-statefulset-nginx.yaml - statusInputPath: testdata/status-file.yaml - operation: AggregateStatus - - desiredInputPath: testdata/desired-statefulset-nginx.yaml - operation: InterpretDependency - - observedInputPath: testdata/observed-statefulset-nginx.yaml - operation: InterpretReplica - - observedInputPath: testdata/observed-statefulset-nginx.yaml - operation: InterpretHealth - - observedInputPath: testdata/observed-statefulset-nginx.yaml - operation: InterpretStatus - - observedInputPath: testdata/observed-statefulset-nginx.yaml - operation: ReviseReplica - desiredReplicas: 1 diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1beta1/StatefulSet/testdata/aggregatestatus-test.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1beta1/StatefulSet/testdata/aggregatestatus-test.yaml new file mode 100644 index 000000000000..0983bfded4c6 --- /dev/null +++ b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1beta1/StatefulSet/testdata/aggregatestatus-test.yaml @@ -0,0 +1,88 @@ +# test case for aggregating status of StatefulSet +# case1. StatefulSet with two status items + +name: "StatefulSet with two status items" +description: "Test aggregating status of StatefulSet with two status items" +desiredObj: + apiVersion: apps.kruise.io/v1beta1 + kind: StatefulSet + metadata: + name: sample + namespace: test-statefulset + generation: 1 + spec: + replicas: 2 + serviceName: sample-statefulset-headless-service + selector: + matchLabels: + app: sample + template: + metadata: + labels: + app: sample + spec: + volumes: + - name: configmap + configMap: + name: my-sample-config + readinessGates: + # A new condition that ensures the pod remains at NotReady state while the in-place update is happening + - conditionType: InPlaceUpdateReady + containers: + - name: nginx + image: nginx:alpine + ports: + - containerPort: 80 + name: web + env: + - name: logData + valueFrom: + configMapKeyRef: + name: mysql-config + key: log + - name: lowerData + valueFrom: + configMapKeyRef: + name: mysql-config + key: lower + podManagementPolicy: Parallel # allow parallel updates, works together with maxUnavailable + updateStrategy: + type: RollingUpdate + rollingUpdate: + # Do in-place update if possible, currently only image update is supported for in-place update + podUpdatePolicy: InPlaceIfPossible + # Allow parallel updates with max number of unavailable instances equals to 2 + maxUnavailable: 2 +statusItems: + - applied: true + clusterName: member1 + health: Healthy + status: + availableReplicas: 2 + currentReplicas: 2 + currentRevision: sample-5675547df7 + generation: 1 + resourceTemplateGeneration: 1 + observedGeneration: 1 + readyReplicas: 2 + replicas: 2 + updateRevision: sample-5675547df7 + updatedReadyReplicas: 2 + updatedReplicas: 2 + - applied: true + clusterName: member3 + health: Healthy + status: + availableReplicas: 2 + currentReplicas: 2 + currentRevision: sample-5675547df7 + generation: 1 + observedGeneration: 1 + resourceTemplateGeneration: 1 + readyReplicas: 2 + replicas: 2 + updateRevision: sample-5675547df7 + updatedReadyReplicas: 2 + updatedReplicas: 2 +operation: AggregateStatus +output: diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1beta1/StatefulSet/testdata/desired-statefulset-nginx.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1beta1/StatefulSet/testdata/desired-statefulset-nginx.yaml deleted file mode 100644 index 47d506b45ac8..000000000000 --- a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1beta1/StatefulSet/testdata/desired-statefulset-nginx.yaml +++ /dev/null @@ -1,49 +0,0 @@ -apiVersion: apps.kruise.io/v1beta1 -kind: StatefulSet -metadata: - name: sample - namespace: test-statefulset - generation: 1 -spec: - replicas: 2 - serviceName: sample-statefulset-headless-service - selector: - matchLabels: - app: sample - template: - metadata: - labels: - app: sample - spec: - volumes: - - name: configmap - configMap: - name: my-sample-config - readinessGates: - # A new condition that ensures the pod remains at NotReady state while the in-place update is happening - - conditionType: InPlaceUpdateReady - containers: - - name: nginx - image: nginx:alpine - ports: - - containerPort: 80 - name: web - env: - - name: logData - valueFrom: - configMapKeyRef: - name: mysql-config - key: log - - name: lowerData - valueFrom: - configMapKeyRef: - name: mysql-config - key: lower - podManagementPolicy: Parallel # allow parallel updates, works together with maxUnavailable - updateStrategy: - type: RollingUpdate - rollingUpdate: - # Do in-place update if possible, currently only image update is supported for in-place update - podUpdatePolicy: InPlaceIfPossible - # Allow parallel updates with max number of unavailable instances equals to 2 - maxUnavailable: 2 diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1beta1/StatefulSet/testdata/interpretstatus-test.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1beta1/StatefulSet/testdata/interpretstatus-test.yaml new file mode 100644 index 000000000000..64464770779d --- /dev/null +++ b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1beta1/StatefulSet/testdata/interpretstatus-test.yaml @@ -0,0 +1,68 @@ +# test case for interpreting status of StatefulSet +# case1. StatefulSet: interpret status test + +name: "StatefulSet: interpret status test" +description: "Test interpreting status for StatefulSet" +observedObj: + apiVersion: apps.kruise.io/v1beta1 + kind: StatefulSet + metadata: + annotations: + resourcetemplate.karmada.io/generation: "1" + name: sample + namespace: test-statefulset + generation: 1 + spec: + replicas: 2 + serviceName: sample-statefulset-headless-service + selector: + matchLabels: + app: sample + template: + metadata: + labels: + app: sample + spec: + volumes: + - name: configmap + configMap: + name: my-sample-config + readinessGates: + - conditionType: InPlaceUpdateReady + containers: + - name: nginx + image: nginx:alpine + ports: + - containerPort: 80 + name: web + env: + - name: logData + valueFrom: + configMapKeyRef: + name: mysql-config + key: log + - name: lowerData + valueFrom: + configMapKeyRef: + name: mysql-config + key: lower + podManagementPolicy: Parallel + updateStrategy: + type: RollingUpdate + rollingUpdate: + podUpdatePolicy: InPlaceIfPossible + maxUnavailable: 2 + status: + availableReplicas: 2 + collisionCount: 0 + currentReplicas: 2 + currentRevision: sample-5675547df7 + labelSelector: app=sample + observedGeneration: 1 + readyReplicas: 2 + replicas: 2 + updateRevision: sample-5675547df7 + updatedReadyReplicas: 2 + updatedReplicas: 2 +operation: InterpretStatus +output: diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1beta1/StatefulSet/testdata/observed-statefulset-nginx.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1beta1/StatefulSet/testdata/observed-statefulset-nginx.yaml deleted file mode 100644 index ccd464bf9ef1..000000000000 --- a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1beta1/StatefulSet/testdata/observed-statefulset-nginx.yaml +++ /dev/null @@ -1,60 +0,0 @@ -apiVersion: apps.kruise.io/v1beta1 -kind: StatefulSet -metadata: - annotations: - resourcetemplate.karmada.io/generation: "1" - name: sample - namespace: test-statefulset - generation: 1 -spec: - replicas: 2 - serviceName: sample-statefulset-headless-service - selector: - matchLabels: - app: sample - template: - metadata: - labels: - app: sample - spec: - volumes: - - name: configmap - configMap: - name: my-sample-config - readinessGates: - - conditionType: InPlaceUpdateReady - containers: - - name: nginx - image: nginx:alpine - ports: - - containerPort: 80 - name: web - env: - - name: logData - valueFrom: - configMapKeyRef: - name: mysql-config - key: log - - name: lowerData - valueFrom: - configMapKeyRef: - name: mysql-config - key: lower - podManagementPolicy: Parallel - updateStrategy: - type: RollingUpdate - rollingUpdate: - podUpdatePolicy: InPlaceIfPossible - maxUnavailable: 2 -status: - availableReplicas: 2 - collisionCount: 0 - currentReplicas: 2 - currentRevision: sample-5675547df7 - labelSelector: app=sample - observedGeneration: 1 - readyReplicas: 2 - replicas: 2 - updateRevision: sample-5675547df7 - updatedReadyReplicas: 2 - updatedReplicas: 2 diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1beta1/StatefulSet/testdata/status-file.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1beta1/StatefulSet/testdata/status-file.yaml deleted file mode 100644 index 76874392e502..000000000000 --- a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/apps.kruise.io/v1beta1/StatefulSet/testdata/status-file.yaml +++ /dev/null @@ -1,31 +0,0 @@ -applied: true -clusterName: member1 -health: Healthy -status: - availableReplicas: 2 - currentReplicas: 2 - currentRevision: sample-5675547df7 - generation: 1 - resourceTemplateGeneration: 1 - observedGeneration: 1 - readyReplicas: 2 - replicas: 2 - updateRevision: sample-5675547df7 - updatedReadyReplicas: 2 - updatedReplicas: 2 ---- -applied: true -clusterName: member3 -health: Healthy -status: - availableReplicas: 2 - currentReplicas: 2 - currentRevision: sample-5675547df7 - generation: 1 - observedGeneration: 1 - resourceTemplateGeneration: 1 - readyReplicas: 2 - replicas: 2 - updateRevision: sample-5675547df7 - updatedReadyReplicas: 2 - updatedReplicas: 2 diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/argoproj.io/v1alpha1/Workflow/customizations_tests.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/argoproj.io/v1alpha1/Workflow/customizations_tests.yaml deleted file mode 100644 index 758ea623cd1a..000000000000 --- a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/argoproj.io/v1alpha1/Workflow/customizations_tests.yaml +++ /dev/null @@ -1,13 +0,0 @@ -tests: - - desiredInputPath: testdata/desired-workflow.yaml - operation: InterpretDependency - - observedInputPath: testdata/observed-workflow.yaml - operation: InterpretHealth - - observedInputPath: testdata/observed-workflow.yaml - operation: InterpretReplica - - desiredInputPath: testdata/desired-workflow.yaml - observedInputPath: testdata/observed-workflow.yaml - operation: Retain - - observedInputPath: testdata/observed-workflow.yaml - operation: ReviseReplica - desiredReplicas: 1 diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/argoproj.io/v1alpha1/Workflow/testdata/desired-workflow.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/argoproj.io/v1alpha1/Workflow/testdata/desired-workflow.yaml deleted file mode 100644 index 32486dea3810..000000000000 --- a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/argoproj.io/v1alpha1/Workflow/testdata/desired-workflow.yaml +++ /dev/null @@ -1,40 +0,0 @@ -apiVersion: argoproj.io/v1alpha1 -kind: Workflow -metadata: - labels: - app: sample - name: sample - namespace: test-workflow -spec: - parallelism: 2 - entrypoint: volumes-existing-example - volumes: - - name: workdir - persistentVolumeClaim: - claimName: my-existing-volume - serviceAccountName: my-service-account - imagePullSecrets: - - name: my-secret - tolerations: - - key: 'key' - operation: 'Equal' - value: 'value' - effect: 'NoSchedule' - templates: - - name: volumes-existing-example - steps: - - - name: hello - template: whalesay - - name: whalesay - container: - image: docker/whalesay:latest - command: [cowsay] - args: ["hello world"] - volumeMounts: - - name: workdir - mountPath: /mnt/vol - resources: - limits: - memory: 1Gi - requests: - memory: 1Mi diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/argoproj.io/v1alpha1/Workflow/testdata/interprethealth-test.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/argoproj.io/v1alpha1/Workflow/testdata/interprethealth-test.yaml new file mode 100644 index 000000000000..a743cb40575a --- /dev/null +++ b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/argoproj.io/v1alpha1/Workflow/testdata/interprethealth-test.yaml @@ -0,0 +1,120 @@ +# test case for interpreting health of Workflow +# case1. Workflow interpreting health test + +name: "Workflow interpreting health test" +description: "Test interpreting health of Workflow" +observedObj: + apiVersion: argoproj.io/v1alpha1 + kind: Workflow + metadata: + labels: + app: sample + name: sample + namespace: test-workflow + spec: + parallelism: 1 + entrypoint: volumes-existing-example + suspend: true + volumes: + - name: workdir + persistentVolumeClaim: + claimName: my-existing-volume + serviceAccountName: my-service-account + imagePullSecrets: + - name: my-secret + tolerations: + - key: 'key' + operation: 'Equal' + value: 'value' + effect: 'NoSchedule' + templates: + - name: volumes-existing-example + steps: + - - name: hello + template: whalesay + - name: whalesay + container: + image: docker/whalesay:latest + command: [ cowsay ] + args: [ "hello world" ] + volumeMounts: + - name: workdir + mountPath: /mnt/vol + resources: + limits: + memory: 1Gi + requests: + memory: 1Mi + status: + artifactGCStatus: + notSpecified: true + artifactRepositoryRef: + artifactRepository: { } + default: true + conditions: + - status: "False" + type: PodRunning + - status: "True" + type: Completed + finishedAt: "2023-04-20T11:26:47Z" + nodes: + sample: + children: + - sample-2754495299 + displayName: sample + finishedAt: "2023-04-20T11:26:47Z" + id: sample + name: sample + outboundNodes: + - sample-410485805 + phase: Succeeded + progress: 1/1 + resourcesDuration: + cpu: 19 + memory: 18 + startedAt: "2023-04-20T11:26:17Z" + templateName: volumes-existing-example + templateScope: local/sample + type: Steps + sample-410485805: + boundaryID: sample + displayName: hello + finishedAt: "2023-04-20T11:26:38Z" + hostNodeName: member1-control-plane + id: sample-410485805 + name: sample[0].hello + outputs: + exitCode: "0" + phase: Succeeded + progress: 1/1 + resourcesDuration: + cpu: 19 + memory: 18 + startedAt: "2023-04-20T11:26:17Z" + templateName: whalesay + templateScope: local/sample + type: Pod + sample-2754495299: + boundaryID: sample + children: + - sample-410485805 + displayName: '[0]' + finishedAt: "2023-04-20T11:26:47Z" + id: sample-2754495299 + name: sample[0] + phase: Succeeded + progress: 1/1 + resourcesDuration: + cpu: 19 + memory: 18 + startedAt: "2023-04-20T11:26:17Z" + templateScope: local/sample + type: StepGroup + phase: Succeeded + progress: 1/1 + resourcesDuration: + cpu: 19 + memory: 18 + startedAt: "2023-04-20T11:26:17Z" +operation: InterpretHealth +output: diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/argoproj.io/v1alpha1/Workflow/testdata/interpretreplica-test.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/argoproj.io/v1alpha1/Workflow/testdata/interpretreplica-test.yaml new file mode 100644 index 000000000000..0147faf64135 --- /dev/null +++ b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/argoproj.io/v1alpha1/Workflow/testdata/interpretreplica-test.yaml @@ -0,0 +1,47 @@ +# test case for interpreting replica of Workflow +# case1. Workflow with parallelism set to 2 + +name: "Workflow with parallelism set to 2" +description: "Test interpreting replica of Workflow with parallelism set to 2" +desiredObj: + apiVersion: argoproj.io/v1alpha1 + kind: Workflow + metadata: + labels: + app: sample + name: sample + namespace: test-workflow + spec: + parallelism: 2 + entrypoint: volumes-existing-example + volumes: + - name: workdir + persistentVolumeClaim: + claimName: my-existing-volume + serviceAccountName: my-service-account + imagePullSecrets: + - name: my-secret + tolerations: + - key: 'key' + operation: 'Equal' + value: 'value' + effect: 'NoSchedule' + templates: + - name: volumes-existing-example + steps: + - - name: hello + template: whalesay + - name: whalesay + container: + image: docker/whalesay:latest + command: [ cowsay ] + args: [ "hello world" ] + volumeMounts: + - name: workdir + mountPath: /mnt/vol + resources: + limits: + memory: 1Gi + requests: + memory: 1Mi +operation: InterpretReplica diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/argoproj.io/v1alpha1/Workflow/testdata/observed-workflow.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/argoproj.io/v1alpha1/Workflow/testdata/observed-workflow.yaml deleted file mode 100644 index 7c69396f4886..000000000000 --- a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/argoproj.io/v1alpha1/Workflow/testdata/observed-workflow.yaml +++ /dev/null @@ -1,112 +0,0 @@ -apiVersion: argoproj.io/v1alpha1 -kind: Workflow -metadata: - labels: - app: sample - name: sample - namespace: test-workflow -spec: - parallelism: 1 - entrypoint: volumes-existing-example - suspend: true - volumes: - - name: workdir - persistentVolumeClaim: - claimName: my-existing-volume - serviceAccountName: my-service-account - imagePullSecrets: - - name: my-secret - tolerations: - - key: 'key' - operation: 'Equal' - value: 'value' - effect: 'NoSchedule' - templates: - - name: volumes-existing-example - steps: - - - name: hello - template: whalesay - - name: whalesay - container: - image: docker/whalesay:latest - command: [cowsay] - args: ["hello world"] - volumeMounts: - - name: workdir - mountPath: /mnt/vol - resources: - limits: - memory: 1Gi - requests: - memory: 1Mi -status: - artifactGCStatus: - notSpecified: true - artifactRepositoryRef: - artifactRepository: {} - default: true - conditions: - - status: "False" - type: PodRunning - - status: "True" - type: Completed - finishedAt: "2023-04-20T11:26:47Z" - nodes: - sample: - children: - - sample-2754495299 - displayName: sample - finishedAt: "2023-04-20T11:26:47Z" - id: sample - name: sample - outboundNodes: - - sample-410485805 - phase: Succeeded - progress: 1/1 - resourcesDuration: - cpu: 19 - memory: 18 - startedAt: "2023-04-20T11:26:17Z" - templateName: volumes-existing-example - templateScope: local/sample - type: Steps - sample-410485805: - boundaryID: sample - displayName: hello - finishedAt: "2023-04-20T11:26:38Z" - hostNodeName: member1-control-plane - id: sample-410485805 - name: sample[0].hello - outputs: - exitCode: "0" - phase: Succeeded - progress: 1/1 - resourcesDuration: - cpu: 19 - memory: 18 - startedAt: "2023-04-20T11:26:17Z" - templateName: whalesay - templateScope: local/sample - type: Pod - sample-2754495299: - boundaryID: sample - children: - - sample-410485805 - displayName: '[0]' - finishedAt: "2023-04-20T11:26:47Z" - id: sample-2754495299 - name: sample[0] - phase: Succeeded - progress: 1/1 - resourcesDuration: - cpu: 19 - memory: 18 - startedAt: "2023-04-20T11:26:17Z" - templateScope: local/sample - type: StepGroup - phase: Succeeded - progress: 1/1 - resourcesDuration: - cpu: 19 - memory: 18 - startedAt: "2023-04-20T11:26:17Z" diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/batch.volcano.sh/v1alpha1/Job/customizations_tests.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/batch.volcano.sh/v1alpha1/Job/customizations_tests.yaml deleted file mode 100644 index 41739db5177a..000000000000 --- a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/batch.volcano.sh/v1alpha1/Job/customizations_tests.yaml +++ /dev/null @@ -1,8 +0,0 @@ -tests: - - desiredInputPath: testdata/desired-job.yaml - statusInputPath: testdata/status-file.yaml - operation: AggregateStatus - - observedInputPath: testdata/observed-job.yaml - operation: InterpretHealth - - observedInputPath: testdata/observed-job.yaml - operation: InterpretStatus diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/batch.volcano.sh/v1alpha1/Job/testdata/aggregatestatus-test.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/batch.volcano.sh/v1alpha1/Job/testdata/aggregatestatus-test.yaml new file mode 100644 index 000000000000..e1c54418fd2e --- /dev/null +++ b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/batch.volcano.sh/v1alpha1/Job/testdata/aggregatestatus-test.yaml @@ -0,0 +1,99 @@ +# test case for aggregating status of VCJob +# case1. VCJob with one status item + +name: "VCJob with one status item" +description: "Test aggregating status of VCJob with one status item" +desiredObj: + apiVersion: batch.volcano.sh/v1alpha1 + kind: Job + metadata: + name: dk-job + spec: + maxRetry: 3 + minAvailable: 3 + plugins: + env: [ ] + ssh: [ ] + svc: + - --disable-network-policy=true + queue: default + schedulerName: volcano + tasks: + - minAvailable: 1 + name: job-nginx1 + replicas: 1 + template: + metadata: + name: nginx1 + spec: + containers: + - args: + - sleep 10 + command: + - bash + - -c + image: nginx:latest + imagePullPolicy: IfNotPresent + name: nginx + resources: + requests: + cpu: 100m + nodeSelector: + kubernetes.io/os: linux + restartPolicy: OnFailure + - minAvailable: 2 + name: job-nginx2 + replicas: 3 + template: + metadata: + name: nginx2 + spec: + containers: + - args: + - sleep 30 + command: + - bash + - -c + image: nginx:latest + imagePullPolicy: IfNotPresent + name: nginx + resources: + requests: + cpu: 100m + nodeSelector: + kubernetes.io/os: linux + restartPolicy: OnFailure +statusItems: + - applied: true + clusterName: member1 + health: Healthy + status: + conditions: + - lastTransitionTime: "2025-09-29T10:57:03Z" + status: Pending + - lastTransitionTime: "2025-09-29T10:57:07Z" + status: Running + - lastTransitionTime: "2025-09-29T10:57:38Z" + status: Completed + failed: 0 + minAvailable: 3 + pending: 0 + retryCount: 0 + running: 0 + runningDuration: 35.688396584s + state: + lastTransitionTime: "2025-09-29T10:57:38Z" + phase: Completed + succeeded: 4 + taskStatusCount: + job-nginx1: + phase: + Succeeded: 1 + job-nginx2: + phase: + Succeeded: 3 + terminating: 0 + unknown: 0 + version: 1 +operation: AggregateStatus +output: diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/batch.volcano.sh/v1alpha1/Job/testdata/desired-job.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/batch.volcano.sh/v1alpha1/Job/testdata/desired-job.yaml deleted file mode 100644 index 59181c95a546..000000000000 --- a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/batch.volcano.sh/v1alpha1/Job/testdata/desired-job.yaml +++ /dev/null @@ -1,59 +0,0 @@ -apiVersion: batch.volcano.sh/v1alpha1 -kind: Job -metadata: - name: dk-job -spec: - maxRetry: 3 - minAvailable: 3 - plugins: - env: [] - ssh: [] - svc: - - --disable-network-policy=true - queue: default - schedulerName: volcano - tasks: - - minAvailable: 1 - name: job-nginx1 - replicas: 1 - template: - metadata: - name: nginx1 - spec: - containers: - - args: - - sleep 10 - command: - - bash - - -c - image: nginx:latest - imagePullPolicy: IfNotPresent - name: nginx - resources: - requests: - cpu: 100m - nodeSelector: - kubernetes.io/os: linux - restartPolicy: OnFailure - - minAvailable: 2 - name: job-nginx2 - replicas: 3 - template: - metadata: - name: nginx2 - spec: - containers: - - args: - - sleep 30 - command: - - bash - - -c - image: nginx:latest - imagePullPolicy: IfNotPresent - name: nginx - resources: - requests: - cpu: 100m - nodeSelector: - kubernetes.io/os: linux - restartPolicy: OnFailure diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/batch.volcano.sh/v1alpha1/Job/testdata/interpretstatus-test.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/batch.volcano.sh/v1alpha1/Job/testdata/interpretstatus-test.yaml new file mode 100644 index 000000000000..2720623a9089 --- /dev/null +++ b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/batch.volcano.sh/v1alpha1/Job/testdata/interpretstatus-test.yaml @@ -0,0 +1,95 @@ +# test case for interpreting status of VCJob +# case1. VCJob: interpret status test + +name: "VCJob: interpret status test" +description: "Test interpreting status for VCJob" +observedObj: + apiVersion: batch.volcano.sh/v1alpha1 + kind: Job + metadata: + name: dk-job + spec: + maxRetry: 3 + minAvailable: 3 + plugins: + env: [ ] + ssh: [ ] + svc: + - --disable-network-policy=true + queue: default + schedulerName: volcano + tasks: + - minAvailable: 1 + name: job-nginx1 + replicas: 1 + template: + metadata: + name: nginx1 + spec: + containers: + - args: + - sleep 10 + command: + - bash + - -c + image: nginx:latest + imagePullPolicy: IfNotPresent + name: nginx + resources: + requests: + cpu: 100m + nodeSelector: + kubernetes.io/os: linux + restartPolicy: OnFailure + - minAvailable: 2 + name: job-nginx2 + replicas: 3 + template: + metadata: + name: nginx2 + spec: + containers: + - args: + - sleep 30 + command: + - bash + - -c + image: nginx:latest + imagePullPolicy: IfNotPresent + name: nginx + resources: + requests: + cpu: 100m + nodeSelector: + kubernetes.io/os: linux + restartPolicy: OnFailure + status: + conditions: + - lastTransitionTime: "2025-09-29T10:57:03Z" + status: Pending + - lastTransitionTime: "2025-09-29T10:57:07Z" + status: Running + - lastTransitionTime: "2025-09-29T10:57:38Z" + status: Completed + failed: 0 + minAvailable: 3 + pending: 0 + retryCount: 0 + running: 0 + runningDuration: 35.688396584s + state: + lastTransitionTime: "2025-09-29T10:57:38Z" + phase: Completed + succeeded: 4 + taskStatusCount: + job-nginx1: + phase: + Succeeded: 1 + job-nginx2: + phase: + Succeeded: 3 + terminating: 0 + unknown: 0 + version: 1 +operation: InterpretStatus +output: diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/batch.volcano.sh/v1alpha1/Job/testdata/observed-job.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/batch.volcano.sh/v1alpha1/Job/testdata/observed-job.yaml deleted file mode 100644 index ca958aeff855..000000000000 --- a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/batch.volcano.sh/v1alpha1/Job/testdata/observed-job.yaml +++ /dev/null @@ -1,87 +0,0 @@ -apiVersion: batch.volcano.sh/v1alpha1 -kind: Job -metadata: - name: dk-job -spec: - maxRetry: 3 - minAvailable: 3 - plugins: - env: [] - ssh: [] - svc: - - --disable-network-policy=true - queue: default - schedulerName: volcano - tasks: - - minAvailable: 1 - name: job-nginx1 - replicas: 1 - template: - metadata: - name: nginx1 - spec: - containers: - - args: - - sleep 10 - command: - - bash - - -c - image: nginx:latest - imagePullPolicy: IfNotPresent - name: nginx - resources: - requests: - cpu: 100m - nodeSelector: - kubernetes.io/os: linux - restartPolicy: OnFailure - - minAvailable: 2 - name: job-nginx2 - replicas: 3 - template: - metadata: - name: nginx2 - spec: - containers: - - args: - - sleep 30 - command: - - bash - - -c - image: nginx:latest - imagePullPolicy: IfNotPresent - name: nginx - resources: - requests: - cpu: 100m - nodeSelector: - kubernetes.io/os: linux - restartPolicy: OnFailure -status: - conditions: - - lastTransitionTime: "2025-09-29T10:57:03Z" - status: Pending - - lastTransitionTime: "2025-09-29T10:57:07Z" - status: Running - - lastTransitionTime: "2025-09-29T10:57:38Z" - status: Completed - failed: 0 - minAvailable: 3 - pending: 0 - retryCount: 0 - running: 0 - runningDuration: 35.688396584s - state: - lastTransitionTime: "2025-09-29T10:57:38Z" - phase: Completed - succeeded: 4 - taskStatusCount: - job-nginx1: - phase: - Succeeded: 1 - job-nginx2: - phase: - Succeeded: 3 - terminating: 0 - unknown: 0 - version: 1 diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/batch.volcano.sh/v1alpha1/Job/testdata/status-file.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/batch.volcano.sh/v1alpha1/Job/testdata/status-file.yaml deleted file mode 100644 index e7d11c3932c8..000000000000 --- a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/batch.volcano.sh/v1alpha1/Job/testdata/status-file.yaml +++ /dev/null @@ -1,31 +0,0 @@ -applied: true -clusterName: member1 -health: Healthy -status: - conditions: - - lastTransitionTime: "2025-09-29T10:57:03Z" - status: Pending - - lastTransitionTime: "2025-09-29T10:57:07Z" - status: Running - - lastTransitionTime: "2025-09-29T10:57:38Z" - status: Completed - failed: 0 - minAvailable: 3 - pending: 0 - retryCount: 0 - running: 0 - runningDuration: 35.688396584s - state: - lastTransitionTime: "2025-09-29T10:57:38Z" - phase: Completed - succeeded: 4 - taskStatusCount: - job-nginx1: - phase: - Succeeded: 1 - job-nginx2: - phase: - Succeeded: 3 - terminating: 0 - unknown: 0 - version: 1 diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/flink.apache.org/v1beta1/FlinkDeployment/customizations_tests.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/flink.apache.org/v1beta1/FlinkDeployment/customizations_tests.yaml deleted file mode 100644 index 27c9f19e95cd..000000000000 --- a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/flink.apache.org/v1beta1/FlinkDeployment/customizations_tests.yaml +++ /dev/null @@ -1,10 +0,0 @@ -tests: - - desiredInputPath: testdata/desired-flinkdeployment.yaml - statusInputPath: testdata/status-file.yaml - operation: AggregateStatus - - observedInputPath: testdata/observed-flinkdeployment.yaml - operation: InterpretReplica - - observedInputPath: testdata/observed-flinkdeployment.yaml - operation: InterpretHealth - - observedInputPath: testdata/observed-flinkdeployment.yaml - operation: InterpretStatus diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/flink.apache.org/v1beta1/FlinkDeployment/testdata/aggregatestatus-test.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/flink.apache.org/v1beta1/FlinkDeployment/testdata/aggregatestatus-test.yaml new file mode 100644 index 000000000000..5057039e28be --- /dev/null +++ b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/flink.apache.org/v1beta1/FlinkDeployment/testdata/aggregatestatus-test.yaml @@ -0,0 +1,178 @@ +# test case for aggregating status of FlinkDeployment +# case1. FlinkDeployment with nil status items +# case2. FlinkDeployment with one status item + +name: "FlinkDeployment with nil status items" +description: "Test aggregating status of FlinkDeployment with nil status items" +desiredObj: + apiVersion: flink.apache.org/v1beta1 + kind: FlinkDeployment + metadata: + name: basic-example + namespace: test-namespace + spec: + flinkConfiguration: + taskmanager.numberOfTaskSlots: "2" + flinkVersion: v1_17 + image: flink:1.17 + job: + jarURI: local:///opt/flink/examples/streaming/StateMachineExample.jar + parallelism: 2 + upgradeMode: stateless + jobManager: + replicas: 1 + resource: + cpu: 1 + memory: 2048m + mode: native + serviceAccount: flink + taskManager: + resource: + cpu: 1 + memory: 2048m +statusItems: +operation: AggregateStatus +output: + aggregatedStatus: + apiVersion: flink.apache.org/v1beta1 + kind: FlinkDeployment + metadata: + name: basic-example + namespace: test-namespace + spec: + flinkConfiguration: + taskmanager.numberOfTaskSlots: "2" + flinkVersion: v1_17 + image: flink:1.17 + job: + jarURI: local:///opt/flink/examples/streaming/StateMachineExample.jar + parallelism: 2 + upgradeMode: stateless + jobManager: + replicas: 1 + resource: + cpu: 1 + memory: 2048m + mode: native + serviceAccount: flink + taskManager: + resource: + cpu: 1 + memory: 2048m + +--- +name: "FlinkDeployment with one status item" +description: "Test aggregating status of FlinkDeployment with one status item" +desiredObj: + apiVersion: flink.apache.org/v1beta1 + kind: FlinkDeployment + metadata: + name: basic-example + namespace: test-namespace + spec: + flinkConfiguration: + taskmanager.numberOfTaskSlots: "2" + flinkVersion: v1_17 + image: flink:1.17 + job: + jarURI: local:///opt/flink/examples/streaming/StateMachineExample.jar + parallelism: 2 + upgradeMode: stateless + jobManager: + replicas: 1 + resource: + cpu: 1 + memory: 2048m + mode: native + serviceAccount: flink + taskManager: + resource: + cpu: 1 + memory: 2048m +statusItems: + - applied: true + clusterName: member1 + health: Healthy + status: + clusterInfo: + flink-revision: 2750d5c @ 2023-05-19T10:45:46+02:00 + flink-version: 1.17.1 + total-cpu: "2.0" + total-memory: "4294967296" + jobManagerDeploymentStatus: READY + jobStatus: + checkpointInfo: + lastPeriodicCheckpointTimestamp: 0 + jobId: 44cc5573945d1d4925732d915c70b9ac + jobName: Minimal Spec Example + savepointInfo: + lastPeriodicSavepointTimestamp: 0 + savepointHistory: [ ] + startTime: "1717599166365" + state: RUNNING + updateTime: "1717599182544" + lifecycleState: STABLE + observedGeneration: 1 + reconciliationStatus: + lastReconciledSpec: '{"spec":{"job":{"jarURI":"local:///opt/flink/examples/streaming/StateMachineExample.jar","parallelism":2,"entryClass":null,"args":[],"state":"running","savepointTriggerNonce":null,"initialSavepointPath":null,"checkpointTriggerNonce":null,"upgradeMode":"stateless","allowNonRestoredState":null,"savepointRedeployNonce":null},"restartNonce":null,"flinkConfiguration":{"taskmanager.numberOfTaskSlots":"2"},"image":"flink:1.17","imagePullPolicy":null,"serviceAccount":"flink","flinkVersion":"v1_17","ingress":null,"podTemplate":null,"jobManager":{"resource":{"cpu":1.0,"memory":"2048m","ephemeralStorage":null},"replicas":1,"podTemplate":null},"taskManager":{"resource":{"cpu":1.0,"memory":"2048m","ephemeralStorage":null},"replicas":null,"podTemplate":null},"logConfiguration":null,"mode":null},"resource_metadata":{"apiVersion":"flink.apache.org/v1beta1","metadata":{"generation":2},"firstDeployment":true}}' + lastStableSpec: '{"spec":{"job":{"jarURI":"local:///opt/flink/examples/streaming/StateMachineExample.jar","parallelism":2,"entryClass":null,"args":[],"state":"running","savepointTriggerNonce":null,"initialSavepointPath":null,"checkpointTriggerNonce":null,"upgradeMode":"stateless","allowNonRestoredState":null,"savepointRedeployNonce":null},"restartNonce":null,"flinkConfiguration":{"taskmanager.numberOfTaskSlots":"2"},"image":"flink:1.17","imagePullPolicy":null,"serviceAccount":"flink","flinkVersion":"v1_17","ingress":null,"podTemplate":null,"jobManager":{"resource":{"cpu":1.0,"memory":"2048m","ephemeralStorage":null},"replicas":1,"podTemplate":null},"taskManager":{"resource":{"cpu":1.0,"memory":"2048m","ephemeralStorage":null},"replicas":null,"podTemplate":null},"logConfiguration":null,"mode":null},"resource_metadata":{"apiVersion":"flink.apache.org/v1beta1","metadata":{"generation":2},"firstDeployment":true}}' + reconciliationTimestamp: 1717599148930 + state: DEPLOYED + taskManager: + labelSelector: component=taskmanager,app=basic-example + replicas: 1 +operation: AggregateStatus +output: + aggregatedStatus: + apiVersion: flink.apache.org/v1beta1 + kind: FlinkDeployment + metadata: + name: basic-example + namespace: test-namespace + spec: + flinkConfiguration: + taskmanager.numberOfTaskSlots: "2" + flinkVersion: v1_17 + image: flink:1.17 + job: + jarURI: local:///opt/flink/examples/streaming/StateMachineExample.jar + parallelism: 2 + upgradeMode: stateless + jobManager: + replicas: 1 + resource: + cpu: 1 + memory: 2048m + mode: native + serviceAccount: flink + taskManager: + resource: + cpu: 1 + memory: 2048m + status: + clusterInfo: + flink-revision: 2750d5c @ 2023-05-19T10:45:46+02:00 + flink-version: 1.17.1 + total-cpu: "2.0" + total-memory: "4294967296" + jobManagerDeploymentStatus: READY + jobStatus: + checkpointInfo: + lastPeriodicCheckpointTimestamp: 0 + jobId: 44cc5573945d1d4925732d915c70b9ac + jobName: Minimal Spec Example + savepointInfo: + lastPeriodicSavepointTimestamp: 0 + startTime: "1717599166365" + state: RUNNING + updateTime: "1717599182544" + lifecycleState: STABLE + observedGeneration: 1 + reconciliationStatus: + lastReconciledSpec: '{"spec":{"job":{"jarURI":"local:///opt/flink/examples/streaming/StateMachineExample.jar","parallelism":2,"entryClass":null,"args":[],"state":"running","savepointTriggerNonce":null,"initialSavepointPath":null,"checkpointTriggerNonce":null,"upgradeMode":"stateless","allowNonRestoredState":null,"savepointRedeployNonce":null},"restartNonce":null,"flinkConfiguration":{"taskmanager.numberOfTaskSlots":"2"},"image":"flink:1.17","imagePullPolicy":null,"serviceAccount":"flink","flinkVersion":"v1_17","ingress":null,"podTemplate":null,"jobManager":{"resource":{"cpu":1.0,"memory":"2048m","ephemeralStorage":null},"replicas":1,"podTemplate":null},"taskManager":{"resource":{"cpu":1.0,"memory":"2048m","ephemeralStorage":null},"replicas":null,"podTemplate":null},"logConfiguration":null,"mode":null},"resource_metadata":{"apiVersion":"flink.apache.org/v1beta1","metadata":{"generation":2},"firstDeployment":true}}' + lastStableSpec: '{"spec":{"job":{"jarURI":"local:///opt/flink/examples/streaming/StateMachineExample.jar","parallelism":2,"entryClass":null,"args":[],"state":"running","savepointTriggerNonce":null,"initialSavepointPath":null,"checkpointTriggerNonce":null,"upgradeMode":"stateless","allowNonRestoredState":null,"savepointRedeployNonce":null},"restartNonce":null,"flinkConfiguration":{"taskmanager.numberOfTaskSlots":"2"},"image":"flink:1.17","imagePullPolicy":null,"serviceAccount":"flink","flinkVersion":"v1_17","ingress":null,"podTemplate":null,"jobManager":{"resource":{"cpu":1.0,"memory":"2048m","ephemeralStorage":null},"replicas":1,"podTemplate":null},"taskManager":{"resource":{"cpu":1.0,"memory":"2048m","ephemeralStorage":null},"replicas":null,"podTemplate":null},"logConfiguration":null,"mode":null},"resource_metadata":{"apiVersion":"flink.apache.org/v1beta1","metadata":{"generation":2},"firstDeployment":true}}' + reconciliationTimestamp: 1717599148930 + state: DEPLOYED + taskManager: + labelSelector: component=taskmanager,app=basic-example + replicas: 1 diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/flink.apache.org/v1beta1/FlinkDeployment/testdata/desired-flinkdeployment.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/flink.apache.org/v1beta1/FlinkDeployment/testdata/desired-flinkdeployment.yaml deleted file mode 100644 index 17b8dec57061..000000000000 --- a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/flink.apache.org/v1beta1/FlinkDeployment/testdata/desired-flinkdeployment.yaml +++ /dev/null @@ -1,25 +0,0 @@ -apiVersion: flink.apache.org/v1beta1 -kind: FlinkDeployment -metadata: - name: basic-example - namespace: test-namespace -spec: - flinkConfiguration: - taskmanager.numberOfTaskSlots: "2" - flinkVersion: v1_17 - image: flink:1.17 - job: - jarURI: local:///opt/flink/examples/streaming/StateMachineExample.jar - parallelism: 2 - upgradeMode: stateless - jobManager: - replicas: 1 - resource: - cpu: 1 - memory: 2048m - mode: native - serviceAccount: flink - taskManager: - resource: - cpu: 1 - memory: 2048m diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/flink.apache.org/v1beta1/FlinkDeployment/testdata/interpretcomponent-test.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/flink.apache.org/v1beta1/FlinkDeployment/testdata/interpretcomponent-test.yaml new file mode 100644 index 000000000000..19cccbb9dd63 --- /dev/null +++ b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/flink.apache.org/v1beta1/FlinkDeployment/testdata/interpretcomponent-test.yaml @@ -0,0 +1,92 @@ +# test case for interpreting component of FlinkDeployment +# case1. FlinkDeployment with taskManager.replicas set to 1 +# case2. FlinkDeployment with taskManager.replicas not set, use parallelism/numberOfTaskSlots + +name: "FlinkDeployment with taskManager.replicas set to 1" +description: "Test interpreting component of FlinkDeployment when taskManager.replicas is set" +desiredObj: + apiVersion: flink.apache.org/v1beta1 + kind: FlinkDeployment + metadata: + name: basic-example + namespace: test-namespace + spec: + flinkConfiguration: + taskmanager.numberOfTaskSlots: "2" + flinkVersion: v1_17 + image: flink:1.17 + job: + jarURI: local:///opt/flink/examples/streaming/StateMachineExample.jar + parallelism: 2 + upgradeMode: stateless + jobManager: + replicas: 1 + resource: + cpu: 1 + memory: 2048m + mode: native + serviceAccount: flink + taskManager: + replicas: 1 + resource: + cpu: 1 + memory: 2048m +operation: InterpretComponent +output: + components: + - name: jobmanager + replicas: 1 + replicaRequirements: + resourceRequest: + "cpu": "1" + "memory": "2048m" + - name: taskmanager + replicas: 1 + replicaRequirements: + resourceRequest: + "cpu": "1" + "memory": "2048m" + +--- +name: "FlinkDeployment with taskManager.replicas not set, use parallelism/numberOfTaskSlots" +description: "Test interpreting component of FlinkDeployment when taskManager.replicas is not set" +desiredObj: + apiVersion: flink.apache.org/v1beta1 + kind: FlinkDeployment + metadata: + namespace: default + name: basic-example + spec: + image: flink:1.20 + flinkVersion: v1_20 + flinkConfiguration: + taskmanager.numberOfTaskSlots: "2" + serviceAccount: flink + jobManager: + resource: + memory: "2048m" + cpu: 1 + taskManager: + resource: + memory: "2048m" + cpu: 1 + job: + jarURI: local:///opt/flink/examples/streaming/StateMachineExample.jar + parallelism: 10 + upgradeMode: stateless + state: running +operation: InterpretComponent +output: + components: + - name: jobmanager + replicas: 1 + replicaRequirements: + resourceRequest: + "cpu": "1" + "memory": "2048m" + - name: taskmanager + replicas: 5 + replicaRequirements: + resourceRequest: + "cpu": "1" + "memory": "2048m" diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/flink.apache.org/v1beta1/FlinkDeployment/testdata/interprethealth-test.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/flink.apache.org/v1beta1/FlinkDeployment/testdata/interprethealth-test.yaml new file mode 100644 index 000000000000..18d743561082 --- /dev/null +++ b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/flink.apache.org/v1beta1/FlinkDeployment/testdata/interprethealth-test.yaml @@ -0,0 +1,69 @@ +# test case for interpreting health of FlinkDeployment +# case1. FlinkDeployment with DEPLOYED state should be Healthy + +name: "FlinkDeployment with DEPLOYED state should be Healthy" +description: "Test interpreting health of FlinkDeployment when lifecycleState is DEPLOYED" +observedObj: + apiVersion: flink.apache.org/v1beta1 + kind: FlinkDeployment + metadata: + creationTimestamp: "2024-06-05T14:52:28Z" + finalizers: + - flinkdeployments.flink.apache.org/finalizer + generation: 1 + name: basic-example + namespace: test-namespace + resourceVersion: "5053661" + uid: 87ef77ca-7bf0-4998-b275-06f459872e03 + spec: + flinkConfiguration: + taskmanager.numberOfTaskSlots: "2" + flinkVersion: v1_17 + image: flink:1.17 + job: + args: [ ] + jarURI: local:///opt/flink/examples/streaming/StateMachineExample.jar + parallelism: 2 + state: running + upgradeMode: stateless + jobManager: + replicas: 1 + resource: + cpu: 1 + memory: 2048m + serviceAccount: flink + taskManager: + resource: + cpu: 1 + memory: 2048m + status: + clusterInfo: + flink-revision: 2750d5c @ 2023-05-19T10:45:46+02:00 + flink-version: 1.17.1 + total-cpu: "2.0" + total-memory: "4294967296" + jobManagerDeploymentStatus: READY + jobStatus: + checkpointInfo: + lastPeriodicCheckpointTimestamp: 0 + jobId: 44cc5573945d1d4925732d915c70b9ac + jobName: Minimal Spec Example + savepointInfo: + lastPeriodicSavepointTimestamp: 0 + savepointHistory: [ ] + startTime: "1717599166365" + state: RUNNING + updateTime: "1717599182544" + lifecycleState: STABLE + observedGeneration: 1 + reconciliationStatus: + lastReconciledSpec: '{"spec":{"job":{"jarURI":"local:///opt/flink/examples/streaming/StateMachineExample.jar","parallelism":2,"entryClass":null,"args":[],"state":"running","savepointTriggerNonce":null,"initialSavepointPath":null,"checkpointTriggerNonce":null,"upgradeMode":"stateless","allowNonRestoredState":null,"savepointRedeployNonce":null},"restartNonce":null,"flinkConfiguration":{"taskmanager.numberOfTaskSlots":"2"},"image":"flink:1.17","imagePullPolicy":null,"serviceAccount":"flink","flinkVersion":"v1_17","ingress":null,"podTemplate":null,"jobManager":{"resource":{"cpu":1.0,"memory":"2048m","ephemeralStorage":null},"replicas":1,"podTemplate":null},"taskManager":{"resource":{"cpu":1.0,"memory":"2048m","ephemeralStorage":null},"replicas":null,"podTemplate":null},"logConfiguration":null,"mode":null},"resource_metadata":{"apiVersion":"flink.apache.org/v1beta1","metadata":{"generation":2},"firstDeployment":true}}' + lastStableSpec: '{"spec":{"job":{"jarURI":"local:///opt/flink/examples/streaming/StateMachineExample.jar","parallelism":2,"entryClass":null,"args":[],"state":"running","savepointTriggerNonce":null,"initialSavepointPath":null,"checkpointTriggerNonce":null,"upgradeMode":"stateless","allowNonRestoredState":null,"savepointRedeployNonce":null},"restartNonce":null,"flinkConfiguration":{"taskmanager.numberOfTaskSlots":"2"},"image":"flink:1.17","imagePullPolicy":null,"serviceAccount":"flink","flinkVersion":"v1_17","ingress":null,"podTemplate":null,"jobManager":{"resource":{"cpu":1.0,"memory":"2048m","ephemeralStorage":null},"replicas":1,"podTemplate":null},"taskManager":{"resource":{"cpu":1.0,"memory":"2048m","ephemeralStorage":null},"replicas":null,"podTemplate":null},"logConfiguration":null,"mode":null},"resource_metadata":{"apiVersion":"flink.apache.org/v1beta1","metadata":{"generation":2},"firstDeployment":true}}' + reconciliationTimestamp: 1717599148930 + state: DEPLOYED + taskManager: + labelSelector: component=taskmanager,app=basic-example + replicas: 1 +operation: InterpretHealth +output: + healthy: true diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/flink.apache.org/v1beta1/FlinkDeployment/testdata/interpretreplica-test.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/flink.apache.org/v1beta1/FlinkDeployment/testdata/interpretreplica-test.yaml new file mode 100644 index 000000000000..7aeb2e756931 --- /dev/null +++ b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/flink.apache.org/v1beta1/FlinkDeployment/testdata/interpretreplica-test.yaml @@ -0,0 +1,78 @@ +# test case for interpreting replica of FlinkDeployment +# case1. FlinkDeployment with taskManager.replicas set to 1 +# case2. FlinkDeployment with taskManager.replicas not set, use parallelism/numberOfTaskSlots + +name: "FlinkDeployment with taskManager.replicas set to 1" +description: "Test interpreting replica of FlinkDeployment when taskManager.replicas is set" +desiredObj: + apiVersion: flink.apache.org/v1beta1 + kind: FlinkDeployment + metadata: + name: basic-example + namespace: test-namespace + spec: + flinkConfiguration: + taskmanager.numberOfTaskSlots: "2" + flinkVersion: v1_17 + image: flink:1.17 + job: + jarURI: local:///opt/flink/examples/streaming/StateMachineExample.jar + parallelism: 2 + upgradeMode: stateless + jobManager: + replicas: 1 + resource: + cpu: 1 + memory: 2048m + mode: native + serviceAccount: flink + taskManager: + replicas: 1 + resource: + cpu: 1 + memory: 2048m +operation: InterpretReplica +output: + replica: 2 + requires: + resourceRequest: + "cpu": "1" + "memory": "2048m" + namespace: "test-namespace" + +--- +name: "FlinkDeployment with taskManager.replicas not set, use parallelism/numberOfTaskSlots" +description: "Test interpreting replica of FlinkDeployment when taskManager.replicas is not set" +desiredObj: + apiVersion: flink.apache.org/v1beta1 + kind: FlinkDeployment + metadata: + namespace: test-namespace + name: basic-example + spec: + image: flink:1.20 + flinkVersion: v1_20 + flinkConfiguration: + taskmanager.numberOfTaskSlots: "2" + serviceAccount: flink + jobManager: + resource: + memory: "2048m" + cpu: 1 + taskManager: + resource: + memory: "2048m" + cpu: 1 + job: + jarURI: local:///opt/flink/examples/streaming/StateMachineExample.jar + parallelism: 10 + upgradeMode: stateless + state: running +operation: InterpretReplica +output: + replica: 6 + requires: + resourceRequest: + "cpu": "1" + "memory": "2048m" + namespace: "test-namespace" diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/flink.apache.org/v1beta1/FlinkDeployment/testdata/interpretstatus-test.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/flink.apache.org/v1beta1/FlinkDeployment/testdata/interpretstatus-test.yaml new file mode 100644 index 000000000000..44aed1f65317 --- /dev/null +++ b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/flink.apache.org/v1beta1/FlinkDeployment/testdata/interpretstatus-test.yaml @@ -0,0 +1,95 @@ +# test case for interpreting status of FlinkDeployment +# case1. FlinkDeployment: interpret status test + +name: "FlinkDeployment: interpret status test" +description: "Test interpreting status for FlinkDeployment" +observedObj: + apiVersion: flink.apache.org/v1beta1 + kind: FlinkDeployment + metadata: + creationTimestamp: "2024-06-05T14:52:28Z" + finalizers: + - flinkdeployments.flink.apache.org/finalizer + generation: 1 + name: basic-example + namespace: test-namespace + resourceVersion: "5053661" + uid: 87ef77ca-7bf0-4998-b275-06f459872e03 + spec: + flinkConfiguration: + taskmanager.numberOfTaskSlots: "2" + flinkVersion: v1_17 + image: flink:1.17 + job: + args: [ ] + jarURI: local:///opt/flink/examples/streaming/StateMachineExample.jar + parallelism: 2 + state: running + upgradeMode: stateless + jobManager: + replicas: 1 + resource: + cpu: 1 + memory: 2048m + serviceAccount: flink + taskManager: + resource: + cpu: 1 + memory: 2048m + status: + clusterInfo: + flink-revision: 2750d5c @ 2023-05-19T10:45:46+02:00 + flink-version: 1.17.1 + total-cpu: "2.0" + total-memory: "4294967296" + jobManagerDeploymentStatus: READY + jobStatus: + checkpointInfo: + lastPeriodicCheckpointTimestamp: 0 + jobId: 44cc5573945d1d4925732d915c70b9ac + jobName: Minimal Spec Example + savepointInfo: + lastPeriodicSavepointTimestamp: 0 + savepointHistory: [ ] + startTime: "1717599166365" + state: RUNNING + updateTime: "1717599182544" + lifecycleState: STABLE + observedGeneration: 1 + reconciliationStatus: + lastReconciledSpec: '{"spec":{"job":{"jarURI":"local:///opt/flink/examples/streaming/StateMachineExample.jar","parallelism":2,"entryClass":null,"args":[],"state":"running","savepointTriggerNonce":null,"initialSavepointPath":null,"checkpointTriggerNonce":null,"upgradeMode":"stateless","allowNonRestoredState":null,"savepointRedeployNonce":null},"restartNonce":null,"flinkConfiguration":{"taskmanager.numberOfTaskSlots":"2"},"image":"flink:1.17","imagePullPolicy":null,"serviceAccount":"flink","flinkVersion":"v1_17","ingress":null,"podTemplate":null,"jobManager":{"resource":{"cpu":1.0,"memory":"2048m","ephemeralStorage":null},"replicas":1,"podTemplate":null},"taskManager":{"resource":{"cpu":1.0,"memory":"2048m","ephemeralStorage":null},"replicas":null,"podTemplate":null},"logConfiguration":null,"mode":null},"resource_metadata":{"apiVersion":"flink.apache.org/v1beta1","metadata":{"generation":2},"firstDeployment":true}}' + lastStableSpec: '{"spec":{"job":{"jarURI":"local:///opt/flink/examples/streaming/StateMachineExample.jar","parallelism":2,"entryClass":null,"args":[],"state":"running","savepointTriggerNonce":null,"initialSavepointPath":null,"checkpointTriggerNonce":null,"upgradeMode":"stateless","allowNonRestoredState":null,"savepointRedeployNonce":null},"restartNonce":null,"flinkConfiguration":{"taskmanager.numberOfTaskSlots":"2"},"image":"flink:1.17","imagePullPolicy":null,"serviceAccount":"flink","flinkVersion":"v1_17","ingress":null,"podTemplate":null,"jobManager":{"resource":{"cpu":1.0,"memory":"2048m","ephemeralStorage":null},"replicas":1,"podTemplate":null},"taskManager":{"resource":{"cpu":1.0,"memory":"2048m","ephemeralStorage":null},"replicas":null,"podTemplate":null},"logConfiguration":null,"mode":null},"resource_metadata":{"apiVersion":"flink.apache.org/v1beta1","metadata":{"generation":2},"firstDeployment":true}}' + reconciliationTimestamp: 1717599148930 + state: DEPLOYED + taskManager: + labelSelector: component=taskmanager,app=basic-example + replicas: 1 +operation: InterpretStatus +output: + status: + clusterInfo: + flink-revision: 2750d5c @ 2023-05-19T10:45:46+02:00 + flink-version: 1.17.1 + total-cpu: "2.0" + total-memory: "4294967296" + jobManagerDeploymentStatus: READY + jobStatus: + checkpointInfo: + lastPeriodicCheckpointTimestamp: 0 + jobId: 44cc5573945d1d4925732d915c70b9ac + jobName: Minimal Spec Example + savepointInfo: + lastPeriodicSavepointTimestamp: 0 + startTime: "1717599166365" + state: RUNNING + updateTime: "1717599182544" + lifecycleState: STABLE + observedGeneration: 1 + reconciliationStatus: + lastReconciledSpec: '{"spec":{"job":{"jarURI":"local:///opt/flink/examples/streaming/StateMachineExample.jar","parallelism":2,"entryClass":null,"args":[],"state":"running","savepointTriggerNonce":null,"initialSavepointPath":null,"checkpointTriggerNonce":null,"upgradeMode":"stateless","allowNonRestoredState":null,"savepointRedeployNonce":null},"restartNonce":null,"flinkConfiguration":{"taskmanager.numberOfTaskSlots":"2"},"image":"flink:1.17","imagePullPolicy":null,"serviceAccount":"flink","flinkVersion":"v1_17","ingress":null,"podTemplate":null,"jobManager":{"resource":{"cpu":1.0,"memory":"2048m","ephemeralStorage":null},"replicas":1,"podTemplate":null},"taskManager":{"resource":{"cpu":1.0,"memory":"2048m","ephemeralStorage":null},"replicas":null,"podTemplate":null},"logConfiguration":null,"mode":null},"resource_metadata":{"apiVersion":"flink.apache.org/v1beta1","metadata":{"generation":2},"firstDeployment":true}}' + lastStableSpec: '{"spec":{"job":{"jarURI":"local:///opt/flink/examples/streaming/StateMachineExample.jar","parallelism":2,"entryClass":null,"args":[],"state":"running","savepointTriggerNonce":null,"initialSavepointPath":null,"checkpointTriggerNonce":null,"upgradeMode":"stateless","allowNonRestoredState":null,"savepointRedeployNonce":null},"restartNonce":null,"flinkConfiguration":{"taskmanager.numberOfTaskSlots":"2"},"image":"flink:1.17","imagePullPolicy":null,"serviceAccount":"flink","flinkVersion":"v1_17","ingress":null,"podTemplate":null,"jobManager":{"resource":{"cpu":1.0,"memory":"2048m","ephemeralStorage":null},"replicas":1,"podTemplate":null},"taskManager":{"resource":{"cpu":1.0,"memory":"2048m","ephemeralStorage":null},"replicas":null,"podTemplate":null},"logConfiguration":null,"mode":null},"resource_metadata":{"apiVersion":"flink.apache.org/v1beta1","metadata":{"generation":2},"firstDeployment":true}}' + reconciliationTimestamp: 1717599148930 + state: DEPLOYED + taskManager: + labelSelector: component=taskmanager,app=basic-example + replicas: 1 diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/flink.apache.org/v1beta1/FlinkDeployment/testdata/observed-flinkdeployment.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/flink.apache.org/v1beta1/FlinkDeployment/testdata/observed-flinkdeployment.yaml deleted file mode 100644 index d31cf4eaa8f4..000000000000 --- a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/flink.apache.org/v1beta1/FlinkDeployment/testdata/observed-flinkdeployment.yaml +++ /dev/null @@ -1,60 +0,0 @@ -apiVersion: flink.apache.org/v1beta1 -kind: FlinkDeployment -metadata: - creationTimestamp: "2024-06-05T14:52:28Z" - finalizers: - - flinkdeployments.flink.apache.org/finalizer - generation: 1 - name: basic-example - namespace: test-namespace - resourceVersion: "5053661" - uid: 87ef77ca-7bf0-4998-b275-06f459872e03 -spec: - flinkConfiguration: - taskmanager.numberOfTaskSlots: "2" - flinkVersion: v1_17 - image: flink:1.17 - job: - args: [] - jarURI: local:///opt/flink/examples/streaming/StateMachineExample.jar - parallelism: 2 - state: running - upgradeMode: stateless - jobManager: - replicas: 1 - resource: - cpu: 1 - memory: 2048m - serviceAccount: flink - taskManager: - resource: - cpu: 1 - memory: 2048m -status: - clusterInfo: - flink-revision: 2750d5c @ 2023-05-19T10:45:46+02:00 - flink-version: 1.17.1 - total-cpu: "2.0" - total-memory: "4294967296" - jobManagerDeploymentStatus: READY - jobStatus: - checkpointInfo: - lastPeriodicCheckpointTimestamp: 0 - jobId: 44cc5573945d1d4925732d915c70b9ac - jobName: Minimal Spec Example - savepointInfo: - lastPeriodicSavepointTimestamp: 0 - savepointHistory: [] - startTime: "1717599166365" - state: RUNNING - updateTime: "1717599182544" - lifecycleState: STABLE - observedGeneration: 1 - reconciliationStatus: - lastReconciledSpec: '{"spec":{"job":{"jarURI":"local:///opt/flink/examples/streaming/StateMachineExample.jar","parallelism":2,"entryClass":null,"args":[],"state":"running","savepointTriggerNonce":null,"initialSavepointPath":null,"checkpointTriggerNonce":null,"upgradeMode":"stateless","allowNonRestoredState":null,"savepointRedeployNonce":null},"restartNonce":null,"flinkConfiguration":{"taskmanager.numberOfTaskSlots":"2"},"image":"flink:1.17","imagePullPolicy":null,"serviceAccount":"flink","flinkVersion":"v1_17","ingress":null,"podTemplate":null,"jobManager":{"resource":{"cpu":1.0,"memory":"2048m","ephemeralStorage":null},"replicas":1,"podTemplate":null},"taskManager":{"resource":{"cpu":1.0,"memory":"2048m","ephemeralStorage":null},"replicas":null,"podTemplate":null},"logConfiguration":null,"mode":null},"resource_metadata":{"apiVersion":"flink.apache.org/v1beta1","metadata":{"generation":2},"firstDeployment":true}}' - lastStableSpec: '{"spec":{"job":{"jarURI":"local:///opt/flink/examples/streaming/StateMachineExample.jar","parallelism":2,"entryClass":null,"args":[],"state":"running","savepointTriggerNonce":null,"initialSavepointPath":null,"checkpointTriggerNonce":null,"upgradeMode":"stateless","allowNonRestoredState":null,"savepointRedeployNonce":null},"restartNonce":null,"flinkConfiguration":{"taskmanager.numberOfTaskSlots":"2"},"image":"flink:1.17","imagePullPolicy":null,"serviceAccount":"flink","flinkVersion":"v1_17","ingress":null,"podTemplate":null,"jobManager":{"resource":{"cpu":1.0,"memory":"2048m","ephemeralStorage":null},"replicas":1,"podTemplate":null},"taskManager":{"resource":{"cpu":1.0,"memory":"2048m","ephemeralStorage":null},"replicas":null,"podTemplate":null},"logConfiguration":null,"mode":null},"resource_metadata":{"apiVersion":"flink.apache.org/v1beta1","metadata":{"generation":2},"firstDeployment":true}}' - reconciliationTimestamp: 1717599148930 - state: DEPLOYED - taskManager: - labelSelector: component=taskmanager,app=basic-example - replicas: 1 diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/flink.apache.org/v1beta1/FlinkDeployment/testdata/status-file.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/flink.apache.org/v1beta1/FlinkDeployment/testdata/status-file.yaml deleted file mode 100644 index 9a5c36808f5c..000000000000 --- a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/flink.apache.org/v1beta1/FlinkDeployment/testdata/status-file.yaml +++ /dev/null @@ -1,31 +0,0 @@ -applied: true -clusterName: member1 -health: Healthy -status: - clusterInfo: - flink-revision: 2750d5c @ 2023-05-19T10:45:46+02:00 - flink-version: 1.17.1 - total-cpu: "2.0" - total-memory: "4294967296" - jobManagerDeploymentStatus: READY - jobStatus: - checkpointInfo: - lastPeriodicCheckpointTimestamp: 0 - jobId: 44cc5573945d1d4925732d915c70b9ac - jobName: Minimal Spec Example - savepointInfo: - lastPeriodicSavepointTimestamp: 0 - savepointHistory: [] - startTime: "1717599166365" - state: RUNNING - updateTime: "1717599182544" - lifecycleState: STABLE - observedGeneration: 1 - reconciliationStatus: - lastReconciledSpec: '{"spec":{"job":{"jarURI":"local:///opt/flink/examples/streaming/StateMachineExample.jar","parallelism":2,"entryClass":null,"args":[],"state":"running","savepointTriggerNonce":null,"initialSavepointPath":null,"checkpointTriggerNonce":null,"upgradeMode":"stateless","allowNonRestoredState":null,"savepointRedeployNonce":null},"restartNonce":null,"flinkConfiguration":{"taskmanager.numberOfTaskSlots":"2"},"image":"flink:1.17","imagePullPolicy":null,"serviceAccount":"flink","flinkVersion":"v1_17","ingress":null,"podTemplate":null,"jobManager":{"resource":{"cpu":1.0,"memory":"2048m","ephemeralStorage":null},"replicas":1,"podTemplate":null},"taskManager":{"resource":{"cpu":1.0,"memory":"2048m","ephemeralStorage":null},"replicas":null,"podTemplate":null},"logConfiguration":null,"mode":null},"resource_metadata":{"apiVersion":"flink.apache.org/v1beta1","metadata":{"generation":2},"firstDeployment":true}}' - lastStableSpec: '{"spec":{"job":{"jarURI":"local:///opt/flink/examples/streaming/StateMachineExample.jar","parallelism":2,"entryClass":null,"args":[],"state":"running","savepointTriggerNonce":null,"initialSavepointPath":null,"checkpointTriggerNonce":null,"upgradeMode":"stateless","allowNonRestoredState":null,"savepointRedeployNonce":null},"restartNonce":null,"flinkConfiguration":{"taskmanager.numberOfTaskSlots":"2"},"image":"flink:1.17","imagePullPolicy":null,"serviceAccount":"flink","flinkVersion":"v1_17","ingress":null,"podTemplate":null,"jobManager":{"resource":{"cpu":1.0,"memory":"2048m","ephemeralStorage":null},"replicas":1,"podTemplate":null},"taskManager":{"resource":{"cpu":1.0,"memory":"2048m","ephemeralStorage":null},"replicas":null,"podTemplate":null},"logConfiguration":null,"mode":null},"resource_metadata":{"apiVersion":"flink.apache.org/v1beta1","metadata":{"generation":2},"firstDeployment":true}}' - reconciliationTimestamp: 1717599148930 - state: DEPLOYED - taskManager: - labelSelector: component=taskmanager,app=basic-example - replicas: 1 diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/helm.toolkit.fluxcd.io/v2beta1/HelmRelease/customizations_tests.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/helm.toolkit.fluxcd.io/v2beta1/HelmRelease/customizations_tests.yaml deleted file mode 100644 index 8ab4aa76aacd..000000000000 --- a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/helm.toolkit.fluxcd.io/v2beta1/HelmRelease/customizations_tests.yaml +++ /dev/null @@ -1,13 +0,0 @@ -tests: - - desiredInputPath: testdata/desired-helmrelease.yaml - statusInputPath: testdata/status-file.yaml - operation: AggregateStatus - - desiredInputPath: testdata/desired-helmrelease.yaml - operation: InterpretDependency - - desiredInputPath: testdata/desired-helmrelease.yaml - observedInputPath: testdata/observed-helmrelease.yaml - operation: Retain - - observedInputPath: testdata/observed-helmrelease.yaml - operation: InterpretHealth - - observedInputPath: testdata/observed-helmrelease.yaml - operation: InterpretStatus diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/helm.toolkit.fluxcd.io/v2beta1/HelmRelease/testdata/aggregatestatus-test.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/helm.toolkit.fluxcd.io/v2beta1/HelmRelease/testdata/aggregatestatus-test.yaml new file mode 100644 index 000000000000..d3e6d17360b1 --- /dev/null +++ b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/helm.toolkit.fluxcd.io/v2beta1/HelmRelease/testdata/aggregatestatus-test.yaml @@ -0,0 +1,75 @@ +# test case for aggregating status of HelmRelease +# case1. HelmRelease with two status items + +name: "HelmRelease with two status items" +description: "Test aggregating status of HelmRelease with two status items" +desiredObj: + apiVersion: helm.toolkit.fluxcd.io/v2beta1 + kind: HelmRelease + metadata: + name: sample + namespace: default + generation: 1 + spec: + interval: 5m + chart: + spec: + chart: "./charts/podinfo" + version: ">=4.0.0 <5.0.0" + sourceRef: + kind: GitRepository + name: podinfo + namespace: default + interval: 1m + test: + enable: true + ignoreFailures: true +statusItems: + - applied: true + clusterName: member1 + health: Healthy + status: + conditions: + - lastTransitionTime: "2023-05-01T07:11:16Z" + message: Release reconciliation succeeded + reason: ReconciliationSucceeded + status: "True" + type: Ready + - lastTransitionTime: "2023-05-01T07:11:16Z" + message: Helm install succeeded + reason: InstallSucceeded + status: "True" + type: Released + generation: 1 + helmChart: test-helmrelease/test-helmrelease-sample + lastAppliedRevision: 6.3.5 + lastAttemptedRevision: 6.3.5 + lastAttemptedValuesChecksum: da39a3ee5e6b4b0d3255bfef95601890afd80709 + lastReleaseRevision: 1 + observedGeneration: 1 + resourceTemplateGeneration: 1 + - applied: true + clusterName: member3 + health: Healthy + status: + conditions: + - lastTransitionTime: "2023-05-01T07:11:17Z" + message: Release reconciliation succeeded + reason: ReconciliationSucceeded + status: "True" + type: Ready + - lastTransitionTime: "2023-05-01T07:11:17Z" + message: Helm install succeeded + reason: InstallSucceeded + status: "True" + type: Released + generation: 1 + helmChart: test-helmrelease/test-helmrelease-sample + lastAppliedRevision: 6.3.5 + lastAttemptedRevision: 6.3.5 + lastAttemptedValuesChecksum: da39a3ee5e6b4b0d3255bfef95601890afd80709 + lastReleaseRevision: 1 + observedGeneration: 1 + resourceTemplateGeneration: 1 +operation: AggregateStatus +output: diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/helm.toolkit.fluxcd.io/v2beta1/HelmRelease/testdata/desired-helmrelease.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/helm.toolkit.fluxcd.io/v2beta1/HelmRelease/testdata/desired-helmrelease.yaml deleted file mode 100644 index 57a7720a7d4f..000000000000 --- a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/helm.toolkit.fluxcd.io/v2beta1/HelmRelease/testdata/desired-helmrelease.yaml +++ /dev/null @@ -1,20 +0,0 @@ -apiVersion: helm.toolkit.fluxcd.io/v2beta1 -kind: HelmRelease -metadata: - name: sample - namespace: default - generation: 1 -spec: - interval: 5m - chart: - spec: - chart: "./charts/podinfo" - version: ">=4.0.0 <5.0.0" - sourceRef: - kind: GitRepository - name: podinfo - namespace: default - interval: 1m - test: - enable: true - ignoreFailures: true diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/helm.toolkit.fluxcd.io/v2beta1/HelmRelease/testdata/interpretstatus-test.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/helm.toolkit.fluxcd.io/v2beta1/HelmRelease/testdata/interpretstatus-test.yaml new file mode 100644 index 000000000000..ee6c2c2cc5b9 --- /dev/null +++ b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/helm.toolkit.fluxcd.io/v2beta1/HelmRelease/testdata/interpretstatus-test.yaml @@ -0,0 +1,59 @@ +# test case for interpreting status of HelmRelease +# case1. HelmRelease: interpret status test + +name: "HelmRelease: interpret status test" +description: "Test interpreting status for HelmRelease" +observedObj: + apiVersion: helm.toolkit.fluxcd.io/v2beta1 + kind: HelmRelease + metadata: + annotations: + resourcetemplate.karmada.io/generation: "1" + name: sample + namespace: default + generation: 1 + spec: + interval: 5m + chart: + spec: + chart: "./charts/podinfo" + version: ">=4.0.0 <5.0.0" + sourceRef: + kind: GitRepository + name: podinfo + namespace: default + interval: 1m + verify: + secretRef: + name: fake-verify-secret + test: + enable: true + ignoreFailures: true + serviceAccountName: fake-sa + kubeConfig: + secretRef: + name: + fake-secret + valuesFrom: + - kind: ConfigMap + name: fake-configmap + status: + conditions: + - lastTransitionTime: "2023-05-01T07:11:16Z" + message: Release reconciliation succeeded + reason: ReconciliationSucceeded + status: "True" + type: Ready + - lastTransitionTime: "2023-05-01T07:11:16Z" + message: Helm install succeeded + reason: InstallSucceeded + status: "True" + type: Released + helmChart: test-helmrelease/test-helmrelease-sample + lastAppliedRevision: 6.3.5 + lastAttemptedRevision: 6.3.5 + lastAttemptedValuesChecksum: da39a3ee5e6b4b0d3255bfef95601890afd80709 + lastReleaseRevision: 1 + observedGeneration: 1 +operation: InterpretStatus +output: diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/helm.toolkit.fluxcd.io/v2beta1/HelmRelease/testdata/observed-helmrelease.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/helm.toolkit.fluxcd.io/v2beta1/HelmRelease/testdata/observed-helmrelease.yaml deleted file mode 100644 index 9fd2eb920c9a..000000000000 --- a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/helm.toolkit.fluxcd.io/v2beta1/HelmRelease/testdata/observed-helmrelease.yaml +++ /dev/null @@ -1,51 +0,0 @@ -apiVersion: helm.toolkit.fluxcd.io/v2beta1 -kind: HelmRelease -metadata: - annotations: - resourcetemplate.karmada.io/generation: "1" - name: sample - namespace: default - generation: 1 -spec: - interval: 5m - chart: - spec: - chart: "./charts/podinfo" - version: ">=4.0.0 <5.0.0" - sourceRef: - kind: GitRepository - name: podinfo - namespace: default - interval: 1m - verify: - secretRef: - name: fake-verify-secret - test: - enable: true - ignoreFailures: true - serviceAccountName: fake-sa - kubeConfig: - secretRef: - name: - fake-secret - valuesFrom: - - kind: ConfigMap - name: fake-configmap -status: - conditions: - - lastTransitionTime: "2023-05-01T07:11:16Z" - message: Release reconciliation succeeded - reason: ReconciliationSucceeded - status: "True" - type: Ready - - lastTransitionTime: "2023-05-01T07:11:16Z" - message: Helm install succeeded - reason: InstallSucceeded - status: "True" - type: Released - helmChart: test-helmrelease/test-helmrelease-sample - lastAppliedRevision: 6.3.5 - lastAttemptedRevision: 6.3.5 - lastAttemptedValuesChecksum: da39a3ee5e6b4b0d3255bfef95601890afd80709 - lastReleaseRevision: 1 - observedGeneration: 1 diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/helm.toolkit.fluxcd.io/v2beta1/HelmRelease/testdata/status-file.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/helm.toolkit.fluxcd.io/v2beta1/HelmRelease/testdata/status-file.yaml deleted file mode 100644 index 9c5724f0e39d..000000000000 --- a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/helm.toolkit.fluxcd.io/v2beta1/HelmRelease/testdata/status-file.yaml +++ /dev/null @@ -1,47 +0,0 @@ -applied: true -clusterName: member1 -health: Healthy -status: - conditions: - - lastTransitionTime: "2023-05-01T07:11:16Z" - message: Release reconciliation succeeded - reason: ReconciliationSucceeded - status: "True" - type: Ready - - lastTransitionTime: "2023-05-01T07:11:16Z" - message: Helm install succeeded - reason: InstallSucceeded - status: "True" - type: Released - generation: 1 - helmChart: test-helmrelease/test-helmrelease-sample - lastAppliedRevision: 6.3.5 - lastAttemptedRevision: 6.3.5 - lastAttemptedValuesChecksum: da39a3ee5e6b4b0d3255bfef95601890afd80709 - lastReleaseRevision: 1 - observedGeneration: 1 - resourceTemplateGeneration: 1 ---- -applied: true -clusterName: member3 -health: Healthy -status: - conditions: - - lastTransitionTime: "2023-05-01T07:11:17Z" - message: Release reconciliation succeeded - reason: ReconciliationSucceeded - status: "True" - type: Ready - - lastTransitionTime: "2023-05-01T07:11:17Z" - message: Helm install succeeded - reason: InstallSucceeded - status: "True" - type: Released - generation: 1 - helmChart: test-helmrelease/test-helmrelease-sample - lastAppliedRevision: 6.3.5 - lastAttemptedRevision: 6.3.5 - lastAttemptedValuesChecksum: da39a3ee5e6b4b0d3255bfef95601890afd80709 - lastReleaseRevision: 1 - observedGeneration: 1 - resourceTemplateGeneration: 1 diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kubeflow.org/v1/Notebook/customizations_tests.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kubeflow.org/v1/Notebook/customizations_tests.yaml deleted file mode 100644 index b939ed1bf531..000000000000 --- a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kubeflow.org/v1/Notebook/customizations_tests.yaml +++ /dev/null @@ -1,8 +0,0 @@ -tests: - - desiredInputPath: testdata/desired-notebook.yaml - statusInputPath: testdata/status-file.yaml - operation: AggregateStatus - - observedInputPath: testdata/observed-notebook.yaml - operation: InterpretHealth - - observedInputPath: testdata/observed-notebook.yaml - operation: InterpretStatus diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kubeflow.org/v1/Notebook/testdata/aggregatestatus-test.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kubeflow.org/v1/Notebook/testdata/aggregatestatus-test.yaml new file mode 100644 index 000000000000..5e6944dfc260 --- /dev/null +++ b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kubeflow.org/v1/Notebook/testdata/aggregatestatus-test.yaml @@ -0,0 +1,53 @@ +# test case for aggregating status of Notebook +# case1. Notebook with two status items + +name: "Notebook with one status item" +description: "Test aggregating status of Notebook with two status items" +desiredObj: + apiVersion: kubeflow.org/v1 + kind: Notebook + metadata: + name: notebook-sample-v1 + spec: + template: + spec: + containers: + - name: notebook-sample-v1 + image: ghcr.io/kubeflow/kubeflow/notebook-servers/jupyter:latest +statusItems: + - status: + conditions: + - lastProbeTime: "2025-10-09T06:58:59Z" + lastTransitionTime: "2025-10-09T06:58:54Z" + status: "True" + type: Initialized + - lastProbeTime: "2025-10-09T06:58:59Z" + lastTransitionTime: "2025-10-09T06:58:59Z" + status: "True" + type: Ready + - lastProbeTime: "2025-10-09T06:58:59Z" + lastTransitionTime: "2025-10-09T06:58:59Z" + status: "True" + type: ContainersReady + - lastProbeTime: "2025-10-09T06:58:59Z" + lastTransitionTime: "2025-10-09T06:58:54Z" + status: "True" + type: PodScheduled + containerState: + running: + startedAt: "2025-10-09T06:58:58Z" + readyReplicas: 1 + - status: + conditions: + - lastProbeTime: "2025-10-24T07:56:35Z" + lastTransitionTime: "2025-10-24T07:56:35Z" + message: '0/6 nodes are available: 1 node(s) had untolerated taint {virtual-kubelet.io/provider: + leinao}, 5 node(s) were unschedulable. preemption: 0/6 nodes are available: + 6 Preemption is not helpful for scheduling.' + reason: Unschedulable + status: "False" + type: PodScheduled + containerState: { } + readyReplicas: 0 +operation: AggregateStatus +output: diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kubeflow.org/v1/Notebook/testdata/desired-notebook.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kubeflow.org/v1/Notebook/testdata/desired-notebook.yaml deleted file mode 100644 index e79a0849a6cd..000000000000 --- a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kubeflow.org/v1/Notebook/testdata/desired-notebook.yaml +++ /dev/null @@ -1,10 +0,0 @@ -apiVersion: kubeflow.org/v1 -kind: Notebook -metadata: - name: notebook-sample-v1 -spec: - template: - spec: - containers: - - name: notebook-sample-v1 - image: ghcr.io/kubeflow/kubeflow/notebook-servers/jupyter:latest diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kubeflow.org/v1/Notebook/testdata/interpretstatus-test.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kubeflow.org/v1/Notebook/testdata/interpretstatus-test.yaml new file mode 100644 index 000000000000..1d10f5624052 --- /dev/null +++ b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kubeflow.org/v1/Notebook/testdata/interpretstatus-test.yaml @@ -0,0 +1,40 @@ +# test case for interpreting status of Notebook +# case1. Notebook: interpret status test + +name: "Notebook: interpret status test" +description: "Test interpreting status for Notebook" +observedObj: + apiVersion: kubeflow.org/v1 + kind: Notebook + metadata: + name: notebook-sample-v1 + spec: + template: + spec: + containers: + - name: notebook-sample-v1 + image: ghcr.io/kubeflow/kubeflow/notebook-servers/jupyter:latest + status: + conditions: + - lastProbeTime: "2025-10-09T06:58:59Z" + lastTransitionTime: "2025-10-09T06:58:54Z" + status: "True" + type: Initialized + - lastProbeTime: "2025-10-09T06:58:59Z" + lastTransitionTime: "2025-10-09T06:58:59Z" + status: "True" + type: Ready + - lastProbeTime: "2025-10-09T06:58:59Z" + lastTransitionTime: "2025-10-09T06:58:59Z" + status: "True" + type: ContainersReady + - lastProbeTime: "2025-10-09T06:58:59Z" + lastTransitionTime: "2025-10-09T06:58:54Z" + status: "True" + type: PodScheduled + containerState: + running: + startedAt: "2025-10-09T06:58:58Z" + readyReplicas: 1 +operation: InterpretStatus +output: diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kubeflow.org/v1/Notebook/testdata/observed-notebook.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kubeflow.org/v1/Notebook/testdata/observed-notebook.yaml deleted file mode 100644 index d8d679abae85..000000000000 --- a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kubeflow.org/v1/Notebook/testdata/observed-notebook.yaml +++ /dev/null @@ -1,32 +0,0 @@ -apiVersion: kubeflow.org/v1 -kind: Notebook -metadata: - name: notebook-sample-v1 -spec: - template: - spec: - containers: - - name: notebook-sample-v1 - image: ghcr.io/kubeflow/kubeflow/notebook-servers/jupyter:latest -status: - conditions: - - lastProbeTime: "2025-10-09T06:58:59Z" - lastTransitionTime: "2025-10-09T06:58:54Z" - status: "True" - type: Initialized - - lastProbeTime: "2025-10-09T06:58:59Z" - lastTransitionTime: "2025-10-09T06:58:59Z" - status: "True" - type: Ready - - lastProbeTime: "2025-10-09T06:58:59Z" - lastTransitionTime: "2025-10-09T06:58:59Z" - status: "True" - type: ContainersReady - - lastProbeTime: "2025-10-09T06:58:59Z" - lastTransitionTime: "2025-10-09T06:58:54Z" - status: "True" - type: PodScheduled - containerState: - running: - startedAt: "2025-10-09T06:58:58Z" - readyReplicas: 1 diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kubeflow.org/v1/Notebook/testdata/status-file.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kubeflow.org/v1/Notebook/testdata/status-file.yaml deleted file mode 100644 index a47ec031d969..000000000000 --- a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kubeflow.org/v1/Notebook/testdata/status-file.yaml +++ /dev/null @@ -1,35 +0,0 @@ -status: - conditions: - - lastProbeTime: "2025-10-09T06:58:59Z" - lastTransitionTime: "2025-10-09T06:58:54Z" - status: "True" - type: Initialized - - lastProbeTime: "2025-10-09T06:58:59Z" - lastTransitionTime: "2025-10-09T06:58:59Z" - status: "True" - type: Ready - - lastProbeTime: "2025-10-09T06:58:59Z" - lastTransitionTime: "2025-10-09T06:58:59Z" - status: "True" - type: ContainersReady - - lastProbeTime: "2025-10-09T06:58:59Z" - lastTransitionTime: "2025-10-09T06:58:54Z" - status: "True" - type: PodScheduled - containerState: - running: - startedAt: "2025-10-09T06:58:58Z" - readyReplicas: 1 ---- -status: - conditions: - - lastProbeTime: "2025-10-24T07:56:35Z" - lastTransitionTime: "2025-10-24T07:56:35Z" - message: '0/6 nodes are available: 1 node(s) had untolerated taint {virtual-kubelet.io/provider: - leinao}, 5 node(s) were unschedulable. preemption: 0/6 nodes are available: - 6 Preemption is not helpful for scheduling.' - reason: Unschedulable - status: "False" - type: PodScheduled - containerState: {} - readyReplicas: 0 diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kubeflow.org/v1/PyTorchJob/customizations_tests.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kubeflow.org/v1/PyTorchJob/customizations_tests.yaml deleted file mode 100644 index f9a3dfa8ba6b..000000000000 --- a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kubeflow.org/v1/PyTorchJob/customizations_tests.yaml +++ /dev/null @@ -1,10 +0,0 @@ -tests: - - desiredInputPath: testdata/desired-pytorchjob.yaml - statusInputPath: testdata/status-file.yaml - operation: AggregateStatus - - observedInputPath: testdata/observed-pytorchjob.yaml - operation: InterpretHealth - - observedInputPath: testdata/observed-pytorchjob.yaml - operation: InterpretComponent - - desiredInputPath: testdata/desired-pytorchjob.yaml - operation: InterpretDependency diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kubeflow.org/v1/PyTorchJob/testdata/aggregatestatus-test.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kubeflow.org/v1/PyTorchJob/testdata/aggregatestatus-test.yaml new file mode 100644 index 000000000000..2eaa619b138d --- /dev/null +++ b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kubeflow.org/v1/PyTorchJob/testdata/aggregatestatus-test.yaml @@ -0,0 +1,122 @@ +# test case for aggregating status of PyTorchJob +# case1. PyTorchJob with two status items + +name: "PyTorchJob with two status items" +description: "Test aggregating status of PyTorchJob with two status items" +desiredObj: + apiVersion: kubeflow.org/v1 + kind: PyTorchJob + metadata: + name: pytorch-simple + namespace: kubeflow + spec: + pytorchReplicaSpecs: + Master: + replicas: 2 + restartPolicy: OnFailure + template: + spec: + containers: + - name: pytorch + image: docker.io/kubeflowkatib/pytorch-mnist:v1beta1-45c5727 + imagePullPolicy: Always + command: + - "python3" + - "/opt/pytorch-mnist/mnist.py" + - "--epochs=1" + resources: + limits: + cpu: 1 + memory: 512Mi + Worker: + replicas: 2 + restartPolicy: OnFailure + template: + spec: + serviceAccountName: pytorch-service-account + containers: + - name: pytorch + image: docker.io/kubeflowkatib/pytorch-mnist:v1beta1-45c5727 + imagePullPolicy: Always + volumeMounts: + - mountPath: "/train" + name: "training" + command: + - "python3" + - "/opt/pytorch-mnist/mnist.py" + - "--epochs=1" + resources: + limits: + cpu: 1 + memory: 512Mi + volumes: + - name: "training" + persistentVolumeClaim: + claimName: "training-data" +statusItems: + - applied: true + clusterName: member1 + health: Healthy + status: + completionTime: "2025-10-13T11:48:12Z" + conditions: + - lastTransitionTime: "2025-10-13T11:46:42Z" + lastUpdateTime: "2025-10-13T11:46:42Z" + message: PyTorchJob pytorch-simple is created. + reason: PyTorchJobCreated + status: "True" + type: Created + - lastTransitionTime: "2025-10-13T11:47:40Z" + lastUpdateTime: "2025-10-13T11:47:40Z" + message: PyTorchJob pytorch-simple is running. + reason: PyTorchJobRunning + status: "False" + type: Running + - lastTransitionTime: "2025-10-13T11:48:12Z" + lastUpdateTime: "2025-10-13T11:48:12Z" + message: PyTorchJob pytorch-simple is successfully completed. + reason: PyTorchJobSucceeded + status: "True" + type: Succeeded + replicaStatuses: + Master: + selector: training.kubeflow.org/job-name=pytorch-simple,training.kubeflow.org/operator-name=pytorchjob-controller,training.kubeflow.org/replica-type=master + succeeded: 1 + Worker: + selector: training.kubeflow.org/job-name=pytorch-simple,training.kubeflow.org/operator-name=pytorchjob-controller,training.kubeflow.org/replica-type=worker + succeeded: 1 + startTime: "2025-10-13T11:46:42Z" + - applied: true + clusterName: member2 + health: Healthy + status: + completionTime: "2025-10-13T11:48:12Z" + conditions: + - lastTransitionTime: "2025-10-13T11:46:42Z" + lastUpdateTime: "2025-10-13T11:46:42Z" + message: PyTorchJob pytorch-simple is created. + reason: PyTorchJobCreated + status: "True" + type: Created + - lastTransitionTime: "2025-10-13T11:47:40Z" + lastUpdateTime: "2025-10-13T11:47:40Z" + message: PyTorchJob pytorch-simple is running. + reason: PyTorchJobRunning + status: "False" + type: Running + - lastTransitionTime: "2025-10-13T11:48:12Z" + lastUpdateTime: "2025-10-13T11:48:12Z" + message: PyTorchJob pytorch-simple is successfully completed. + reason: PyTorchJobSucceeded + status: "True" + type: Succeeded + replicaStatuses: + Master: + selector: training.kubeflow.org/job-name=pytorch-simple,training.kubeflow.org/operator-name=pytorchjob-controller,training.kubeflow.org/replica-type=master + succeeded: 1 + Worker: + selector: training.kubeflow.org/job-name=pytorch-simple,training.kubeflow.org/operator-name=pytorchjob-controller,training.kubeflow.org/replica-type=worker + succeeded: 1 + startTime: "2025-10-13T11:46:42Z" +operation: AggregateStatus +output: diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kubeflow.org/v1/PyTorchJob/testdata/desired-pytorchjob.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kubeflow.org/v1/PyTorchJob/testdata/desired-pytorchjob.yaml deleted file mode 100644 index ec9ecc3c522e..000000000000 --- a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kubeflow.org/v1/PyTorchJob/testdata/desired-pytorchjob.yaml +++ /dev/null @@ -1,49 +0,0 @@ -apiVersion: kubeflow.org/v1 -kind: PyTorchJob -metadata: - name: pytorch-simple - namespace: kubeflow -spec: - pytorchReplicaSpecs: - Master: - replicas: 2 - restartPolicy: OnFailure - template: - spec: - containers: - - name: pytorch - image: docker.io/kubeflowkatib/pytorch-mnist:v1beta1-45c5727 - imagePullPolicy: Always - command: - - "python3" - - "/opt/pytorch-mnist/mnist.py" - - "--epochs=1" - resources: - limits: - cpu: 1 - memory: 512Mi - Worker: - replicas: 2 - restartPolicy: OnFailure - template: - spec: - serviceAccountName: pytorch-service-account - containers: - - name: pytorch - image: docker.io/kubeflowkatib/pytorch-mnist:v1beta1-45c5727 - imagePullPolicy: Always - volumeMounts: - - mountPath: "/train" - name: "training" - command: - - "python3" - - "/opt/pytorch-mnist/mnist.py" - - "--epochs=1" - resources: - limits: - cpu: 1 - memory: 512Mi - volumes: - - name: "training" - persistentVolumeClaim: - claimName: "training-data" diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kubeflow.org/v1/PyTorchJob/testdata/interprethealth-test.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kubeflow.org/v1/PyTorchJob/testdata/interprethealth-test.yaml new file mode 100644 index 000000000000..f76663e5d482 --- /dev/null +++ b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kubeflow.org/v1/PyTorchJob/testdata/interprethealth-test.yaml @@ -0,0 +1,86 @@ +# test case for interpreting health of PyTorchJob +# case1. PyTorchJob interpreting health test + +name: "PyTorchJob interpreting health test" +description: "Test interpreting health of PyTorchJob" +observedObj: + apiVersion: kubeflow.org/v1 + kind: PyTorchJob + metadata: + name: pytorch-simple + namespace: kubeflow + spec: + pytorchReplicaSpecs: + Master: + replicas: 2 + restartPolicy: OnFailure + template: + spec: + containers: + - name: pytorch + image: docker.io/kubeflowkatib/pytorch-mnist:v1beta1-45c5727 + imagePullPolicy: Always + command: + - "python3" + - "/opt/pytorch-mnist/mnist.py" + - "--epochs=1" + resources: + limits: + cpu: 1 + memory: 512Mi + Worker: + replicas: 2 + restartPolicy: OnFailure + template: + spec: + serviceAccountName: pytorch-service-account + containers: + - name: pytorch + image: docker.io/kubeflowkatib/pytorch-mnist:v1beta1-45c5727 + imagePullPolicy: Always + volumeMounts: + - mountPath: "/train" + name: "training" + command: + - "python3" + - "/opt/pytorch-mnist/mnist.py" + - "--epochs=1" + resources: + limits: + cpu: 1 + memory: 512Mi + volumes: + - name: "training" + persistentVolumeClaim: + claimName: "training-data" + status: + completionTime: "2025-10-13T11:48:12Z" + conditions: + - lastTransitionTime: "2025-10-13T11:46:42Z" + lastUpdateTime: "2025-10-13T11:46:42Z" + message: PyTorchJob pytorch-simple is created. + reason: PyTorchJobCreated + status: "True" + type: Created + - lastTransitionTime: "2025-10-13T11:47:40Z" + lastUpdateTime: "2025-10-13T11:47:40Z" + message: PyTorchJob pytorch-simple is running. + reason: PyTorchJobRunning + status: "False" + type: Running + - lastTransitionTime: "2025-10-13T11:48:12Z" + lastUpdateTime: "2025-10-13T11:48:12Z" + message: PyTorchJob pytorch-simple is successfully completed. + reason: PyTorchJobSucceeded + status: "True" + type: Succeeded + replicaStatuses: + Master: + selector: training.kubeflow.org/job-name=pytorch-simple,training.kubeflow.org/operator-name=pytorchjob-controller,training.kubeflow.org/replica-type=master + succeeded: 1 + Worker: + selector: training.kubeflow.org/job-name=pytorch-simple,training.kubeflow.org/operator-name=pytorchjob-controller,training.kubeflow.org/replica-type=worker + succeeded: 1 + startTime: "2025-10-13T11:46:42Z" +operation: InterpretHealth +output: diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kubeflow.org/v1/PyTorchJob/testdata/observed-pytorchjob.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kubeflow.org/v1/PyTorchJob/testdata/observed-pytorchjob.yaml deleted file mode 100644 index 06ac257b60ab..000000000000 --- a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kubeflow.org/v1/PyTorchJob/testdata/observed-pytorchjob.yaml +++ /dev/null @@ -1,78 +0,0 @@ -apiVersion: kubeflow.org/v1 -kind: PyTorchJob -metadata: - name: pytorch-simple - namespace: kubeflow -spec: - pytorchReplicaSpecs: - Master: - replicas: 2 - restartPolicy: OnFailure - template: - spec: - containers: - - name: pytorch - image: docker.io/kubeflowkatib/pytorch-mnist:v1beta1-45c5727 - imagePullPolicy: Always - command: - - "python3" - - "/opt/pytorch-mnist/mnist.py" - - "--epochs=1" - resources: - limits: - cpu: 1 - memory: 512Mi - Worker: - replicas: 2 - restartPolicy: OnFailure - template: - spec: - serviceAccountName: pytorch-service-account - containers: - - name: pytorch - image: docker.io/kubeflowkatib/pytorch-mnist:v1beta1-45c5727 - imagePullPolicy: Always - volumeMounts: - - mountPath: "/train" - name: "training" - command: - - "python3" - - "/opt/pytorch-mnist/mnist.py" - - "--epochs=1" - resources: - limits: - cpu: 1 - memory: 512Mi - volumes: - - name: "training" - persistentVolumeClaim: - claimName: "training-data" -status: - completionTime: "2025-10-13T11:48:12Z" - conditions: - - lastTransitionTime: "2025-10-13T11:46:42Z" - lastUpdateTime: "2025-10-13T11:46:42Z" - message: PyTorchJob pytorch-simple is created. - reason: PyTorchJobCreated - status: "True" - type: Created - - lastTransitionTime: "2025-10-13T11:47:40Z" - lastUpdateTime: "2025-10-13T11:47:40Z" - message: PyTorchJob pytorch-simple is running. - reason: PyTorchJobRunning - status: "False" - type: Running - - lastTransitionTime: "2025-10-13T11:48:12Z" - lastUpdateTime: "2025-10-13T11:48:12Z" - message: PyTorchJob pytorch-simple is successfully completed. - reason: PyTorchJobSucceeded - status: "True" - type: Succeeded - replicaStatuses: - Master: - selector: training.kubeflow.org/job-name=pytorch-simple,training.kubeflow.org/operator-name=pytorchjob-controller,training.kubeflow.org/replica-type=master - succeeded: 1 - Worker: - selector: training.kubeflow.org/job-name=pytorch-simple,training.kubeflow.org/operator-name=pytorchjob-controller,training.kubeflow.org/replica-type=worker - succeeded: 1 - startTime: "2025-10-13T11:46:42Z" diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kubeflow.org/v1/PyTorchJob/testdata/status-file.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kubeflow.org/v1/PyTorchJob/testdata/status-file.yaml deleted file mode 100644 index 93aac9b01482..000000000000 --- a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kubeflow.org/v1/PyTorchJob/testdata/status-file.yaml +++ /dev/null @@ -1,65 +0,0 @@ -applied: true -clusterName: member1 -health: Healthy -status: - completionTime: "2025-10-13T11:48:12Z" - conditions: - - lastTransitionTime: "2025-10-13T11:46:42Z" - lastUpdateTime: "2025-10-13T11:46:42Z" - message: PyTorchJob pytorch-simple is created. - reason: PyTorchJobCreated - status: "True" - type: Created - - lastTransitionTime: "2025-10-13T11:47:40Z" - lastUpdateTime: "2025-10-13T11:47:40Z" - message: PyTorchJob pytorch-simple is running. - reason: PyTorchJobRunning - status: "False" - type: Running - - lastTransitionTime: "2025-10-13T11:48:12Z" - lastUpdateTime: "2025-10-13T11:48:12Z" - message: PyTorchJob pytorch-simple is successfully completed. - reason: PyTorchJobSucceeded - status: "True" - type: Succeeded - replicaStatuses: - Master: - selector: training.kubeflow.org/job-name=pytorch-simple,training.kubeflow.org/operator-name=pytorchjob-controller,training.kubeflow.org/replica-type=master - succeeded: 1 - Worker: - selector: training.kubeflow.org/job-name=pytorch-simple,training.kubeflow.org/operator-name=pytorchjob-controller,training.kubeflow.org/replica-type=worker - succeeded: 1 - startTime: "2025-10-13T11:46:42Z" ---- -applied: true -clusterName: member2 -health: Healthy -status: - completionTime: "2025-10-13T11:48:12Z" - conditions: - - lastTransitionTime: "2025-10-13T11:46:42Z" - lastUpdateTime: "2025-10-13T11:46:42Z" - message: PyTorchJob pytorch-simple is created. - reason: PyTorchJobCreated - status: "True" - type: Created - - lastTransitionTime: "2025-10-13T11:47:40Z" - lastUpdateTime: "2025-10-13T11:47:40Z" - message: PyTorchJob pytorch-simple is running. - reason: PyTorchJobRunning - status: "False" - type: Running - - lastTransitionTime: "2025-10-13T11:48:12Z" - lastUpdateTime: "2025-10-13T11:48:12Z" - message: PyTorchJob pytorch-simple is successfully completed. - reason: PyTorchJobSucceeded - status: "True" - type: Succeeded - replicaStatuses: - Master: - selector: training.kubeflow.org/job-name=pytorch-simple,training.kubeflow.org/operator-name=pytorchjob-controller,training.kubeflow.org/replica-type=master - succeeded: 1 - Worker: - selector: training.kubeflow.org/job-name=pytorch-simple,training.kubeflow.org/operator-name=pytorchjob-controller,training.kubeflow.org/replica-type=worker - succeeded: 1 - startTime: "2025-10-13T11:46:42Z" diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kubeflow.org/v1/TFJob/customizations_tests.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kubeflow.org/v1/TFJob/customizations_tests.yaml deleted file mode 100644 index 6be5e9b13a68..000000000000 --- a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kubeflow.org/v1/TFJob/customizations_tests.yaml +++ /dev/null @@ -1,10 +0,0 @@ -tests: - - desiredInputPath: testdata/desired-tfjob.yaml - statusInputPath: testdata/status-file.yaml - operation: AggregateStatus - - observedInputPath: testdata/observed-tfjob.yaml - operation: InterpretHealth - - observedInputPath: testdata/observed-tfjob.yaml - operation: InterpretComponent - - desiredInputPath: testdata/desired-tfjob.yaml - operation: InterpretDependency diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kubeflow.org/v1/TFJob/testdata/aggregatestatus-test.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kubeflow.org/v1/TFJob/testdata/aggregatestatus-test.yaml new file mode 100644 index 000000000000..95662414cf5d --- /dev/null +++ b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kubeflow.org/v1/TFJob/testdata/aggregatestatus-test.yaml @@ -0,0 +1,105 @@ +# test case for aggregating status of TFJob +# case1. TFJob with two status items + +name: "TFJob with two status items" +description: "Test aggregating status of TFJob with two status items" +desiredObj: + apiVersion: kubeflow.org/v1 + kind: TFJob + metadata: + name: dist-mnist-for-e2e-test + namespace: default + spec: + tfReplicaSpecs: + PS: + replicas: 2 + restartPolicy: Never + template: + spec: + containers: + - image: kubeflow/tf-dist-mnist-test:latest + name: tensorflow + resources: + limits: + cpu: 1 + memory: 512Mi + Worker: + replicas: 4 + restartPolicy: Never + template: + spec: + containers: + - image: kubeflow/tf-dist-mnist-test:latest + name: tensorflow + volumeMounts: + - mountPath: "/train" + name: "training" + resources: + limits: + cpu: 1 + memory: 512Mi + volumes: + - name: "training" + persistentVolumeClaim: + claimName: "training-data" +statusItems: + - applied: true + clusterName: member1 + health: Healthy + status: + completionTime: "2025-11-22T10:49:40Z" + conditions: + - lastTransitionTime: "2025-11-22T10:48:50Z" + lastUpdateTime: "2025-11-22T10:48:50Z" + message: TFJob dist-mnist-for-e2e-test is created. + reason: TFJobCreated + status: "True" + type: Created + - lastTransitionTime: "2025-11-22T10:49:24Z" + lastUpdateTime: "2025-11-22T10:49:24Z" + message: TFJob default/dist-mnist-for-e2e-test is running. + reason: TFJobRunning + status: "False" + type: Running + - lastTransitionTime: "2025-11-22T10:49:40Z" + lastUpdateTime: "2025-11-22T10:49:40Z" + message: TFJob default/dist-mnist-for-e2e-test successfully completed. + reason: TFJobSucceeded + status: "True" + type: Succeeded + replicaStatuses: + PS: + succeeded: 1 + Worker: + succeeded: 2 + - applied: true + clusterName: member2 + health: Healthy + status: + completionTime: "2025-11-22T10:49:40Z" + conditions: + - lastTransitionTime: "2025-11-22T10:48:50Z" + lastUpdateTime: "2025-11-22T10:48:50Z" + message: TFJob dist-mnist-for-e2e-test is created. + reason: TFJobCreated + status: "True" + type: Created + - lastTransitionTime: "2025-11-22T10:49:24Z" + lastUpdateTime: "2025-11-22T10:49:24Z" + message: TFJob default/dist-mnist-for-e2e-test is running. + reason: TFJobRunning + status: "False" + type: Running + - lastTransitionTime: "2025-11-22T10:49:40Z" + lastUpdateTime: "2025-11-22T10:49:40Z" + message: TFJob default/dist-mnist-for-e2e-test successfully completed. + reason: TFJobSucceeded + status: "True" + type: Succeeded + replicaStatuses: + PS: + succeeded: 1 + Worker: + succeeded: 2 +operation: AggregateStatus +output: diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kubeflow.org/v1/TFJob/testdata/desired-tfjob.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kubeflow.org/v1/TFJob/testdata/desired-tfjob.yaml deleted file mode 100644 index f007a209930d..000000000000 --- a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kubeflow.org/v1/TFJob/testdata/desired-tfjob.yaml +++ /dev/null @@ -1,38 +0,0 @@ -apiVersion: kubeflow.org/v1 -kind: TFJob -metadata: - name: dist-mnist-for-e2e-test - namespace: default -spec: - tfReplicaSpecs: - PS: - replicas: 2 - restartPolicy: Never - template: - spec: - containers: - - image: kubeflow/tf-dist-mnist-test:latest - name: tensorflow - resources: - limits: - cpu: 1 - memory: 512Mi - Worker: - replicas: 4 - restartPolicy: Never - template: - spec: - containers: - - image: kubeflow/tf-dist-mnist-test:latest - name: tensorflow - volumeMounts: - - mountPath: "/train" - name: "training" - resources: - limits: - cpu: 1 - memory: 512Mi - volumes: - - name: "training" - persistentVolumeClaim: - claimName: "training-data" diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kubeflow.org/v1/TFJob/testdata/interprethealth-test.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kubeflow.org/v1/TFJob/testdata/interprethealth-test.yaml new file mode 100644 index 000000000000..840c1a3195cb --- /dev/null +++ b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kubeflow.org/v1/TFJob/testdata/interprethealth-test.yaml @@ -0,0 +1,76 @@ +# test case for interpreting health of TFJob +# case1. TFJob interpreting health test + +name: "TFJob interpreting health test" +description: "Test interpreting health of TFJob" +observedObj: + apiVersion: kubeflow.org/v1 + kind: TFJob + metadata: + name: dist-mnist-for-e2e-test + namespace: default + spec: + tfReplicaSpecs: + PS: + replicas: 2 + restartPolicy: Never + template: + spec: + containers: + - image: kubeflow/tf-dist-mnist-test:latest + name: tensorflow + resources: + limits: + cpu: 1 + memory: 512Mi + Worker: + replicas: 4 + restartPolicy: Never + template: + spec: + containers: + - command: + - bash + - -c + - sleep 15s + image: kubeflow/tf-dist-mnist-test:latest + name: tensorflow + volumeMounts: + - mountPath: "/train" + name: "training" + resources: + limits: + cpu: 1 + memory: 512Mi + volumes: + - name: "training" + persistentVolumeClaim: + claimName: "training-data" + status: + completionTime: "2025-11-22T10:49:40Z" + conditions: + - lastTransitionTime: "2025-11-22T10:48:50Z" + lastUpdateTime: "2025-11-22T10:48:50Z" + message: TFJob dist-mnist-for-e2e-test is created. + reason: TFJobCreated + status: "True" + type: Created + - lastTransitionTime: "2025-11-22T10:49:24Z" + lastUpdateTime: "2025-11-22T10:49:24Z" + message: TFJob default/dist-mnist-for-e2e-test is running. + reason: TFJobRunning + status: "False" + type: Running + - lastTransitionTime: "2025-11-22T10:49:40Z" + lastUpdateTime: "2025-11-22T10:49:40Z" + message: TFJob default/dist-mnist-for-e2e-test successfully completed. + reason: TFJobSucceeded + status: "True" + type: Succeeded + replicaStatuses: + PS: + succeeded: 2 + Worker: + succeeded: 4 +operation: InterpretHealth +output: diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kubeflow.org/v1/TFJob/testdata/observed-tfjob.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kubeflow.org/v1/TFJob/testdata/observed-tfjob.yaml deleted file mode 100644 index 81a9a9f6a2a3..000000000000 --- a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kubeflow.org/v1/TFJob/testdata/observed-tfjob.yaml +++ /dev/null @@ -1,68 +0,0 @@ -apiVersion: kubeflow.org/v1 -kind: TFJob -metadata: - name: dist-mnist-for-e2e-test - namespace: default -spec: - tfReplicaSpecs: - PS: - replicas: 2 - restartPolicy: Never - template: - spec: - containers: - - image: kubeflow/tf-dist-mnist-test:latest - name: tensorflow - resources: - limits: - cpu: 1 - memory: 512Mi - Worker: - replicas: 4 - restartPolicy: Never - template: - spec: - containers: - - command: - - bash - - -c - - sleep 15s - image: kubeflow/tf-dist-mnist-test:latest - name: tensorflow - volumeMounts: - - mountPath: "/train" - name: "training" - resources: - limits: - cpu: 1 - memory: 512Mi - volumes: - - name: "training" - persistentVolumeClaim: - claimName: "training-data" -status: - completionTime: "2025-11-22T10:49:40Z" - conditions: - - lastTransitionTime: "2025-11-22T10:48:50Z" - lastUpdateTime: "2025-11-22T10:48:50Z" - message: TFJob dist-mnist-for-e2e-test is created. - reason: TFJobCreated - status: "True" - type: Created - - lastTransitionTime: "2025-11-22T10:49:24Z" - lastUpdateTime: "2025-11-22T10:49:24Z" - message: TFJob default/dist-mnist-for-e2e-test is running. - reason: TFJobRunning - status: "False" - type: Running - - lastTransitionTime: "2025-11-22T10:49:40Z" - lastUpdateTime: "2025-11-22T10:49:40Z" - message: TFJob default/dist-mnist-for-e2e-test successfully completed. - reason: TFJobSucceeded - status: "True" - type: Succeeded - replicaStatuses: - PS: - succeeded: 2 - Worker: - succeeded: 4 diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kubeflow.org/v1/TFJob/testdata/status-file.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kubeflow.org/v1/TFJob/testdata/status-file.yaml deleted file mode 100644 index 480f2c0413a1..000000000000 --- a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kubeflow.org/v1/TFJob/testdata/status-file.yaml +++ /dev/null @@ -1,59 +0,0 @@ -applied: true -clusterName: member1 -health: Healthy -status: - completionTime: "2025-11-22T10:49:40Z" - conditions: - - lastTransitionTime: "2025-11-22T10:48:50Z" - lastUpdateTime: "2025-11-22T10:48:50Z" - message: TFJob dist-mnist-for-e2e-test is created. - reason: TFJobCreated - status: "True" - type: Created - - lastTransitionTime: "2025-11-22T10:49:24Z" - lastUpdateTime: "2025-11-22T10:49:24Z" - message: TFJob default/dist-mnist-for-e2e-test is running. - reason: TFJobRunning - status: "False" - type: Running - - lastTransitionTime: "2025-11-22T10:49:40Z" - lastUpdateTime: "2025-11-22T10:49:40Z" - message: TFJob default/dist-mnist-for-e2e-test successfully completed. - reason: TFJobSucceeded - status: "True" - type: Succeeded - replicaStatuses: - PS: - succeeded: 1 - Worker: - succeeded: 2 ---- -applied: true -clusterName: member2 -health: Healthy -status: - completionTime: "2025-11-22T10:49:40Z" - conditions: - - lastTransitionTime: "2025-11-22T10:48:50Z" - lastUpdateTime: "2025-11-22T10:48:50Z" - message: TFJob dist-mnist-for-e2e-test is created. - reason: TFJobCreated - status: "True" - type: Created - - lastTransitionTime: "2025-11-22T10:49:24Z" - lastUpdateTime: "2025-11-22T10:49:24Z" - message: TFJob default/dist-mnist-for-e2e-test is running. - reason: TFJobRunning - status: "False" - type: Running - - lastTransitionTime: "2025-11-22T10:49:40Z" - lastUpdateTime: "2025-11-22T10:49:40Z" - message: TFJob default/dist-mnist-for-e2e-test successfully completed. - reason: TFJobSucceeded - status: "True" - type: Succeeded - replicaStatuses: - PS: - succeeded: 1 - Worker: - succeeded: 2 diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kubeflow.org/v2beta1/MPIJob/customizations_tests.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kubeflow.org/v2beta1/MPIJob/customizations_tests.yaml deleted file mode 100644 index b6d08fbeb11f..000000000000 --- a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kubeflow.org/v2beta1/MPIJob/customizations_tests.yaml +++ /dev/null @@ -1,8 +0,0 @@ -tests: - - desiredInputPath: testdata/desired-mpijob.yaml - statusInputPath: testdata/status-file.yaml - operation: AggregateStatus - - observedInputPath: testdata/observed-mpijob.yaml - operation: InterpretHealth - - observedInputPath: testdata/observed-mpijob.yaml - operation: InterpretStatus diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kubeflow.org/v2beta1/MPIJob/testdata/aggregatestatus-test.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kubeflow.org/v2beta1/MPIJob/testdata/aggregatestatus-test.yaml new file mode 100644 index 000000000000..f50247c92997 --- /dev/null +++ b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kubeflow.org/v2beta1/MPIJob/testdata/aggregatestatus-test.yaml @@ -0,0 +1,132 @@ +# test case for aggregating status of MPIJob +# case1. MPIJob with three status items + +name: "MPIJob with three status items" +description: "Test aggregating status of MPIJob with three status items" +desiredObj: + apiVersion: kubeflow.org/v2beta1 + kind: MPIJob + metadata: + name: tensorflow-benchmarks + spec: + slotsPerWorker: 1 + runPolicy: + cleanPodPolicy: Running + mpiReplicaSpecs: + Launcher: + replicas: 1 + template: + spec: + containers: + - image: mpioperator/tensorflow-benchmarks:latest + name: tensorflow-benchmarks + command: + - mpirun + - --allow-run-as-root + - -np + - "2" + - -bind-to + - none + - -map-by + - slot + - -x + - NCCL_DEBUG=INFO + - -x + - LD_LIBRARY_PATH + - -x + - PATH + - -mca + - pml + - ob1 + - -mca + - btl + - ^openib + - python + - scripts/tf_cnn_benchmarks/tf_cnn_benchmarks.py + - --model=resnet101 + - --batch_size=64 + - --variable_update=horovod + Worker: + replicas: 2 + template: + spec: + containers: + - image: mpioperator/tensorflow-benchmarks:latest + name: tensorflow-benchmarks + resources: + limits: + nvidia.com/gpu: 1 +statusItems: + - applied: true + clusterName: member1 + health: Healthy + status: + startTime: "2019-07-10T10:00:00Z" + conditions: + - lastTransitionTime: "2019-07-10T10:00:00Z" + lastUpdateTime: "2019-07-10T10:00:00Z" + message: MPIJob default/tensorflow-benchmarks is created. + reason: MPIJobCreated + status: "True" + type: Created + - lastTransitionTime: "2019-07-10T10:01:00Z" + lastUpdateTime: "2019-07-10T10:01:00Z" + message: MPIJob default/tensorflow-benchmarks is running. + reason: MPIJobRunning + status: "True" + type: Running + replicaStatuses: + Launcher: + active: 1 + Worker: + active: 2 + - applied: true + clusterName: member2 + health: Unhealthy + status: + completionTime: "2019-07-11T12:00:00Z" + startTime: "2019-07-11T11:30:00Z" + conditions: + - lastTransitionTime: "2019-07-11T11:30:00Z" + lastUpdateTime: "2019-07-11T11:30:00Z" + message: MPIJob default/tensorflow-benchmarks is created. + reason: MPIJobCreated + status: "True" + type: Created + - lastTransitionTime: "2019-07-11T11:45:00Z" + lastUpdateTime: "2019-07-11T11:45:00Z" + message: MPIJob default/tensorflow-benchmarks failed during execution. + reason: MPIJobFailed + status: "True" + type: Failed + replicaStatuses: + Launcher: + failed: 1 + Worker: + failed: 2 + - applied: true + clusterName: member3 + health: Healthy + status: + startTime: "2019-07-12T08:00:00Z" + conditions: + - lastTransitionTime: "2019-07-12T08:00:00Z" + lastUpdateTime: "2019-07-12T08:00:00Z" + message: MPIJob default/tensorflow-benchmarks is created. + reason: MPIJobCreated + status: "True" + type: Created + - lastTransitionTime: "2019-07-12T08:05:00Z" + lastUpdateTime: "2019-07-12T08:05:00Z" + message: MPIJob default/tensorflow-benchmarks running with partial successes. + reason: MPIJobRunning + status: "True" + type: Running + replicaStatuses: + Launcher: + active: 1 + Worker: + active: 1 + succeeded: 1 +operation: AggregateStatus +output: diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kubeflow.org/v2beta1/MPIJob/testdata/desired-mpijob.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kubeflow.org/v2beta1/MPIJob/testdata/desired-mpijob.yaml deleted file mode 100644 index b140445268c5..000000000000 --- a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kubeflow.org/v2beta1/MPIJob/testdata/desired-mpijob.yaml +++ /dev/null @@ -1,52 +0,0 @@ -apiVersion: kubeflow.org/v2beta1 -kind: MPIJob -metadata: - name: tensorflow-benchmarks -spec: - slotsPerWorker: 1 - runPolicy: - cleanPodPolicy: Running - mpiReplicaSpecs: - Launcher: - replicas: 1 - template: - spec: - containers: - - image: mpioperator/tensorflow-benchmarks:latest - name: tensorflow-benchmarks - command: - - mpirun - - --allow-run-as-root - - -np - - "2" - - -bind-to - - none - - -map-by - - slot - - -x - - NCCL_DEBUG=INFO - - -x - - LD_LIBRARY_PATH - - -x - - PATH - - -mca - - pml - - ob1 - - -mca - - btl - - ^openib - - python - - scripts/tf_cnn_benchmarks/tf_cnn_benchmarks.py - - --model=resnet101 - - --batch_size=64 - - --variable_update=horovod - Worker: - replicas: 2 - template: - spec: - containers: - - image: mpioperator/tensorflow-benchmarks:latest - name: tensorflow-benchmarks - resources: - limits: - nvidia.com/gpu: 1 diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kubeflow.org/v2beta1/MPIJob/testdata/interpretstatus-test.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kubeflow.org/v2beta1/MPIJob/testdata/interpretstatus-test.yaml new file mode 100644 index 000000000000..e1df8394fb90 --- /dev/null +++ b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kubeflow.org/v2beta1/MPIJob/testdata/interpretstatus-test.yaml @@ -0,0 +1,92 @@ +# test case for interpreting status of MPIJob +# case1. MPIJob: interpret status test + +name: "MPIJob: interpret status test" +description: "Test interpreting status for MPIJob" +observedObj: + apiVersion: kubeflow.org/v2beta1 + kind: MPIJob + metadata: + creationTimestamp: "2019-07-09T22:15:51Z" + generation: 1 + name: tensorflow-benchmarks + namespace: default + resourceVersion: "5645868" + selfLink: /apis/kubeflow.org/v2beta1/namespaces/default/mpijobs/tensorflow-benchmarks + uid: 1c5b470f-a297-11e9-964d-88d7f67c6e6d + spec: + runPolicy: + cleanPodPolicy: Running + mpiReplicaSpecs: + Launcher: + replicas: 1 + template: + spec: + containers: + - command: + - mpirun + - --allow-run-as-root + - -np + - "2" + - -bind-to + - none + - -map-by + - slot + - -x + - NCCL_DEBUG=INFO + - -x + - LD_LIBRARY_PATH + - -x + - PATH + - -mca + - pml + - ob1 + - -mca + - btl + - ^openib + - python + - scripts/tf_cnn_benchmarks/tf_cnn_benchmarks.py + - --model=resnet101 + - --batch_size=64 + - --variable_update=horovod + image: mpioperator/tensorflow-benchmarks:latest + name: tensorflow-benchmarks + Worker: + replicas: 1 + template: + spec: + containers: + - image: mpioperator/tensorflow-benchmarks:latest + name: tensorflow-benchmarks + resources: + limits: + nvidia.com/gpu: 2 + slotsPerWorker: 2 + status: + completionTime: "2019-07-09T22:17:06Z" + conditions: + - lastTransitionTime: "2019-07-09T22:15:51Z" + lastUpdateTime: "2019-07-09T22:15:51Z" + message: MPIJob default/tensorflow-benchmarks is created. + reason: MPIJobCreated + status: "True" + type: Created + - lastTransitionTime: "2019-07-09T22:15:54Z" + lastUpdateTime: "2019-07-09T22:15:54Z" + message: MPIJob default/tensorflow-benchmarks is running. + reason: MPIJobRunning + status: "False" + type: Running + - lastTransitionTime: "2019-07-09T22:17:06Z" + lastUpdateTime: "2019-07-09T22:17:06Z" + message: MPIJob default/tensorflow-benchmarks successfully completed. + reason: MPIJobSucceeded + status: "True" + type: Succeeded + replicaStatuses: + Launcher: + succeeded: 1 + Worker: { } + startTime: "2019-07-09T22:15:51Z" +operation: InterpretStatus +output: diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kubeflow.org/v2beta1/MPIJob/testdata/observed-mpijob.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kubeflow.org/v2beta1/MPIJob/testdata/observed-mpijob.yaml deleted file mode 100644 index 07e7313dad21..000000000000 --- a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kubeflow.org/v2beta1/MPIJob/testdata/observed-mpijob.yaml +++ /dev/null @@ -1,84 +0,0 @@ -apiVersion: kubeflow.org/v2beta1 -kind: MPIJob -metadata: - creationTimestamp: "2019-07-09T22:15:51Z" - generation: 1 - name: tensorflow-benchmarks - namespace: default - resourceVersion: "5645868" - selfLink: /apis/kubeflow.org/v2beta1/namespaces/default/mpijobs/tensorflow-benchmarks - uid: 1c5b470f-a297-11e9-964d-88d7f67c6e6d -spec: - runPolicy: - cleanPodPolicy: Running - mpiReplicaSpecs: - Launcher: - replicas: 1 - template: - spec: - containers: - - command: - - mpirun - - --allow-run-as-root - - -np - - "2" - - -bind-to - - none - - -map-by - - slot - - -x - - NCCL_DEBUG=INFO - - -x - - LD_LIBRARY_PATH - - -x - - PATH - - -mca - - pml - - ob1 - - -mca - - btl - - ^openib - - python - - scripts/tf_cnn_benchmarks/tf_cnn_benchmarks.py - - --model=resnet101 - - --batch_size=64 - - --variable_update=horovod - image: mpioperator/tensorflow-benchmarks:latest - name: tensorflow-benchmarks - Worker: - replicas: 1 - template: - spec: - containers: - - image: mpioperator/tensorflow-benchmarks:latest - name: tensorflow-benchmarks - resources: - limits: - nvidia.com/gpu: 2 - slotsPerWorker: 2 -status: - completionTime: "2019-07-09T22:17:06Z" - conditions: - - lastTransitionTime: "2019-07-09T22:15:51Z" - lastUpdateTime: "2019-07-09T22:15:51Z" - message: MPIJob default/tensorflow-benchmarks is created. - reason: MPIJobCreated - status: "True" - type: Created - - lastTransitionTime: "2019-07-09T22:15:54Z" - lastUpdateTime: "2019-07-09T22:15:54Z" - message: MPIJob default/tensorflow-benchmarks is running. - reason: MPIJobRunning - status: "False" - type: Running - - lastTransitionTime: "2019-07-09T22:17:06Z" - lastUpdateTime: "2019-07-09T22:17:06Z" - message: MPIJob default/tensorflow-benchmarks successfully completed. - reason: MPIJobSucceeded - status: "True" - type: Succeeded - replicaStatuses: - Launcher: - succeeded: 1 - Worker: {} - startTime: "2019-07-09T22:15:51Z" diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kubeflow.org/v2beta1/MPIJob/testdata/status-file.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kubeflow.org/v2beta1/MPIJob/testdata/status-file.yaml deleted file mode 100644 index 54b0c0ec95f6..000000000000 --- a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kubeflow.org/v2beta1/MPIJob/testdata/status-file.yaml +++ /dev/null @@ -1,73 +0,0 @@ -applied: true -clusterName: member1 -health: Healthy -status: - startTime: "2019-07-10T10:00:00Z" - conditions: - - lastTransitionTime: "2019-07-10T10:00:00Z" - lastUpdateTime: "2019-07-10T10:00:00Z" - message: MPIJob default/tensorflow-benchmarks is created. - reason: MPIJobCreated - status: "True" - type: Created - - lastTransitionTime: "2019-07-10T10:01:00Z" - lastUpdateTime: "2019-07-10T10:01:00Z" - message: MPIJob default/tensorflow-benchmarks is running. - reason: MPIJobRunning - status: "True" - type: Running - replicaStatuses: - Launcher: - active: 1 - Worker: - active: 2 ---- -applied: true -clusterName: member2 -health: Unhealthy -status: - completionTime: "2019-07-11T12:00:00Z" - startTime: "2019-07-11T11:30:00Z" - conditions: - - lastTransitionTime: "2019-07-11T11:30:00Z" - lastUpdateTime: "2019-07-11T11:30:00Z" - message: MPIJob default/tensorflow-benchmarks is created. - reason: MPIJobCreated - status: "True" - type: Created - - lastTransitionTime: "2019-07-11T11:45:00Z" - lastUpdateTime: "2019-07-11T11:45:00Z" - message: MPIJob default/tensorflow-benchmarks failed during execution. - reason: MPIJobFailed - status: "True" - type: Failed - replicaStatuses: - Launcher: - failed: 1 - Worker: - failed: 2 ---- -applied: true -clusterName: member3 -health: Healthy -status: - startTime: "2019-07-12T08:00:00Z" - conditions: - - lastTransitionTime: "2019-07-12T08:00:00Z" - lastUpdateTime: "2019-07-12T08:00:00Z" - message: MPIJob default/tensorflow-benchmarks is created. - reason: MPIJobCreated - status: "True" - type: Created - - lastTransitionTime: "2019-07-12T08:05:00Z" - lastUpdateTime: "2019-07-12T08:05:00Z" - message: MPIJob default/tensorflow-benchmarks running with partial successes. - reason: MPIJobRunning - status: "True" - type: Running - replicaStatuses: - Launcher: - active: 1 - Worker: - active: 1 - succeeded: 1 diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kustomize.toolkit.fluxcd.io/v1/Kustomization/customizations_tests.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kustomize.toolkit.fluxcd.io/v1/Kustomization/customizations_tests.yaml deleted file mode 100644 index f63129db25f3..000000000000 --- a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kustomize.toolkit.fluxcd.io/v1/Kustomization/customizations_tests.yaml +++ /dev/null @@ -1,14 +0,0 @@ -tests: - - desiredInputPath: testdata/desired-kustomization.yaml - statusInputPath: testdata/status-file.yaml - operation: AggregateStatus - - desiredInputPath: testdata/desired-kustomization.yaml - operation: InterpretDependency - - desiredInputPath: testdata/desired-kustomization.yaml - observedInputPath: testdata/observed-kustomization.yaml - operation: Retain - - observedInputPath: testdata/observed-kustomization.yaml - operation: InterpretHealth - - observedInputPath: testdata/observed-kustomization.yaml - operation: InterpretStatus - diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kustomize.toolkit.fluxcd.io/v1/Kustomization/testdata/aggregatestatus-test.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kustomize.toolkit.fluxcd.io/v1/Kustomization/testdata/aggregatestatus-test.yaml new file mode 100644 index 000000000000..bbf9d2fd06f5 --- /dev/null +++ b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kustomize.toolkit.fluxcd.io/v1/Kustomization/testdata/aggregatestatus-test.yaml @@ -0,0 +1,56 @@ +# test case for aggregating status of Kustomization +# case1. Kustomization with two status items + +name: "Kustomization with two status items" +description: "Test aggregating status of Kustomization with two status items" +desiredObj: + apiVersion: kustomize.toolkit.fluxcd.io/v1 + kind: Kustomization + metadata: + name: sample + namespace: test-kustomization + generation: 1 + spec: + interval: 10m + targetNamespace: test-kustomization + sourceRef: + kind: GitRepository + name: sample + path: "./kustomize" + prune: true + timeout: 1m +statusItems: + - applied: true + clusterName: member1 + health: Healthy + status: + conditions: + - lastTransitionTime: "2023-04-30T12:51:06Z" + message: 'Applied revision: master@sha1:0647aea75b85755411b007a290b9321668370be5' + observedGeneration: 1 + reason: ReconciliationSucceeded + status: "True" + type: Ready + generation: 1 + lastAppliedRevision: master@sha1:0647aea75b85755411b007a290b9321668370be5 + lastAttemptedRevision: master@sha1:0647aea75b85755411b007a290b9321668370be5 + observedGeneration: 1 + resourceTemplateGeneration: 1 + - applied: true + clusterName: member3 + health: Healthy + status: + conditions: + - lastTransitionTime: "2023-04-30T12:51:06Z" + message: 'Applied revision: master@sha1:0647aea75b85755411b007a290b9321668370be5' + observedGeneration: 1 + reason: ReconciliationSucceeded + status: "True" + type: Ready + generation: 1 + lastAppliedRevision: master@sha1:0647aea75b85755411b007a290b9321668370be5 + lastAttemptedRevision: master@sha1:0647aea75b85755411b007a290b9321668370be5 + observedGeneration: 1 + resourceTemplateGeneration: 1 +operation: AggregateStatus +output: diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kustomize.toolkit.fluxcd.io/v1/Kustomization/testdata/desired-kustomization.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kustomize.toolkit.fluxcd.io/v1/Kustomization/testdata/desired-kustomization.yaml deleted file mode 100644 index 4c2b6a47d0d0..000000000000 --- a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kustomize.toolkit.fluxcd.io/v1/Kustomization/testdata/desired-kustomization.yaml +++ /dev/null @@ -1,15 +0,0 @@ -apiVersion: kustomize.toolkit.fluxcd.io/v1 -kind: Kustomization -metadata: - name: sample - namespace: test-kustomization - generation: 1 -spec: - interval: 10m - targetNamespace: test-kustomization - sourceRef: - kind: GitRepository - name: sample - path: "./kustomize" - prune: true - timeout: 1m diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kustomize.toolkit.fluxcd.io/v1/Kustomization/testdata/interpretstatus-test.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kustomize.toolkit.fluxcd.io/v1/Kustomization/testdata/interpretstatus-test.yaml new file mode 100644 index 000000000000..6e7551773a1d --- /dev/null +++ b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kustomize.toolkit.fluxcd.io/v1/Kustomization/testdata/interpretstatus-test.yaml @@ -0,0 +1,52 @@ +# test case for interpreting status of Kustomization +# case1. Kustomization: interpret status test + +name: "Kustomization: interpret status test" +description: "Test interpreting status for Kustomization" +observedObj: + apiVersion: kustomize.toolkit.fluxcd.io/v1 + kind: Kustomization + metadata: + annotations: + resourcetemplate.karmada.io/generation: "1" + name: sample + namespace: test-kustomization + generation: 1 + spec: + interval: 10m + targetNamespace: test-kustomization + sourceRef: + kind: GitRepository + name: sample + path: "./kustomize" + prune: true + timeout: 1m + serviceAccountName: fake-sa + suspend: true + decryption: + secretRef: + name: fake-decryption-secret + kubeConfig: + secretRef: + name: fake--decryption-secret + status: + conditions: + - lastTransitionTime: "2023-04-30T12:51:06Z" + message: 'Applied revision: master@sha1:0647aea75b85755411b007a290b9321668370be5' + observedGeneration: 1 + reason: ReconciliationSucceeded + status: "True" + type: Ready + inventory: + entries: + - id: test-kustomization_podinfo__Service + v: v1 + - id: test-kustomization_podinfo_apps_Deployment + v: v1 + - id: test-kustomization_podinfo_autoscaling_HorizontalPodAutoscaler + v: v2 + lastAppliedRevision: master@sha1:0647aea75b85755411b007a290b9321668370be5 + lastAttemptedRevision: master@sha1:0647aea75b85755411b007a290b9321668370be5 + observedGeneration: 1 +operation: InterpretStatus +output: diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kustomize.toolkit.fluxcd.io/v1/Kustomization/testdata/observed-kustomization.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kustomize.toolkit.fluxcd.io/v1/Kustomization/testdata/observed-kustomization.yaml deleted file mode 100644 index c89012914ebd..000000000000 --- a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kustomize.toolkit.fluxcd.io/v1/Kustomization/testdata/observed-kustomization.yaml +++ /dev/null @@ -1,44 +0,0 @@ -apiVersion: kustomize.toolkit.fluxcd.io/v1 -kind: Kustomization -metadata: - annotations: - resourcetemplate.karmada.io/generation: "1" - name: sample - namespace: test-kustomization - generation: 1 -spec: - interval: 10m - targetNamespace: test-kustomization - sourceRef: - kind: GitRepository - name: sample - path: "./kustomize" - prune: true - timeout: 1m - serviceAccountName: fake-sa - suspend: true - decryption: - secretRef: - name: fake-decryption-secret - kubeConfig: - secretRef: - name: fake--decryption-secret -status: - conditions: - - lastTransitionTime: "2023-04-30T12:51:06Z" - message: 'Applied revision: master@sha1:0647aea75b85755411b007a290b9321668370be5' - observedGeneration: 1 - reason: ReconciliationSucceeded - status: "True" - type: Ready - inventory: - entries: - - id: test-kustomization_podinfo__Service - v: v1 - - id: test-kustomization_podinfo_apps_Deployment - v: v1 - - id: test-kustomization_podinfo_autoscaling_HorizontalPodAutoscaler - v: v2 - lastAppliedRevision: master@sha1:0647aea75b85755411b007a290b9321668370be5 - lastAttemptedRevision: master@sha1:0647aea75b85755411b007a290b9321668370be5 - observedGeneration: 1 diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kustomize.toolkit.fluxcd.io/v1/Kustomization/testdata/status-file.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kustomize.toolkit.fluxcd.io/v1/Kustomization/testdata/status-file.yaml deleted file mode 100644 index 608faa3e85d3..000000000000 --- a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kustomize.toolkit.fluxcd.io/v1/Kustomization/testdata/status-file.yaml +++ /dev/null @@ -1,33 +0,0 @@ -applied: true -clusterName: member1 -health: Healthy -status: - conditions: - - lastTransitionTime: "2023-04-30T12:51:06Z" - message: 'Applied revision: master@sha1:0647aea75b85755411b007a290b9321668370be5' - observedGeneration: 1 - reason: ReconciliationSucceeded - status: "True" - type: Ready - generation: 1 - lastAppliedRevision: master@sha1:0647aea75b85755411b007a290b9321668370be5 - lastAttemptedRevision: master@sha1:0647aea75b85755411b007a290b9321668370be5 - observedGeneration: 1 - resourceTemplateGeneration: 1 ---- -applied: true -clusterName: member3 -health: Healthy -status: - conditions: - - lastTransitionTime: "2023-04-30T12:51:06Z" - message: 'Applied revision: master@sha1:0647aea75b85755411b007a290b9321668370be5' - observedGeneration: 1 - reason: ReconciliationSucceeded - status: "True" - type: Ready - generation: 1 - lastAppliedRevision: master@sha1:0647aea75b85755411b007a290b9321668370be5 - lastAttemptedRevision: master@sha1:0647aea75b85755411b007a290b9321668370be5 - observedGeneration: 1 - resourceTemplateGeneration: 1 diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kyverno.io/v1/ClusterPolicy/customizations_tests.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kyverno.io/v1/ClusterPolicy/customizations_tests.yaml deleted file mode 100644 index 12a55d57f1e9..000000000000 --- a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kyverno.io/v1/ClusterPolicy/customizations_tests.yaml +++ /dev/null @@ -1,8 +0,0 @@ -tests: - - desiredInputPath: testdata/desired-clusterpolicy.yaml - statusInputPath: testdata/status-file.yaml - operation: AggregateStatus - - observedInputPath: testdata/observed-clusterpolicy.yaml - operation: InterpretHealth - - observedInputPath: testdata/observed-clusterpolicy.yaml - operation: InterpretStatus diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kyverno.io/v1/ClusterPolicy/testdata/aggregatestatus-test.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kyverno.io/v1/ClusterPolicy/testdata/aggregatestatus-test.yaml new file mode 100644 index 000000000000..e413be08dbdb --- /dev/null +++ b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kyverno.io/v1/ClusterPolicy/testdata/aggregatestatus-test.yaml @@ -0,0 +1,60 @@ +# test case for aggregating status of ClusterPolicy +# case1. ClusterPolicy with two status items + +name: "ClusterPolicy with two status items" +description: "Test aggregating status of ClusterPolicy with two status items" +desiredObj: + apiVersion: kyverno.io/v1 + kind: ClusterPolicy + metadata: + name: sample + spec: + validationFailureAction: Enforce + rules: + - name: require-ns-purpose-label + match: + any: + - resources: + kinds: + - Namespace + validate: + message: "You must have label `purpose` with value `production` set on all new namespaces." + pattern: + metadata: + labels: + purpose: production +statusItems: + - applied: true + clusterName: member2 + health: Healthy + status: + conditions: + - lastTransitionTime: "2023-05-07T12:28:58Z" + message: "" + reason: Succeeded + status: "True" + type: Ready + ready: true + rulecount: + generate: 0 + mutate: 0 + validate: 1 + verifyimages: 0 + - applied: true + clusterName: member3 + health: Healthy + status: + conditions: + - lastTransitionTime: "2023-05-07T12:28:58Z" + message: "" + reason: Succeeded + status: "True" + type: Ready + ready: true + rulecount: + generate: 0 + mutate: 0 + validate: 1 + verifyimages: 0 +operation: AggregateStatus +output: diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kyverno.io/v1/ClusterPolicy/testdata/desired-clusterpolicy.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kyverno.io/v1/ClusterPolicy/testdata/desired-clusterpolicy.yaml deleted file mode 100644 index 97565ed5ce24..000000000000 --- a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kyverno.io/v1/ClusterPolicy/testdata/desired-clusterpolicy.yaml +++ /dev/null @@ -1,19 +0,0 @@ -apiVersion: kyverno.io/v1 -kind: ClusterPolicy -metadata: - name: sample -spec: - validationFailureAction: Enforce - rules: - - name: require-ns-purpose-label - match: - any: - - resources: - kinds: - - Namespace - validate: - message: "You must have label `purpose` with value `production` set on all new namespaces." - pattern: - metadata: - labels: - purpose: production diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kyverno.io/v1/ClusterPolicy/testdata/interpretstatus-test.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kyverno.io/v1/ClusterPolicy/testdata/interpretstatus-test.yaml new file mode 100644 index 000000000000..7c983aed1a96 --- /dev/null +++ b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kyverno.io/v1/ClusterPolicy/testdata/interpretstatus-test.yaml @@ -0,0 +1,43 @@ +# test case for interpreting status of ClusterPolicy +# case1. ClusterPolicy: interpret status test + +name: "ClusterPolicy: interpret status test" +description: "Test interpreting status for ClusterPolicy" +observedObj: + apiVersion: kyverno.io/v1 + kind: ClusterPolicy + metadata: + name: sample + spec: + background: true + rules: + - match: + any: + - resources: + kinds: + - Namespace + name: require-ns-purpose-label + validate: + message: You must have label `purpose` with value `production` set on all new + namespaces. + pattern: + metadata: + labels: + purpose: production + validationFailureAction: Enforce + status: + autogen: { } + conditions: + - lastTransitionTime: "2023-05-07T12:28:58Z" + message: "" + reason: Succeeded + status: "True" + type: Ready + ready: true + rulecount: + generate: 0 + mutate: 0 + validate: 1 + verifyimages: 0 +operation: InterpretStatus +output: diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kyverno.io/v1/ClusterPolicy/testdata/observed-clusterpolicy.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kyverno.io/v1/ClusterPolicy/testdata/observed-clusterpolicy.yaml deleted file mode 100644 index 1c0680fec179..000000000000 --- a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kyverno.io/v1/ClusterPolicy/testdata/observed-clusterpolicy.yaml +++ /dev/null @@ -1,35 +0,0 @@ -apiVersion: kyverno.io/v1 -kind: ClusterPolicy -metadata: - name: sample -spec: - background: true - rules: - - match: - any: - - resources: - kinds: - - Namespace - name: require-ns-purpose-label - validate: - message: You must have label `purpose` with value `production` set on all new - namespaces. - pattern: - metadata: - labels: - purpose: production - validationFailureAction: Enforce -status: - autogen: {} - conditions: - - lastTransitionTime: "2023-05-07T12:28:58Z" - message: "" - reason: Succeeded - status: "True" - type: Ready - ready: true - rulecount: - generate: 0 - mutate: 0 - validate: 1 - verifyimages: 0 diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kyverno.io/v1/ClusterPolicy/testdata/status-file.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kyverno.io/v1/ClusterPolicy/testdata/status-file.yaml deleted file mode 100644 index 92b0e9fe6949..000000000000 --- a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kyverno.io/v1/ClusterPolicy/testdata/status-file.yaml +++ /dev/null @@ -1,33 +0,0 @@ -applied: true -clusterName: member2 -health: Healthy -status: - conditions: - - lastTransitionTime: "2023-05-07T12:28:58Z" - message: "" - reason: Succeeded - status: "True" - type: Ready - ready: true - rulecount: - generate: 0 - mutate: 0 - validate: 1 - verifyimages: 0 ---- -applied: true -clusterName: member3 -health: Healthy -status: - conditions: - - lastTransitionTime: "2023-05-07T12:28:58Z" - message: "" - reason: Succeeded - status: "True" - type: Ready - ready: true - rulecount: - generate: 0 - mutate: 0 - validate: 1 - verifyimages: 0 diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kyverno.io/v1/Policy/customizations_tests.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kyverno.io/v1/Policy/customizations_tests.yaml deleted file mode 100644 index dec129d7e516..000000000000 --- a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kyverno.io/v1/Policy/customizations_tests.yaml +++ /dev/null @@ -1,8 +0,0 @@ -tests: - - desiredInputPath: testdata/desired-policy.yaml - statusInputPath: testdata/status-file.yaml - operation: AggregateStatus - - observedInputPath: testdata/observed-policy.yaml - operation: InterpretHealth - - observedInputPath: testdata/observed-policy.yaml - operation: InterpretStatus diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kyverno.io/v1/Policy/testdata/aggregatestatus-test.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kyverno.io/v1/Policy/testdata/aggregatestatus-test.yaml new file mode 100644 index 000000000000..0b5e3b47b75e --- /dev/null +++ b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kyverno.io/v1/Policy/testdata/aggregatestatus-test.yaml @@ -0,0 +1,147 @@ +# test case for aggregating status of Policy +# case1. Policy with two status items + +name: "Policy with two status items" +description: "Test aggregating status of Policy with two status items" +desiredObj: + apiVersion: kyverno.io/v1 + kind: Policy + metadata: + name: sample + namespace: test-policy + spec: + validationFailureAction: Enforce + rules: + - name: require-pod-purpose-label + match: + any: + - resources: + kinds: + - Pod + validate: + message: "You must have label `purpose` with value `production` set on all new Pod in test-policy Namespace." + pattern: + metadata: + labels: + purpose: production +statusItems: + - applied: true + clusterName: member2 + health: Healthy + status: + autogen: + rules: + - exclude: [ ] + generate: [ ] + match: + any: + - resources: + kinds: + - DaemonSet + - Deployment + - Job + - StatefulSet + - ReplicaSet + - ReplicationController + name: autogen-require-pod-purpose-label + validate: + message: You must have label `purpose` with value `production` set on + all new Pod in test-policy Namespace. + pattern: + spec: + template: + metadata: + labels: + purpose: production + - exclude: [ ] + generate: [ ] + match: + any: + - resources: + kinds: + - CronJob + name: autogen-cronjob-require-pod-purpose-label + validate: + message: You must have label `purpose` with value `production` set on + all new Pod in test-policy Namespace. + pattern: + spec: + jobTemplate: + spec: + template: + metadata: + labels: + purpose: production + conditions: + - lastTransitionTime: "2023-05-07T09:19:06Z" + message: "" + reason: Succeeded + status: "True" + type: Ready + ready: true + rulecount: + generate: 0 + mutate: 0 + validate: 1 + verifyimages: 0 + - applied: true + clusterName: member3 + health: Healthy + status: + autogen: + rules: + - exclude: [ ] + generate: [ ] + match: + any: + - resources: + kinds: + - DaemonSet + - Deployment + - Job + - StatefulSet + - ReplicaSet + - ReplicationController + name: autogen-require-pod-purpose-label + validate: + message: You must have label `purpose` with value `production` set on + all new Pod in test-policy Namespace. + pattern: + spec: + template: + metadata: + labels: + purpose: production + - exclude: [ ] + generate: [ ] + match: + any: + - resources: + kinds: + - CronJob + name: autogen-cronjob-require-pod-purpose-label + validate: + message: You must have label `purpose` with value `production` set on + all new Pod in test-policy Namespace. + pattern: + spec: + jobTemplate: + spec: + template: + metadata: + labels: + purpose: production + conditions: + - lastTransitionTime: "2023-05-07T09:19:06Z" + message: "" + reason: Succeeded + status: "True" + type: Ready + ready: true + rulecount: + generate: 0 + mutate: 0 + validate: 1 + verifyimages: 0 +operation: AggregateStatus +output: diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kyverno.io/v1/Policy/testdata/desired-policy.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kyverno.io/v1/Policy/testdata/desired-policy.yaml deleted file mode 100644 index 3f6fe0b0be33..000000000000 --- a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kyverno.io/v1/Policy/testdata/desired-policy.yaml +++ /dev/null @@ -1,20 +0,0 @@ -apiVersion: kyverno.io/v1 -kind: Policy -metadata: - name: sample - namespace: test-policy -spec: - validationFailureAction: Enforce - rules: - - name: require-pod-purpose-label - match: - any: - - resources: - kinds: - - Pod - validate: - message: "You must have label `purpose` with value `production` set on all new Pod in test-policy Namespace." - pattern: - metadata: - labels: - purpose: production diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kyverno.io/v1/Policy/testdata/interpretstatus-test.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kyverno.io/v1/Policy/testdata/interpretstatus-test.yaml new file mode 100644 index 000000000000..459dedac5f4f --- /dev/null +++ b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kyverno.io/v1/Policy/testdata/interpretstatus-test.yaml @@ -0,0 +1,94 @@ +# test case for interpreting status of Policy +# case1. Policy: interpret status test + +name: "Policy: interpret status test" +description: "Test interpreting status for Policy" +observedObj: + apiVersion: kyverno.io/v1 + kind: Policy + metadata: + name: sample + namespace: test-policy + spec: + validationFailureAction: Enforce + rules: + - name: require-pod-purpose-label + match: + any: + - resources: + kinds: + - Pod + validate: + message: "You must have label `purpose` with value `production` set on all new Pod in test-policy Namespace." + pattern: + metadata: + labels: + purpose: production + status: + autogen: + rules: + - exclude: + resources: { } + generate: + clone: { } + cloneList: { } + match: + any: + - resources: + kinds: + - DaemonSet + - Deployment + - Job + - StatefulSet + - ReplicaSet + - ReplicationController + resources: { } + mutate: { } + name: autogen-require-pod-purpose-label + validate: + message: You must have label `purpose` with value `production` set on all + new Pod in test-policy Namespace. + pattern: + spec: + template: + metadata: + labels: + purpose: production + - exclude: + resources: { } + generate: + clone: { } + cloneList: { } + match: + any: + - resources: + kinds: + - CronJob + resources: { } + mutate: { } + name: autogen-cronjob-require-pod-purpose-label + validate: + message: You must have label `purpose` with value `production` set on all + new Pod in test-policy Namespace. + pattern: + spec: + jobTemplate: + spec: + template: + metadata: + labels: + purpose: production + conditions: + - lastTransitionTime: "2023-05-07T09:19:06Z" + message: "" + reason: Succeeded + status: "True" + type: Ready + ready: true + rulecount: + generate: 0 + mutate: 0 + validate: 1 + verifyimages: 0 +operation: InterpretStatus +output: diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kyverno.io/v1/Policy/testdata/observed-policy.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kyverno.io/v1/Policy/testdata/observed-policy.yaml deleted file mode 100644 index 64050a5e4237..000000000000 --- a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kyverno.io/v1/Policy/testdata/observed-policy.yaml +++ /dev/null @@ -1,86 +0,0 @@ -apiVersion: kyverno.io/v1 -kind: Policy -metadata: - name: sample - namespace: test-policy -spec: - validationFailureAction: Enforce - rules: - - name: require-pod-purpose-label - match: - any: - - resources: - kinds: - - Pod - validate: - message: "You must have label `purpose` with value `production` set on all new Pod in test-policy Namespace." - pattern: - metadata: - labels: - purpose: production -status: - autogen: - rules: - - exclude: - resources: {} - generate: - clone: {} - cloneList: {} - match: - any: - - resources: - kinds: - - DaemonSet - - Deployment - - Job - - StatefulSet - - ReplicaSet - - ReplicationController - resources: {} - mutate: {} - name: autogen-require-pod-purpose-label - validate: - message: You must have label `purpose` with value `production` set on all - new Pod in test-policy Namespace. - pattern: - spec: - template: - metadata: - labels: - purpose: production - - exclude: - resources: {} - generate: - clone: {} - cloneList: {} - match: - any: - - resources: - kinds: - - CronJob - resources: {} - mutate: {} - name: autogen-cronjob-require-pod-purpose-label - validate: - message: You must have label `purpose` with value `production` set on all - new Pod in test-policy Namespace. - pattern: - spec: - jobTemplate: - spec: - template: - metadata: - labels: - purpose: production - conditions: - - lastTransitionTime: "2023-05-07T09:19:06Z" - message: "" - reason: Succeeded - status: "True" - type: Ready - ready: true - rulecount: - generate: 0 - mutate: 0 - validate: 1 - verifyimages: 0 diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kyverno.io/v1/Policy/testdata/status-file.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kyverno.io/v1/Policy/testdata/status-file.yaml deleted file mode 100644 index 0f16a7b8ce39..000000000000 --- a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/kyverno.io/v1/Policy/testdata/status-file.yaml +++ /dev/null @@ -1,119 +0,0 @@ -applied: true -clusterName: member2 -health: Healthy -status: - autogen: - rules: - - exclude: [] - generate: [] - match: - any: - - resources: - kinds: - - DaemonSet - - Deployment - - Job - - StatefulSet - - ReplicaSet - - ReplicationController - name: autogen-require-pod-purpose-label - validate: - message: You must have label `purpose` with value `production` set on - all new Pod in test-policy Namespace. - pattern: - spec: - template: - metadata: - labels: - purpose: production - - exclude: [] - generate: [] - match: - any: - - resources: - kinds: - - CronJob - name: autogen-cronjob-require-pod-purpose-label - validate: - message: You must have label `purpose` with value `production` set on - all new Pod in test-policy Namespace. - pattern: - spec: - jobTemplate: - spec: - template: - metadata: - labels: - purpose: production - conditions: - - lastTransitionTime: "2023-05-07T09:19:06Z" - message: "" - reason: Succeeded - status: "True" - type: Ready - ready: true - rulecount: - generate: 0 - mutate: 0 - validate: 1 - verifyimages: 0 ---- -applied: true -clusterName: member3 -health: Healthy -status: - autogen: - rules: - - exclude: [] - generate: [] - match: - any: - - resources: - kinds: - - DaemonSet - - Deployment - - Job - - StatefulSet - - ReplicaSet - - ReplicationController - name: autogen-require-pod-purpose-label - validate: - message: You must have label `purpose` with value `production` set on - all new Pod in test-policy Namespace. - pattern: - spec: - template: - metadata: - labels: - purpose: production - - exclude: [] - generate: [] - match: - any: - - resources: - kinds: - - CronJob - name: autogen-cronjob-require-pod-purpose-label - validate: - message: You must have label `purpose` with value `production` set on - all new Pod in test-policy Namespace. - pattern: - spec: - jobTemplate: - spec: - template: - metadata: - labels: - purpose: production - conditions: - - lastTransitionTime: "2023-05-07T09:19:06Z" - message: "" - reason: Succeeded - status: "True" - type: Ready - ready: true - rulecount: - generate: 0 - mutate: 0 - validate: 1 - verifyimages: 0 diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/ray.io/v1/RayCluster/customizations_tests.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/ray.io/v1/RayCluster/customizations_tests.yaml deleted file mode 100644 index bd644361786f..000000000000 --- a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/ray.io/v1/RayCluster/customizations_tests.yaml +++ /dev/null @@ -1,8 +0,0 @@ -tests: - - desiredInputPath: testdata/desired-raycluster.yaml - statusInputPath: testdata/status-file.yaml - operation: AggregateStatus - - observedInputPath: testdata/observed-raycluster.yaml - operation: InterpretHealth - - observedInputPath: testdata/observed-raycluster.yaml - operation: InterpretComponent diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/ray.io/v1/RayCluster/testdata/aggregatestatus-test.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/ray.io/v1/RayCluster/testdata/aggregatestatus-test.yaml new file mode 100644 index 000000000000..32bb7bdfba44 --- /dev/null +++ b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/ray.io/v1/RayCluster/testdata/aggregatestatus-test.yaml @@ -0,0 +1,139 @@ +# test case for aggregating status of RayCluster +# case1. RayCluster with two status items + +name: "RayCluster with two status items" +description: "Test aggregating status of RayCluster with two status items" +desiredObj: + apiVersion: ray.io/v1 + kind: RayCluster + metadata: + name: sample + spec: + rayVersion: '2.46.0' + headGroupSpec: + rayStartParams: { } + template: + spec: + containers: + - name: ray-head + image: rayproject/ray:2.46.0 + resources: + limits: + cpu: 1 + memory: 2G + requests: + cpu: 1 + memory: 2G + ports: + - containerPort: 6379 + name: gcs-server + - containerPort: 8265 + name: dashboard + - containerPort: 10001 + name: client + workerGroupSpecs: + - replicas: 1 + minReplicas: 1 + maxReplicas: 5 + groupName: workergroup + rayStartParams: { } + template: + spec: + containers: + image: rayproject/ray:2.46.0 + resources: + limits: + cpu: 1 + memory: 1G + requests: + cpu: 1 + memory: 1G +statusItems: + - applied: true + clusterName: member1 + status: + availableWorkerReplicas: 1 + conditions: + - lastTransitionTime: "2025-09-21T03:55:30Z" + message: "" + reason: HeadPodRunningAndReady + status: "True" + type: HeadPodReady + - lastTransitionTime: "2025-09-21T03:55:45Z" + message: All Ray Pods are ready for the first time + reason: AllPodRunningAndReadyFirstTime + status: "True" + type: RayClusterProvisioned + - lastTransitionTime: "2025-09-21T03:54:44Z" + message: "" + reason: RayClusterSuspended + status: "False" + type: RayClusterSuspended + - lastTransitionTime: "2025-09-21T03:54:44Z" + message: "" + reason: RayClusterSuspending + status: "False" + type: RayClusterSuspending + desiredCPU: "2" + desiredGPU: "0" + desiredMemory: 3G + desiredTPU: "0" + desiredWorkerReplicas: 1 + endpoints: + client: "10001" + dashboard: "8265" + gcs-server: "6379" + metrics: "8080" + head: + podIP: 10.244.0.6 + podName: sample-head-9cvfc + serviceIP: 10.244.0.6 + serviceName: sample-head-svc + lastUpdateTime: "2025-09-21T03:55:45Z" + maxWorkerReplicas: 5 + minWorkerReplicas: 1 + observedGeneration: 1 + readyWorkerReplicas: 1 + state: ready + stateTransitionTimes: + ready: "2025-09-21T03:55:45Z" + - applied: true + clusterName: member2 + status: + availableWorkerReplicas: 2 + conditions: + - lastTransitionTime: "2025-09-21T03:56:30Z" + message: "" + reason: HeadPodRunningAndReady + status: "True" + type: HeadPodReady + - lastTransitionTime: "2025-09-21T03:56:50Z" + message: All Ray Pods are ready for the first time + reason: AllPodRunningAndReadyFirstTime + status: "True" + type: RayClusterProvisioned + - lastTransitionTime: "2025-09-21T03:54:50Z" + message: "" + reason: RayClusterSuspended + status: "False" + type: RayClusterSuspended + - lastTransitionTime: "2025-09-21T03:54:50Z" + message: "" + reason: RayClusterSuspending + status: "False" + type: RayClusterSuspending + desiredCPU: "4" + desiredGPU: "1" + desiredMemory: 5G + desiredTPU: "0" + desiredWorkerReplicas: 3 + lastUpdateTime: "2025-09-21T03:56:50Z" + maxWorkerReplicas: 10 + minWorkerReplicas: 2 + observedGeneration: 2 + readyWorkerReplicas: 3 + state: ready + stateTransitionTimes: + ready: "2025-09-21T03:56:50Z" +operation: AggregateStatus +output: diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/ray.io/v1/RayCluster/testdata/desired-raycluster.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/ray.io/v1/RayCluster/testdata/desired-raycluster.yaml deleted file mode 100644 index 4f59e08fe5a8..000000000000 --- a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/ray.io/v1/RayCluster/testdata/desired-raycluster.yaml +++ /dev/null @@ -1,44 +0,0 @@ -apiVersion: ray.io/v1 -kind: RayCluster -metadata: - name: sample -spec: - rayVersion: '2.46.0' - headGroupSpec: - rayStartParams: {} - template: - spec: - containers: - - name: ray-head - image: rayproject/ray:2.46.0 - resources: - limits: - cpu: 1 - memory: 2G - requests: - cpu: 1 - memory: 2G - ports: - - containerPort: 6379 - name: gcs-server - - containerPort: 8265 - name: dashboard - - containerPort: 10001 - name: client - workerGroupSpecs: - - replicas: 1 - minReplicas: 1 - maxReplicas: 5 - groupName: workergroup - rayStartParams: {} - template: - spec: - containers: - image: rayproject/ray:2.46.0 - resources: - limits: - cpu: 1 - memory: 1G - requests: - cpu: 1 - memory: 1G diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/ray.io/v1/RayCluster/testdata/interprethealth-test.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/ray.io/v1/RayCluster/testdata/interprethealth-test.yaml new file mode 100644 index 000000000000..4d40c7b367a1 --- /dev/null +++ b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/ray.io/v1/RayCluster/testdata/interprethealth-test.yaml @@ -0,0 +1,111 @@ +# test case for interpreting health of RayCluster +# case1. RayCluster: interpret health test + +name: "RayCluster: interpret health test" +description: "Test interpreting health for RayCluster" +observedObj: + apiVersion: ray.io/v1 + kind: RayCluster + metadata: + annotations: + kubectl.kubernetes.io/last-applied-configuration: | + {"apiVersion":"ray.io/v1","kind":"RayCluster","metadata":{"annotations":{},"name":"sample","namespace":"default"},"spec":{"headGroupSpec":{"rayStartParams":{},"template":{"spec":{"containers":[{"image":"rayproject/ray:2.46.0","name":"ray-head","ports":[{"containerPort":6379,"name":"gcs-server"},{"containerPort":8265,"name":"dashboard"},{"containerPort":10001,"name":"client"}],"resources":{"limits":{"cpu":1,"memory":"2G"},"requests":{"cpu":1,"memory":"2G"}}}]}}},"rayVersion":"2.46.0","workerGroupSpecs":[{"groupName":"workergroup","maxReplicas":5,"minReplicas":1,"rayStartParams":{},"replicas":1,"template":{"spec":{"containers":[{"image":"rayproject/ray:2.46.0","name":"ray-worker","resources":{"limits":{"cpu":1,"memory":"1G"},"requests":{"cpu":1,"memory":"1G"}}}]}}}]}} + creationTimestamp: "2025-09-21T03:54:44Z" + generation: 1 + name: sample + namespace: default + resourceVersion: "850" + uid: 040acb09-4e53-4a23-a8b2-28b4300af70b + spec: + headGroupSpec: + rayStartParams: { } + template: + spec: + containers: + - image: rayproject/ray:2.46.0 + name: ray-head + ports: + - containerPort: 6379 + name: gcs-server + protocol: TCP + - containerPort: 8265 + name: dashboard + protocol: TCP + - containerPort: 10001 + name: client + protocol: TCP + resources: + limits: + cpu: 1 + memory: 2G + requests: + cpu: 1 + memory: 2G + rayVersion: 2.46.0 + workerGroupSpecs: + - groupName: workergroup + maxReplicas: 5 + minReplicas: 1 + numOfHosts: 1 + rayStartParams: { } + replicas: 1 + template: + spec: + containers: + - image: rayproject/ray:2.46.0 + name: ray-worker + resources: + limits: + cpu: 1 + memory: 1G + requests: + cpu: 1 + memory: 1G + status: + availableWorkerReplicas: 1 + conditions: + - lastTransitionTime: "2025-09-21T03:55:30Z" + message: "" + reason: HeadPodRunningAndReady + status: "True" + type: HeadPodReady + - lastTransitionTime: "2025-09-21T03:55:45Z" + message: All Ray Pods are ready for the first time + reason: AllPodRunningAndReadyFirstTime + status: "True" + type: RayClusterProvisioned + - lastTransitionTime: "2025-09-21T03:54:44Z" + message: "" + reason: RayClusterSuspended + status: "False" + type: RayClusterSuspended + - lastTransitionTime: "2025-09-21T03:54:44Z" + message: "" + reason: RayClusterSuspending + status: "False" + type: RayClusterSuspending + desiredCPU: "2" + desiredGPU: "0" + desiredMemory: 3G + desiredTPU: "0" + desiredWorkerReplicas: 1 + endpoints: + client: "10001" + dashboard: "8265" + gcs-server: "6379" + metrics: "8080" + head: + podIP: 10.244.0.6 + podName: sample-head-9cvfc + serviceIP: 10.244.0.6 + serviceName: sample-head-svc + lastUpdateTime: "2025-09-21T03:55:45Z" + maxWorkerReplicas: 5 + minWorkerReplicas: 1 + observedGeneration: 1 + readyWorkerReplicas: 1 + state: ready + stateTransitionTimes: + ready: "2025-09-21T03:55:45Z" +operation: InterpretHealth +output: diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/ray.io/v1/RayCluster/testdata/observed-raycluster.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/ray.io/v1/RayCluster/testdata/observed-raycluster.yaml deleted file mode 100644 index bead72475f27..000000000000 --- a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/ray.io/v1/RayCluster/testdata/observed-raycluster.yaml +++ /dev/null @@ -1,103 +0,0 @@ -apiVersion: ray.io/v1 -kind: RayCluster -metadata: - annotations: - kubectl.kubernetes.io/last-applied-configuration: | - {"apiVersion":"ray.io/v1","kind":"RayCluster","metadata":{"annotations":{},"name":"sample","namespace":"default"},"spec":{"headGroupSpec":{"rayStartParams":{},"template":{"spec":{"containers":[{"image":"rayproject/ray:2.46.0","name":"ray-head","ports":[{"containerPort":6379,"name":"gcs-server"},{"containerPort":8265,"name":"dashboard"},{"containerPort":10001,"name":"client"}],"resources":{"limits":{"cpu":1,"memory":"2G"},"requests":{"cpu":1,"memory":"2G"}}}]}}},"rayVersion":"2.46.0","workerGroupSpecs":[{"groupName":"workergroup","maxReplicas":5,"minReplicas":1,"rayStartParams":{},"replicas":1,"template":{"spec":{"containers":[{"image":"rayproject/ray:2.46.0","name":"ray-worker","resources":{"limits":{"cpu":1,"memory":"1G"},"requests":{"cpu":1,"memory":"1G"}}}]}}}]}} - creationTimestamp: "2025-09-21T03:54:44Z" - generation: 1 - name: sample - namespace: default - resourceVersion: "850" - uid: 040acb09-4e53-4a23-a8b2-28b4300af70b -spec: - headGroupSpec: - rayStartParams: {} - template: - spec: - containers: - - image: rayproject/ray:2.46.0 - name: ray-head - ports: - - containerPort: 6379 - name: gcs-server - protocol: TCP - - containerPort: 8265 - name: dashboard - protocol: TCP - - containerPort: 10001 - name: client - protocol: TCP - resources: - limits: - cpu: 1 - memory: 2G - requests: - cpu: 1 - memory: 2G - rayVersion: 2.46.0 - workerGroupSpecs: - - groupName: workergroup - maxReplicas: 5 - minReplicas: 1 - numOfHosts: 1 - rayStartParams: {} - replicas: 1 - template: - spec: - containers: - - image: rayproject/ray:2.46.0 - name: ray-worker - resources: - limits: - cpu: 1 - memory: 1G - requests: - cpu: 1 - memory: 1G -status: - availableWorkerReplicas: 1 - conditions: - - lastTransitionTime: "2025-09-21T03:55:30Z" - message: "" - reason: HeadPodRunningAndReady - status: "True" - type: HeadPodReady - - lastTransitionTime: "2025-09-21T03:55:45Z" - message: All Ray Pods are ready for the first time - reason: AllPodRunningAndReadyFirstTime - status: "True" - type: RayClusterProvisioned - - lastTransitionTime: "2025-09-21T03:54:44Z" - message: "" - reason: RayClusterSuspended - status: "False" - type: RayClusterSuspended - - lastTransitionTime: "2025-09-21T03:54:44Z" - message: "" - reason: RayClusterSuspending - status: "False" - type: RayClusterSuspending - desiredCPU: "2" - desiredGPU: "0" - desiredMemory: 3G - desiredTPU: "0" - desiredWorkerReplicas: 1 - endpoints: - client: "10001" - dashboard: "8265" - gcs-server: "6379" - metrics: "8080" - head: - podIP: 10.244.0.6 - podName: sample-head-9cvfc - serviceIP: 10.244.0.6 - serviceName: sample-head-svc - lastUpdateTime: "2025-09-21T03:55:45Z" - maxWorkerReplicas: 5 - minWorkerReplicas: 1 - observedGeneration: 1 - readyWorkerReplicas: 1 - state: ready - stateTransitionTimes: - ready: "2025-09-21T03:55:45Z" diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/ray.io/v1/RayCluster/testdata/status-file.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/ray.io/v1/RayCluster/testdata/status-file.yaml deleted file mode 100644 index faf4f05959bc..000000000000 --- a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/ray.io/v1/RayCluster/testdata/status-file.yaml +++ /dev/null @@ -1,87 +0,0 @@ -applied: true -clusterName: member1 -status: - availableWorkerReplicas: 1 - conditions: - - lastTransitionTime: "2025-09-21T03:55:30Z" - message: "" - reason: HeadPodRunningAndReady - status: "True" - type: HeadPodReady - - lastTransitionTime: "2025-09-21T03:55:45Z" - message: All Ray Pods are ready for the first time - reason: AllPodRunningAndReadyFirstTime - status: "True" - type: RayClusterProvisioned - - lastTransitionTime: "2025-09-21T03:54:44Z" - message: "" - reason: RayClusterSuspended - status: "False" - type: RayClusterSuspended - - lastTransitionTime: "2025-09-21T03:54:44Z" - message: "" - reason: RayClusterSuspending - status: "False" - type: RayClusterSuspending - desiredCPU: "2" - desiredGPU: "0" - desiredMemory: 3G - desiredTPU: "0" - desiredWorkerReplicas: 1 - endpoints: - client: "10001" - dashboard: "8265" - gcs-server: "6379" - metrics: "8080" - head: - podIP: 10.244.0.6 - podName: sample-head-9cvfc - serviceIP: 10.244.0.6 - serviceName: sample-head-svc - lastUpdateTime: "2025-09-21T03:55:45Z" - maxWorkerReplicas: 5 - minWorkerReplicas: 1 - observedGeneration: 1 - readyWorkerReplicas: 1 - state: ready - stateTransitionTimes: - ready: "2025-09-21T03:55:45Z" ---- -applied: true -clusterName: member2 -status: - availableWorkerReplicas: 2 - conditions: - - lastTransitionTime: "2025-09-21T03:56:30Z" - message: "" - reason: HeadPodRunningAndReady - status: "True" - type: HeadPodReady - - lastTransitionTime: "2025-09-21T03:56:50Z" - message: All Ray Pods are ready for the first time - reason: AllPodRunningAndReadyFirstTime - status: "True" - type: RayClusterProvisioned - - lastTransitionTime: "2025-09-21T03:54:50Z" - message: "" - reason: RayClusterSuspended - status: "False" - type: RayClusterSuspended - - lastTransitionTime: "2025-09-21T03:54:50Z" - message: "" - reason: RayClusterSuspending - status: "False" - type: RayClusterSuspending - desiredCPU: "4" - desiredGPU: "1" - desiredMemory: 5G - desiredTPU: "0" - desiredWorkerReplicas: 3 - lastUpdateTime: "2025-09-21T03:56:50Z" - maxWorkerReplicas: 10 - minWorkerReplicas: 2 - observedGeneration: 2 - readyWorkerReplicas: 3 - state: ready - stateTransitionTimes: - ready: "2025-09-21T03:56:50Z" diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/ray.io/v1/RayJob/customizations_tests.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/ray.io/v1/RayJob/customizations_tests.yaml deleted file mode 100644 index 176eef22fe24..000000000000 --- a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/ray.io/v1/RayJob/customizations_tests.yaml +++ /dev/null @@ -1,11 +0,0 @@ -tests: - - desiredInputPath: testdata/desired-rayjob.yaml - statusInputPath: testdata/status-file.yaml - operation: AggregateStatus - - observedInputPath: testdata/observed-rayjob.yaml - operation: InterpretHealth - - observedInputPath: testdata/observed-rayjob.yaml - operation: InterpretComponent - - desiredInputPath: testdata/desired-rayjob-with-dependencies.yaml - operation: InterpretDependency - diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/ray.io/v1/RayJob/testdata/aggregatestatus-test.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/ray.io/v1/RayJob/testdata/aggregatestatus-test.yaml new file mode 100644 index 000000000000..15afbe3a041b --- /dev/null +++ b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/ray.io/v1/RayJob/testdata/aggregatestatus-test.yaml @@ -0,0 +1,97 @@ +# test case for aggregating status of RayJob +# case1. RayJob with two status items + +name: "RayJob with two status items" +description: "Test aggregating status of RayJob with two status items" +desiredObj: + apiVersion: ray.io/v1 + kind: RayJob + metadata: + name: sample-rayjob + namespace: default + spec: + entrypoint: python /home/ray/samples/sample_code.py + shutdownAfterJobFinishes: true + ttlSecondsAfterFinished: 60 + rayClusterSpec: + rayVersion: '2.46.0' + headGroupSpec: + rayStartParams: { } + template: + spec: + containers: + - name: ray-head + image: rayproject/ray:2.46.0 + ports: + - containerPort: 6379 + name: gcs-server + - containerPort: 8265 + name: dashboard + - containerPort: 10001 + name: client + resources: + limits: + cpu: "2" + memory: 4Gi + requests: + cpu: "2" + memory: 4Gi + workerGroupSpecs: + - groupName: small-workers + replicas: 2 + minReplicas: 1 + maxReplicas: 5 + rayStartParams: { } + template: + spec: + containers: + - name: ray-worker + image: rayproject/ray:2.46.0 + resources: + limits: + cpu: "1" + memory: 2Gi + requests: + cpu: "1" + memory: 2Gi +statusItems: + - applied: true + clusterName: member1 + status: + jobId: raysubmit_12345abcde + rayClusterName: sample-rayjob-raycluster-abc12 + dashboardURL: "sample-rayjob-raycluster-abc12-head-svc.default.svc.cluster.local:8265" + jobStatus: RUNNING + jobDeploymentStatus: Running + startTime: "2025-11-22T10:30:00Z" + succeeded: 0 + failed: 0 + observedGeneration: 1 + rayJobInfo: + startTime: "2025-11-22T10:30:15Z" + rayClusterStatus: + availableWorkerReplicas: 2 + desiredCPU: "4" + desiredMemory: 8Gi + readyWorkerReplicas: 2 + - applied: true + clusterName: member2 + status: + jobId: raysubmit_12345abcde + rayClusterName: sample-rayjob-raycluster-xyz78 + dashboardURL: "sample-rayjob-raycluster-xyz78-head-svc.default.svc.cluster.local:8265" + jobStatus: RUNNING + jobDeploymentStatus: Running + startTime: "2025-11-22T10:31:00Z" + succeeded: 0 + failed: 0 + observedGeneration: 2 + rayJobInfo: + startTime: "2025-11-22T10:31:20Z" + rayClusterStatus: + availableWorkerReplicas: 3 + desiredCPU: "6" + desiredMemory: 12Gi + readyWorkerReplicas: 3 +operation: AggregateStatus +output: diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/ray.io/v1/RayJob/testdata/desired-rayjob-with-dependencies.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/ray.io/v1/RayJob/testdata/desired-rayjob-with-dependencies.yaml deleted file mode 100644 index 7f9590fe5ac5..000000000000 --- a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/ray.io/v1/RayJob/testdata/desired-rayjob-with-dependencies.yaml +++ /dev/null @@ -1,125 +0,0 @@ -apiVersion: ray.io/v1 -kind: RayJob -metadata: - name: rayjob-with-dependencies - namespace: default -spec: - entrypoint: python /home/ray/samples/sample_code.py - shutdownAfterJobFinishes: false - submissionMode: K8sJobMode - runtimeEnvYAML: | - pip: - - requests==2.26.0 - env_vars: - counter_name: "test_counter" - rayClusterSpec: - rayVersion: '2.52.0' - headGroupSpec: - rayStartParams: {} - template: - spec: - serviceAccountName: ray-head-sa - imagePullSecrets: - - name: registry-secret - containers: - - name: ray-head - image: rayproject/ray:2.52.0 - ports: - - containerPort: 6379 - name: gcs-server - - containerPort: 8265 - name: dashboard - resources: - limits: - cpu: "1" - memory: 2Gi - volumeMounts: - - mountPath: /home/ray/samples - name: code-sample - - mountPath: /etc/config - name: app-config - - mountPath: /etc/tls - name: tls-certs - envFrom: - - configMapRef: - name: ray-env-config - - secretRef: - name: ray-env-secrets - env: - - name: API_KEY - valueFrom: - secretKeyRef: - name: api-credentials - key: api-key - - name: DB_CONFIG - valueFrom: - configMapKeyRef: - name: db-config - key: connection-string - volumes: - - name: code-sample - configMap: - name: ray-job-code-sample - - name: app-config - configMap: - name: app-config - - name: tls-certs - secret: - secretName: tls-certs - - name: projected-vol - projected: - sources: - - configMap: - name: projected-config - - secret: - name: projected-secret - workerGroupSpecs: - - replicas: 2 - minReplicas: 1 - maxReplicas: 5 - groupName: small-group - rayStartParams: {} - template: - spec: - containers: - - name: ray-worker - image: rayproject/ray:2.52.0 - resources: - limits: - cpu: "1" - memory: 1Gi - volumeMounts: - - mountPath: /data - name: worker-data - - mountPath: /cache - name: worker-cache - initContainers: - - name: init-worker - image: busybox:latest - envFrom: - - configMapRef: - name: init-config - volumes: - - name: worker-data - secret: - secretName: worker-data-secret - - name: worker-cache - persistentVolumeClaim: - claimName: worker-cache-pvc - submitterPodTemplate: - spec: - restartPolicy: Never - containers: - - name: ray-job-submitter - image: rayproject/ray:2.52.0 - envFrom: - - secretRef: - name: submitter-secrets - volumeMounts: - - mountPath: /config - name: submitter-config - volumes: - - name: submitter-config - configMap: - name: submitter-config - diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/ray.io/v1/RayJob/testdata/desired-rayjob.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/ray.io/v1/RayJob/testdata/desired-rayjob.yaml deleted file mode 100644 index 91813ffbca60..000000000000 --- a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/ray.io/v1/RayJob/testdata/desired-rayjob.yaml +++ /dev/null @@ -1,51 +0,0 @@ -apiVersion: ray.io/v1 -kind: RayJob -metadata: - name: sample-rayjob - namespace: default -spec: - entrypoint: python /home/ray/samples/sample_code.py - shutdownAfterJobFinishes: true - ttlSecondsAfterFinished: 60 - rayClusterSpec: - rayVersion: '2.46.0' - headGroupSpec: - rayStartParams: {} - template: - spec: - containers: - - name: ray-head - image: rayproject/ray:2.46.0 - ports: - - containerPort: 6379 - name: gcs-server - - containerPort: 8265 - name: dashboard - - containerPort: 10001 - name: client - resources: - limits: - cpu: "2" - memory: 4Gi - requests: - cpu: "2" - memory: 4Gi - workerGroupSpecs: - - groupName: small-workers - replicas: 2 - minReplicas: 1 - maxReplicas: 5 - rayStartParams: {} - template: - spec: - containers: - - name: ray-worker - image: rayproject/ray:2.46.0 - resources: - limits: - cpu: "1" - memory: 2Gi - requests: - cpu: "1" - memory: 2Gi - diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/ray.io/v1/RayJob/testdata/interprethealth-test.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/ray.io/v1/RayJob/testdata/interprethealth-test.yaml new file mode 100644 index 000000000000..c7cf0ff36a2a --- /dev/null +++ b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/ray.io/v1/RayJob/testdata/interprethealth-test.yaml @@ -0,0 +1,76 @@ +# test case for interpreting health of RayJob +# case1. RayJob: interpret health test + +name: "RayJob: interpret health test" +description: "Test interpreting health for RayJob" +observedObj: + apiVersion: ray.io/v1 + kind: RayJob + metadata: + name: sample-rayjob + namespace: default + generation: 1 + spec: + entrypoint: python /home/ray/samples/sample_code.py + shutdownAfterJobFinishes: true + ttlSecondsAfterFinished: 60 + rayClusterSpec: + rayVersion: '2.46.0' + headGroupSpec: + rayStartParams: { } + template: + spec: + containers: + - name: ray-head + image: rayproject/ray:2.46.0 + resources: + limits: + cpu: "2" + memory: 4Gi + workerGroupSpecs: + - groupName: small-workers + replicas: 2 + minReplicas: 1 + maxReplicas: 5 + rayStartParams: { } + template: + spec: + containers: + - name: ray-worker + image: rayproject/ray:2.46.0 + resources: + limits: + cpu: "1" + memory: 2Gi + status: + jobId: raysubmit_12345abcde + rayClusterName: sample-rayjob-raycluster-abc12 + dashboardURL: "sample-rayjob-raycluster-abc12-head-svc.default.svc.cluster.local:8265" + jobStatus: RUNNING + jobDeploymentStatus: Running + startTime: "2025-11-22T10:30:00Z" + succeeded: 0 + failed: 0 + observedGeneration: 1 + rayJobInfo: + startTime: "2025-11-22T10:30:15Z" + rayClusterStatus: + availableWorkerReplicas: 2 + conditions: + - lastTransitionTime: "2025-11-22T10:29:30Z" + message: "" + reason: HeadPodRunningAndReady + status: "True" + type: HeadPodReady + - lastTransitionTime: "2025-11-22T10:29:45Z" + message: All Ray Pods are ready for the first time + reason: AllPodRunningAndReadyFirstTime + status: "True" + type: RayClusterProvisioned + desiredCPU: "4" + desiredMemory: 8Gi + desiredWorkerReplicas: 2 + readyWorkerReplicas: 2 + state: ready +operation: InterpretHealth +output: diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/ray.io/v1/RayJob/testdata/observed-rayjob.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/ray.io/v1/RayJob/testdata/observed-rayjob.yaml deleted file mode 100644 index 32d5b39f36e4..000000000000 --- a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/ray.io/v1/RayJob/testdata/observed-rayjob.yaml +++ /dev/null @@ -1,69 +0,0 @@ -apiVersion: ray.io/v1 -kind: RayJob -metadata: - name: sample-rayjob - namespace: default - generation: 1 -spec: - entrypoint: python /home/ray/samples/sample_code.py - shutdownAfterJobFinishes: true - ttlSecondsAfterFinished: 60 - rayClusterSpec: - rayVersion: '2.46.0' - headGroupSpec: - rayStartParams: {} - template: - spec: - containers: - - name: ray-head - image: rayproject/ray:2.46.0 - resources: - limits: - cpu: "2" - memory: 4Gi - workerGroupSpecs: - - groupName: small-workers - replicas: 2 - minReplicas: 1 - maxReplicas: 5 - rayStartParams: {} - template: - spec: - containers: - - name: ray-worker - image: rayproject/ray:2.46.0 - resources: - limits: - cpu: "1" - memory: 2Gi -status: - jobId: raysubmit_12345abcde - rayClusterName: sample-rayjob-raycluster-abc12 - dashboardURL: "sample-rayjob-raycluster-abc12-head-svc.default.svc.cluster.local:8265" - jobStatus: RUNNING - jobDeploymentStatus: Running - startTime: "2025-11-22T10:30:00Z" - succeeded: 0 - failed: 0 - observedGeneration: 1 - rayJobInfo: - startTime: "2025-11-22T10:30:15Z" - rayClusterStatus: - availableWorkerReplicas: 2 - conditions: - - lastTransitionTime: "2025-11-22T10:29:30Z" - message: "" - reason: HeadPodRunningAndReady - status: "True" - type: HeadPodReady - - lastTransitionTime: "2025-11-22T10:29:45Z" - message: All Ray Pods are ready for the first time - reason: AllPodRunningAndReadyFirstTime - status: "True" - type: RayClusterProvisioned - desiredCPU: "4" - desiredMemory: 8Gi - desiredWorkerReplicas: 2 - readyWorkerReplicas: 2 - state: ready - diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/ray.io/v1/RayJob/testdata/status-file.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/ray.io/v1/RayJob/testdata/status-file.yaml deleted file mode 100644 index d9fcfd5ca573..000000000000 --- a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/ray.io/v1/RayJob/testdata/status-file.yaml +++ /dev/null @@ -1,40 +0,0 @@ -applied: true -clusterName: member1 -status: - jobId: raysubmit_12345abcde - rayClusterName: sample-rayjob-raycluster-abc12 - dashboardURL: "sample-rayjob-raycluster-abc12-head-svc.default.svc.cluster.local:8265" - jobStatus: RUNNING - jobDeploymentStatus: Running - startTime: "2025-11-22T10:30:00Z" - succeeded: 0 - failed: 0 - observedGeneration: 1 - rayJobInfo: - startTime: "2025-11-22T10:30:15Z" - rayClusterStatus: - availableWorkerReplicas: 2 - desiredCPU: "4" - desiredMemory: 8Gi - readyWorkerReplicas: 2 ---- -applied: true -clusterName: member2 -status: - jobId: raysubmit_12345abcde - rayClusterName: sample-rayjob-raycluster-xyz78 - dashboardURL: "sample-rayjob-raycluster-xyz78-head-svc.default.svc.cluster.local:8265" - jobStatus: RUNNING - jobDeploymentStatus: Running - startTime: "2025-11-22T10:31:00Z" - succeeded: 0 - failed: 0 - observedGeneration: 2 - rayJobInfo: - startTime: "2025-11-22T10:31:20Z" - rayClusterStatus: - availableWorkerReplicas: 3 - desiredCPU: "6" - desiredMemory: 12Gi - readyWorkerReplicas: 3 - diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/source.toolkit.fluxcd.io/v1/GitRepository/customizations_tests.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/source.toolkit.fluxcd.io/v1/GitRepository/customizations_tests.yaml deleted file mode 100644 index b58c549bb2e6..000000000000 --- a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/source.toolkit.fluxcd.io/v1/GitRepository/customizations_tests.yaml +++ /dev/null @@ -1,13 +0,0 @@ -tests: - - desiredInputPath: testdata/desired-gitrepository.yaml - statusInputPath: testdata/status-file.yaml - operation: AggregateStatus - - desiredInputPath: testdata/desired-gitrepository.yaml - operation: InterpretDependency - - desiredInputPath: testdata/desired-gitrepository.yaml - observedInputPath: testdata/observed-gitrepository.yaml - operation: Retain - - observedInputPath: testdata/observed-gitrepository.yaml - operation: InterpretHealth - - observedInputPath: testdata/observed-gitrepository.yaml - operation: InterpretStatus diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/source.toolkit.fluxcd.io/v1/GitRepository/testdata/aggregatestatus-test.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/source.toolkit.fluxcd.io/v1/GitRepository/testdata/aggregatestatus-test.yaml new file mode 100644 index 000000000000..22e1422b27e1 --- /dev/null +++ b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/source.toolkit.fluxcd.io/v1/GitRepository/testdata/aggregatestatus-test.yaml @@ -0,0 +1,74 @@ +# test case for aggregating status of GitRepository +# case1. GitRepository with two status items + +name: "GitRepository with two status items" +description: "Test aggregating status of GitRepository with two status items" +desiredObj: + apiVersion: source.toolkit.fluxcd.io/v1 + kind: GitRepository + metadata: + generation: 1 + name: sample + namespace: test-gitrepository + spec: + interval: 30s + ref: + branch: master + url: https://github.com/stefanprodan/podinfo +statusItems: + - applied: true + clusterName: member1 + health: Healthy + status: + artifact: + digest: sha256:a375b2ca68275734e3850d3c80e0bc20c1d7a4daa1a9717056d5c0c563ea0719 + lastUpdateTime: "2023-05-01T10:17:09Z" + path: gitrepository/test-gitrepository/sample/0647aea75b85755411b007a290b9321668370be5.tar.gz + revision: master@sha1:0647aea75b85755411b007a290b9321668370be5 + size: 83516 + url: http://source-controller.flux-system.svc.cluster.local./gitrepository/test-gitrepository/sample/0647aea75b85755411b007a290b9321668370be5.tar.gz + conditions: + - lastTransitionTime: "2023-05-01T10:17:09Z" + message: stored artifact for revision 'master@sha1:0647aea75b85755411b007a290b9321668370be5' + observedGeneration: 1 + reason: Succeeded + status: "True" + type: Ready + - lastTransitionTime: "2023-05-01T10:17:09Z" + message: stored artifact for revision 'master@sha1:0647aea75b85755411b007a290b9321668370be5' + observedGeneration: 1 + reason: Succeeded + status: "True" + type: ArtifactInStorage + generation: 1 + observedGeneration: 1 + resourceTemplateGeneration: 1 + - applied: true + clusterName: member3 + health: Healthy + status: + artifact: + digest: sha256:a375b2ca68275734e3850d3c80e0bc20c1d7a4daa1a9717056d5c0c563ea0719 + lastUpdateTime: "2023-05-01T10:17:08Z" + path: gitrepository/test-gitrepository/sample/0647aea75b85755411b007a290b9321668370be5.tar.gz + revision: master@sha1:0647aea75b85755411b007a290b9321668370be5 + size: 83516 + url: http://source-controller.flux-system.svc.cluster.local./gitrepository/test-gitrepository/sample/0647aea75b85755411b007a290b9321668370be5.tar.gz + conditions: + - lastTransitionTime: "2023-05-01T10:17:08Z" + message: stored artifact for revision 'master@sha1:0647aea75b85755411b007a290b9321668370be5' + observedGeneration: 1 + reason: Succeeded + status: "True" + type: Ready + - lastTransitionTime: "2023-05-01T10:17:08Z" + message: stored artifact for revision 'master@sha1:0647aea75b85755411b007a290b9321668370be5' + observedGeneration: 1 + reason: Succeeded + status: "True" + type: ArtifactInStorage + generation: 1 + observedGeneration: 1 + resourceTemplateGeneration: 1 +operation: AggregateStatus +output: diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/source.toolkit.fluxcd.io/v1/GitRepository/testdata/desired-gitrepository.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/source.toolkit.fluxcd.io/v1/GitRepository/testdata/desired-gitrepository.yaml deleted file mode 100644 index f0c3e95e7ef6..000000000000 --- a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/source.toolkit.fluxcd.io/v1/GitRepository/testdata/desired-gitrepository.yaml +++ /dev/null @@ -1,11 +0,0 @@ -apiVersion: source.toolkit.fluxcd.io/v1 -kind: GitRepository -metadata: - generation: 1 - name: sample - namespace: test-gitrepository -spec: - interval: 30s - ref: - branch: master - url: https://github.com/stefanprodan/podinfo diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/source.toolkit.fluxcd.io/v1/GitRepository/testdata/interpretstatus-test.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/source.toolkit.fluxcd.io/v1/GitRepository/testdata/interpretstatus-test.yaml new file mode 100644 index 000000000000..19512aa5a910 --- /dev/null +++ b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/source.toolkit.fluxcd.io/v1/GitRepository/testdata/interpretstatus-test.yaml @@ -0,0 +1,47 @@ +# test case for interpreting status of GitRepository +# case1. GitRepository: interpret status test + +name: "GitRepository: interpret status test" +description: "Test interpreting status for GitRepository" +observedObj: + apiVersion: source.toolkit.fluxcd.io/v1 + kind: GitRepository + metadata: + annotations: + resourcetemplate.karmada.io/generation: "1" + generation: 1 + name: sample + namespace: test-gitrepository + spec: + interval: 30s + ref: + branch: master + secretRef: + name: fake-secret + timeout: 60s + url: https://github.com/stefanprodan/podinfo + suspend: true + status: + artifact: + digest: sha256:a375b2ca68275734e3850d3c80e0bc20c1d7a4daa1a9717056d5c0c563ea0719 + lastUpdateTime: "2023-05-01T10:17:09Z" + path: gitrepository/test-gitrepository/sample/0647aea75b85755411b007a290b9321668370be5.tar.gz + revision: master@sha1:0647aea75b85755411b007a290b9321668370be5 + size: 83516 + url: http://source-controller.flux-system.svc.cluster.local./gitrepository/test-gitrepository/sample/0647aea75b85755411b007a290b9321668370be5.tar.gz + conditions: + - lastTransitionTime: "2023-05-01T10:17:09Z" + message: stored artifact for revision 'master@sha1:0647aea75b85755411b007a290b9321668370be5' + observedGeneration: 1 + reason: Succeeded + status: "True" + type: Ready + - lastTransitionTime: "2023-05-01T10:17:09Z" + message: stored artifact for revision 'master@sha1:0647aea75b85755411b007a290b9321668370be5' + observedGeneration: 1 + reason: Succeeded + status: "True" + type: ArtifactInStorage + observedGeneration: 1 +operation: InterpretStatus +output: diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/source.toolkit.fluxcd.io/v1/GitRepository/testdata/observed-gitrepository.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/source.toolkit.fluxcd.io/v1/GitRepository/testdata/observed-gitrepository.yaml deleted file mode 100644 index 1a64811afe14..000000000000 --- a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/source.toolkit.fluxcd.io/v1/GitRepository/testdata/observed-gitrepository.yaml +++ /dev/null @@ -1,39 +0,0 @@ -apiVersion: source.toolkit.fluxcd.io/v1 -kind: GitRepository -metadata: - annotations: - resourcetemplate.karmada.io/generation: "1" - generation: 1 - name: sample - namespace: test-gitrepository -spec: - interval: 30s - ref: - branch: master - secretRef: - name: fake-secret - timeout: 60s - url: https://github.com/stefanprodan/podinfo - suspend: true -status: - artifact: - digest: sha256:a375b2ca68275734e3850d3c80e0bc20c1d7a4daa1a9717056d5c0c563ea0719 - lastUpdateTime: "2023-05-01T10:17:09Z" - path: gitrepository/test-gitrepository/sample/0647aea75b85755411b007a290b9321668370be5.tar.gz - revision: master@sha1:0647aea75b85755411b007a290b9321668370be5 - size: 83516 - url: http://source-controller.flux-system.svc.cluster.local./gitrepository/test-gitrepository/sample/0647aea75b85755411b007a290b9321668370be5.tar.gz - conditions: - - lastTransitionTime: "2023-05-01T10:17:09Z" - message: stored artifact for revision 'master@sha1:0647aea75b85755411b007a290b9321668370be5' - observedGeneration: 1 - reason: Succeeded - status: "True" - type: Ready - - lastTransitionTime: "2023-05-01T10:17:09Z" - message: stored artifact for revision 'master@sha1:0647aea75b85755411b007a290b9321668370be5' - observedGeneration: 1 - reason: Succeeded - status: "True" - type: ArtifactInStorage - observedGeneration: 1 diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/source.toolkit.fluxcd.io/v1/GitRepository/testdata/status-file.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/source.toolkit.fluxcd.io/v1/GitRepository/testdata/status-file.yaml deleted file mode 100644 index 6878cd4bfbb2..000000000000 --- a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/source.toolkit.fluxcd.io/v1/GitRepository/testdata/status-file.yaml +++ /dev/null @@ -1,55 +0,0 @@ -applied: true -clusterName: member1 -health: Healthy -status: - artifact: - digest: sha256:a375b2ca68275734e3850d3c80e0bc20c1d7a4daa1a9717056d5c0c563ea0719 - lastUpdateTime: "2023-05-01T10:17:09Z" - path: gitrepository/test-gitrepository/sample/0647aea75b85755411b007a290b9321668370be5.tar.gz - revision: master@sha1:0647aea75b85755411b007a290b9321668370be5 - size: 83516 - url: http://source-controller.flux-system.svc.cluster.local./gitrepository/test-gitrepository/sample/0647aea75b85755411b007a290b9321668370be5.tar.gz - conditions: - - lastTransitionTime: "2023-05-01T10:17:09Z" - message: stored artifact for revision 'master@sha1:0647aea75b85755411b007a290b9321668370be5' - observedGeneration: 1 - reason: Succeeded - status: "True" - type: Ready - - lastTransitionTime: "2023-05-01T10:17:09Z" - message: stored artifact for revision 'master@sha1:0647aea75b85755411b007a290b9321668370be5' - observedGeneration: 1 - reason: Succeeded - status: "True" - type: ArtifactInStorage - generation: 1 - observedGeneration: 1 - resourceTemplateGeneration: 1 ---- -applied: true -clusterName: member3 -health: Healthy -status: - artifact: - digest: sha256:a375b2ca68275734e3850d3c80e0bc20c1d7a4daa1a9717056d5c0c563ea0719 - lastUpdateTime: "2023-05-01T10:17:08Z" - path: gitrepository/test-gitrepository/sample/0647aea75b85755411b007a290b9321668370be5.tar.gz - revision: master@sha1:0647aea75b85755411b007a290b9321668370be5 - size: 83516 - url: http://source-controller.flux-system.svc.cluster.local./gitrepository/test-gitrepository/sample/0647aea75b85755411b007a290b9321668370be5.tar.gz - conditions: - - lastTransitionTime: "2023-05-01T10:17:08Z" - message: stored artifact for revision 'master@sha1:0647aea75b85755411b007a290b9321668370be5' - observedGeneration: 1 - reason: Succeeded - status: "True" - type: Ready - - lastTransitionTime: "2023-05-01T10:17:08Z" - message: stored artifact for revision 'master@sha1:0647aea75b85755411b007a290b9321668370be5' - observedGeneration: 1 - reason: Succeeded - status: "True" - type: ArtifactInStorage - generation: 1 - observedGeneration: 1 - resourceTemplateGeneration: 1 diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/source.toolkit.fluxcd.io/v1beta2/Bucket/customizations_tests.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/source.toolkit.fluxcd.io/v1beta2/Bucket/customizations_tests.yaml deleted file mode 100644 index 44973cbb5cf3..000000000000 --- a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/source.toolkit.fluxcd.io/v1beta2/Bucket/customizations_tests.yaml +++ /dev/null @@ -1,13 +0,0 @@ -tests: - - desiredInputPath: testdata/desired-bucket.yaml - statusInputPath: testdata/status-file.yaml - operation: AggregateStatus - - desiredInputPath: testdata/desired-bucket.yaml - operation: InterpretDependency - - desiredInputPath: testdata/desired-bucket.yaml - observedInputPath: testdata/observed-bucket.yaml - operation: Retain - - observedInputPath: testdata/observed-bucket.yaml - operation: InterpretHealth - - observedInputPath: testdata/observed-bucket.yaml - operation: InterpretStatus diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/source.toolkit.fluxcd.io/v1beta2/Bucket/testdata/aggregatestatus-test.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/source.toolkit.fluxcd.io/v1beta2/Bucket/testdata/aggregatestatus-test.yaml new file mode 100644 index 000000000000..57696805b8ca --- /dev/null +++ b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/source.toolkit.fluxcd.io/v1beta2/Bucket/testdata/aggregatestatus-test.yaml @@ -0,0 +1,80 @@ +# test case for aggregating status of Bucket +# case1. Bucket with two status items + +name: "Bucket with two status items" +description: "Test aggregating status of Bucket with two status items" +desiredObj: + apiVersion: source.toolkit.fluxcd.io/v1beta2 + kind: Bucket + metadata: + name: sample + namespace: test-bucket + generation: 1 + spec: + provider: generic + interval: 5m0s + bucketName: podinfo + endpoint: minio.minio.svc.cluster.local:9000 + timeout: 60s + insecure: true + secretRef: + name: fake-minio-credentials +statusItems: + - applied: true + clusterName: member1 + health: Unhealthy + status: + conditions: + - lastTransitionTime: "2023-04-29T14:02:31Z" + message: building artifact + observedGeneration: 1 + reason: ProgressingWithRetry + status: "True" + type: Reconciling + - lastTransitionTime: "2023-04-29T14:02:31Z" + message: 'invalid ''fake-secret'' secret data: required fields ''accesskey'' + and ''secretkey''' + observedGeneration: 1 + reason: AuthenticationFailed + status: "False" + type: Ready + - lastTransitionTime: "2023-04-29T14:01:44Z" + message: 'invalid ''fake-secret'' secret data: required fields ''accesskey'' + and ''secretkey''' + observedGeneration: 1 + reason: AuthenticationFailed + status: "True" + type: FetchFailed + generation: 1 + observedGeneration: -1 + resourceTemplateGeneration: 1 + - applied: true + clusterName: member3 + health: Unhealthy + status: + conditions: + - lastTransitionTime: "2023-04-29T14:02:31Z" + message: building artifact + observedGeneration: 1 + reason: ProgressingWithRetry + status: "True" + type: Reconciling + - lastTransitionTime: "2023-04-29T14:02:31Z" + message: 'invalid ''fake-secret'' secret data: required fields ''accesskey'' + and ''secretkey''' + observedGeneration: 1 + reason: AuthenticationFailed + status: "False" + type: Ready + - lastTransitionTime: "2023-04-29T14:01:44Z" + message: 'invalid ''fake-secret'' secret data: required fields ''accesskey'' + and ''secretkey''' + observedGeneration: 1 + reason: AuthenticationFailed + status: "True" + type: FetchFailed + generation: 1 + observedGeneration: -1 + resourceTemplateGeneration: 1 +operation: AggregateStatus +output: diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/source.toolkit.fluxcd.io/v1beta2/Bucket/testdata/desired-bucket.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/source.toolkit.fluxcd.io/v1beta2/Bucket/testdata/desired-bucket.yaml deleted file mode 100644 index b7d17dfd0391..000000000000 --- a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/source.toolkit.fluxcd.io/v1beta2/Bucket/testdata/desired-bucket.yaml +++ /dev/null @@ -1,15 +0,0 @@ -apiVersion: source.toolkit.fluxcd.io/v1beta2 -kind: Bucket -metadata: - name: sample - namespace: test-bucket - generation: 1 -spec: - provider: generic - interval: 5m0s - bucketName: podinfo - endpoint: minio.minio.svc.cluster.local:9000 - timeout: 60s - insecure: true - secretRef: - name: fake-minio-credentials diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/source.toolkit.fluxcd.io/v1beta2/Bucket/testdata/interpretstatus-test.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/source.toolkit.fluxcd.io/v1beta2/Bucket/testdata/interpretstatus-test.yaml new file mode 100644 index 000000000000..fcbc7f4c8781 --- /dev/null +++ b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/source.toolkit.fluxcd.io/v1beta2/Bucket/testdata/interpretstatus-test.yaml @@ -0,0 +1,49 @@ +# test case for interpreting status of Bucket +# case1. Bucket: interpret status test + +name: "Bucket: interpret status test" +description: "Test interpreting status for Bucket" +observedObj: + apiVersion: source.toolkit.fluxcd.io/v1beta2 + kind: Bucket + metadata: + name: sample + namespace: test-bucket + annotations: + resourcetemplate.karmada.io/generation: "1" + generation: 1 + spec: + provider: generic + interval: 5m0s + bucketName: podinfo + endpoint: minio.minio.svc.cluster.local:9000 + timeout: 60s + insecure: true + secretRef: + name: fake-minio-credentials + suspend: true + status: + conditions: + - lastTransitionTime: "2023-04-29T14:03:19Z" + message: building artifact + observedGeneration: 1 + reason: ProgressingWithRetry + status: "True" + type: Reconciling + - lastTransitionTime: "2023-04-29T14:03:19Z" + message: 'invalid ''fake-secret'' secret data: required fields ''accesskey'' + and ''secretkey''' + observedGeneration: 1 + reason: AuthenticationFailed + status: "False" + type: Ready + - lastTransitionTime: "2023-04-29T14:01:44Z" + message: 'invalid ''fake-secret'' secret data: required fields ''accesskey'' + and ''secretkey''' + observedGeneration: 1 + reason: AuthenticationFailed + status: "True" + type: FetchFailed + observedGeneration: -1 +operation: InterpretStatus +output: diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/source.toolkit.fluxcd.io/v1beta2/Bucket/testdata/observed-bucket.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/source.toolkit.fluxcd.io/v1beta2/Bucket/testdata/observed-bucket.yaml deleted file mode 100644 index ac73f617f57e..000000000000 --- a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/source.toolkit.fluxcd.io/v1beta2/Bucket/testdata/observed-bucket.yaml +++ /dev/null @@ -1,41 +0,0 @@ -apiVersion: source.toolkit.fluxcd.io/v1beta2 -kind: Bucket -metadata: - name: sample - namespace: test-bucket - annotations: - resourcetemplate.karmada.io/generation: "1" - generation: 1 -spec: - provider: generic - interval: 5m0s - bucketName: podinfo - endpoint: minio.minio.svc.cluster.local:9000 - timeout: 60s - insecure: true - secretRef: - name: fake-minio-credentials - suspend: true -status: - conditions: - - lastTransitionTime: "2023-04-29T14:03:19Z" - message: building artifact - observedGeneration: 1 - reason: ProgressingWithRetry - status: "True" - type: Reconciling - - lastTransitionTime: "2023-04-29T14:03:19Z" - message: 'invalid ''fake-secret'' secret data: required fields ''accesskey'' - and ''secretkey''' - observedGeneration: 1 - reason: AuthenticationFailed - status: "False" - type: Ready - - lastTransitionTime: "2023-04-29T14:01:44Z" - message: 'invalid ''fake-secret'' secret data: required fields ''accesskey'' - and ''secretkey''' - observedGeneration: 1 - reason: AuthenticationFailed - status: "True" - type: FetchFailed - observedGeneration: -1 diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/source.toolkit.fluxcd.io/v1beta2/Bucket/testdata/status-file.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/source.toolkit.fluxcd.io/v1beta2/Bucket/testdata/status-file.yaml deleted file mode 100644 index 8db6c97a1a08..000000000000 --- a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/source.toolkit.fluxcd.io/v1beta2/Bucket/testdata/status-file.yaml +++ /dev/null @@ -1,57 +0,0 @@ -applied: true -clusterName: member1 -health: Unhealthy -status: - conditions: - - lastTransitionTime: "2023-04-29T14:02:31Z" - message: building artifact - observedGeneration: 1 - reason: ProgressingWithRetry - status: "True" - type: Reconciling - - lastTransitionTime: "2023-04-29T14:02:31Z" - message: 'invalid ''fake-secret'' secret data: required fields ''accesskey'' - and ''secretkey''' - observedGeneration: 1 - reason: AuthenticationFailed - status: "False" - type: Ready - - lastTransitionTime: "2023-04-29T14:01:44Z" - message: 'invalid ''fake-secret'' secret data: required fields ''accesskey'' - and ''secretkey''' - observedGeneration: 1 - reason: AuthenticationFailed - status: "True" - type: FetchFailed - generation: 1 - observedGeneration: -1 - resourceTemplateGeneration: 1 ---- -applied: true -clusterName: member3 -health: Unhealthy -status: - conditions: - - lastTransitionTime: "2023-04-29T14:02:31Z" - message: building artifact - observedGeneration: 1 - reason: ProgressingWithRetry - status: "True" - type: Reconciling - - lastTransitionTime: "2023-04-29T14:02:31Z" - message: 'invalid ''fake-secret'' secret data: required fields ''accesskey'' - and ''secretkey''' - observedGeneration: 1 - reason: AuthenticationFailed - status: "False" - type: Ready - - lastTransitionTime: "2023-04-29T14:01:44Z" - message: 'invalid ''fake-secret'' secret data: required fields ''accesskey'' - and ''secretkey''' - observedGeneration: 1 - reason: AuthenticationFailed - status: "True" - type: FetchFailed - generation: 1 - observedGeneration: -1 - resourceTemplateGeneration: 1 diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/source.toolkit.fluxcd.io/v1beta2/HelmChart/customizations_tests.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/source.toolkit.fluxcd.io/v1beta2/HelmChart/customizations_tests.yaml deleted file mode 100644 index bba82df71d39..000000000000 --- a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/source.toolkit.fluxcd.io/v1beta2/HelmChart/customizations_tests.yaml +++ /dev/null @@ -1,13 +0,0 @@ -tests: - - desiredInputPath: testdata/desired-helmchart.yaml - statusInputPath: testdata/status-file.yaml - operation: AggregateStatus - - desiredInputPath: testdata/desired-helmchart.yaml - operation: InterpretDependency - - desiredInputPath: testdata/desired-helmchart.yaml - observedInputPath: testdata/observed-helmchart.yaml - operation: Retain - - observedInputPath: testdata/observed-helmchart.yaml - operation: InterpretHealth - - observedInputPath: testdata/observed-helmchart.yaml - operation: InterpretStatus diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/source.toolkit.fluxcd.io/v1beta2/HelmChart/testdata/aggregatestatus-test.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/source.toolkit.fluxcd.io/v1beta2/HelmChart/testdata/aggregatestatus-test.yaml new file mode 100644 index 000000000000..fac553ed9df5 --- /dev/null +++ b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/source.toolkit.fluxcd.io/v1beta2/HelmChart/testdata/aggregatestatus-test.yaml @@ -0,0 +1,83 @@ +# test case for aggregating status of HelmChart +# case1. HelmChart with two status items + +name: "HelmChart with two status items" +description: "Test aggregating status of HelmChart with two status items" +desiredObj: + apiVersion: source.toolkit.fluxcd.io/v1beta2 + kind: HelmChart + metadata: + name: sample + namespace: test-helmchart + generation: 1 + spec: + interval: 5m0s + chart: podinfo + reconcileStrategy: ChartVersion + sourceRef: + kind: HelmRepository + name: sample + version: '5.*' +statusItems: + - applied: true + clusterName: member1 + health: Healthy + status: + artifact: + digest: sha256:6c3cc3b955bce1686036ae6822ee2ca0ef6ecb994e3f2d19eaf3ec03dcba84b3 + lastUpdateTime: "2023-04-30T07:22:36Z" + path: helmchart/test-helmchart/sample/podinfo-5.2.1.tgz + revision: 5.2.1 + size: 13418 + url: http://source-controller.flux-system.svc.cluster.local./helmchart/test-helmchart/sample/podinfo-5.2.1.tgz + conditions: + - lastTransitionTime: "2023-04-30T07:22:36Z" + message: pulled 'podinfo' chart with version '5.2.1' + observedGeneration: 1 + reason: ChartPullSucceeded + status: "True" + type: Ready + - lastTransitionTime: "2023-04-30T07:22:36Z" + message: pulled 'podinfo' chart with version '5.2.1' + observedGeneration: 1 + reason: ChartPullSucceeded + status: "True" + type: ArtifactInStorage + generation: 1 + observedChartName: podinfo + observedGeneration: 1 + observedSourceArtifactRevision: sha256:61f94c20ee9417f222c3d30672724473ae50d406c8c097d80a8a6263c1384f69 + resourceTemplateGeneration: 1 + url: http://source-controller.flux-system.svc.cluster.local./helmchart/test-helmchart/sample/latest.tar.gz + - applied: true + clusterName: member3 + health: Healthy + status: + artifact: + digest: sha256:6c3cc3b955bce1686036ae6822ee2ca0ef6ecb994e3f2d19eaf3ec03dcba84b3 + lastUpdateTime: "2023-04-30T07:22:37Z" + path: helmchart/test-helmchart/sample/podinfo-5.2.1.tgz + revision: 5.2.1 + size: 13418 + url: http://source-controller.flux-system.svc.cluster.local./helmchart/test-helmchart/sample/podinfo-5.2.1.tgz + conditions: + - lastTransitionTime: "2023-04-30T07:22:37Z" + message: pulled 'podinfo' chart with version '5.2.1' + observedGeneration: 1 + reason: ChartPullSucceeded + status: "True" + type: Ready + - lastTransitionTime: "2023-04-30T07:22:37Z" + message: pulled 'podinfo' chart with version '5.2.1' + observedGeneration: 1 + reason: ChartPullSucceeded + status: "True" + type: ArtifactInStorage + generation: 1 + observedChartName: podinfo + observedGeneration: 1 + observedSourceArtifactRevision: sha256:61f94c20ee9417f222c3d30672724473ae50d406c8c097d80a8a6263c1384f69 + resourceTemplateGeneration: 1 + url: http://source-controller.flux-system.svc.cluster.local./helmchart/test-helmchart/sample/latest.tar.gz +operation: AggregateStatus +output: diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/source.toolkit.fluxcd.io/v1beta2/HelmChart/testdata/desired-helmchart.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/source.toolkit.fluxcd.io/v1beta2/HelmChart/testdata/desired-helmchart.yaml deleted file mode 100644 index 9b0311d12593..000000000000 --- a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/source.toolkit.fluxcd.io/v1beta2/HelmChart/testdata/desired-helmchart.yaml +++ /dev/null @@ -1,14 +0,0 @@ -apiVersion: source.toolkit.fluxcd.io/v1beta2 -kind: HelmChart -metadata: - name: sample - namespace: test-helmchart - generation: 1 -spec: - interval: 5m0s - chart: podinfo - reconcileStrategy: ChartVersion - sourceRef: - kind: HelmRepository - name: sample - version: '5.*' diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/source.toolkit.fluxcd.io/v1beta2/HelmChart/testdata/interpretstatus-test.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/source.toolkit.fluxcd.io/v1beta2/HelmChart/testdata/interpretstatus-test.yaml new file mode 100644 index 000000000000..add49cc26626 --- /dev/null +++ b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/source.toolkit.fluxcd.io/v1beta2/HelmChart/testdata/interpretstatus-test.yaml @@ -0,0 +1,54 @@ +# test case for interpreting status of HelmChart +# case1. HelmChart: interpret status test + +name: "HelmChart: interpret status test" +description: "Test interpreting status for HelmChart" +observedObj: + apiVersion: source.toolkit.fluxcd.io/v1beta2 + kind: HelmChart + metadata: + name: sample + namespace: test-helmchart + annotations: + resourcetemplate.karmada.io/generation: "1" + generation: 1 + spec: + interval: 5m0s + chart: podinfo + reconcileStrategy: ChartVersion + sourceRef: + kind: HelmRepository + name: sample + version: '5.*' + suspend: true + verify: + provider: cosign + secretRef: + name: fake-cosign-public-keys + status: + artifact: + digest: sha256:6c3cc3b955bce1686036ae6822ee2ca0ef6ecb994e3f2d19eaf3ec03dcba84b3 + lastUpdateTime: "2023-04-30T07:22:36Z" + path: helmchart/test-helmchart/sample/podinfo-5.2.1.tgz + revision: 5.2.1 + size: 13418 + url: http://source-controller.flux-system.svc.cluster.local./helmchart/test-helmchart/sample/podinfo-5.2.1.tgz + conditions: + - lastTransitionTime: "2023-04-30T07:22:36Z" + message: pulled 'podinfo' chart with version '5.2.1' + observedGeneration: 1 + reason: ChartPullSucceeded + status: "True" + type: Ready + - lastTransitionTime: "2023-04-30T07:22:36Z" + message: pulled 'podinfo' chart with version '5.2.1' + observedGeneration: 1 + reason: ChartPullSucceeded + status: "True" + type: ArtifactInStorage + observedChartName: podinfo + observedGeneration: 1 + observedSourceArtifactRevision: sha256:61f94c20ee9417f222c3d30672724473ae50d406c8c097d80a8a6263c1384f69 + url: http://source-controller.flux-system.svc.cluster.local./helmchart/test-helmchart/sample/latest.tar.gz +operation: InterpretStatus +output: diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/source.toolkit.fluxcd.io/v1beta2/HelmChart/testdata/observed-helmchart.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/source.toolkit.fluxcd.io/v1beta2/HelmChart/testdata/observed-helmchart.yaml deleted file mode 100644 index 546bbbe44bbd..000000000000 --- a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/source.toolkit.fluxcd.io/v1beta2/HelmChart/testdata/observed-helmchart.yaml +++ /dev/null @@ -1,46 +0,0 @@ -apiVersion: source.toolkit.fluxcd.io/v1beta2 -kind: HelmChart -metadata: - name: sample - namespace: test-helmchart - annotations: - resourcetemplate.karmada.io/generation: "1" - generation: 1 -spec: - interval: 5m0s - chart: podinfo - reconcileStrategy: ChartVersion - sourceRef: - kind: HelmRepository - name: sample - version: '5.*' - suspend: true - verify: - provider: cosign - secretRef: - name: fake-cosign-public-keys -status: - artifact: - digest: sha256:6c3cc3b955bce1686036ae6822ee2ca0ef6ecb994e3f2d19eaf3ec03dcba84b3 - lastUpdateTime: "2023-04-30T07:22:36Z" - path: helmchart/test-helmchart/sample/podinfo-5.2.1.tgz - revision: 5.2.1 - size: 13418 - url: http://source-controller.flux-system.svc.cluster.local./helmchart/test-helmchart/sample/podinfo-5.2.1.tgz - conditions: - - lastTransitionTime: "2023-04-30T07:22:36Z" - message: pulled 'podinfo' chart with version '5.2.1' - observedGeneration: 1 - reason: ChartPullSucceeded - status: "True" - type: Ready - - lastTransitionTime: "2023-04-30T07:22:36Z" - message: pulled 'podinfo' chart with version '5.2.1' - observedGeneration: 1 - reason: ChartPullSucceeded - status: "True" - type: ArtifactInStorage - observedChartName: podinfo - observedGeneration: 1 - observedSourceArtifactRevision: sha256:61f94c20ee9417f222c3d30672724473ae50d406c8c097d80a8a6263c1384f69 - url: http://source-controller.flux-system.svc.cluster.local./helmchart/test-helmchart/sample/latest.tar.gz diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/source.toolkit.fluxcd.io/v1beta2/HelmChart/testdata/status-file.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/source.toolkit.fluxcd.io/v1beta2/HelmChart/testdata/status-file.yaml deleted file mode 100644 index aeefc8f08b03..000000000000 --- a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/source.toolkit.fluxcd.io/v1beta2/HelmChart/testdata/status-file.yaml +++ /dev/null @@ -1,61 +0,0 @@ -applied: true -clusterName: member1 -health: Healthy -status: - artifact: - digest: sha256:6c3cc3b955bce1686036ae6822ee2ca0ef6ecb994e3f2d19eaf3ec03dcba84b3 - lastUpdateTime: "2023-04-30T07:22:36Z" - path: helmchart/test-helmchart/sample/podinfo-5.2.1.tgz - revision: 5.2.1 - size: 13418 - url: http://source-controller.flux-system.svc.cluster.local./helmchart/test-helmchart/sample/podinfo-5.2.1.tgz - conditions: - - lastTransitionTime: "2023-04-30T07:22:36Z" - message: pulled 'podinfo' chart with version '5.2.1' - observedGeneration: 1 - reason: ChartPullSucceeded - status: "True" - type: Ready - - lastTransitionTime: "2023-04-30T07:22:36Z" - message: pulled 'podinfo' chart with version '5.2.1' - observedGeneration: 1 - reason: ChartPullSucceeded - status: "True" - type: ArtifactInStorage - generation: 1 - observedChartName: podinfo - observedGeneration: 1 - observedSourceArtifactRevision: sha256:61f94c20ee9417f222c3d30672724473ae50d406c8c097d80a8a6263c1384f69 - resourceTemplateGeneration: 1 - url: http://source-controller.flux-system.svc.cluster.local./helmchart/test-helmchart/sample/latest.tar.gz ---- -applied: true -clusterName: member3 -health: Healthy -status: - artifact: - digest: sha256:6c3cc3b955bce1686036ae6822ee2ca0ef6ecb994e3f2d19eaf3ec03dcba84b3 - lastUpdateTime: "2023-04-30T07:22:37Z" - path: helmchart/test-helmchart/sample/podinfo-5.2.1.tgz - revision: 5.2.1 - size: 13418 - url: http://source-controller.flux-system.svc.cluster.local./helmchart/test-helmchart/sample/podinfo-5.2.1.tgz - conditions: - - lastTransitionTime: "2023-04-30T07:22:37Z" - message: pulled 'podinfo' chart with version '5.2.1' - observedGeneration: 1 - reason: ChartPullSucceeded - status: "True" - type: Ready - - lastTransitionTime: "2023-04-30T07:22:37Z" - message: pulled 'podinfo' chart with version '5.2.1' - observedGeneration: 1 - reason: ChartPullSucceeded - status: "True" - type: ArtifactInStorage - generation: 1 - observedChartName: podinfo - observedGeneration: 1 - observedSourceArtifactRevision: sha256:61f94c20ee9417f222c3d30672724473ae50d406c8c097d80a8a6263c1384f69 - resourceTemplateGeneration: 1 - url: http://source-controller.flux-system.svc.cluster.local./helmchart/test-helmchart/sample/latest.tar.gz diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/source.toolkit.fluxcd.io/v1beta2/HelmRepository/customizations_tests.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/source.toolkit.fluxcd.io/v1beta2/HelmRepository/customizations_tests.yaml deleted file mode 100644 index 75145e6467dd..000000000000 --- a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/source.toolkit.fluxcd.io/v1beta2/HelmRepository/customizations_tests.yaml +++ /dev/null @@ -1,13 +0,0 @@ -tests: - - desiredInputPath: testdata/desired-helmrepository.yaml - statusInputPath: testdata/status-file.yaml - operation: AggregateStatus - - desiredInputPath: testdata/desired-helmrepository.yaml - operation: InterpretDependency - - desiredInputPath: testdata/desired-helmrepository.yaml - observedInputPath: testdata/observed-helmrepository.yaml - operation: Retain - - observedInputPath: testdata/observed-helmrepository.yaml - operation: InterpretHealth - - observedInputPath: testdata/observed-helmrepository.yaml - operation: InterpretStatus diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/source.toolkit.fluxcd.io/v1beta2/HelmRepository/testdata/aggregatestatus-test.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/source.toolkit.fluxcd.io/v1beta2/HelmRepository/testdata/aggregatestatus-test.yaml new file mode 100644 index 000000000000..1cc1132041df --- /dev/null +++ b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/source.toolkit.fluxcd.io/v1beta2/HelmRepository/testdata/aggregatestatus-test.yaml @@ -0,0 +1,76 @@ +# test case for aggregating status of HelmRepository +# case1. HelmRepository with two status items + +name: "HelmRepository with two status items" +description: "Test aggregating status of HelmRepository with two status items" +desiredObj: + apiVersion: source.toolkit.fluxcd.io/v1beta2 + kind: HelmRepository + metadata: + name: podinfo + namespace: test-helmrepository + generation: 1 + spec: + interval: 5m0s + url: https://stefanprodan.github.io/podinfo + secretRef: + name: fake-secret +statusItems: + - applied: true + clusterName: member1 + health: Healthy + status: + artifact: + digest: sha256:61f94c20ee9417f222c3d30672724473ae50d406c8c097d80a8a6263c1384f69 + lastUpdateTime: "2023-04-29T09:30:31Z" + path: helmrepository/test-helmrepository/sample/index-61f94c20ee9417f222c3d30672724473ae50d406c8c097d80a8a6263c1384f69.yaml + revision: sha256:61f94c20ee9417f222c3d30672724473ae50d406c8c097d80a8a6263c1384f69 + size: 42012 + url: http://source-controller.flux-system.svc.cluster.local./helmrepository/test-helmrepository/sample/index-61f94c20ee9417f222c3d30672724473ae50d406c8c097d80a8a6263c1384f69.yaml + conditions: + - lastTransitionTime: "2023-04-29T09:30:31Z" + message: 'stored artifact: revision ''sha256:61f94c20ee9417f222c3d30672724473ae50d406c8c097d80a8a6263c1384f69''' + observedGeneration: 1 + reason: Succeeded + status: "True" + type: Ready + - lastTransitionTime: "2023-04-29T09:30:31Z" + message: 'stored artifact: revision ''sha256:61f94c20ee9417f222c3d30672724473ae50d406c8c097d80a8a6263c1384f69''' + observedGeneration: 1 + reason: Succeeded + status: "True" + type: ArtifactInStorage + generation: 1 + observedGeneration: 1 + resourceTemplateGeneration: 1 + url: http://source-controller.flux-system.svc.cluster.local./helmrepository/test-helmrepository/sample/index.yaml + - applied: true + clusterName: member3 + health: Healthy + status: + artifact: + digest: sha256:61f94c20ee9417f222c3d30672724473ae50d406c8c097d80a8a6263c1384f69 + lastUpdateTime: "2023-04-29T09:30:33Z" + path: helmrepository/test-helmrepository/sample/index-61f94c20ee9417f222c3d30672724473ae50d406c8c097d80a8a6263c1384f69.yaml + revision: sha256:61f94c20ee9417f222c3d30672724473ae50d406c8c097d80a8a6263c1384f69 + size: 42012 + url: http://source-controller.flux-system.svc.cluster.local./helmrepository/test-helmrepository/sample/index-61f94c20ee9417f222c3d30672724473ae50d406c8c097d80a8a6263c1384f69.yaml + conditions: + - lastTransitionTime: "2023-04-29T09:30:33Z" + message: 'stored artifact: revision ''sha256:61f94c20ee9417f222c3d30672724473ae50d406c8c097d80a8a6263c1384f69''' + observedGeneration: 1 + reason: Succeeded + status: "True" + type: Ready + - lastTransitionTime: "2023-04-29T09:30:33Z" + message: 'stored artifact: revision ''sha256:61f94c20ee9417f222c3d30672724473ae50d406c8c097d80a8a6263c1384f69''' + observedGeneration: 1 + reason: Succeeded + status: "True" + type: ArtifactInStorage + generation: 1 + observedGeneration: 1 + resourceTemplateGeneration: 1 + url: http://source-controller.flux-system.svc.cluster.local./helmrepository/test-helmrepository/sample/index.yaml +operation: AggregateStatus +output: diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/source.toolkit.fluxcd.io/v1beta2/HelmRepository/testdata/desired-helmrepository.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/source.toolkit.fluxcd.io/v1beta2/HelmRepository/testdata/desired-helmrepository.yaml deleted file mode 100644 index b17024a73a8a..000000000000 --- a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/source.toolkit.fluxcd.io/v1beta2/HelmRepository/testdata/desired-helmrepository.yaml +++ /dev/null @@ -1,11 +0,0 @@ -apiVersion: source.toolkit.fluxcd.io/v1beta2 -kind: HelmRepository -metadata: - name: podinfo - namespace: test-helmrepository - generation: 1 -spec: - interval: 5m0s - url: https://stefanprodan.github.io/podinfo - secretRef: - name: fake-secret diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/source.toolkit.fluxcd.io/v1beta2/HelmRepository/testdata/interpretstatus-test.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/source.toolkit.fluxcd.io/v1beta2/HelmRepository/testdata/interpretstatus-test.yaml new file mode 100644 index 000000000000..690cbfd13303 --- /dev/null +++ b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/source.toolkit.fluxcd.io/v1beta2/HelmRepository/testdata/interpretstatus-test.yaml @@ -0,0 +1,47 @@ +# test case for interpreting status of HelmRepository +# case1. HelmRepository: interpret status test + +name: "HelmRepository: interpret status test" +description: "Test interpreting status for HelmRepository" +observedObj: + apiVersion: source.toolkit.fluxcd.io/v1beta2 + kind: HelmRepository + metadata: + annotations: + resourcetemplate.karmada.io/generation: "1" + name: podinfo + namespace: test-helmrepository + generation: 1 + spec: + interval: 5m0s + provider: generic + timeout: 60s + url: https://stefanprodan.github.io/podinfo + secretRef: + name: fake-secret + suspend: true + status: + artifact: + digest: sha256:61f94c20ee9417f222c3d30672724473ae50d406c8c097d80a8a6263c1384f69 + lastUpdateTime: "2023-04-29T09:30:31Z" + path: helmrepository/test-helmrepository/sample/index-61f94c20ee9417f222c3d30672724473ae50d406c8c097d80a8a6263c1384f69.yaml + revision: sha256:61f94c20ee9417f222c3d30672724473ae50d406c8c097d80a8a6263c1384f69 + size: 42012 + url: http://source-controller.flux-system.svc.cluster.local./helmrepository/test-helmrepository/sample/index-61f94c20ee9417f222c3d30672724473ae50d406c8c097d80a8a6263c1384f69.yaml + conditions: + - lastTransitionTime: "2023-04-29T09:30:31Z" + message: 'stored artifact: revision ''sha256:61f94c20ee9417f222c3d30672724473ae50d406c8c097d80a8a6263c1384f69''' + observedGeneration: 1 + reason: Succeeded + status: "True" + type: Ready + - lastTransitionTime: "2023-04-29T09:30:31Z" + message: 'stored artifact: revision ''sha256:61f94c20ee9417f222c3d30672724473ae50d406c8c097d80a8a6263c1384f69''' + observedGeneration: 1 + reason: Succeeded + status: "True" + type: ArtifactInStorage + observedGeneration: 1 + url: http://source-controller.flux-system.svc.cluster.local./helmrepository/test-helmrepository/sample/index.yaml +operation: InterpretStatus +output: diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/source.toolkit.fluxcd.io/v1beta2/HelmRepository/testdata/observed-helmrepository.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/source.toolkit.fluxcd.io/v1beta2/HelmRepository/testdata/observed-helmrepository.yaml deleted file mode 100644 index 90250560039c..000000000000 --- a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/source.toolkit.fluxcd.io/v1beta2/HelmRepository/testdata/observed-helmrepository.yaml +++ /dev/null @@ -1,39 +0,0 @@ -apiVersion: source.toolkit.fluxcd.io/v1beta2 -kind: HelmRepository -metadata: - annotations: - resourcetemplate.karmada.io/generation: "1" - name: podinfo - namespace: test-helmrepository - generation: 1 -spec: - interval: 5m0s - provider: generic - timeout: 60s - url: https://stefanprodan.github.io/podinfo - secretRef: - name: fake-secret - suspend: true -status: - artifact: - digest: sha256:61f94c20ee9417f222c3d30672724473ae50d406c8c097d80a8a6263c1384f69 - lastUpdateTime: "2023-04-29T09:30:31Z" - path: helmrepository/test-helmrepository/sample/index-61f94c20ee9417f222c3d30672724473ae50d406c8c097d80a8a6263c1384f69.yaml - revision: sha256:61f94c20ee9417f222c3d30672724473ae50d406c8c097d80a8a6263c1384f69 - size: 42012 - url: http://source-controller.flux-system.svc.cluster.local./helmrepository/test-helmrepository/sample/index-61f94c20ee9417f222c3d30672724473ae50d406c8c097d80a8a6263c1384f69.yaml - conditions: - - lastTransitionTime: "2023-04-29T09:30:31Z" - message: 'stored artifact: revision ''sha256:61f94c20ee9417f222c3d30672724473ae50d406c8c097d80a8a6263c1384f69''' - observedGeneration: 1 - reason: Succeeded - status: "True" - type: Ready - - lastTransitionTime: "2023-04-29T09:30:31Z" - message: 'stored artifact: revision ''sha256:61f94c20ee9417f222c3d30672724473ae50d406c8c097d80a8a6263c1384f69''' - observedGeneration: 1 - reason: Succeeded - status: "True" - type: ArtifactInStorage - observedGeneration: 1 - url: http://source-controller.flux-system.svc.cluster.local./helmrepository/test-helmrepository/sample/index.yaml diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/source.toolkit.fluxcd.io/v1beta2/HelmRepository/testdata/status-file.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/source.toolkit.fluxcd.io/v1beta2/HelmRepository/testdata/status-file.yaml deleted file mode 100644 index 09df03567a2c..000000000000 --- a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/source.toolkit.fluxcd.io/v1beta2/HelmRepository/testdata/status-file.yaml +++ /dev/null @@ -1,57 +0,0 @@ -applied: true -clusterName: member1 -health: Healthy -status: - artifact: - digest: sha256:61f94c20ee9417f222c3d30672724473ae50d406c8c097d80a8a6263c1384f69 - lastUpdateTime: "2023-04-29T09:30:31Z" - path: helmrepository/test-helmrepository/sample/index-61f94c20ee9417f222c3d30672724473ae50d406c8c097d80a8a6263c1384f69.yaml - revision: sha256:61f94c20ee9417f222c3d30672724473ae50d406c8c097d80a8a6263c1384f69 - size: 42012 - url: http://source-controller.flux-system.svc.cluster.local./helmrepository/test-helmrepository/sample/index-61f94c20ee9417f222c3d30672724473ae50d406c8c097d80a8a6263c1384f69.yaml - conditions: - - lastTransitionTime: "2023-04-29T09:30:31Z" - message: 'stored artifact: revision ''sha256:61f94c20ee9417f222c3d30672724473ae50d406c8c097d80a8a6263c1384f69''' - observedGeneration: 1 - reason: Succeeded - status: "True" - type: Ready - - lastTransitionTime: "2023-04-29T09:30:31Z" - message: 'stored artifact: revision ''sha256:61f94c20ee9417f222c3d30672724473ae50d406c8c097d80a8a6263c1384f69''' - observedGeneration: 1 - reason: Succeeded - status: "True" - type: ArtifactInStorage - generation: 1 - observedGeneration: 1 - resourceTemplateGeneration: 1 - url: http://source-controller.flux-system.svc.cluster.local./helmrepository/test-helmrepository/sample/index.yaml ---- -applied: true -clusterName: member3 -health: Healthy -status: - artifact: - digest: sha256:61f94c20ee9417f222c3d30672724473ae50d406c8c097d80a8a6263c1384f69 - lastUpdateTime: "2023-04-29T09:30:33Z" - path: helmrepository/test-helmrepository/sample/index-61f94c20ee9417f222c3d30672724473ae50d406c8c097d80a8a6263c1384f69.yaml - revision: sha256:61f94c20ee9417f222c3d30672724473ae50d406c8c097d80a8a6263c1384f69 - size: 42012 - url: http://source-controller.flux-system.svc.cluster.local./helmrepository/test-helmrepository/sample/index-61f94c20ee9417f222c3d30672724473ae50d406c8c097d80a8a6263c1384f69.yaml - conditions: - - lastTransitionTime: "2023-04-29T09:30:33Z" - message: 'stored artifact: revision ''sha256:61f94c20ee9417f222c3d30672724473ae50d406c8c097d80a8a6263c1384f69''' - observedGeneration: 1 - reason: Succeeded - status: "True" - type: Ready - - lastTransitionTime: "2023-04-29T09:30:33Z" - message: 'stored artifact: revision ''sha256:61f94c20ee9417f222c3d30672724473ae50d406c8c097d80a8a6263c1384f69''' - observedGeneration: 1 - reason: Succeeded - status: "True" - type: ArtifactInStorage - generation: 1 - observedGeneration: 1 - resourceTemplateGeneration: 1 - url: http://source-controller.flux-system.svc.cluster.local./helmrepository/test-helmrepository/sample/index.yaml diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/source.toolkit.fluxcd.io/v1beta2/OCIRepository/customizations_tests.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/source.toolkit.fluxcd.io/v1beta2/OCIRepository/customizations_tests.yaml deleted file mode 100644 index f9d499660971..000000000000 --- a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/source.toolkit.fluxcd.io/v1beta2/OCIRepository/customizations_tests.yaml +++ /dev/null @@ -1,14 +0,0 @@ -tests: - - desiredInputPath: testdata/desired-ocirepository.yaml - statusInputPath: testdata/status-file.yaml - operation: AggregateStatus - - desiredInputPath: testdata/desired-ocirepository.yaml - operation: InterpretDependency - - desiredInputPath: testdata/desired-ocirepository.yaml - observedInputPath: testdata/observed-ocirepository.yaml - operation: Retain - - observedInputPath: testdata/observed-ocirepository.yaml - operation: InterpretHealth - - observedInputPath: testdata/observed-ocirepository.yaml - operation: InterpretStatus - diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/source.toolkit.fluxcd.io/v1beta2/OCIRepository/testdata/aggregatestatus-test.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/source.toolkit.fluxcd.io/v1beta2/OCIRepository/testdata/aggregatestatus-test.yaml new file mode 100644 index 000000000000..129ccef82479 --- /dev/null +++ b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/source.toolkit.fluxcd.io/v1beta2/OCIRepository/testdata/aggregatestatus-test.yaml @@ -0,0 +1,88 @@ +# test case for aggregating status of OCIRepository +# case1. OCIRepository with two status items + +name: "OCIRepository with two status items" +description: "Test aggregating status of OCIRepository with two status items" +desiredObj: + apiVersion: source.toolkit.fluxcd.io/v1beta2 + kind: OCIRepository + metadata: + name: sample + namespace: test-ocirepository + generation: 1 + spec: + interval: 5m + ref: + branch: master + semver: "6.2.x" + url: oci://ghcr.io/stefanprodan/podinfo-deploy + secretRef: + name: fake-secret + serviceAccountName: fake-serviceaccount +statusItems: + - applied: true + clusterName: member1 + health: Healthy + status: + artifact: + digest: sha256:b6ccead26c790c8a0d40579905edc6d83f732ceacc0f4133f578fed456a2438a + lastUpdateTime: "2023-04-29T06:07:53Z" + metadata: + org.opencontainers.image.created: "2022-11-09T11:24:23Z" + org.opencontainers.image.revision: 6.2.3/8615cb75d926ea0ba5353b1d56867868c737bf5e + org.opencontainers.image.source: https://github.com/stefanprodan/podinfo + path: ocirepository/test-ocirepository/sample/sha256:a081a2c95eff48a80add59a9db3488c1653b8f82223ed409e32d925d228af792.tar.gz + revision: 6.2.3@sha256:a081a2c95eff48a80add59a9db3488c1653b8f82223ed409e32d925d228af792 + size: 1103 + url: http://source-controller.flux-system.svc.cluster.local./ocirepository/test-ocirepository/sample/sha256:a081a2c95eff48a80add59a9db3488c1653b8f82223ed409e32d925d228af792.tar.gz + conditions: + - lastTransitionTime: "2023-04-29T06:07:53Z" + message: stored artifact for digest '6.2.3@sha256:a081a2c95eff48a80add59a9db3488c1653b8f82223ed409e32d925d228af792' + observedGeneration: 1 + reason: Succeeded + status: "True" + type: Ready + - lastTransitionTime: "2023-04-29T06:07:53Z" + message: stored artifact for digest '6.2.3@sha256:a081a2c95eff48a80add59a9db3488c1653b8f82223ed409e32d925d228af792' + observedGeneration: 1 + reason: Succeeded + status: "True" + type: ArtifactInStorage + generation: 1 + observedGeneration: 1 + resourceTemplateGeneration: 1 + url: http://source-controller.flux-system.svc.cluster.local./ocirepository/test-ocirepository/sample/latest.tar.gz + - applied: true + clusterName: member3 + health: Healthy + status: + artifact: + digest: sha256:b6ccead26c790c8a0d40579905edc6d83f732ceacc0f4133f578fed456a2438a + lastUpdateTime: "2023-04-29T06:07:53Z" + metadata: + org.opencontainers.image.created: "2022-11-09T11:24:23Z" + org.opencontainers.image.revision: 6.2.3/8615cb75d926ea0ba5353b1d56867868c737bf5e + org.opencontainers.image.source: https://github.com/stefanprodan/podinfo + path: ocirepository/test-ocirepository/sample/sha256:a081a2c95eff48a80add59a9db3488c1653b8f82223ed409e32d925d228af792.tar.gz + revision: 6.2.3@sha256:a081a2c95eff48a80add59a9db3488c1653b8f82223ed409e32d925d228af792 + size: 1103 + url: http://source-controller.flux-system.svc.cluster.local./ocirepository/test-ocirepository/sample/sha256:a081a2c95eff48a80add59a9db3488c1653b8f82223ed409e32d925d228af792.tar.gz + conditions: + - lastTransitionTime: "2023-04-29T06:07:53Z" + message: stored artifact for digest '6.2.3@sha256:a081a2c95eff48a80add59a9db3488c1653b8f82223ed409e32d925d228af792' + observedGeneration: 1 + reason: Succeeded + status: "True" + type: Ready + - lastTransitionTime: "2023-04-29T06:07:53Z" + message: stored artifact for digest '6.2.3@sha256:a081a2c95eff48a80add59a9db3488c1653b8f82223ed409e32d925d228af792' + observedGeneration: 1 + reason: Succeeded + status: "True" + type: ArtifactInStorage + generation: 1 + observedGeneration: 1 + resourceTemplateGeneration: 1 + url: http://source-controller.flux-system.svc.cluster.local./ocirepository/test-ocirepository/sample/latest.tar.gz +operation: AggregateStatus +output: diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/source.toolkit.fluxcd.io/v1beta2/OCIRepository/testdata/desired-ocirepository.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/source.toolkit.fluxcd.io/v1beta2/OCIRepository/testdata/desired-ocirepository.yaml deleted file mode 100644 index cf6a0d43d0f8..000000000000 --- a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/source.toolkit.fluxcd.io/v1beta2/OCIRepository/testdata/desired-ocirepository.yaml +++ /dev/null @@ -1,15 +0,0 @@ -apiVersion: source.toolkit.fluxcd.io/v1beta2 -kind: OCIRepository -metadata: - name: sample - namespace: test-ocirepository - generation: 1 -spec: - interval: 5m - ref: - branch: master - semver: "6.2.x" - url: oci://ghcr.io/stefanprodan/podinfo-deploy - secretRef: - name: fake-secret - serviceAccountName: fake-serviceaccount diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/source.toolkit.fluxcd.io/v1beta2/OCIRepository/testdata/interpretstatus-test.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/source.toolkit.fluxcd.io/v1beta2/OCIRepository/testdata/interpretstatus-test.yaml new file mode 100644 index 000000000000..97c211bd4a35 --- /dev/null +++ b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/source.toolkit.fluxcd.io/v1beta2/OCIRepository/testdata/interpretstatus-test.yaml @@ -0,0 +1,54 @@ +# test case for interpreting status of OCIRepository +# case1. OCIRepository: interpret status test + +name: "OCIRepository: interpret status test" +description: "Test interpreting status for OCIRepository" +observedObj: + apiVersion: source.toolkit.fluxcd.io/v1beta2 + kind: OCIRepository + metadata: + annotations: + resourcetemplate.karmada.io/generation: "1" + name: sample + namespace: test-ocirepository + generation: 1 + spec: + interval: 5m + provider: generic + ref: + semver: 6.2.x + secretRef: + name: fake-secret + serviceAccountName: fake-serviceaccount + timeout: 60s + url: oci://ghcr.io/stefanprodan/podinfo-deploy + suspend: true + status: + artifact: + digest: sha256:b6ccead26c790c8a0d40579905edc6d83f732ceacc0f4133f578fed456a2438a + lastUpdateTime: "2023-04-29T06:07:53Z" + metadata: + org.opencontainers.image.created: "2022-11-09T11:24:23Z" + org.opencontainers.image.revision: 6.2.3/8615cb75d926ea0ba5353b1d56867868c737bf5e + org.opencontainers.image.source: https://github.com/stefanprodan/podinfo + path: ocirepository/test-ocirepository/sample/sha256:a081a2c95eff48a80add59a9db3488c1653b8f82223ed409e32d925d228af792.tar.gz + revision: 6.2.3@sha256:a081a2c95eff48a80add59a9db3488c1653b8f82223ed409e32d925d228af792 + size: 1103 + url: http://source-controller.flux-system.svc.cluster.local./ocirepository/test-ocirepository/sample/sha256:a081a2c95eff48a80add59a9db3488c1653b8f82223ed409e32d925d228af792.tar.gz + conditions: + - lastTransitionTime: "2023-04-29T06:07:53Z" + message: stored artifact for digest '6.2.3@sha256:a081a2c95eff48a80add59a9db3488c1653b8f82223ed409e32d925d228af792' + observedGeneration: 1 + reason: Succeeded + status: "True" + type: Ready + - lastTransitionTime: "2023-04-29T06:07:53Z" + message: stored artifact for digest '6.2.3@sha256:a081a2c95eff48a80add59a9db3488c1653b8f82223ed409e32d925d228af792' + observedGeneration: 1 + reason: Succeeded + status: "True" + type: ArtifactInStorage + observedGeneration: 1 + url: http://source-controller.flux-system.svc.cluster.local./ocirepository/test-ocirepository/sample/latest.tar.gz +operation: InterpretStatus +output: diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/source.toolkit.fluxcd.io/v1beta2/OCIRepository/testdata/observed-ocirepository.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/source.toolkit.fluxcd.io/v1beta2/OCIRepository/testdata/observed-ocirepository.yaml deleted file mode 100644 index 6144ede6da62..000000000000 --- a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/source.toolkit.fluxcd.io/v1beta2/OCIRepository/testdata/observed-ocirepository.yaml +++ /dev/null @@ -1,46 +0,0 @@ -apiVersion: source.toolkit.fluxcd.io/v1beta2 -kind: OCIRepository -metadata: - annotations: - resourcetemplate.karmada.io/generation: "1" - name: sample - namespace: test-ocirepository - generation: 1 -spec: - interval: 5m - provider: generic - ref: - semver: 6.2.x - secretRef: - name: fake-secret - serviceAccountName: fake-serviceaccount - timeout: 60s - url: oci://ghcr.io/stefanprodan/podinfo-deploy - suspend: true -status: - artifact: - digest: sha256:b6ccead26c790c8a0d40579905edc6d83f732ceacc0f4133f578fed456a2438a - lastUpdateTime: "2023-04-29T06:07:53Z" - metadata: - org.opencontainers.image.created: "2022-11-09T11:24:23Z" - org.opencontainers.image.revision: 6.2.3/8615cb75d926ea0ba5353b1d56867868c737bf5e - org.opencontainers.image.source: https://github.com/stefanprodan/podinfo - path: ocirepository/test-ocirepository/sample/sha256:a081a2c95eff48a80add59a9db3488c1653b8f82223ed409e32d925d228af792.tar.gz - revision: 6.2.3@sha256:a081a2c95eff48a80add59a9db3488c1653b8f82223ed409e32d925d228af792 - size: 1103 - url: http://source-controller.flux-system.svc.cluster.local./ocirepository/test-ocirepository/sample/sha256:a081a2c95eff48a80add59a9db3488c1653b8f82223ed409e32d925d228af792.tar.gz - conditions: - - lastTransitionTime: "2023-04-29T06:07:53Z" - message: stored artifact for digest '6.2.3@sha256:a081a2c95eff48a80add59a9db3488c1653b8f82223ed409e32d925d228af792' - observedGeneration: 1 - reason: Succeeded - status: "True" - type: Ready - - lastTransitionTime: "2023-04-29T06:07:53Z" - message: stored artifact for digest '6.2.3@sha256:a081a2c95eff48a80add59a9db3488c1653b8f82223ed409e32d925d228af792' - observedGeneration: 1 - reason: Succeeded - status: "True" - type: ArtifactInStorage - observedGeneration: 1 - url: http://source-controller.flux-system.svc.cluster.local./ocirepository/test-ocirepository/sample/latest.tar.gz diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/source.toolkit.fluxcd.io/v1beta2/OCIRepository/testdata/status-file.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/source.toolkit.fluxcd.io/v1beta2/OCIRepository/testdata/status-file.yaml deleted file mode 100644 index 9e7357acc2fe..000000000000 --- a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/source.toolkit.fluxcd.io/v1beta2/OCIRepository/testdata/status-file.yaml +++ /dev/null @@ -1,65 +0,0 @@ -applied: true -clusterName: member1 -health: Healthy -status: - artifact: - digest: sha256:b6ccead26c790c8a0d40579905edc6d83f732ceacc0f4133f578fed456a2438a - lastUpdateTime: "2023-04-29T06:07:53Z" - metadata: - org.opencontainers.image.created: "2022-11-09T11:24:23Z" - org.opencontainers.image.revision: 6.2.3/8615cb75d926ea0ba5353b1d56867868c737bf5e - org.opencontainers.image.source: https://github.com/stefanprodan/podinfo - path: ocirepository/test-ocirepository/sample/sha256:a081a2c95eff48a80add59a9db3488c1653b8f82223ed409e32d925d228af792.tar.gz - revision: 6.2.3@sha256:a081a2c95eff48a80add59a9db3488c1653b8f82223ed409e32d925d228af792 - size: 1103 - url: http://source-controller.flux-system.svc.cluster.local./ocirepository/test-ocirepository/sample/sha256:a081a2c95eff48a80add59a9db3488c1653b8f82223ed409e32d925d228af792.tar.gz - conditions: - - lastTransitionTime: "2023-04-29T06:07:53Z" - message: stored artifact for digest '6.2.3@sha256:a081a2c95eff48a80add59a9db3488c1653b8f82223ed409e32d925d228af792' - observedGeneration: 1 - reason: Succeeded - status: "True" - type: Ready - - lastTransitionTime: "2023-04-29T06:07:53Z" - message: stored artifact for digest '6.2.3@sha256:a081a2c95eff48a80add59a9db3488c1653b8f82223ed409e32d925d228af792' - observedGeneration: 1 - reason: Succeeded - status: "True" - type: ArtifactInStorage - generation: 1 - observedGeneration: 1 - resourceTemplateGeneration: 1 - url: http://source-controller.flux-system.svc.cluster.local./ocirepository/test-ocirepository/sample/latest.tar.gz ---- -applied: true -clusterName: member3 -health: Healthy -status: - artifact: - digest: sha256:b6ccead26c790c8a0d40579905edc6d83f732ceacc0f4133f578fed456a2438a - lastUpdateTime: "2023-04-29T06:07:53Z" - metadata: - org.opencontainers.image.created: "2022-11-09T11:24:23Z" - org.opencontainers.image.revision: 6.2.3/8615cb75d926ea0ba5353b1d56867868c737bf5e - org.opencontainers.image.source: https://github.com/stefanprodan/podinfo - path: ocirepository/test-ocirepository/sample/sha256:a081a2c95eff48a80add59a9db3488c1653b8f82223ed409e32d925d228af792.tar.gz - revision: 6.2.3@sha256:a081a2c95eff48a80add59a9db3488c1653b8f82223ed409e32d925d228af792 - size: 1103 - url: http://source-controller.flux-system.svc.cluster.local./ocirepository/test-ocirepository/sample/sha256:a081a2c95eff48a80add59a9db3488c1653b8f82223ed409e32d925d228af792.tar.gz - conditions: - - lastTransitionTime: "2023-04-29T06:07:53Z" - message: stored artifact for digest '6.2.3@sha256:a081a2c95eff48a80add59a9db3488c1653b8f82223ed409e32d925d228af792' - observedGeneration: 1 - reason: Succeeded - status: "True" - type: Ready - - lastTransitionTime: "2023-04-29T06:07:53Z" - message: stored artifact for digest '6.2.3@sha256:a081a2c95eff48a80add59a9db3488c1653b8f82223ed409e32d925d228af792' - observedGeneration: 1 - reason: Succeeded - status: "True" - type: ArtifactInStorage - generation: 1 - observedGeneration: 1 - resourceTemplateGeneration: 1 - url: http://source-controller.flux-system.svc.cluster.local./ocirepository/test-ocirepository/sample/latest.tar.gz diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/sparkoperator.k8s.io/v1beta2/SparkApplication/customizations_tests.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/sparkoperator.k8s.io/v1beta2/SparkApplication/customizations_tests.yaml deleted file mode 100644 index 905548c2adff..000000000000 --- a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/sparkoperator.k8s.io/v1beta2/SparkApplication/customizations_tests.yaml +++ /dev/null @@ -1,10 +0,0 @@ -tests: - - desiredInputPath: testdata/desired-sparkapplication.yaml - statusInputPath: testdata/status-file.yaml - operation: AggregateStatus - - desiredInputPath: testdata/desired-sparkapplication.yaml - operation: InterpretComponent - - observedInputPath: testdata/observed-sparkapplication.yaml - operation: InterpretHealth - - observedInputPath: testdata/observed-sparkapplication.yaml - operation: InterpretStatus diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/sparkoperator.k8s.io/v1beta2/SparkApplication/testdata/aggregatestatus-test.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/sparkoperator.k8s.io/v1beta2/SparkApplication/testdata/aggregatestatus-test.yaml new file mode 100644 index 000000000000..8c00b0427e25 --- /dev/null +++ b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/sparkoperator.k8s.io/v1beta2/SparkApplication/testdata/aggregatestatus-test.yaml @@ -0,0 +1,116 @@ +# test case for aggregating status of SparkApplication +# case1. SparkApplication with three status items + +name: "SparkApplication with three status items" +description: "Test aggregating status of SparkApplication with three status items" +desiredObj: + apiVersion: "sparkoperator.k8s.io/v1beta2" + kind: SparkApplication + metadata: + name: spark-pi + namespace: default + spec: + type: Java + mode: cluster + image: "spark:3.5.0" + imagePullPolicy: Always + mainClass: org.apache.spark.examples.SparkPi + mainApplicationFile: "local:///opt/spark/examples/jars/spark-examples_2.12-3.5.0.jar" + sparkVersion: "3.5.0" + sparkUIOptions: + serviceLabels: + test-label/v1: 'true' + restartPolicy: + type: Never + volumes: + - name: "test-volume" + hostPath: + path: "/tmp" + type: Directory + driver: + cores: 2 + memory: "512m" + labels: + version: 3.5.0 + serviceAccount: spark-operator-spark + volumeMounts: + - name: "test-volume" + mountPath: "/tmp" + executor: + cores: 1 + instances: 2 + memory: "1g" + memoryOverhead: "512m" + labels: + version: 3.5.0 + volumeMounts: + - name: "test-volume" + mountPath: "/tmp" + dynamicAllocation: + enabled: true + initialExecutors: 3 + minExecutors: 3 + maxExecutors: 10 +statusItems: + - applied: true + clusterName: member1 + health: Healthy + status: + applicationState: + state: COMPLETED + driverInfo: + podName: spark-pi-driver + webUIAddress: 10.11.254.226:4040 + webUIPort: 4040 + webUIServiceName: spark-pi-ui-svc + executionAttempts: 1 + executorState: + spark-pi-b5777a99d8b732a7-exec-1: COMPLETED + spark-pi-b5777a99d8b732a7-exec-2: COMPLETED + lastSubmissionAttemptTime: "2025-10-12T13:57:17Z" + sparkApplicationId: spark-ff27607fd312454b92455e2feabdd343 + submissionAttempts: 1 + submissionID: 0df4a04b-620b-425e-997a-e4404010e26a + terminationTime: "2025-10-12T13:58:39Z" + - applied: true + clusterName: member2 + health: Healthy + status: + applicationState: + state: RUNNING + driverInfo: + podName: spark-pi-driver + webUIAddress: 10.11.254.227:4040 + webUIPort: 4040 + webUIServiceName: spark-pi-ui-svc + executionAttempts: 2 + executorState: + spark-pi-b5777a99d8b732a8-exec-1: RUNNING + spark-pi-b5777a99d8b732a8-exec-2: RUNNING + lastSubmissionAttemptTime: "2025-10-12T14:00:00Z" + sparkApplicationId: spark-ff27607fd312454b92455e2feabdd343 + submissionAttempts: 1 + submissionID: 1ab2c34d-5678-9abc-def0-1234567890ab + terminationTime: null + - applied: true + clusterName: member3 + health: Unhealthy + status: + applicationState: + state: FAILED + driverInfo: + podName: spark-pi-driver + webUIAddress: 10.11.254.228:4040 + webUIPort: 4040 + webUIServiceName: spark-pi-ui-svc + executionAttempts: 3 + executorState: + spark-pi-b5777a99d8b732a9-exec-1: FAILED + spark-pi-b5777a99d8b732a9-exec-2: FAILED + lastSubmissionAttemptTime: "2025-10-12T14:10:00Z" + sparkApplicationId: spark-ff27607fd312454b92455e2feabdd343 + submissionAttempts: 2 + submissionID: 2cd4e56f-789a-1234-bcde-567890abcdef + terminationTime: "2025-10-12T14:12:30Z" +operation: AggregateStatus +output: diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/sparkoperator.k8s.io/v1beta2/SparkApplication/testdata/desired-sparkapplication.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/sparkoperator.k8s.io/v1beta2/SparkApplication/testdata/desired-sparkapplication.yaml deleted file mode 100644 index e3446daddbb1..000000000000 --- a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/sparkoperator.k8s.io/v1beta2/SparkApplication/testdata/desired-sparkapplication.yaml +++ /dev/null @@ -1,47 +0,0 @@ -apiVersion: "sparkoperator.k8s.io/v1beta2" -kind: SparkApplication -metadata: - name: spark-pi - namespace: default -spec: - type: Java - mode: cluster - image: "spark:3.5.0" - imagePullPolicy: Always - mainClass: org.apache.spark.examples.SparkPi - mainApplicationFile: "local:///opt/spark/examples/jars/spark-examples_2.12-3.5.0.jar" - sparkVersion: "3.5.0" - sparkUIOptions: - serviceLabels: - test-label/v1: 'true' - restartPolicy: - type: Never - volumes: - - name: "test-volume" - hostPath: - path: "/tmp" - type: Directory - driver: - cores: 2 - memory: "512m" - labels: - version: 3.5.0 - serviceAccount: spark-operator-spark - volumeMounts: - - name: "test-volume" - mountPath: "/tmp" - executor: - cores: 1 - instances: 2 - memory: "1g" - memoryOverhead: "512m" - labels: - version: 3.5.0 - volumeMounts: - - name: "test-volume" - mountPath: "/tmp" - dynamicAllocation: - enabled: true - initialExecutors: 3 - minExecutors: 3 - maxExecutors: 10 diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/sparkoperator.k8s.io/v1beta2/SparkApplication/testdata/interpretstatus-test.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/sparkoperator.k8s.io/v1beta2/SparkApplication/testdata/interpretstatus-test.yaml new file mode 100644 index 000000000000..a0d9d963c5e6 --- /dev/null +++ b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/sparkoperator.k8s.io/v1beta2/SparkApplication/testdata/interpretstatus-test.yaml @@ -0,0 +1,77 @@ +# test case for interpreting status of SparkApplication +# case1. SparkApplication: interpret status test + +name: "SparkApplication: interpret status test" +description: "Test interpreting status for SparkApplication" +observedObj: + apiVersion: sparkoperator.k8s.io/v1beta2 + kind: SparkApplication + metadata: + annotations: + kubectl.kubernetes.io/last-applied-configuration: | + {"apiVersion":"sparkoperator.k8s.io/v1beta2","kind":"SparkApplication","metadata":{"annotations":{},"name":"spark-pi","namespace":"default"},"spec":{"driver":{"cores":2,"labels":{"version":"3.5.0"},"memory":"512m","serviceAccount":"spark-operator-spark","volumeMounts":[{"mountPath":"/tmp","name":"test-volume"}]},"executor":{"cores":1,"instances":2,"labels":{"version":"3.5.0"},"memory":"512m","volumeMounts":[{"mountPath":"/tmp","name":"test-volume"}]},"image":"spark:3.5.0","imagePullPolicy":"Always","mainApplicationFile":"local:///opt/spark/examples/jars/spark-examples_2.12-3.5.0.jar","mainClass":"org.apache.spark.examples.SparkPi","mode":"cluster","restartPolicy":{"type":"Never"},"sparkUIOptions":{"serviceLabels":{"test-label/v1":"true"}},"sparkVersion":"3.5.0","type":"Scala","volumes":[{"hostPath":{"path":"/tmp","type":"Directory"},"name":"test-volume"}]}} + propagationpolicy.karmada.io/name: spark-pi-pp + propagationpolicy.karmada.io/namespace: default + creationTimestamp: "2025-10-12T13:57:17Z" + generation: 1 + labels: + propagationpolicy.karmada.io/permanent-id: 5c1aa82e-d727-4ec4-8d58-5d3cff7335e1 + name: spark-pi + namespace: default + resourceVersion: "1152" + uid: 30dde6fb-dc13-40fd-b131-4839fdf7fddd + spec: + driver: + cores: 2 + labels: + version: 3.5.0 + memory: 512m + serviceAccount: spark-operator-spark + volumeMounts: + - mountPath: /tmp + name: test-volume + executor: + cores: 1 + instances: 2 + labels: + version: 3.5.0 + memory: 512m + volumeMounts: + - mountPath: /tmp + name: test-volume + image: spark:3.5.0 + imagePullPolicy: Always + mainApplicationFile: local:///opt/spark/examples/jars/spark-examples_2.12-3.5.0.jar + mainClass: org.apache.spark.examples.SparkPi + mode: cluster + restartPolicy: + type: Never + sparkUIOptions: + serviceLabels: + test-label/v1: "true" + sparkVersion: 3.5.0 + type: Scala + volumes: + - hostPath: + path: /tmp + type: Directory + name: test-volume + status: + applicationState: + state: COMPLETED + driverInfo: + podName: spark-pi-driver + webUIAddress: 10.11.254.226:4040 + webUIPort: 4040 + webUIServiceName: spark-pi-ui-svc + executionAttempts: 1 + executorState: + spark-pi-b5777a99d8b732a7-exec-1: COMPLETED + spark-pi-b5777a99d8b732a7-exec-2: COMPLETED + lastSubmissionAttemptTime: "2025-10-12T13:57:17Z" + sparkApplicationId: spark-ff27607fd312454b92455e2feabdd343 + submissionAttempts: 1 + submissionID: 0df4a04b-620b-425e-997a-e4404010e26a + terminationTime: "2025-10-12T13:58:39Z" +operation: InterpretStatus +output: diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/sparkoperator.k8s.io/v1beta2/SparkApplication/testdata/observed-sparkapplication.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/sparkoperator.k8s.io/v1beta2/SparkApplication/testdata/observed-sparkapplication.yaml deleted file mode 100644 index cd72ffc15d74..000000000000 --- a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/sparkoperator.k8s.io/v1beta2/SparkApplication/testdata/observed-sparkapplication.yaml +++ /dev/null @@ -1,69 +0,0 @@ -apiVersion: sparkoperator.k8s.io/v1beta2 -kind: SparkApplication -metadata: - annotations: - kubectl.kubernetes.io/last-applied-configuration: | - {"apiVersion":"sparkoperator.k8s.io/v1beta2","kind":"SparkApplication","metadata":{"annotations":{},"name":"spark-pi","namespace":"default"},"spec":{"driver":{"cores":2,"labels":{"version":"3.5.0"},"memory":"512m","serviceAccount":"spark-operator-spark","volumeMounts":[{"mountPath":"/tmp","name":"test-volume"}]},"executor":{"cores":1,"instances":2,"labels":{"version":"3.5.0"},"memory":"512m","volumeMounts":[{"mountPath":"/tmp","name":"test-volume"}]},"image":"spark:3.5.0","imagePullPolicy":"Always","mainApplicationFile":"local:///opt/spark/examples/jars/spark-examples_2.12-3.5.0.jar","mainClass":"org.apache.spark.examples.SparkPi","mode":"cluster","restartPolicy":{"type":"Never"},"sparkUIOptions":{"serviceLabels":{"test-label/v1":"true"}},"sparkVersion":"3.5.0","type":"Scala","volumes":[{"hostPath":{"path":"/tmp","type":"Directory"},"name":"test-volume"}]}} - propagationpolicy.karmada.io/name: spark-pi-pp - propagationpolicy.karmada.io/namespace: default - creationTimestamp: "2025-10-12T13:57:17Z" - generation: 1 - labels: - propagationpolicy.karmada.io/permanent-id: 5c1aa82e-d727-4ec4-8d58-5d3cff7335e1 - name: spark-pi - namespace: default - resourceVersion: "1152" - uid: 30dde6fb-dc13-40fd-b131-4839fdf7fddd -spec: - driver: - cores: 2 - labels: - version: 3.5.0 - memory: 512m - serviceAccount: spark-operator-spark - volumeMounts: - - mountPath: /tmp - name: test-volume - executor: - cores: 1 - instances: 2 - labels: - version: 3.5.0 - memory: 512m - volumeMounts: - - mountPath: /tmp - name: test-volume - image: spark:3.5.0 - imagePullPolicy: Always - mainApplicationFile: local:///opt/spark/examples/jars/spark-examples_2.12-3.5.0.jar - mainClass: org.apache.spark.examples.SparkPi - mode: cluster - restartPolicy: - type: Never - sparkUIOptions: - serviceLabels: - test-label/v1: "true" - sparkVersion: 3.5.0 - type: Scala - volumes: - - hostPath: - path: /tmp - type: Directory - name: test-volume -status: - applicationState: - state: COMPLETED - driverInfo: - podName: spark-pi-driver - webUIAddress: 10.11.254.226:4040 - webUIPort: 4040 - webUIServiceName: spark-pi-ui-svc - executionAttempts: 1 - executorState: - spark-pi-b5777a99d8b732a7-exec-1: COMPLETED - spark-pi-b5777a99d8b732a7-exec-2: COMPLETED - lastSubmissionAttemptTime: "2025-10-12T13:57:17Z" - sparkApplicationId: spark-ff27607fd312454b92455e2feabdd343 - submissionAttempts: 1 - submissionID: 0df4a04b-620b-425e-997a-e4404010e26a - terminationTime: "2025-10-12T13:58:39Z" diff --git a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/sparkoperator.k8s.io/v1beta2/SparkApplication/testdata/status-file.yaml b/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/sparkoperator.k8s.io/v1beta2/SparkApplication/testdata/status-file.yaml deleted file mode 100644 index 619111587e92..000000000000 --- a/pkg/resourceinterpreter/default/thirdparty/resourcecustomizations/sparkoperator.k8s.io/v1beta2/SparkApplication/testdata/status-file.yaml +++ /dev/null @@ -1,62 +0,0 @@ -applied: true -clusterName: member1 -health: Healthy -status: - applicationState: - state: COMPLETED - driverInfo: - podName: spark-pi-driver - webUIAddress: 10.11.254.226:4040 - webUIPort: 4040 - webUIServiceName: spark-pi-ui-svc - executionAttempts: 1 - executorState: - spark-pi-b5777a99d8b732a7-exec-1: COMPLETED - spark-pi-b5777a99d8b732a7-exec-2: COMPLETED - lastSubmissionAttemptTime: "2025-10-12T13:57:17Z" - sparkApplicationId: spark-ff27607fd312454b92455e2feabdd343 - submissionAttempts: 1 - submissionID: 0df4a04b-620b-425e-997a-e4404010e26a - terminationTime: "2025-10-12T13:58:39Z" ---- -applied: true -clusterName: member2 -health: Healthy -status: - applicationState: - state: RUNNING - driverInfo: - podName: spark-pi-driver - webUIAddress: 10.11.254.227:4040 - webUIPort: 4040 - webUIServiceName: spark-pi-ui-svc - executionAttempts: 2 - executorState: - spark-pi-b5777a99d8b732a8-exec-1: RUNNING - spark-pi-b5777a99d8b732a8-exec-2: RUNNING - lastSubmissionAttemptTime: "2025-10-12T14:00:00Z" - sparkApplicationId: spark-ff27607fd312454b92455e2feabdd343 - submissionAttempts: 1 - submissionID: 1ab2c34d-5678-9abc-def0-1234567890ab - terminationTime: null ---- -applied: true -clusterName: member3 -health: Unhealthy -status: - applicationState: - state: FAILED - driverInfo: - podName: spark-pi-driver - webUIAddress: 10.11.254.228:4040 - webUIPort: 4040 - webUIServiceName: spark-pi-ui-svc - executionAttempts: 3 - executorState: - spark-pi-b5777a99d8b732a9-exec-1: FAILED - spark-pi-b5777a99d8b732a9-exec-2: FAILED - lastSubmissionAttemptTime: "2025-10-12T14:10:00Z" - sparkApplicationId: spark-ff27607fd312454b92455e2feabdd343 - submissionAttempts: 2 - submissionID: 2cd4e56f-789a-1234-bcde-567890abcdef - terminationTime: "2025-10-12T14:12:30Z" diff --git a/pkg/resourceinterpreter/default/thirdparty/thirdparty_test.go b/pkg/resourceinterpreter/default/thirdparty/thirdparty_test.go index f782a06ae7b1..c272c9ec3d31 100644 --- a/pkg/resourceinterpreter/default/thirdparty/thirdparty_test.go +++ b/pkg/resourceinterpreter/default/thirdparty/thirdparty_test.go @@ -27,7 +27,9 @@ import ( "testing" "time" + "k8s.io/apimachinery/pkg/api/resource" "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured" + "k8s.io/apimachinery/pkg/conversion" "k8s.io/apimachinery/pkg/util/json" "k8s.io/apimachinery/pkg/util/yaml" @@ -39,6 +41,10 @@ import ( ) var rules interpreter.Rules = interpreter.AllResourceInterpreterCustomizationRules +var checker = conversion.EqualitiesOrDie( + func(a, b resource.Quantity) bool { + return a.Equal(b) + }) func checkScript(script string) error { ctx, cancel := context.WithTimeout(context.TODO(), time.Second) @@ -52,61 +58,21 @@ func checkScript(script string) error { return err } -func getObj(t *testing.T, path string) *unstructured.Unstructured { - if path == "" { - return nil - } - data, err := os.ReadFile(path) - if err != nil { - t.Fatal(err) - } - jsonData, err := yaml.ToJSON(data) - if err != nil { - t.Fatal(err) - } - obj := make(map[string]interface{}) - err = json.Unmarshal(jsonData, &obj) - if err != nil { - t.Fatal(err) - } - return &unstructured.Unstructured{Object: obj} -} - -func getAggregatedStatusItems(t *testing.T, path string) []workv1alpha2.AggregatedStatusItem { - if path == "" { - return nil - } - data, err := os.ReadFile(path) - if err != nil { - t.Fatal(err) - } - var statusItems []workv1alpha2.AggregatedStatusItem - decoder := yaml.NewYAMLOrJSONDecoder(bytes.NewReader(data), 4096) - for { - statusItem := &workv1alpha2.AggregatedStatusItem{} - err = decoder.Decode(statusItem) - if err != nil { - break - } - statusItems = append(statusItems, *statusItem) - } - if err != io.EOF { - t.Fatal(err) - } - - return statusItems -} - type TestStructure struct { Tests []IndividualTest `yaml:"tests"` } type IndividualTest struct { - DesiredInputPath string `yaml:"desiredInputPath,omitempty"` - ObservedInputPath string `yaml:"observedInputPath,omitempty"` - StatusInputPath string `yaml:"statusInputPath,omitempty"` - DesiredReplica int64 `yaml:"desiredReplicas,omitempty"` - Operation string `yaml:"operation"` + Name string `yaml:"name"` // the name of individual test + Description string `yaml:"description,omitempty"` // the description of individual test + DesiredObj *unstructured.Unstructured `yaml:"desiredObj,omitempty"` // the desired object + ObservedObj *unstructured.Unstructured `yaml:"observedObj,omitempty"` // the observed object + StatusItems []workv1alpha2.AggregatedStatusItem `yaml:"statusItems,omitempty"` // the status items of aggregated status + InputReplicas int64 `yaml:"inputReplicas,omitempty"` // the input replicas for revise operation + Operation string `yaml:"operation"` // the operation of resource interpreter + Filepath string `yaml:"filepath,omitempty"` // the file path of current test case, used for logging + // TODO(@zhzhuang-zju): When we have a complete set of test cases, change Output to required field. + Output map[string]interface{} `yaml:"output,omitempty"` // the expected output results } func checkInterpretationRule(t *testing.T, path string, configs []*configv1alpha1.ResourceInterpreterCustomization) { @@ -114,39 +80,133 @@ func checkInterpretationRule(t *testing.T, path string, configs []*configv1alpha ipt.LoadConfig(configs) dir := filepath.Dir(path) - yamlBytes, err := os.ReadFile(dir + string(os.PathSeparator) + "customizations_tests.yaml") - if err != nil { - t.Fatal(err) + testDataDir := filepath.Join(dir, "testdata") + + var err error + for _, customization := range configs { + for _, input := range getAllTestCases(t, testDataDir).Tests { + t.Run(fmt.Sprintf("[%s/%s]:%s", customization.Name, input.Operation, input.Name), func(t *testing.T) { + rule := rules.GetByOperation(input.Operation) + if rule == nil { + t.Fatalf("FilePath: %s. Test case: %s. Operation %s is not supported. Use one of: %s", input.Filepath, input.Name, input.Operation, strings.Join(rules.Names(), ", ")) + } + err = checkScript(rule.GetScript(customization)) + if err != nil { + t.Fatalf("FilePath: %s. Test case: %s. Checking %s of %s, expected nil, but got: %v", input.Filepath, input.Name, rule.Name(), customization.Name, err) + } + args := buildRuleArgs(input) + result := rule.Run(ipt, args) + if result.Err != nil { + t.Fatalf("FilePath: %s. Test case: %s. Execute %s %s error: %v\n", input.Filepath, input.Name, customization.Name, rule.Name(), result.Err) + } + for _, res := range result.Results { + expected, ok := input.Output[res.Name] + if !ok { + // TODO(@zhzhuang-zju): Once we have a complete set of test cases, change this to t.Fatal. + t.Logf("FilePath: %s. Test case: %s. No expected result for %s of %s\n", input.Filepath, input.Name, res.Name, customization.Name) + continue + } + + if equal, err := deepEqual(expected, res.Value); err != nil || !equal { + t.Fatalf("FilePath: %s. Test case: %s. Unexpected result for %s, expected: %+v, got: %+v, error: %v", input.Filepath, input.Name, res.Name, expected, res.Value, err) + } + } + }) + } } +} + +func getAllTestCases(t *testing.T, testDataDir string) TestStructure { var resourceTest TestStructure - err = yaml.Unmarshal(yamlBytes, &resourceTest) + err := filepath.Walk(testDataDir, func(path string, info os.FileInfo, err error) error { + if err != nil { + t.Fatal(fmt.Errorf("failed to access path %s: %v", path, err)) + } + if info.IsDir() { + return nil + } + + data, err := os.ReadFile(path) + if err != nil { + t.Fatal(fmt.Errorf("failed to read file %s: %v", path, err)) + } + + decoder := yaml.NewYAMLOrJSONDecoder(bytes.NewReader(data), 4096) + for { + var test IndividualTest + err = decoder.Decode(&test) + if err != nil { + if err == io.EOF { + break + } + t.Fatal(fmt.Errorf("failed to decode file %s: %v", path, err)) + } + test.Filepath = path + resourceTest.Tests = append(resourceTest.Tests, test) + } + return nil + }) + if err != nil { t.Fatal(err) } - for _, customization := range configs { - for _, input := range resourceTest.Tests { - rule := rules.GetByOperation(input.Operation) - if rule == nil { - t.Fatalf("operation %s is not supported. Use one of: %s", input.Operation, strings.Join(rules.Names(), ", ")) - } - err = checkScript(rule.GetScript(customization)) - if err != nil { - t.Fatalf("checking %s of %s, expected nil, but got: %v", rule.Name(), customization.Name, err) - } - args := interpreter.RuleArgs{Replica: input.DesiredReplica} - if input.DesiredInputPath != "" { - args.Desired = getObj(t, dir+"/"+strings.TrimPrefix(input.DesiredInputPath, "/")) - } - if input.ObservedInputPath != "" { - args.Observed = getObj(t, dir+"/"+strings.TrimPrefix(input.ObservedInputPath, "/")) - } - if input.StatusInputPath != "" { - args.Status = getAggregatedStatusItems(t, dir+"/"+strings.TrimPrefix(input.StatusInputPath, "/")) - } - if result := rule.Run(ipt, args); result.Err != nil { - t.Fatalf("execute %s %s error: %v\n", customization.Name, rule.Name(), result.Err) - } + return resourceTest +} + +func buildRuleArgs(input IndividualTest) interpreter.RuleArgs { + return interpreter.RuleArgs{ + Replica: input.InputReplicas, + Desired: input.DesiredObj, + Observed: input.ObservedObj, + Status: input.StatusItems, + } +} + +func deepEqual(expected, actualValue interface{}) (bool, error) { + expectedJSONBytes, err := json.Marshal(expected) + if err != nil { + return false, fmt.Errorf("failed to marshal expected value: %w", err) + } + + // Handle known types for semantic comparison + switch typedActual := actualValue.(type) { + case *workv1alpha2.ReplicaRequirements: + var unmarshaledExpected workv1alpha2.ReplicaRequirements + if err := json.Unmarshal(expectedJSONBytes, &unmarshaledExpected); err != nil { + return false, fmt.Errorf("failed to unmarshal expected JSON into ReplicaRequirements: %w", err) + } + return checker.DeepEqual(&unmarshaledExpected, typedActual), nil + + case []configv1alpha1.DependentObjectReference: + var unmarshaledExpected []configv1alpha1.DependentObjectReference + if err := json.Unmarshal(expectedJSONBytes, &unmarshaledExpected); err != nil { + return false, fmt.Errorf("failed to unmarshal expected JSON into []DependentObjectReference: %w", err) + } + return checker.DeepEqual(unmarshaledExpected, typedActual), nil + + case []workv1alpha2.Component: + var unmarshaledExpected []workv1alpha2.Component + if err := json.Unmarshal(expectedJSONBytes, &unmarshaledExpected); err != nil { + return false, fmt.Errorf("failed to unmarshal expected JSON into []Component: %w", err) + } + + return checker.DeepEqual(unmarshaledExpected, typedActual), nil + + case *unstructured.Unstructured: + var unmarshaledExpected unstructured.Unstructured + + if err := json.Unmarshal(expectedJSONBytes, &unmarshaledExpected); err != nil { + return false, fmt.Errorf("failed to unmarshal expected JSON into Unstructured: %w", err) + } + return checker.DeepEqual(&unmarshaledExpected, typedActual), nil + + default: + // Fallback: marshal actualValue and do byte-wise comparison + actualJSON, err := json.Marshal(actualValue) + if err != nil { + return false, fmt.Errorf("failed to marshal actual value: %w", err) } + return bytes.Equal(expectedJSONBytes, actualJSON), nil } } diff --git a/pkg/util/interpreter/rule.go b/pkg/util/interpreter/rule.go index 3da0ecf6b985..69ff2e56513f 100644 --- a/pkg/util/interpreter/rule.go +++ b/pkg/util/interpreter/rule.go @@ -351,11 +351,7 @@ func (s *statusAggregationRule) Run(interpreter *declarative.ConfigurableInterpr return newRuleResultWithError(err) } - status := args.Status - if status == nil { - status = []workv1alpha2.AggregatedStatusItem{} - } - aggregateStatus, enabled, err := interpreter.AggregateStatus(obj, status) + aggregateStatus, enabled, err := interpreter.AggregateStatus(obj, args.Status) if err != nil { return newRuleResultWithError(err) }