Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to list the Bundle resources by RESTful API #103

Closed
2 of 3 tasks
skeeey opened this issue May 30, 2024 · 8 comments
Closed
2 of 3 tasks

Allow to list the Bundle resources by RESTful API #103

skeeey opened this issue May 30, 2024 · 8 comments

Comments

@skeeey
Copy link
Contributor

skeeey commented May 30, 2024

Allow to list the resource of type Bundle by RESTful API, then we can use this API to initialize the ManifestWork source client cache with this API, this will have two related tasks

refer to open-cluster-management-io/ocm#483

@skeeey
Copy link
Contributor Author

skeeey commented May 30, 2024

/cc @qiujian16 @clyang82 @morvencao @machi1990

@morvencao
Copy link
Contributor

need to update openAPI schema for this.
current list API return a list of 'Resource',
we should return a list of 'ManifestBundle' for this new requirement.

@clyang82
Copy link
Contributor

How about the name for API/api/maestro/v1/resource-bundles for all ManifestBundle resources?
Post /api/maestro/v1/resource-bundles
GET/PATCH/DELETE /api/maestro/v1/resource-bundles/${bundle_id}

@morvencao
Copy link
Contributor

we don't need POST, PATCH and DELETE, right? only need GET and LIST?

@skeeey
Copy link
Contributor Author

skeeey commented May 30, 2024

For POST, PATCH and DELETE, we may still to use grpc publish method to do them

@morvencao
Copy link
Contributor

morvencao commented May 30, 2024

drafted a PR for this: #106
a running example:

# curl -k -X GET -H "Content-Type: application/json" https://maestro.${external_apps_domain}/api/maestro/v1/resourcebundles | jq
{
  "items": [
    {
      "consumer_name": "cluster1",
      "created_at": "2024-05-30T05:03:08.493083Z",
      "delete_option": {
        "propagationPolicy": "Foreground"
      },
      "href": "/api/maestro/v1/resources/68ebf474-6709-48bb-b760-386181268060",
      "id": "68ebf474-6709-48bb-b760-386181268060",
      "kind": "Resource",
      "manifest_configs": [
        {
          "feedbackRules": [
            {
              "jsonPaths": [
                {
                  "name": "status",
                  "path": ".status"
                }
              ],
              "type": "JSONPaths"
            }
          ],
          "resourceIdentifier": {
            "group": "apps",
            "name": "web",
            "namespace": "default",
            "resource": "deployments"
          },
          "updateStrategy": {
            "type": "ServerSideApply"
          }
        }
      ],
      "manifests": [
        {
          "apiVersion": "v1",
          "kind": "ConfigMap",
          "metadata": {
            "name": "web",
            "namespace": "default"
          }
        },
        {
          "apiVersion": "apps/v1",
          "kind": "Deployment",
          "metadata": {
            "name": "web",
            "namespace": "default"
          },
          "spec": {
            "replicas": 1,
            "selector": {
              "matchLabels": {
                "app": "web"
              }
            },
            "template": {
              "metadata": {
                "labels": {
                  "app": "web"
                }
              },
              "spec": {
                "containers": [
                  {
                    "image": "nginxinc/nginx-unprivileged",
                    "name": "nginx"
                  }
                ]
              }
            }
          }
        }
      ],
      "name": "68ebf474-6709-48bb-b760-386181268060",
      "status": {
        "ObservedVersion": 1,
        "SequenceID": "1796044690592632832",
        "conditions": [
          {
            "lastTransitionTime": "2024-05-30T05:03:08Z",
            "message": "Apply manifest work complete",
            "reason": "AppliedManifestWorkComplete",
            "status": "True",
            "type": "Applied"
          },
          {
            "lastTransitionTime": "2024-05-30T05:03:08Z",
            "message": "All resources are available",
            "reason": "ResourcesAvailable",
            "status": "True",
            "type": "Available"
          }
        ],
        "resourceStatus": [
          {
            "conditions": [
              {
                "lastTransitionTime": "2024-05-30T05:03:08Z",
                "message": "Apply manifest complete",
                "reason": "AppliedManifestComplete",
                "status": "True",
                "type": "Applied"
              },
              {
                "lastTransitionTime": "2024-05-30T05:03:08Z",
                "message": "Resource is available",
                "reason": "ResourceAvailable",
                "status": "True",
                "type": "Available"
              },
              {
                "lastTransitionTime": "2024-05-30T05:03:08Z",
                "message": "",
                "reason": "NoStatusFeedbackSynced",
                "status": "True",
                "type": "StatusFeedbackSynced"
              }
            ],
            "resourceMeta": {
              "group": "",
              "kind": "ConfigMap",
              "name": "web",
              "namespace": "default",
              "ordinal": 0,
              "resource": "configmaps",
              "version": "v1"
            },
            "statusFeedback": {}
          },
          {
            "conditions": [
              {
                "lastTransitionTime": "2024-05-30T05:03:08Z",
                "message": "Apply manifest complete",
                "reason": "AppliedManifestComplete",
                "status": "True",
                "type": "Applied"
              },
              {
                "lastTransitionTime": "2024-05-30T05:03:08Z",
                "message": "Resource is available",
                "reason": "ResourceAvailable",
                "status": "True",
                "type": "Available"
              },
              {
                "lastTransitionTime": "2024-05-30T05:03:08Z",
                "message": "",
                "reason": "StatusFeedbackSynced",
                "status": "True",
                "type": "StatusFeedbackSynced"
              }
            ],
            "resourceMeta": {
              "group": "apps",
              "kind": "Deployment",
              "name": "web",
              "namespace": "default",
              "ordinal": 1,
              "resource": "deployments",
              "version": "v1"
            },
            "statusFeedback": {
              "values": [
                {
                  "fieldValue": {
                    "jsonRaw": "{\"availableReplicas\":1,\"conditions\":[{\"lastTransitionTime\":\"2024-05-30T05:03:13Z\",\"lastUpdateTime\":\"2024-05-30T05:03:13Z\",\"message\":\"Deployment has minimum availability.\",\"reason\":\"MinimumReplicasAvailable\",\"status\":\"True\",\"type\":\"Available\"},{\"lastTransitionTime\":\"2024-05-30T05:03:08Z\",\"lastUpdateTime\":\"2024-05-30T05:03:13Z\",\"message\":\"ReplicaSet \\\"web-dcffc4f85\\\" has successfully progressed.\",\"reason\":\"NewReplicaSetAvailable\",\"status\":\"True\",\"type\":\"Progressing\"}],\"observedGeneration\":1,\"readyReplicas\":1,\"replicas\":1,\"updatedReplicas\":1}",
                    "type": "JsonRaw"
                  },
                  "name": "status"
                }
              ]
            }
          }
        ]
      },
      "updated_at": "2024-05-30T05:03:17.796496Z",
      "version": 1
    }
  ],
  "kind": "ResourceList",
  "page": 1,
  "size": 1,
  "total": 1
}

@clyang82
Copy link
Contributor

clyang82 commented Jun 7, 2024

@machi1990 the resource-bundles api is also ready for use. please verify it as well. Thanks.

@machi1990
Copy link
Contributor

I've verified it via the example @skeeey (thanks) created here

Let's close this and iterate from it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants