Azure / Azure/draft

Missing namespace in deploy step when using kustomize deployment target

Offen
#239 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
bug
Vorherrschende Sprache
Go
Sterne
644
Forks
74
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

**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.

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Beginne damit, die Generierung des kustomize-Deployment-Ziels und das Workflow-Template zu lokalisieren, das den GitHub-Action-Deploy-Schritt erstellt. Untersuche die generierte kustomization.yaml und das Deployment-Manifest. Überprüfe anschließend, dass der konfigurierte Namespace konsistent angewendet und an die Deploy-Action übergeben wird; reproduziere den Workflow, um zu bestätigen, dass das Deployment für einen nicht standardmäßigen Namespace erfolgreich ist.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
github-actions, go
Bereich
cli, devops
Issue-Typ
Bug
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.