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

Implement namespace support using go-sdk #976

Merged
merged 1 commit into from
Sep 22, 2023

Conversation

nitishkumar71
Copy link
Member

@nitishkumar71 nitishkumar71 commented Sep 13, 2023

Description

Include namespace create, update, get, list and delete support in faas-cli

Motivation and Context

How Has This Been Tested?

All the commands has been tested with local builds

  1. namespace create command
faas-cli ns create ns-demo --label demo=true

output

Creating Namespace: ns-demo
Namespace ns-demo Created!
  1. namespace list command
faas-cli ns ls

output

Namespaces:
 - ns-demo
 - openfaas-fn
  1. namespace get command
faas-cli ns get ns-demo

output

Getting Namespace: ns-demo
Name:	ns-demo
Labels map[demo:true openfaas:1]
Annotations map[]
  1. namespace update command
faas-cli ns update ns-demo --label demo=false
faas-cli ns get ns-demo

output

Updating Namespace: ns-demo
Namespace ns-demo Updated!
Getting Namespace: ns-demo
Name:	ns-demo
Labels map[demo:false openfaas:1]
Annotations map[]

  1. namespace delete command
faas-cli ns delete ns-demo
faas-cli ns ls

output

Deleting Namespace: ns-demo
Namespace ns-demo Deleted!
Namespaces:
 - openfaas-fn

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I've read the CONTRIBUTION guide
  • I have signed-off my commits with git commit -s
  • I have added tests to cover my changes.
  • All new and existing tests passed.

namespaceCmd.AddCommand(namespaceListCmd)
}

var namespacesCmd = &cobra.Command{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Potentially make this one hidden? Because we want to have one going forward, it'll still work, but be less confusing (I hope)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. It has been now hidden, as well marked deprecated

@alexellis
Copy link
Member

Could you check the --gateway flag?

Unknown flag: --gateway

@nitishkumar71
Copy link
Member Author

Could you check the --gateway flag?

Unknown flag: --gateway

This is fixed. Used PersistentFlags() to pass those flags to lower level. Earlier, we had to define them to each sub-command too.

@nitishkumar71 nitishkumar71 marked this pull request as ready for review September 17, 2023 14:24
@nitishkumar71 nitishkumar71 changed the title [WIP] Implement namespace support using go-sdk Implement namespace support using go-sdk Sep 17, 2023
Copy link
Member

@alexellis alexellis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you update help messages/formatting?

Signed-off-by: Nitishkumar Singh <nitishkumarsingh71@gmail.com>
@nitishkumar71
Copy link
Member Author

Tested the CLI after feedback changes, result are ok. Please note output of get command.

  1. namespace create command
faas-cli ns create ns-demo --label demo=true

output

Creating Namespace: ns-demo
Namespace ns-demo Created!
  1. namespace list command
faas-cli ns ls

output

Namespaces:
 - ns-demo
 - openfaas-fn
  1. namespace get command
faas-cli ns get ns-demo

output

Name: ns-demo
Labels:
 demo: true
 openfaas: 1
  1. namespace update command
faas-cli ns update ns-demo --label demo=false
faas-cli ns get ns-demo

output

Updating Namespace: ns-demo
Namespace ns-demo Updated!
Name: ns-demo
Labels:
 demo: false
 openfaas: 1

  1. namespace delete command
faas-cli ns delete ns-demo
faas-cli ns ls

output

Deleting Namespace: ns-demo
Namespace ns-demo Deleted!
Namespaces:
 - openfaas-fn

Copy link
Member

@alexellis alexellis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved

@alexellis alexellis merged commit 03fd309 into openfaas:master Sep 22, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

provide namespace mangement capabilities in faas-cli
2 participants