@@ -29,22 +29,22 @@ const (
2929 crdRolloutTimeout = 2 * time .Minute
3030)
3131
32- func CreateAssets (manifestDir string , timeout time.Duration ) error {
32+ func CreateAssets (config clientcmd. ClientConfig , manifestDir string , timeout time.Duration ) error {
3333 if _ , err := os .Stat (manifestDir ); os .IsNotExist (err ) {
3434 UserOutput (fmt .Sprintf ("WARNING: %v does not exist, not creating any self-hosted assets.\n " , manifestDir ))
3535 return nil
3636 }
3737
3838 upFn := func () (bool , error ) {
39- if err := apiTest (); err != nil {
39+ if err := apiTest (config ); err != nil {
4040 glog .Warningf ("Unable to determine api-server readiness: %v" , err )
4141 return false , nil
4242 }
4343 return true , nil
4444 }
4545
4646 createFn := func () (bool , error ) {
47- err := createAssets (manifestDir )
47+ err := createAssets (config , manifestDir )
4848 if err != nil {
4949 err = fmt .Errorf ("Error creating assets: %v" , err )
5050 glog .Error (err )
@@ -81,8 +81,8 @@ func CreateAssets(manifestDir string, timeout time.Duration) error {
8181// we should consider refactoring this. The kubectl code tends to be very verbose and difficult to
8282// reason about, especially as the behevior of certain functions (e.g. `Visit`) can be difficult to
8383// predict with regards to error handling.
84- func createAssets (manifestDir string ) error {
85- f := cmdutil .NewFactory (kubeConfig )
84+ func createAssets (config clientcmd. ClientConfig , manifestDir string ) error {
85+ f := cmdutil .NewFactory (config )
8686
8787 shouldValidate := true
8888 schema , err := f .Validator (shouldValidate , fmt .Sprintf ("~/%s/%s" , clientcmd .RecommendedHomeDir , clientcmd .RecommendedSchemaName ))
@@ -205,8 +205,8 @@ func customResourceDefinitionKindURI(apiGroup, version, namespace, plural string
205205 strings .ToLower (plural ))
206206}
207207
208- func apiTest () error {
209- config , err := kubeConfig .ClientConfig ()
208+ func apiTest (c clientcmd. ClientConfig ) error {
209+ config , err := c .ClientConfig ()
210210 if err != nil {
211211 return err
212212 }
0 commit comments