This may have been what was giving us errors like:
Sep 10 19:41:16 ip-10-0-3-146 bootkube.sh[1605]: "99_openshift-cluster-api_master-user-data-secret.yaml": unable to convert asset "99_openshift-cluster-api_master-user-data-secret.yaml" to unstructed
Sep 10 19:41:16 ip-10-0-3-146 bootkube.sh[1605]: "99_openshift-cluster-api_worker-user-data-secret.yaml": unable to convert asset "99_openshift-cluster-api_worker-user-data-secret.yaml" to unstructed
after failing this cast to *unstructured.Unstructured [2]. I don't
have a theory for why the unstructured cast fails for Lists, but
that's what I see in local testing:
$ cat test.go
package main
import (
"io/ioutil"
"log"
"os"
"github.com/ghodss/yaml"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/runtime"
)
func main() {
file, err := os.Open("test.yaml")
if err != nil {
log.Fatal(err)
}
manifestBytes, err := ioutil.ReadAll(file)
if err != nil {
log.Fatal(err)
}
manifestJSON, err := yaml.YAMLToJSON(manifestBytes)
if err != nil {
log.Fatal(err)
}
manifestObj, err := runtime.Decode(unstructured.UnstructuredJSONScheme, manifestJSON)
if err != nil {
log.Fatal(err)
}
log.Print(manifestObj)
log.Print("")
manifestUnstructured, ok := manifestObj.(*unstructured.Unstructured)
if !ok {
log.Fatal(manifestUnstructured)
}
log.Print(manifestUnstructured)
}
$ cat <<EOF >test.yaml
> apiVersion: v1
> kind: Secret
> metadata:
> name: master-user-data
> namespace: openshift-machine-api
> type: Opaque
> data:
> disableTemplating: dHJ1ZQo=
> userData: dHJ1ZQo=
> EOF
$ go run test.go
2019/09/12 10:32:07 &{map[kind:Secret metadata:map[name:master-user-data namespace:openshift-machine-api] type:Opaque apiVersion:v1 data:map[userData:dHJ1ZQo= disableTemplating:dHJ1ZQo=]]}
2019/09/12 10:32:07
2019/09/12 10:32:07 &{map[apiVersion:v1 data:map[disableTemplating:dHJ1ZQo= userData:dHJ1ZQo=] kind:Secret metadata:map[name:master-user-data namespace:openshift-machine-api] type:Opaque]}
$ cat <<EOF >test.yaml
> kind: List
> apiVersion: v1
> metadata:
> resourceVersion: ""
> selfLink: ""
> items:
> - apiVersion: v1
> kind: Secret
> metadata:
> name: master-user-data
> namespace: openshift-machine-api
> type: Opaque
> data:
> disableTemplating: dHJ1ZQo=
> userData: dHJ1ZQo=
> EOF
$ go run test.go
2019/09/12 10:33:20 &{map[kind:List metadata:map[resourceVersion: selfLink:] apiVersion:v1] [{map[metadata:map[name:master-user-data namespace:openshift-machine-api] type:Opaque apiVersion:v1 data:map[disableTemplating:dHJ1ZQo= userData:dHJ1ZQo=] kind:Secret]}]}
2019/09/12 10:33:20
2019/09/12 10:33:20 <nil>
exit status 1
[1]: openshift#1381 (comment)
[2]: https://github.com/openshift/library-go/blob/7d4acc018c610623ee1413b1e7aebe2ac675d35f/pkg/assets/create/creater.go#L264