openshift-online / maestro

Maestro Service Repo
Apache License 2.0
8 stars 15 forks source link

Add manifest bundle support #59

Closed morvencao closed 3 months ago

morvencao commented 3 months ago

ref: https://issues.redhat.com/browse/OCM-6367

morvencao commented 3 months ago

test results:

# make test-integration
CGO_ENABLED=1 GOEXPERIMENT=boringcrypto go install -ldflags="" ./cmd/maestro
OCM_ENV=testing gotestsum --format short-verbose -- -p 1 -ldflags -s -v -timeout 1h  \
        ./test/integration
I0307 09:30:50.606715  386039 framework.go:76] Initializing testing environment
I0307 09:30:50.887469  386039 framework.go:161] Using Mock OCM Authz Client
I0307 09:30:50.890513  386039 framework.go:199] Disabling Sentry error reporting
I0307 09:30:50.898980  386039 grpc_server.go:74] Serving gRPC service without TLS at 8090
I0307 09:30:50.899286  386039 api_server.go:151] Serving without TLS at 8000
PASS test/integration.TestConsumerGet (5.06s)
PASS test/integration.TestConsumerPost (0.23s)
PASS test/integration.TestConsumerPaging (0.35s)
PASS test/integration.TestControllerRacing (1.76s)
PASS test/integration.TestControllerReconcile (1.38s)
PASS test/integration.TestControllerSync (1.30s)
PASS test/integration.TestPulseServer (5.31s)
PASS test/integration.TestResourceGet (0.19s)
PASS test/integration.TestResourcePost (5.20s)
PASS test/integration.TestResourcePatch (0.35s)
PASS test/integration.TestResourcePaging (0.39s)
PASS test/integration.TestResourceListSearch (0.26s)
PASS test/integration.TestUpdateResourceWithRacingRequests (2.29s)
PASS test/integration.TestResourceFromGRPC (2.28s)
E0307 09:31:17.272039  386039 logger.go:129]   Unable to get all maestro instances: pq: relation "server_instances" does not exist
E0307 09:31:17.273825  386039 logger.go:129]   Unable to get all maestro instances: pq: relation "server_instances" does not exist
E0307 09:31:17.275218  386039 logger.go:129]   Unable to get all maestro instances: pq: relation "server_instances" does not exist
E0307 09:31:17.276482  386039 logger.go:129]   Unable to get all maestro instances: pq: relation "server_instances" does not exist
PASS test/integration

DONE 14 tests in 30.024s
skeeey commented 3 months ago

And cloud you also append the e2e test result?

morvencao commented 3 months ago

e2e test results:

# make e2e-test
ginkgo --output-dir="/home/oasis/workspace/openshift-online-maestro/test/e2e/report" --json-report=report.json --junit-report=report.xml \
/home/oasis/workspace/openshift-online-maestro/test/e2e/pkg -- -consumer_id="34617c63-5f52-4ae0-8428-35daf6b9a45f" \
-api-server=https://127.0.0.1:30080 -kubeconfig=/home/oasis/workspace/openshift-online-maestro/test/e2e/.kubeconfig
Ginkgo detected a version mismatch between the Ginkgo CLI and the version of Ginkgo imported by your packages:
  Ginkgo CLI Version:
    2.6.0
  Mismatched package versions found:
    2.13.2 used by pkg

  Ginkgo will continue to attempt to run but you may see errors (including flag
  parsing errors) and should either update your go.mod or your version of the
  Ginkgo CLI to match.

  To install the matching version of the CLI run
    go install github.com/onsi/ginkgo/v2/ginkgo
  from a path that contains a go.mod file.  Alternatively you can use
    go run github.com/onsi/ginkgo/v2/ginkgo
  from a path that contains a go.mod file to invoke the matching version of the
  Ginkgo CLI.

  If you are attempting to test multiple packages that each have a different
  version of the Ginkgo library with a single Ginkgo CLI that is currently
  unsupported.

