alauda / captain

A Helm 3 Controller
Apache License 2.0
185 stars 46 forks source link

Failed to install mysql-operator with wrong url #47

Open bluven opened 4 years ago

bluven commented 4 years ago

I tried to install mysql-operator, but failed, it seemded helm-controller used wrong address to download chart package.

chartrepo

apiVersion: app.alauda.io/v1alpha1
kind: ChartRepo
metadata:
  name: presslabs
  namespace: captain-system
spec:
  url: https://presslabs.github.io/charts

heml request

Name:         mysql-operator
Namespace:    default
Labels:       <none>
Annotations:  kubectl.kubernetes.io/last-applied-configuration:
                {"apiVersion":"app.alauda.io/v1alpha1","kind":"HelmRequest","metadata":{"annotations":{},"name":"mysql-operator","namespace":"default"},"s...
API Version:  app.alauda.io/v1alpha1
Kind:         HelmRequest
Metadata:
  Creation Timestamp:  2020-02-17T09:38:51Z
  Finalizers:
    captain.cpaas.io
  Generation:        1
  Resource Version:  31048
  Self Link:         /apis/app.alauda.io/v1alpha1/namespaces/default/helmrequests/mysql-operator
  UID:               9ce1521f-c4bc-4c61-9c48-240c01f21b4a
Spec:
  Chart:         presslabs/mysql-operator
  Namespace:     presslabs
  Release Name:  mysql-operator
  Values:
    Extra Args:
      --metrics-exporter-image=registry.bluven.me:5000/bluven/mysqld-exporter:v0.11.0
    Image:  registry.bluven.me:5000/bluven/mysql-operator:0.3.8
    Orchestrator:
      Image:        registry.bluven.me:5000/bluven/mysql-operator-orchestrator:0.3.8
    Replicas:       1
    Sidecar Image:  registry.bluven.me:5000/bluven/mysql-operator-sidecar:0.3.8
Status:
  Phase:  Failed
Events:
  Type     Reason      Age                  From     Message
  ----     ------      ----                 ----     -------
  Warning  FailedSync  15m (x23 over 104m)  captain  failed to fetch https://presslabs.github.io/charts/https://presslabs.github.io/charts/mysql-operator-0.3.8.tgz : 404 Not Found
hangyan commented 4 years ago

Seems a bug, although it's seems a rookie mistake. I will look up into ASAP. Sorry for your inconvenient

hangyan commented 4 years ago

Usually the url of a chart in the index yaml only contains the part path part, but according to helm doc, urls starts with https/http are also supported, this case is not in our test suite. I will add a fix very quickly today

hangyan commented 4 years ago

@bluven Can you try https://github.com/alauda/captain/releases/tag/v0.9.7 ? you can just edit the deploy yaml to update image

bluven commented 4 years ago

Got this problem:

Error from server (InternalError): error when creating "mysql-operator-release.yaml": Internal error occurred: failed calling webhook "mutate-helmrequest.app.alauda.io": Post https://captain-webhook.captain-system.svc:443/mutate?timeout=30s: x509: certificate signed by unknown authority
hangyan commented 4 years ago

Sorry for the later response. This seems a cluster issue. Some other users has also encountered this issue. One solution is to redeploy the cluster, but it obvious not a ideal solution. I will look up into it to find out why

hangyan commented 4 years ago

A temp solution is to delete the mutating and validating webook

lewismarshall commented 4 years ago

Just tested today and relative URL's not supported at version v1.0.1 of Captain:

2020-05-06T09:19:13.873Z    ERROR   helm-skf85sezg  get chart error {"error": "charts.app.alauda.io \"nginx-ingress:0.30.0.kore-helm-repo\" not found"}
github.com/go-logr/zapr.(*zapLogger).Error
    /go/pkg/mod/github.com/go-logr/zapr@v0.1.0/zapr.go:128
github.com/alauda/captain/pkg/helm.(*Downloader).downloadChart
    /workspace/pkg/helm/download.go:94
github.com/alauda/captain/pkg/helm.(*Deploy).Sync
    /workspace/pkg/helm/sync.go:95
github.com/alauda/captain/pkg/controller.(*Controller).sync
    /workspace/pkg/controller/sync.go:126
github.com/alauda/captain/pkg/controller.(*Controller).syncToCluster
    /workspace/pkg/controller/helmrequest.go:117
github.com/alauda/captain/pkg/controller.(*Controller).syncHandler
    /workspace/pkg/controller/helmrequest.go:92
github.com/alauda/captain/pkg/controller.(*Controller).processNextWorkItem.func1
    /workspace/pkg/controller/controller.go:262
github.com/alauda/captain/pkg/controller.(*Controller).processNextWorkItem
    /workspace/pkg/controller/controller.go:272
github.com/alauda/captain/pkg/controller.(*Controller).runWorker
    /workspace/pkg/controller/controller.go:223
k8s.io/apimachinery/pkg/util/wait.JitterUntil.func1
    /go/pkg/mod/k8s.io/apimachinery@v0.0.0-20190612205821-1799e75a0719/pkg/util/wait/wait.go:152
k8s.io/apimachinery/pkg/util/wait.JitterUntil
    /go/pkg/mod/k8s.io/apimachinery@v0.0.0-20190612205821-1799e75a0719/pkg/util/wait/wait.go:153
k8s.io/apimachinery/pkg/util/wait.Until
    /go/pkg/mod/k8s.io/apimachinery@v0.0.0-20190612205821-1799e75a0719/pkg/util/wait/wait.go:88
2020-05-06T09:19:13.873Z    DEBUG   controller-runtime.manager.events   Warning {"object": {"kind":"HelmRequest","namespace":"default","name":"nginx-ingress","uid":"913adf6e-3f7c-4224-9cd6-58b442798a46","apiVersion":"app.alauda.io/v1alpha1","resourceVersion":"475818"}, "reason": "FailedSync", "message": "charts.app.alauda.io \"nginx-ingress:0.30.0.kore-helm-repo\" not found"}
hangyan commented 4 years ago

Seems like your chart name is nginx-ingress:0.30.0, usally the name does not contains version. How do you generated you repo index.yaml?

lewismarshall commented 4 years ago

@hangyan I can confirm this works when I specify the version at a separate tag but only after building our chart repo with the full URL's in the url field.

If reletive URLs are not supported an error about that would be nice.