Azure / azure-functions-core-tools

Command line tools for Azure Functions
MIT License
1.3k stars 430 forks source link

func kubernetes deploy does not honor --min-replicas #2043

Open RytisLT opened 4 years ago

RytisLT commented 4 years ago

I've tried to deploy a simple HttpTrigger that I've created using the following commands:

>func --version
3.0.2534

> func init --docker --worker-runtime dotnet
Writing c:\dev\demo\.vscode\extensions.json
Writing Dockerfile
Writing .dockerignore

>func function create --name functest --language C# --template HttpTrigger
Use the up/down arrow keys to select a template:Function name: functest

The function "functest" was created successfully from the "HttpTrigger" template.

Then I've created a deployment with min-replicas set to 3

func kubernetes deploy --name test --image-name captbrick/helloworld --min-replicas 3 --namespace min-test --dry-run

In the resulting deployment file, osiris.deislabs.io/minReplicas is set to 1 and there's no ScaledObject definition (see yaml below). I was expecting either to see osiris.deislabs.io/minReplicas: 3 or a ScaledObject with minReplicaCount: 3

data:
  AzureWebJobsStorage: VXNlRGV2ZWxvcG1lbnRTdG9yYWdlPXRydWU=
  FUNCTIONS_WORKER_RUNTIME: ZG90bmV0
apiVersion: v1
kind: Secret
metadata:
  name: test
  namespace: min-test
---
apiVersion: v1
kind: Service
metadata:
  name: test-http
  namespace: min-test
  annotations:
    osiris.deislabs.io/enabled: true
    osiris.deislabs.io/deployment: test-http
spec:
  selector:
    app: test-http
  ports:
  - protocol: TCP
    port: 80
    targetPort: 80
  type: LoadBalancer
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: test-http
  namespace: min-test
  labels:
    app: test-http
  annotations:
    osiris.deislabs.io/enabled: true
    osiris.deislabs.io/minReplicas: 1
spec:
  replicas: 1
  selector:
    matchLabels:
      app: test-http
  template:
    metadata:
      labels:
        app: test-http
    spec:
      containers:
      - name: test-http
        image: captbrick/helloworld
        ports:
        - containerPort: 80
        env:
        - name: AzureFunctionsJobHost__functions__0
          value: helloworld
        envFrom:
        - secretRef:
            name: test
anthonychu commented 4 years ago

@ahmelsayed Can you please take a look at this? Thanks.

timesy commented 2 years ago

Any updates on this? I am having the same problem.