Skip to content

Commit 9df4969

Browse files
committed
if not service account name is provided, it will omit
Signed-off-by: Jiaxiao (mossaka) Zhou <[email protected]>
1 parent 9f43b9f commit 9df4969

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

pkg/cmd/scaffold.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ func init() {
341341
scaffoldCmd.Flags().StringVar(&scaffoldOpts.memoryLimit, "memory-limit", "", "The maximum amount of memory the application is allowed to use")
342342
scaffoldCmd.Flags().StringVar(&scaffoldOpts.memoryRequest, "memory-request", "", "The amount of memory requested by the application. Used to determine which node the application will run on")
343343
scaffoldCmd.Flags().BoolVar(&scaffoldOpts.azureWorkloadIdentity, "azure-identity", false, "Enable Azure Workload Identity for the application")
344-
scaffoldCmd.Flags().StringVar(&scaffoldOpts.serviceAccountName, "service-account-name", "default", "The name of the service account to use for the application")
344+
scaffoldCmd.Flags().StringVar(&scaffoldOpts.serviceAccountName, "service-account-name", "", "The name of the service account to use for the application")
345345
scaffoldCmd.Flags().StringVarP(&scaffoldOpts.from, "from", "f", "", "Reference in the registry of the application")
346346
scaffoldCmd.Flags().StringVarP(&scaffoldOpts.output, "out", "o", "", "Path to file to write manifest yaml")
347347
scaffoldCmd.Flags().StringVarP(&scaffoldOpts.configfile, "runtime-config-file", "c", "", "Path to runtime config file")

pkg/cmd/scaffold_test.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,16 @@ func TestScaffoldOutput(t *testing.T) {
7575
},
7676
expected: "service_account_name.yml",
7777
},
78+
{
79+
name: "service account name is not provided",
80+
opts: ScaffoldOptions{
81+
from: "ghcr.io/foo/example-app:v0.1.0",
82+
replicas: 2,
83+
executor: "containerd-shim-spin",
84+
serviceAccountName: "",
85+
},
86+
expected: "no_service_account_name.yml",
87+
},
7888
{
7989
name: "service account with HPA autoscaler",
8090
opts: ScaffoldOptions{
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
apiVersion: core.spinkube.dev/v1alpha1
2+
kind: SpinApp
3+
metadata:
4+
name: example-app
5+
spec:
6+
image: "ghcr.io/foo/example-app:v0.1.0"
7+
executor: containerd-shim-spin
8+
replicas: 2

0 commit comments

Comments
 (0)