k3s-io / helm-controller

Apache License 2.0
391 stars 85 forks source link

New manifests to get it working on Kubernetes 1.22 #139

Open tboerger opened 2 years ago

tboerger commented 2 years ago

I really had problems to get controller working on Kubernetes 1.22. I have written an entirely new manifest and I would like to get some feedback. If everything makes sense I could also create a PR, so far it seem to work correctly after updating the CRD. I also tried to embed the CRD similar to ibuildthecloud/klum, but failed with the dependencies:

apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  name: helmchartconfigs.helm.cattle.io
  namespace: kube-system
spec:
  group: helm.cattle.io
  names:
    categories:
    - helm
    kind: HelmChartConfig
    listKind: HelmChartConfigList
    plural: helmchartconfigs
    shortNames: []
    singular: helmchartconfig
  scope: Namespaced
  versions:
  - name: v1
    schema:
      openAPIV3Schema:
        description: null
        properties:
          apiVersion:
            description: 'APIVersion defines the versioned schema of this representation
              of an object. Servers should convert recognized schemas to the latest
              internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
            type: string
          kind:
            description: 'Kind is a string value representing the REST resource this
              object represents. Servers may infer this from the endpoint the client
              submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
            type: string
          metadata:
            type: object
          spec:
            description: Desired state of the HelmChartConfig resource.
            properties:
              failurePolicy:
                description: null
                type: string
              valuesContent:
                description: null
                type: string
            required: []
            type: object
        required:
        - spec
        type: object
    served: true
    storage: true
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  name: helmcharts.helm.cattle.io
  namespace: kube-system
spec:
  group: helm.cattle.io
  names:
    categories:
    - helm
    kind: HelmChart
    listKind: HelmChartList
    plural: helmcharts
    shortNames: []
    singular: helmchart
  scope: Namespaced
  versions:
  - name: v1
    schema:
      openAPIV3Schema:
        description: null
        properties:
          apiVersion:
            description: 'APIVersion defines the versioned schema of this representation
              of an object. Servers should convert recognized schemas to the latest
              internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
            type: string
          kind:
            description: 'Kind is a string value representing the REST resource this
              object represents. Servers may infer this from the endpoint the client
              submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
            type: string
          metadata:
            type: object
          spec:
            description: Desired state of the HelmChart resource.
            properties:
              bootstrap:
                description: null
                type: boolean
              chart:
                description: null
                type: string
              chartContent:
                description: null
                type: string
              failurePolicy:
                description: null
                type: string
              helmVersion:
                description: null
                type: string
              jobImage:
                description: null
                type: string
              repo:
                description: null
                type: string
              repoCA:
                description: null
                type: string
              set:
                description: null
                type: object
                x-kubernetes-preserve-unknown-fields: true
              targetNamespace:
                description: null
                type: string
              timeout:
                description: null
                type: string
              valuesContent:
                description: null
                type: string
              version:
                description: null
                type: string
            required: []
            type: object
        required:
        - spec
        type: object
    served: true
    storage: true
---
apiVersion: v1
kind: ServiceAccount
metadata:
  labels:
    app.kubernetes.io/component: controller
    app.kubernetes.io/name: helm-controller
  name: helm-controller
  namespace: kube-system
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  labels:
    app.kubernetes.io/component: controller
    app.kubernetes.io/name: helm-controller
  name: helm-controller
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: cluster-admin
subjects:
- kind: ServiceAccount
  name: helm-controller
  namespace: kube-system
---
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app.kubernetes.io/component: controller
    app.kubernetes.io/name: helm-controller
  name: helm-controller
  namespace: kube-system
spec:
  replicas: 1
  revisionHistoryLimit: 3
  selector:
    matchLabels:
      app.kubernetes.io/component: controller
      app.kubernetes.io/name: helm-controller
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        app.kubernetes.io/component: controller
        app.kubernetes.io/name: helm-controller
    spec:
      containers:
      - command:
        - helm-controller
        image: rancher/helm-controller:v0.12.0
        imagePullPolicy: IfNotPresent
        name: server
        resources:
          limits:
            cpu: 500m
            memory: 512Mi
          requests:
            cpu: 100m
            memory: 64Mi
      enableServiceLinks: false
      serviceAccountName: helm-controller
amilstead commented 2 years ago

FWIW, @tboerger this manifest worked for me using kubernetes from Docker Desktop on 1.22.

angelbarrera92 commented 2 years ago

It also worked for me in a kubeadm 1.23.5 kubernetes cluster.

Enity commented 1 year ago