Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make namespace input optional #320

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ inputs:
# Please ensure you have used either azure/k8s-actions/aks-set-context or azure/k8s-actions/k8s-set-context in the workflow before this action
# You also need to have kubectl installed (azure/setup-kubectl)
namespace:
description: 'Choose the target Kubernetes namespace. If the namespace is not provided, the commands will run in the default namespace.'
description: 'Namespace to be added to all kubectl commands.'
required: false
default: default
manifests:
description: 'Path to the manifest files which will be used for deployment.'
required: true
Expand Down Expand Up @@ -64,7 +63,7 @@ inputs:
required: false
default: true
annotate-namespace:
description: 'Annotate the target namespace. Ignored when annotate-resources is set to false.'
description: 'Annotate the target namespace. Ignored when annotate-resources is set to false or no namespace is provided'
required: false
default: true
private-cluster:
Expand Down
2 changes: 1 addition & 1 deletion src/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export async function run() {
const fullManifestFilePaths =
await getFilesFromDirectoriesAndURLs(manifestFilePaths)
const kubectlPath = await getKubectlPath()
const namespace = core.getInput('namespace') || 'default'
const namespace = core.getInput('namespace') || ''
const isPrivateCluster =
core.getInput('private-cluster').toLowerCase() === 'true'
const resourceGroup = core.getInput('resource-group') || ''
Expand Down
4 changes: 2 additions & 2 deletions src/strategyHelpers/deploymentHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ async function annotateResources(
deploymentConfig: DeploymentConfig
) {
const annotateResults: ExecOutput[] = []
const namespace = core.getInput('namespace') || 'default'
const namespace = core.getInput('namespace') || ''
const lastSuccessSha = await getLastSuccessfulRunSha(
kubectl,
namespace,
Expand Down Expand Up @@ -227,7 +227,7 @@ async function annotateResources(
)}`

const annotateNamespace = !(
core.getInput('annotate-namespace').toLowerCase() === 'false'
namespace === '' || core.getInput('annotate-namespace').toLowerCase() === 'false'
)
if (annotateNamespace) {
annotateResults.push(
Expand Down
Loading