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

Feature: add fetch service list and get service detail from k8s cluster api to backend #170

Merged
merged 9 commits into from Dec 28, 2018

Conversation

Projects
None yet
3 participants
@HZ89
Copy link
Collaborator

HZ89 commented Dec 20, 2018

What type of PR is this?

/kind feature

What this PR does / why we need it:
api add:

/api/v1/kubernetes/apps/:appId/services/namespaces/:namespace/clusters/:cluster
/api/v1/kubernetes/apps/:appId/services/:service/detail/namespaces/:namespace/clusters/:cluster

test result:

curl --location --request GET "http://127.0.0.1:8080/api/v1//kubernetes/apps/0/services/namespaces/default/clusters/minikube"
{
  "data": {
    "pageNo": 1,
    "pageSize": 10,
    "totalPage": 1,
    "totalCount": 2,
    "list": [
      {
        "objectMeta": {
          "name": "kubernetes",
          "namespace": "default",
          "labels": {
            "component": "apiserver",
            "provider": "kubernetes"
          },
          "creationTimestamp": "2018-12-20T08:35:42Z"
        },
        "typeMeta": {
          "kind": "service"
        },
        "internalEndpoint": {
          "host": "kubernetes",
          "ports": [
            {
              "port": 443,
              "protocol": "TCP",
              "nodePort": 0
            }
          ]
        },
        "externalEndpoints": null,
        "selector": null,
        "type": "ClusterIP",
        "clusterIP": "10.96.0.1"
      },
      {
        "objectMeta": {
          "name": "my-nginx",
          "namespace": "default",
          "labels": {
            "run": "my-nginx"
          },
          "annotations": {
            "kubectl.kubernetes.io/last-applied-configuration": "{\"apiVersion\":\"v1\",\"kind\":\"Service\",\"metadata\":{\"annotations\":{},\"labels\":{\"run\":\"my-nginx\"},\"name\":\"my-nginx\",\"namespace\":\"default\"},\"spec\":{\"ports\":[{\"port\":80,\"protocol\":\"TCP\"}],\"selector\":{\"run\":\"my-nginx\"}}}\n"
          },
          "creationTimestamp": "2018-12-20T09:13:35Z"
        },
        "typeMeta": {
          "kind": "service"
        },
        "internalEndpoint": {
          "host": "my-nginx",
          "ports": [
            {
              "port": 80,
              "protocol": "TCP",
              "nodePort": 0
            }
          ]
        },
        "externalEndpoints": null,
        "selector": {
          "run": "my-nginx"
        },
        "type": "ClusterIP",
        "clusterIP": "10.101.60.195"
      }
    ]
  }
}
curl --location --request GET "http://127.0.0.1:8080/api/v1//kubernetes/apps/0/services/my-nginx/detail/namespaces/default/clusters/minikube"
{
  "data": {
    "objectMeta": {
      "name": "my-nginx",
      "namespace": "default",
      "labels": {
        "run": "my-nginx"
      },
      "annotations": {
        "kubectl.kubernetes.io/last-applied-configuration": "{\"apiVersion\":\"v1\",\"kind\":\"Service\",\"metadata\":{\"annotations\":{},\"labels\":{\"run\":\"my-nginx\"},\"name\":\"my-nginx\",\"namespace\":\"default\"},\"spec\":{\"ports\":[{\"port\":80,\"protocol\":\"TCP\"}],\"selector\":{\"run\":\"my-nginx\"}}}\n"
      },
      "creationTimestamp": "2018-12-20T09:13:35Z"
    },
    "typeMeta": {
      "kind": "service"
    },
    "internalEndpoint": {
      "host": "my-nginx",
      "ports": [
        {
          "port": 80,
          "protocol": "TCP",
          "nodePort": 0
        }
      ]
    },
    "externalEndpoints": null,
    "endpointList": [
      {
        "objectMeta": {
          "creationTimestamp": null
        },
        "typeMeta": {
          "kind": "endpoint"
        },
        "host": "172.17.0.2",
        "nodeName": "minikube",
        "ready": true,
        "ports": [
          {
            "port": 80,
            "protocol": "TCP"
          }
        ]
      },
      {
        "objectMeta": {
          "creationTimestamp": null
        },
        "typeMeta": {
          "kind": "endpoint"
        },
        "host": "172.17.0.5",
        "nodeName": "minikube",
        "ready": true,
        "ports": [
          {
            "port": 80,
            "protocol": "TCP"
          }
        ]
      }
    ],
    "selector": {
      "run": "my-nginx"
    },
    "type": "ClusterIP",
    "clusterIP": "10.101.60.195",
    "eventList": [],
    "podList": null,
    "sessionAffinity": "None"
  }
}

@HZ89 HZ89 force-pushed the HZ89:k8s-service-api branch from 5576cb0 to 90e3cea Dec 21, 2018

@HZ89 HZ89 changed the title add api support fetch service list and detail from k8s cluster backend: add api support fetch service list and detail from k8s cluster Dec 21, 2018

@wilhelmguo wilhelmguo requested review from wilhelmguo and chengyumeng Dec 21, 2018

@HZ89 HZ89 changed the title backend: add api support fetch service list and detail from k8s cluster Feature: add fetch service list and get service detail from k8s cluster api to backend Dec 21, 2018

@HZ89 HZ89 force-pushed the HZ89:k8s-service-api branch from 90e3cea to 83b4319 Dec 21, 2018

@HZ89 HZ89 force-pushed the HZ89:k8s-service-api branch 2 times, most recently from a26953a to a860087 Dec 21, 2018

@HZ89 HZ89 force-pushed the HZ89:k8s-service-api branch from a860087 to f754bc4 Dec 24, 2018

@wilhelmguo

This comment has been minimized.

Copy link
Collaborator

wilhelmguo commented Dec 24, 2018

LGTM @chengyumeng Please review the PR.

@chengyumeng
Copy link
Collaborator

chengyumeng left a comment

这个文件不应该放在这个目录下面

wilhelmguo added some commits Dec 25, 2018

@wilhelmguo

This comment has been minimized.

Copy link
Collaborator

wilhelmguo commented Dec 25, 2018

@chengyumeng @HZ89 还有其他问题吗

@HZ89

This comment has been minimized.

Copy link
Collaborator Author

HZ89 commented Dec 26, 2018

我没啥问题

@chengyumeng

This comment has been minimized.

Copy link
Collaborator

chengyumeng commented Dec 26, 2018

之前 review 提出的问题有一些还没回复呀 @HZ89 @wilhelmguo

@wilhelmguo wilhelmguo merged commit 5239e41 into Qihoo360:master Dec 28, 2018

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.