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

Support tcp/http liveness/readiness probe #1449

Merged

Conversation

ichxxx
Copy link
Contributor

@ichxxx ichxxx commented Oct 22, 2021

close #1427

Add extra labels to support tcp liveness/readiness probe and http readiness probe

kompose.service.healthcheck.liveness.tcp_port: 8080
kompose.service.healthcheck.readiness.http_get_path: /ready
kompose.service.healthcheck.readiness.http_get_port: 8080
kompose.service.healthcheck.readiness.tcp_port: 8080

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Oct 22, 2021
@hangyan
Copy link
Contributor

hangyan commented Oct 23, 2021

@ichxxx Hi, thanks for the PR, codes looks great. Since we have support merge multiple service to one workload, it's recommned to add extra test for this case. Check out the service-group-mode flags. You can reuse your current fixtures or the existing one for multiple-service-merge

@ichxxx
Copy link
Contributor Author

ichxxx commented Oct 26, 2021

@hangyan Support and test for multiple service merge was added

@ichxxx
Copy link
Contributor Author

ichxxx commented Oct 26, 2021

And I find the annotations have a bit problem on multiple containers, that annotations just show info about one of the services, not all the services.

@hangyan
Copy link
Contributor

hangyan commented Oct 31, 2021

And I find the annotations have a bit problem on multiple containers, that annotations just show info about one of the services, not all the services.

What do you mean? Would you like to give an example?

@ichxxx
Copy link
Contributor Author

ichxxx commented Nov 2, 2021

And I find the annotations have a bit problem on multiple containers, that annotations just show info about one of the services, not all the services.

What do you mean? Would you like to give an example?

For example:
docker-compose.yaml

version: "3.3"
services:
  mongo:
    image: mongo
    labels:
      kompose.service.group: "my-group"
      kompose.service.healthcheck.liveness.tcp_port: 8080

  mysql:
    image: mysql
    labels:
      kompose.service.group: "my-group"
      kompose.service.healthcheck.liveness.tcp_port: 8081

output-k8s.json

{
  "kind": "Deployment",
  "apiVersion": "apps/v1",
  "metadata": {
    "name": "my-group",
    "annotations": {
      "kompose.service.group": "my-group",
      "kompose.service.healthcheck.liveness.tcp_port": "8081"
    }
  },
  "spec": {
    "template": {
      "metadata": {
        "annotations": {
          "kompose.service.group": "my-group",
          "kompose.service.healthcheck.liveness.tcp_port": "8080"
        }
      },
      "spec": {
        "containers": [
          {
            "name": "mongo",
            "livenessProbe": {
              "tcpSocket": {
                "port": 8080
              }
            }
          },
          {
            "name": "mysql",
            "livenessProbe": {
              "tcpSocket": {
                "port": 8081
              }
            }
          }
        ]
      }
    }
  }
}

There are two serivces, I specify liveness probe by labels.
The tcp port of mongo service's liveness probe is 8080, and mysql service is 8081.
But the label info in annotations just show one of the services.

@hangyan
Copy link
Contributor

hangyan commented Nov 3, 2021

We can create some sperate PRs to fix this. Does not seems a big issues for me now. I guess there are some issues exist for the service group feature.

@hangyan hangyan merged commit d55071e into kubernetes:master Nov 3, 2021
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: hangyan, ichxxx

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@hangyan
Copy link
Contributor

hangyan commented Nov 3, 2021

Thanks @ichxxx

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

HTTP/TCP liveness/readiness probe generation
3 participants