Azure / Azure/draft

Missing namespace in deploy step when using kustomize deployment target

Aperta
#239 1 commento 0 reazioni 0 assegnatari Vedi su GitHub
bug
Lingua principale
Go
Stelle
644
Fork
74
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

**Describe the bug**

When creating a project using deployment type `kustomize`, the cli wizard will ask for target namespace:

```
✔ Please enter the namespace to place new resources in (default: default):
```

When using a non-default namespace, for example `foo`, the wizard will create the k8s deployment configuration like this:

```yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: draft-demo
labels:
app: draft-demo
namespace: foo
```

However, the later workflow setup wizard will not prompt for target namespace, and generate a deployment step like this:

```
# Deploys application based on manifest files from previous step
- name: Deploy application
uses: Azure/k8s-deploy@v4
with:
action: deploy
manifests: ${{ steps.bake.outputs.manifestsBundle }}
images: |
${{ env.AZURE_CONTAINER_REGISTRY }}.azurecr.io/${{ env.CONTAINER_NAME }}:${{ github.sha }}
```

This deployment step will deploy to `default` namespace by default:

```
Run Azure/k8s-deploy@v4
with:
action: deploy
manifests:
images:

namespace: default # <---- default value for namespace
pull-images: true
strategy: basic
route-method: service
version-switch-buffer: 0
traffic-split-method: pod
percentage: 0
force: false
token: ***
annotate-namespace: true
private-cluster: false
skip-tls-verify: false
```

Hence, the deployment will fail with error like:

```
the namespace from the provided object "foo" does not match the namespace "default". You must pass '--namespace=foo' to perform this operation.
```

**Mention the platform you are using**

OSS draft

**To Reproduce**
Steps to reproduce the behavior:

See above description.

**Expected behavior**

When using kustomize deployment target:

1. the namespace should be set in `kustomization.yaml` instead of k8s object spec. By using a kustomization level namespace settings, we can ensure all controlled k8s objects are created under the same namespace.
2. namespace settings should set in the deploy GitHub Action step.

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia individuando la generazione della destinazione di deployment di kustomize e il template del workflow che crea il passaggio di deploy di GitHub Action. Esamina la kustomization.yaml e il manifest di deployment generati, quindi verifica che il namespace configurato venga applicato in modo coerente e passato all’azione di deploy; riproduci il workflow per confermare che il deployment abbia esito positivo per un namespace non predefinito.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
github-actions, go
Ambito
cli, devops
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.