openfaas / faas-netes

Serverless Functions For Kubernetes
https://www.openfaas.com
MIT License
2.12k stars 473 forks source link

Could not enable IngressOperator through Helm Chart #718

Closed michaeleekk closed 3 years ago

michaeleekk commented 3 years ago

Expected Behaviour

Changing ingressOperator.create to true will create the FunctionIngress and the related resources.

Current Behaviour

An error is shown,

Error: UPGRADE FAILED: error validating "": error validating data: [ValidationError(CustomResourceDefinition.spec): unknown field "validation" in io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.CustomResourceDefinitionSpec, ValidationError(CustomResourceDefinition.spec): unknown field "version" in io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.CustomResourceDefinitionSpec]

Possible Solution

As the error is saying validation is not a valid field, so I tried to edit the ingress-operator-crd.yaml to make it possible to create the resource. But I wonder if it is correct or not.

apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  annotations:
    controller-gen.kubebuilder.io/version: (unknown)
  name: functioningresses.openfaas.com
spec:
  group: openfaas.com
  names:
    kind: FunctionIngress
    listKind: FunctionIngressList
    plural: functioningresses
    singular: functioningress
  scope: Namespaced
  # version: v1alpha2
  versions:
    - name: v1alpha2
      served: true
      storage: true
      schema:
        openAPIV3Schema:
          description: FunctionIngress describes an OpenFaaS function
          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: FunctionIngressSpec is the spec for a FunctionIngress resource.
                It must be created in the same namespace as the gateway, i.e. openfaas.
              properties:
                bypassGateway:
                  description: BypassGateway, when true creates an Ingress record directly
                    for the Function name without using the gateway in the hot path
                  type: boolean
                domain:
                  description: Domain such as "api.example.com"
                  type: string
                function:
                  description: Function such as "nodeinfo"
                  type: string
                ingressType:
                  description: IngressType such as "nginx"
                  type: string
                path:
                  description: Path such as "/v1/profiles/view/(.*)", or leave empty for
                    default
                  type: string
                tls:
                  description: Enable TLS via cert-manager
                  properties:
                    enabled:
                      type: boolean
                    issuerRef:
                      description: ObjectReference is a reference to an object with a
                        given name and kind.
                      properties:
                        kind:
                          type: string
                        name:
                          type: string
                      required:
                        - name
                      type: object
                  required:
                    - enabled
                    - issuerRef
                  type: object
              required:
                - domain
                - function
                - path
              type: object
          required:
            - spec
          type: object

Steps to Reproduce (for bugs)

  1. Deploy OpenFaaS with Helm according to this page
  2. Trying to enable IngressOperator in the Chart values by changing ingressOperator.create to true
  3. Error occurred.

Context

I was trying to follow this and this to change a custom domain for my hugo site.

Your Environment

CLI: commit: c9d284d0c5bd90415baf9130fdce55af8e5a506b version: 0.12.19

Gateway uri:
version: dev sha: 9fccc1c84d6aac67c5e4657cfdcd0a5cdff3babf commit: Update semi-automatic arm builds

Provider name: faas-netes orchestration: kubernetes version: 0.12.8 sha: e88c54c3854614fe02809c6931d544f74d64c6f0


* Docker version `docker version` (e.g. Docker 17.0.05 ):
Docker Engine Community - 20.10.0-rc1
* What version and distriubtion of Kubernetes are you using? `kubectl version`

Client Version: version.Info{Major:"1", Minor:"17", GitVersion:"v1.17.0", GitCommit:"70132b0f130acc0bed193d9ba59dd186f0e634cf", GitTreeState:"clean", BuildDate:"2019-12-07T21:20:10Z", GoVersion:"go1.13.4", Compiler:"gc", Platform:"darwin/amd64"} Server Version: version.Info{Major:"1", Minor:"19", GitVersion:"v1.19.3+k3s3", GitCommit:"0e4fbfefe1dd8734756dfa4f9ab4fc89665cece4", GitTreeState:"clean", BuildDate:"2020-11-13T07:14:55Z", GoVersion:"go1.15.2", Compiler:"gc", Platform:"linux/arm64"}



* Operating System and version (e.g. Linux, Windows, MacOS):
MacOS 10.15.7
* Link to your project or a code example to reproduce issue:

* What network driver are you using and what CIDR? i.e. Weave net / Flannel
alexellis commented 3 years ago

The version of your kubectl client is rather old. Have you thought about upgrading?

See also: https://github.com/openfaas/ingress-operator/pull/40

cc @LucasRoesler

alexellis commented 3 years ago

I'm getting the same error

alex@alex-nuc8:~/go/src/github.com/openfaas/faas-netes$ arkade install openfaas --ingress-operator
Using Kubeconfig: /home/alex/.kube/config
Using kubeconfig: 
Node architecture: "amd64"
Client: "x86_64", "Linux"
2020/11/29 15:26:28 User dir established as: /home/alex/.arkade/
Using Kubeconfig: 
"openfaas" has been added to your repositories

VALUES values.yaml
Command: /home/alex/.arkade/bin/helm [upgrade --install openfaas openfaas/openfaas --namespace openfaas --values /tmp/charts/openfaas/values.yaml --set clusterRole=false --set operator.create=false --set openfaasImagePullPolicy=IfNotPresent --set gateway.replicas=1 --set queueWorker.replicas=1 --set queueWorker.maxInflight=1 --set gateway.directFunctions=true --set faasnetes.imagePullPolicy=Always --set basicAuthPlugin.replicas=1 --set ingressOperator.create=true --set basic_auth=true --set serviceType=NodePort]
Release "openfaas" does not exist. Installing it now.
Error: unable to build kubernetes objects from release manifest: error validating "": error validating data: [ValidationError(CustomResourceDefinition.spec): unknown field "validation" in io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.CustomResourceDefinitionSpec, ValidationError(CustomResourceDefinition.spec): unknown field "version" in io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.CustomResourceDefinitionSpec]
Error: exit code 1, stderr: Error: unable to build kubernetes objects from release manifest: error validating "": error validating data: [ValidationError(CustomResourceDefinition.spec): unknown field "validation" in io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.CustomResourceDefinitionSpec, ValidationError(CustomResourceDefinition.spec): unknown field "version" in io.k8s.apiextensions-apiserver.pkg.apis.apiextensions.v1.CustomResourceDefinitionSpec]

alex@alex-nuc8:~/go/src/github.com/openfaas/faas-netes$ kubectl version
Client Version: version.Info{Major:"1", Minor:"19", GitVersion:"v1.19.3", GitCommit:"1e11e4a2108024935ecfcb2912226cedeafd99df", GitTreeState:"clean", BuildDate:"2020-10-14T12:50:19Z", GoVersion:"go1.15.2", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"19", GitVersion:"v1.19.3+k3s3", GitCommit:"0e4fbfefe1dd8734756dfa4f9ab4fc89665cece4", GitTreeState:"clean", BuildDate:"2020-11-13T07:19:02Z", GoVersion:"go1.15.2", Compiler:"gc", Platform:"linux/amd64"}
alex@alex-nuc8:~/go/src/github.com/openfaas/faas-netes$ 
alexellis commented 3 years ago

This issue is fixed by #719 - thank you for reporting it.