From 70ee6ee4e9ae7df051eb3460772f7d8839b92bb5 Mon Sep 17 00:00:00 2001 From: jiangpengcheng Date: Sat, 11 May 2024 10:34:23 +0800 Subject: [PATCH] Add ci --- .../functionmesh-with-generic-resources/manifests.yaml | 2 +- .../cases/functionmesh-with-generic-resources/verify.sh | 6 +++--- .ci/tests/integration/e2e_with_tls.yaml | 2 ++ controllers/function_mesh.go | 2 +- controllers/functionmesh_controller.go | 3 +++ controllers/spec/common.go | 3 ++- 6 files changed, 12 insertions(+), 6 deletions(-) diff --git a/.ci/tests/integration/cases/functionmesh-with-generic-resources/manifests.yaml b/.ci/tests/integration/cases/functionmesh-with-generic-resources/manifests.yaml index e566640a8..0d534a47c 100644 --- a/.ci/tests/integration/cases/functionmesh-with-generic-resources/manifests.yaml +++ b/.ci/tests/integration/cases/functionmesh-with-generic-resources/manifests.yaml @@ -1,7 +1,7 @@ apiVersion: compute.functionmesh.io/v1alpha1 kind: FunctionMesh metadata: - name: functionmesh-generic-resources-sample + name: functionmesh-generic-sample spec: genericResources: - apiVersion: "compute.functionmesh.io/v1alpha1" diff --git a/.ci/tests/integration/cases/functionmesh-with-generic-resources/verify.sh b/.ci/tests/integration/cases/functionmesh-with-generic-resources/verify.sh index f06e96324..a88fae06f 100644 --- a/.ci/tests/integration/cases/functionmesh-with-generic-resources/verify.sh +++ b/.ci/tests/integration/cases/functionmesh-with-generic-resources/verify.sh @@ -36,21 +36,21 @@ manifests_file="${BASE_DIR}"/.ci/tests/integration/cases/functionmesh-with-gener kubectl apply -f "${manifests_file}" > /dev/null 2>&1 -verify_fm_result=$(ci::verify_function_mesh functionmesh-generic-resources-sample-java-function 2>&1) +verify_fm_result=$(ci::verify_function_mesh functionmesh-generic-sample-java-function 2>&1) if [ $? -ne 0 ]; then echo "$verify_fm_result" kubectl delete -f "${manifests_file}" > /dev/null 2>&1 || true exit 1 fi -verify_fm_result=$(ci::verify_function_mesh functionmesh-generic-resources-sample-golang-function 2>&1) +verify_fm_result=$(ci::verify_function_mesh functionmesh-generic-sample-golang-function 2>&1) if [ $? -ne 0 ]; then echo "$verify_fm_result" kubectl delete -f "${manifests_file}" > /dev/null 2>&1 || true exit 1 fi -verify_fm_result=$(ci::verify_function_mesh functionmesh-generic-resources-sample-python-function 2>&1) +verify_fm_result=$(ci::verify_function_mesh functionmesh-generic-sample-python-function 2>&1) if [ $? -ne 0 ]; then echo "$verify_fm_result" kubectl delete -f "${manifests_file}" > /dev/null 2>&1 || true diff --git a/.ci/tests/integration/e2e_with_tls.yaml b/.ci/tests/integration/e2e_with_tls.yaml index e1844caf3..8ea255a8b 100644 --- a/.ci/tests/integration/e2e_with_tls.yaml +++ b/.ci/tests/integration/e2e_with_tls.yaml @@ -131,3 +131,5 @@ verify: expected: expected.data.yaml - query: timeout 5m bash .ci/tests/integration/cases/global-and-namespaced-config/verify.sh expected: expected.data.yaml + - query: timeout 5m bash .ci/tests/integration/cases/functionmesh-generic-resources/verify.sh + expected: expected.data.yaml diff --git a/controllers/function_mesh.go b/controllers/function_mesh.go index f18e733ec..a6bd11f32 100644 --- a/controllers/function_mesh.go +++ b/controllers/function_mesh.go @@ -251,7 +251,7 @@ func (r *FunctionMeshReconciler) observeGenericResources(ctx context.Context, me condition, ok := mesh.Status.GenericResourceConditions[resource.Name] if !ok { mesh.Status.GenericResourceConditions[resource.Name] = v1alpha1.ResourceCondition{ - Condition: v1alpha1.SinkReady, + Condition: v1alpha1.GenericResourceReady, Status: metav1.ConditionFalse, Action: v1alpha1.Create, ApiVersion: resource.APIVersion, diff --git a/controllers/functionmesh_controller.go b/controllers/functionmesh_controller.go index e4b72d69f..2ecea79f9 100644 --- a/controllers/functionmesh_controller.go +++ b/controllers/functionmesh_controller.go @@ -72,6 +72,9 @@ func (r *FunctionMeshReconciler) Reconcile(ctx context.Context, req ctrl.Request if mesh.Status.SinkConditions == nil { mesh.Status.SinkConditions = make(map[string]v1alpha1.ResourceCondition) } + if mesh.Status.GenericResourceConditions == nil { + mesh.Status.GenericResourceConditions = make(map[string]v1alpha1.ResourceCondition) + } if mesh.Status.Condition == nil { mesh.Status.Condition = &v1alpha1.ResourceCondition{} } diff --git a/controllers/spec/common.go b/controllers/spec/common.go index d4ea8c5dc..55c624a57 100644 --- a/controllers/spec/common.go +++ b/controllers/spec/common.go @@ -39,6 +39,7 @@ import ( autoscalingv2beta2 "k8s.io/api/autoscaling/v2beta2" v1 "k8s.io/api/batch/v1" corev1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/equality" k8serrors "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" @@ -2058,7 +2059,7 @@ func CheckIfStatefulSetSpecIsEqual(spec *appsv1.StatefulSetSpec, desiredSpec *ap container.ImagePullPolicy != desiredContainer.ImagePullPolicy || !reflect.DeepEqual(ports, desiredPorts) || !reflect.DeepEqual(containerEnvFrom, desiredContainerEnvFrom) || - !reflect.DeepEqual(container.Resources, desiredContainer.Resources) { + !equality.Semantic.DeepEqual(container.Resources, desiredContainer.Resources) { return false }