Skip to content

Commit

Permalink
Enable name override for --from-store
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
  • Loading branch information
alexellis committed Oct 17, 2023
1 parent 9424845 commit 4746367
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions commands/generate.go
Expand Up @@ -31,6 +31,7 @@ const (

var (
api string
name string
functionNamespace string
crdFunctionNamespace string
fromStore string
Expand All @@ -41,6 +42,7 @@ var (
func init() {

generateCmd.Flags().StringVar(&fromStore, "from-store", "", "generate using a store image")
generateCmd.Flags().StringVar(&name, "name", "", "for use with --from-store, override the name for the Function CR")

generateCmd.Flags().StringVar(&api, "api", defaultAPIVersion, "CRD API version e.g openfaas.com/v1, serving.knative.dev/v1")
generateCmd.Flags().StringVarP(&crdFunctionNamespace, "namespace", "n", "openfaas-fn", "Kubernetes namespace for functions")
Expand Down Expand Up @@ -147,8 +149,13 @@ func runGenerate(cmd *cobra.Command, args []string) error {
}
}

services.Functions[item.Name] = stack.Function{
Name: item.Name,
fullName := item.Name
if len(name) > 0 {
fullName = name
}

services.Functions[fullName] = stack.Function{
Name: fullName,
Image: item.Images[desiredArch],
Labels: &item.Labels,
Annotations: &allAnnotations,
Expand Down

0 comments on commit 4746367

Please sign in to comment.