Atlassian/kubectl-run by default runs with --dry-run enabled

Jurgen Heeffer November 30, 2022

I'm using atlassian/kubectl-run:3.3.1 and trying to deploy resources in a namespace that doesn't exist yet but is created in the same apply. 

The namespace is defined like this:

apiVersion: v1
kind: Namespace
metadata:
name: namespace-name

 

Due to the pipe running dry-run by default I'm unable to apply both the namespace resources and the to be deployed resources in a single apply. 

Is there a way around this (by disabling the dry-run by default) or am I stuck creating the namespaces and the resources in two separate applys?

1 answer

1 accepted

0 votes
Answer accepted
Igor Stoyanov
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 2, 2022

Hi @Jurgen Heeffer . Thanks for your question. Please provide us your configuration details of how you use the pipe.

Maybe you use the pipe this way:

script:
  - pipe: atlassian/kubectl-run:3.3.1
    variables:
      KUBE_CONFIG: $KUBE_CONFIG
      KUBECTL_COMMAND: 'apply'
      RESOURCE_PATH: 'nginx.yml'
      KUBECTL_ARGS:
        - '--dry-run'

then you should remove '--dry-run' from KUBECTL_ARGS.

Regards, Igor

Jurgen Heeffer December 2, 2022

Hi @Igor Stoyanov

I'm currently using it like this. 

 
- pipe: atlassian/kubectl-run:3.3.1
variables:
KUBE_CONFIG: ${!kube_config}
KUBECTL_COMMAND: 'apply'
KUBECTL_APPLY_ARGS: '-k'
RESOURCE_PATH: '.deploy/overlays/${ENVIRONMENT}/'
I'm not currently specifying dry-run. 
With regards,
Jurgen
Igor Stoyanov
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 5, 2022

@Jurgen Heeffer Thanks for your response. Please provide also your pipeline output.

 

Regards, Igor

Igor Stoyanov
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 5, 2022

--dry-run is used in validate spec file by default, and i guess you receive 

spec file validation failed error. Our team may think about disable validation with an option available for user, will be this solution ok for you?
Regards, Igor
Jurgen Heeffer December 5, 2022

Hi Igor,

Ah yes that would be perfect. 

Thank you for the response!

With regards,
Jurgen

Igor Stoyanov
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
December 23, 2022

@Jurgen Heeffer . We released a new version 3.4.0 of the pipe:

script:
  - pipe: atlassian/kubectl-run:3.4.0
    variables:
      KUBE_CONFIG: $KUBE_CONFIG
      KUBECTL_COMMAND: 'apply'
      RESOURCE_PATH: 'nginx.yml'
      DISABLE_VALIDATION: 'true'

Regards, Igor

Jurgen Heeffer December 23, 2022

Hi Igor,

Thank you for the change this is perfect!

With regards,

Jurgen

Like Igor Stoyanov likes this

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
TAGS
AUG Leaders

Atlassian Community Events