Skip to content

Commit

Permalink
Allow repctl to create service accounts and secrets
Browse files Browse the repository at this point in the history
  • Loading branch information
falfaroc committed Dec 2, 2022
1 parent 815da5f commit 95ffbd1
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions repctl/pkg/k8s/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,26 @@ func (c *Cluster) CreateObject(ctx context.Context, data []byte) (runtime.Object
return nil, err
}
log.Print("Successfully created config map: ", cmObj.Name)
case *v1.ServiceAccount:
cmObj, ok := runtimeObj.(*v1.ServiceAccount)
if !ok {
return nil, fmt.Errorf("unsupported object type")
}
err := c.client.Create(ctx, cmObj)
if err != nil {
return nil, err
}
log.Print("Successfully created ServiceAccount: ", cmObj.Name)
case *v1.Secret:
cmObj, ok := runtimeObj.(*v1.Secret)
if !ok {
return nil, fmt.Errorf("unsupported object type")
}
err := c.client.Create(ctx, cmObj)
if err != nil {
return nil, err
}
log.Print("Successfully created Secret: ", cmObj.Name)
default:
return nil, fmt.Errorf("unsupported object type %+v", runtimeObj.GetObjectKind())
}
Expand Down

0 comments on commit 95ffbd1

Please sign in to comment.