strapdata / helm-charts

Strapdata HELM charts
24 stars 11 forks source link

no matches for kind "StatefulSet" in version "apps/v1beta1" on strapdata/elassandra chart #9

Open AndreaNicola opened 4 years ago

AndreaNicola commented 4 years ago

Hi,

today i tried to install strapdata/elassandra chart on a kubernetes v 1.18 cluster.

Setup failed with error "no matches for kind "StatefulSet" in version "apps/v1beta1".

I dug into templates/statefulset.yaml to change apiVersion to v1 like suggested in similar issues with statefulsets and i faced a new error:

"Error: unable to build kubernetes objects from release manifest: error validating "": error validating data: ValidationError(StatefulSet.spec): missing required field "selector" in io.k8s.api.apps.v1.StatefulSetSpec"

I added a selector object in spec duplicating the metadata labels and i receveid a new error:

Error: StatefulSet.apps "elassandra" is invalid: spec.template.metadata.labels: Invalid value: map[string]string{"app":"elassandra", "release":"elassandra"}: selector does not match template labels

So I changed selector labels copying spec.template.metadata.labels section and the chart deployed correctly (or at least it seems to be!)

The resulting yaml looks like this:

apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: {{ template "elassandra.fullname" . }}
  labels:
    app: {{ template "elassandra.name" . }}
    chart: {{ template "elassandra.chart" . }}
    release: {{ .Release.Name }}
    heritage: {{ .Release.Service }}
spec:
  selector:
    matchLabels:
      app: {{ template "elassandra.name" . }}
      release: {{ .Release.Name }}
  serviceName: {{ template "elassandra.fullname" . }}
  replicas: {{ .Values.config.cluster_size }}
  podManagementPolicy: {{ .Values.podManagementPolicy }}
  updateStrategy:
    type: RollingUpdate
  template:
    metadata:
      labels:
        app: {{ template "elassandra.name" . }}
        release: {{ .Release.Name }}

...

statefulset.zip

I attach the full modified templates/statefulset.yaml

vroyer commented 4 years ago

Hi Andrea,

Yes, k8s 1.18 involves some modifications, and these will probably be not compatible with some old versions of Kubernetes. Could you summit a pull request to keep the credit of your modification in the GitHub history ? (Clone the repo, checkout a new branch, apply your fix, and create a PR from that branch).

Thanks, Vincent.

On 16 Jul 2020, at 11:48, Andrea Nicola notifications@github.com wrote:

Hi,

today i tried to install strapdata/elassandra chart on a kubernetes v 1.18 cluster.

Setup failed with error "no matches for kind "StatefulSet" in version "apps/v1beta1".

I dug into templates/statefulset.yaml to change apiVersion to v1 like suggested in similar issues with statefulsets and i faced a new error:

"Error: unable to build kubernetes objects from release manifest: error validating "": error validating data: ValidationError(StatefulSet.spec): missing required field "selector" in io.k8s.api.apps.v1.StatefulSetSpec"

I added a selector object in spec duplicating the metadata labels and i receveid a new error:

Error: StatefulSet.apps "elassandra" is invalid: spec.template.metadata.labels: Invalid value: map[string]string{"app":"elassandra", "release":"elassandra"}: selector does not match template labels

So I changed selector labels copying spec.template.metadata.labels section and the chart deployed correctly (or at least it seems to be!)

The resulting yaml looks like this:

apiVersion: apps/v1 kind: StatefulSet metadata: name: {{ template "elassandra.fullname" . }} labels: app: {{ template "elassandra.name" . }} chart: {{ template "elassandra.chart" . }} release: {{ .Release.Name }} heritage: {{ .Release.Service }} spec: selector: matchLabels: app: {{ template "elassandra.name" . }} release: {{ .Release.Name }} serviceName: {{ template "elassandra.fullname" . }} replicas: {{ .Values.config.cluster_size }} podManagementPolicy: {{ .Values.podManagementPolicy }} updateStrategy: type: RollingUpdate template: metadata: labels: app: {{ template "elassandra.name" . }} release: {{ .Release.Name }}

... statefulset.zip

I attach the full modified templates/statefulset.yaml

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/strapdata/helm-charts/issues/9, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACOMPGL7UMZYGEUL227RBJLR33EFRANCNFSM4O35WGYQ.

AndreaNicola commented 4 years ago

Done!

keep up the good work Vincent!

hhaslam11 commented 3 years ago

@vroyer Could we get that PR merged? I'm having the same issue, and the fix is just sitting there 😄