Running Suite: End-to-End Test Suite - /home/oasis/workspace/openshift-online-maestro/test/e2e/pkg
============================================================================================
Random Seed: 1709873066

Will run 5 of 5 specs
•••••

Ran 5 of 5 Specs in 4.149 seconds
SUCCESS! -- 5 Passed | 0 Failed | 0 Pending | 0 Skipped
PASS

Ginkgo ran 1 suite in 8.021418251s
Test Suite Passed
morvencao commented 3 months ago

/assign @qiujian16 @clyang82

morvencao commented 3 months ago

@qiujian16 An example of resource status in DB:

# select jsonb_pretty(resources.status) from resources;
                              jsonb_pretty
--------------------------------------------------------------------
  {
      "id": "0fd2b15f-e4d5-4ecb-a5fb-455284d27e2b",
      "data": {
          "status": {
              "conditions": [
                  {
                      "type": "Applied",
                      "reason": "AppliedManifestComplete",
                      "status": "True",
                      "message": "Apply manifest complete",
                      "lastTransitionTime": "2024-03-18T12:57:58Z"
                  },
                  {
                      "type": "Available",
                      "reason": "ResourceAvailable",
                      "status": "True",
                      "message": "Resource is available",
                      "lastTransitionTime": "2024-03-18T12:57:58Z"
                  },
                  {
                      "type": "StatusFeedbackSynced",
                      "reason": "StatusFeedbackSynced",
                      "status": "True",
                      "message": "",
                      "lastTransitionTime": "2024-03-18T12:57:58Z"
                  }
              ],
              "resourceMeta": {
                  "kind": "Deployment",
                  "name": "nginx1",
                  "group": "apps",
                  "ordinal": 0,
                  "version": "v1",
                  "resource": "deployments",
                  "namespace": "default"
              },
              "statusFeedback": {
                  "values": [
                      {
                          "name": "status",
                          "fieldValue": {
                              "type": "JsonRaw",
                              "jsonRaw": "{\"availableReplicas\":1,\"conditions\":[{\"lastTransitionTime\":\"2024-03-18T12:58:04Z\",\"lastUpdateTime\":\"2024-03-18T12:58:04Z\",\"m
  essage\":\"Deployment has minimum availability.\",\"reason\":\"MinimumReplicasAvailable\",\"status\":\"True\",\"type\":\"Available\"},{\"lastTransitionTime\":\"2024-03-18T12:57:58Z\",\"lastUpdateTime\":\"2024-03-18T12:58:04Z\",\"message\":\"ReplicaSet \\\"nginx1-5d6b548959\\\" has successfully progressed.\",\"reason\":\"NewReplicaSetAvailable\",\"status\
  ":\"True\",\"type\":\"Progressing\"}],\"observedGeneration\":1,\"readyReplicas\":1,\"replicas\":1,\"updatedReplicas\":1}"
                          }
                      }
                  ]
              }
          },
          "conditions": [
              {
                  "type": "Applied",
                  "reason": "AppliedManifestWorkComplete",
                  "status": "True",
                  "message": "Apply manifest work complete",
                  "lastTransitionTime": "2024-03-18T12:57:58Z"
              },
              {
                  "type": "Available",
                  "reason": "ResourcesAvailable",
                  "status": "True",
                  "message": "All resources are available",
                  "lastTransitionTime": "2024-03-18T12:57:58Z"
              }
          ]
      },
      "time": "2024-03-18T12:58:11.020848168Z",
      "type": "io.open-cluster-management.works.v1alpha1.manifests.status.update_request",
      "source": "b288a9da-8bfe-4c82-94cc-2b48e773fc46-work-agent",
      "resourceid": "dc970bd3-da6d-4a63-992b-dc0ae0419a7c",
      "sequenceid": "1769709885668200448",
      "clustername": "b288a9da-8bfe-4c82-94cc-2b48e773fc46",
      "specversion": "1.0",
      "originalsource": "maestro",
      "datacontenttype": "application/json",
      "resourceversion": "1"
  }
(1 row)