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

fix: scheduler/descheduler installed failed by operator #5519

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

Conversation

zhzhuang-zju
Copy link
Contributor

@zhzhuang-zju zhzhuang-zju commented Sep 11, 2024

What type of PR is this?
/kind bug

What this PR does / why we need it:

func getKarmadaSchedulerManifest(name, namespace string, featureGates map[string]bool, cfg *operatorv1alpha1.KarmadaScheduler) (*appsv1.Deployment, error) {
karmadaSchedulerBytes, err := util.ParseTemplate(KarmadaSchedulerDeployment, struct {
Replicas *int32
DeploymentName, Namespace, SystemNamespace string
Image, ImagePullPolicy, KubeconfigSecret string
}{
DeploymentName: util.KarmadaSchedulerName(name),
Namespace: namespace,
SystemNamespace: constants.KarmadaSystemNamespace,
Image: cfg.Image.Name(),
ImagePullPolicy: string(cfg.ImagePullPolicy),
KubeconfigSecret: util.AdminKubeconfigSecretName(name),
Replicas: cfg.Replicas,
})

Argument {{ .KarmadaCertsSecret }} in scheduler/descheduler's manifest also need to be parsed

Which issue(s) this PR fixes:
Fixes #

Special notes for your reviewer:
BTW, I think we chould push for the integration of #4401 to establish a code merge gate for the karmada-operator.

Does this PR introduce a user-facing change?:

`karmada-operator`: Fixed the issue where the manifests for the `karmada-scheduler` and `karmada-descheduler` components were not parsed correctly.

Signed-off-by: zhzhuang-zju <m17799853869@163.com>
@karmada-bot karmada-bot added the kind/bug Categorizes issue or PR as related to a bug. label Sep 11, 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/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Sep 11, 2024
@codecov-commenter
Copy link

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

Codecov Report

Attention: Patch coverage is 0% with 22 lines in your changes missing coverage. Please review.

Project coverage is 32.45%. Comparing base (07e2976) to head (bbda0e6).

Files with missing lines Patch % Lines
operator/pkg/controlplane/controlplane.go 0.00% 22 Missing ⚠️

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

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5519      +/-   ##
==========================================
- Coverage   32.45%   32.45%   -0.01%     
==========================================
  Files         643      643              
  Lines       44497    44499       +2     
==========================================
  Hits        14442    14442              
- Misses      28961    28962       +1     
- Partials     1094     1095       +1     
Flag Coverage Δ
unittests 32.45% <0.00%> (-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.

@zhzhuang-zju
Copy link
Contributor Author

cc @RainbowMango @jabellard

@zhzhuang-zju
Copy link
Contributor Author

test report:

# karmada.yaml
apiVersion: operator.karmada.io/v1alpha1
kind: Karmada
metadata:
  name: karmada-demo
  namespace: test
spec:
  crdTarball:
    httpSource:
      url: https://github.com/karmada-io/karmada/releases/download/v1.11.0/crds.tar.gz
  components:
    etcd:
      local:
        imageRepository: registry.k8s.io/etcd
        imageTag: 3.5.13-0
        replicas: 1
        volumeData:
          # hostPath:
          #   type: DirectoryOrCreate
          #   path: /var/lib/karmada/etcd/karmada-demo
          volumeClaim:
            metadata:
              name: etcd-data
            spec:
              accessModes:
                - ReadWriteOnce
              resources:
                requests:
                  storage: 3Gi
    karmadaAPIServer:
      imageRepository: registry.k8s.io/kube-apiserver
      imageTag: v1.29.6
      replicas: 1
      serviceType: NodePort
      serviceSubnet: 10.96.0.0/12
    karmadaAggregatedAPIServer:
      imageRepository: docker.io/karmada/karmada-aggregated-apiserver
      imageTag: v1.11.0
      replicas: 1
    karmadaControllerManager:
      imageRepository: docker.io/karmada/karmada-controller-manager
      imageTag: v1.11.0
      replicas: 1
    karmadaScheduler:
      imageRepository: docker.io/karmada/karmada-scheduler
      imageTag: v1.11.0
      replicas: 1
    karmadaWebhook:
      imageRepository: docker.io/karmada/karmada-webhook
      imageTag: v1.11.0
      replicas: 1
    kubeControllerManager:
      imageRepository: registry.k8s.io/kube-controller-manager
      imageTag: v1.29.6
      replicas: 1
    karmadaMetricsAdapter:
      imageRepository: docker.io/karmada/karmada-metrics-adapter
      imageTag: v1.11.0
      replicas: 2
    # karmadaSearch: # the component `Karmadasearch` is not installed by default, if you need to install it, uncomment it and note the formatting
      # imageRepository: docker.io/karmada/karmada-search
      # imageTag: v1.8.0
      # replicas: 1
    karmadaDescheduler: # the component `KarmadaDescheduler` is not installed by default, if you need to install it, uncomment it and note the formatting
      imageRepository: docker.io/karmada/karmada-descheduler
      imageTag: v1.11.0
      replicas: 1
  hostCluster:
    networking:
      dnsDomain: cluster.local
$ kubectl create secret generic my-kubeconfig --from-file=config=$HOME/.kube/karmada.config --namespace karmada-system 
$ kubectl apply -f operator/config/deploy/karmada-operator.yaml
$ kubectl apply -f operator/config/crds/
$ kubectl create namespace test
$ kubectl apply -f karmada.yaml
$ kubectl get pods -ntest                                                                 
NAME                                                    READY   STATUS    RESTARTS   AGE
karmada-demo-aggregated-apiserver-7c94956588-kq6m6      1/1     Running   0          49m
karmada-demo-apiserver-9cf845cf4-bkvhk                  1/1     Running   0          49m
karmada-demo-controller-manager-55fb77c55-r4mtr         1/1     Running   0          48m
karmada-demo-descheduler-5b6465697d-xbbqh               1/1     Running   0          48m
karmada-demo-etcd-0                                     1/1     Running   0          49m
karmada-demo-kube-controller-manager-6f8f9b6cf8-zmmsg   1/1     Running   0          48m
karmada-demo-metrics-adapter-686dbd65d4-5tltz           1/1     Running   0          48m
karmada-demo-metrics-adapter-686dbd65d4-v67dd           1/1     Running   0          48m
karmada-demo-scheduler-7d5846d6db-nspv4                 1/1     Running   0          48m
karmada-demo-webhook-5bf69bc674-nh7cp                   1/1     Running   0          48m

@zhzhuang-zju
Copy link
Contributor Author

cc @chaosi-zju

@chaosi-zju
Copy link
Member

chaosi-zju commented Sep 13, 2024

seems to be accidentally introduced in #5040

/lgtm

@karmada-bot karmada-bot added the lgtm Indicates that a PR is ready to be merged. label Sep 13, 2024
@zhzhuang-zju
Copy link
Contributor Author

/assign @RainbowMango

@RainbowMango
Copy link
Member

@zhzhuang-zju How to reproduce it? Does #5040 introduce this issue?

@zhzhuang-zju
Copy link
Contributor Author

@zhzhuang-zju How to reproduce it? Does #5040 introduce this issue?

Yes, Just follow the steps as described in comments #5519 (comment) and will reproduce this issue. I think we can add a CI for installation by the karmada-operator, like #4401

@RainbowMango
Copy link
Member

I think we can add a CI for installation by the karmada-operator, like #4401

We do need CI, but a simple CI like #4401 cannot cover all cases, we still need E2E cases to cover features like #5242, #5272, #5448.

I will take a look at #4401 first.

@zhzhuang-zju
Copy link
Contributor Author

I will take a look at #4401 first.

Recently, karmada-operator has added many new features. The installation verification in #4401 might not be sufficient anymore. For example, it does not validate the installation of the component karmada-scheduler-estimator. Collaborating with #5511 could help resolve this issue, so #4401 needs to be updated.

@RainbowMango
Copy link
Member

OK, please cc me again #4401 once it's ready.

By the way, I think this PR can help update https://github.com/karmada-io/karmada/blob/master/operator/config/samples/karmada.yaml, so that the bugs can be found more easily.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. lgtm Indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants