EDITD / kubetools

:nut_and_bolt: Kubetools is a tool and processes for developing and deploying microservices to Kubernetes.
MIT License
13 stars 2 forks source link

add support for dnsConfig #160

Closed ttecles closed 6 months ago

ttecles commented 8 months ago

This PR allows setting dnsConfig for the PodSpec in kubetools.

ryan109 commented 8 months ago

Has this been built and tested with a service?

ttecles commented 8 months ago

Has this been built and tested with a service?

Nope, shall I pin the service to this branch and see if it works?

ttecles commented 8 months ago

Has this been built and tested with a service?

Nope, shall I pin the-service to this branch and see if it works?

Wait I was thinking in kubetools installed in the service but we want to test it for one of the deployments. I cannot deploy this without changing Kubetools from the CI server or deploying it myself manually.

What are you referring to @ryan109 ?

ttecles commented 8 months ago

I've tested the package locally and I was able to ktd up. I have also executed the kubetools config . on the-service and this is what I am getting:

Deployment: the-service-starter
{
    "apiVersion": "apps/v1",
    "kind": "Deployment",
    "metadata": {
        "name": "the-service-starter",
        "labels": {
            "kubetools/project_name": "the-service",
            "kubetools/role": "my",
            "kubetools/name": "the-service-starter"
        },
        "annotations": {
            "app.kubernetes.io/managed-by": "kubetools"
        }
    },
    "spec": {
        "revisionHistoryLimit": 5,
        "selector": {
            "matchLabels": {
                "kubetools/project_name": "the-service",
                "kubetools/role": "my",
                "kubetools/name": "starter"
            }
        },
        "replicas": 1,
        "template": {
            "metadata": {
                "labels": {
                    "kubetools/project_name": "the-service",
                    "kubetools/role": "my",
                    "kubetools/name": "the-service-starter"
                }
            },
            "spec": {
                "containers": [
                    {
                        "name": "starter",
                        "imagePullPolicy": "Always",
                        "image": "IMAGE",
                        "env": [
                            {
                                "name": "KUBECONFIG",
                                "value": "/config"
                            },
                            {
                                "name": "KUBE",
                                "value": "true"
                            }
                        ],
                        "command": [
                            "dumb-init",
                            "python3",
                            "-m",
                            "starter.py"
                        ]
                    }
                ],
                "dnsConfig": {
                    "options": [
                        {
                            "name": "ndots",
                            "value": "1"
                        }
                    ]
                }
            }
        }
    }
}

Do you want me to deploy this to a minikube and see if it works? I am just following https://kubernetes.io/docs/reference/kubernetes-api/workload-resources/deployment-v1/#DeploymentSpec

gchazot commented 8 months ago

ktd does not use k8s, it uses docker-compose.

It seems like docker-compose does not support setting the value for ndots. This has to be checked because if it actually supports it, then this PR should implement it to make sure ktd envs are aligned with their k8s counterparts.

In any case, this PR needs to be tested against k8s. Any local k8s will do.

ttecles commented 8 months ago

ktd does not use k8s, it uses docker-compose.

It seems like docker-compose does not support setting the value for ndots. This has to be checked because if it actually supports it, then this PR should implement it to make sure ktd envs are aligned with their k8s counterparts.

In any case, this PR needs to be tested against k8s. Any local k8s will do.

Seems there is: https://github.com/compose-spec/compose-spec/blob/master/05-services.md#dns

I'll take a look and add it into the PR. Thanks @gchazot

ttecles commented 6 months ago

closing this since we won't need it anymore