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

karmada operator add the support for custom dns domain #5727

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

zhzhuang-zju
Copy link
Contributor

What type of PR is this?
/kind feature

What this PR does / why we need it:

// Networking contains elements describing cluster's networking configuration
type Networking struct {
// DNSDomain is the dns domain used by k8s services. Defaults to "cluster.local".
// +optional
DNSDomain *string `json:"dnsDomain,omitempty"`
}

Currently, the Karmada API provides a field to configure a custom DNS domain, but this capability has not been implemented in the actual installation process. I hope to introduce support for custom DNS domains in the Karmada operator.

Which issue(s) this PR fixes:
Parts of #5722

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

karmada-operator: add the support for custom dns domain

@karmada-bot karmada-bot added the kind/feature Categorizes issue or PR as related to a new feature. label Oct 23, 2024
@karmada-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign calvin0327 for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found 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

@karmada-bot karmada-bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Oct 23, 2024
@zhzhuang-zju zhzhuang-zju force-pushed the dnsDomain branch 2 times, most recently from 016f9c6 to 0a06215 Compare October 23, 2024 07:25
@zhzhuang-zju
Copy link
Contributor Author

Local Verifcatrion:

  • Create a cluster with dnsDomain set to cluster.remote.
# dns/cluster.config
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
name: member5
networking:
nodes:
  - role: control-plane
    kubeadmConfigPatches:
      - |
        ---
        apiVersion: kubeadm.k8s.io/v1beta3
        kind: ClusterConfiguration
        networking:
          dnsDomain: "cluster.remote"
 $ kind create cluster --config dns/cluster.config --kubeconfig ~/.kube/member5.config
 $ kubectl get cm --namespace kube-system coredns -oyaml
 ...
         kubernetes cluster.remote in-addr.arpa ip6.arpa {
 ...
 $ cat /etc/resolv.conf
search default.svc.cluster.remote svc.cluster.remote cluster.remote openstacklocal
# operator/config/samples/karmada-sample.yaml
  hostCluster:
    networking:
      dnsDomain: cluster.remote
$ hack/deploy-karmada-operator.sh ~/.kube/member5.config member5
$ hack/deploy-karmada-by-operator.sh ~/.kube/member5.config member5 karmada-apiserver v1.11.1 true https://github.com/karmada-io/karmada/releases/download/v1.11.1/crds.tar.gz
  • Before(without the support for custom dns domain)
$ kubectl get pods -ntest
NAME                                     READY   STATUS             RESTARTS        AGE
karmada-demo-apiserver-f99cf9578-rcwfr   0/1     CrashLoopBackOff   6 (37s ago)     9m15s
karmada-demo-etcd-0                      0/1     Error              6 (3m25s ago)   10m
$ kubectl logs -p --namespace test karmada-demo-etcd-0
{"level":"warn","ts":"2024-10-23T03:13:15.050098Z","caller":"netutil/netutil.go:121","msg":"failed to resolve URL Host","url":"http://karmada-demo-etcd-0.karmada-demo-etcd.test.svc.cluster.local:2380","host":"karmada-demo-etcd-0.karmada-demo-etcd.test.svc.cluster.local:2380","retry-interval":"1s","error":"lookup karmada-demo-etcd-0.karmada-demo-etcd.test.svc.cluster.local on 10.96.0.10:53: no such host"}
{"level":"fatal","ts":"2024-10-23T03:13:15.914938Z","caller":"etcdmain/etcd.go:204","msg":"discovery failed","error":"--initial-cluster has karmada-demo-etcd-0=http://karmada-demo-etcd-0.karmada-demo-etcd.test.svc.cluster.local:2380 but missing from --initial-advertise-peer-urls=http://10.244.0.9:2380 (failed to resolve \"http://karmada-demo-etcd-0.karmada-demo-etcd.test.svc.cluster.local:2380\" (lookup karmada-demo-etcd-0.karmada-demo-etcd.test.svc.cluster.local on 10.96.0.10:53: no such host))","stacktrace":"go.etcd.io/etcd/server/v3/etcdmain.startEtcdOrProxyV2\n\tgo.etcd.io/etcd/server/v3/etcdmain/etcd.go:204\ngo.etcd.io/etcd/server/v3/etcdmain.Main\n\tgo.etcd.io/etcd/server/v3/etcdmain/main.go:40\nmain.main\n\tgo.etcd.io/etcd/server/v3/main.go:31\nruntime.main\n\truntime/proc.go:267"}
  • After(with the support for custom dns domain)
$ kubectl get pods -ntest
NAME                                                    READY   STATUS    RESTARTS   AGE
karmada-demo-aggregated-apiserver-5fcb5fbb88-x55mb      1/1     Running   0          5m7s
karmada-demo-apiserver-c6465f7b4-ls79h                  1/1     Running   0          5m19s
karmada-demo-controller-manager-778bc5886d-ds9p6        1/1     Running   0          4m28s
karmada-demo-descheduler-689c679547-mfxqt               1/1     Running   0          4m28s
karmada-demo-etcd-0                                     1/1     Running   0          5m20s
karmada-demo-kube-controller-manager-78cd4fbcff-n75nk   1/1     Running   0          4m28s
karmada-demo-metrics-adapter-5cbd5dfcd5-krxbk           1/1     Running   0          4m28s
karmada-demo-metrics-adapter-5cbd5dfcd5-pf87h           1/1     Running   0          4m28s
karmada-demo-scheduler-7569cf8678-bp7d2                 1/1     Running   0          4m28s
karmada-demo-search-ddb4979f9-gbwz8                     1/1     Running   0          103s
karmada-demo-webhook-7bcd6f9dd7-9tljx                   1/1     Running   0          4m28s

$ ginkgo -v --race --trace -p  --focus="[BasicPropagation] propagation testing deployment propagation testing" ./test/e2e/
Ran 3 of 241 Specs in 26.319 seconds
SUCCESS! -- 3 Passed | 0 Failed | 0 Pending | 238 Skipped


Ginkgo ran 1 suite in 1m29.083269686s
Test Suite Passed

@zhzhuang-zju
Copy link
Contributor Author

@zhzhuang-zju zhzhuang-zju force-pushed the dnsDomain branch 2 times, most recently from 3c5c8d8 to 40265f6 Compare October 23, 2024 08:06
@codecov-commenter
Copy link

codecov-commenter commented Oct 23, 2024

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

Attention: Patch coverage is 73.80952% with 11 lines in your changes missing coverage. Please review.

Project coverage is 40.86%. Comparing base (60e8e34) to head (796514a).

Files with missing lines Patch % Lines
operator/pkg/controlplane/apiserver/apiserver.go 80.00% 0 Missing and 2 partials ⚠️
operator/pkg/controlplane/etcd/util.go 0.00% 2 Missing ⚠️
operator/pkg/init.go 0.00% 2 Missing ⚠️
operator/pkg/controlplane/etcd/etcd.go 90.90% 0 Missing and 1 partial ⚠️
operator/pkg/controlplane/search/search.go 75.00% 0 Missing and 1 partial ⚠️
operator/pkg/tasks/init/component.go 0.00% 1 Missing ⚠️
operator/pkg/tasks/init/etcd.go 0.00% 1 Missing ⚠️
operator/pkg/tasks/init/upload.go 0.00% 1 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5727      +/-   ##
==========================================
+ Coverage   40.85%   40.86%   +0.01%     
==========================================
  Files         651      651              
  Lines       55256    55267      +11     
==========================================
+ Hits        22574    22586      +12     
  Misses      31241    31241              
+ Partials     1441     1440       -1     
Flag Coverage Δ
unittests 40.86% <73.80%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Categorizes issue or PR as related to a new feature. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants