Running aws kubernetes deploy --dry-run seems to still create the kubernetes objects

Brad Vrabete March 1, 2021

As part of the pipeline I want to check the kubernetes deployment scripts for syntax errors. I am adding the --dry-run=client (or just --dry-run) to the deploy command. But that seems to be ignored and the script gets executed as it were called without --dry-run. 

The pipeline is defined as below:


pipeatlassian/aws-eks-kubectl-run:1.4.1 
variables:                
  AWS_ACCESS_KEY_ID"$AWS_DEV_ACCESS_KEY_ID"                
  AWS_SECRET_ACCESS_KEY"$AWS_DEV_SECRET_ACCESS_KEY"                
  AWS_DEFAULT_REGION"$AWS_DEV_DEFAULT_REGION"                
  CLUSTER_NAME"$AWS_CLUSTER_NAME"
  KUBECTL_COMMAND"apply"                
  RESOURCE_PATH"k8s/deploy/aws-dev"                
  KUBECTL_ARGS: "--dry-run=client"                
  KUBECTL_APPLY_ARGS"-k"

 How can I achieve that behavior?

1 answer

0 votes
Oleksandr Kyrdan
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 2, 2021

Hi @Brad Vrabete ,

Thank you for your question!

The pipe atlassian/aws-eks-kubectl-run:1.4.1 based on kubectl v1.17.

According to the kubectl v1.17 documentation apply command supports the next flags only:

If true, only print the object that would be sent, without sending it.

Warning:
--dry-run cannot accurately output the result of merging the local manifest and the server-side data.

Use --server-dry-run to get the merged result instead.

so, recommended way is "--server-dry-run".


Also, we are investigating bump version of the kubectl.

Cheers,
Oleksandr Kyrdan

Brad Vrabete March 2, 2021

Hi @Oleksandr Kyrdan,

Thanks for the answer. The strange thig is that it works if I put all the parameters in the KUBECTL_COMMAND parameter and remove the rest; that's why I thought there must be something in the pipe that prevents it from running. I di not try --server-dry-run.

Are you filtering the parameters passed to the pipe? That would not be a good idea as it is hard to know what went wrong (hence my question); I would rather get the error message from kubectl and let people handle that. 

In any case I'll try with  --server-dry-run.

Thanks,

Brad

Like Oleksandr Kyrdan likes this
Oleksandr Kyrdan
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
March 2, 2021

@Brad Vrabete

Yep, good question! It shouldn't filter or modify passed params.

We are investigating this case and notify you.

 

Thank you!
Oleksandr Kyrdan

Like Brad Vrabete likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events