vbehar / openshift-git

Import/Export OpenShift resources from/to a Git repository
Apache License 2.0
8 stars 3 forks source link

the server could not find the requested resource #1

Open varac opened 6 years ago

varac commented 6 years ago

Thanks for this awesome project! Unfortunatly it fails during export. It already commited 195 changes, but then breaks with this error:

--- openshift/openshift-git ‹master› » openshift-git export everything  --config=/home/varac/.kube/cad.admin.kubeconfig --all-namespaces --repository-path=/home/varac/cad/infrastructure/openshift/openshift-git
I0105 15:16:56.472661   29279 repository.go:77] No remote repository configured.
I0105 15:16:56.661029   29279 list.go:52] Running export for kinds [/v1, Kind=BuildConfig /v1, Kind=ClusterPolicy /v1, Kind=ClusterPolicyBinding /v1, Kind=DeploymentConfig /v1, Kind=Group /v1, Kind=ImageStream /v1, Kind=LimitRange /v1, Kind=Namespace /v1, Kind=Pod /v1, Kind=Policy /v1, Kind=PolicyBinding /v1, Kind=PersistentVolume /v1, Kind=PersistentVolumeClaim /v1, Kind=ResourceQuota /v1, Kind=ReplicationController /v1, Kind=Route /v1, Kind=ServiceAccount /v1, Kind=SecurityContextConstraints /v1, Kind=Secret /v1, Kind=Service /v1, Kind=Template /v1, Kind=User] for all namespaces
W0105 15:16:56.858772   29279 request.go:627] Throttling request took 193.720043ms, request: GET:https://openshift.my.domain:8443/api/v1/services
F0105 15:16:57.951767   29279 cmd.go:85] Failed: Got 4 errors: [the server could not find the requested resource the server could not find the requested resource the server could not find the requested resource the server could not find the requested resource]
--- openshift/openshift-git ‹master› » git lg|wc -l
195

--- openshift/openshift-git ‹master› » git lg|head 
* 245a462 G  (HEAD -> master) Sync ServiceAccount openshift/deployer (6 minutes ago) <OpenShift>
* e55ea9b G  Sync ServiceAccount openshift/default (6 minutes ago) <OpenShift>
* a4daf68 G  Sync ServiceAccount openshift/builder (6 minutes ago) <OpenShift>
* 0950d72 G  Sync ServiceAccount openshift-template-service-broker/templateservicebroker-client (6 minutes ago) <OpenShift>
* 3c13d0f G  Sync ServiceAccount openshift-template-service-broker/deployer (6 minutes ago) <OpenShift>
* 90fdcdf G  Sync ServiceAccount openshift-template-service-broker/default (6 minutes ago) <OpenShift>
* bf32b47 G  Sync ServiceAccount openshift-template-service-broker/builder (6 minutes ago) <OpenShift>
* 81df211 G  Sync ServiceAccount openshift-template-service-broker/apiserver (6 minutes ago) <OpenShift>
* 3250397 G  Sync ServiceAccount openshift-node/deployer (6 minutes ago) <OpenShift>
* babec57 G  Sync ServiceAccount openshift-node/default (6 minutes ago) <OpenShift>

Any chance to git that fixed ?

I'm using openshift 3.7.

vbehar commented 6 years ago

Hi,

it was built for an older version of openshift (3.1 or 3.2 I think), so it might have issues talking to a more recent version.

I guess that the issue is related to the resources requested: the "everything" shortcut references https://github.com/vbehar/openshift-git/blob/master/pkg/openshift/kinds.go#L12 maybe some of those are not available anymore under the same group/version as what the client think.

you can try to run it for only a few resources (for example "pod"). maybe it fails for a resource that you don't care about..

varac commented 6 years ago

@vbehar Thx for the quick answer!

these are the types that don't work with openshift 3.7: policyBindings, policies, clusterPolicyBindings, clusterPolicies

There are new types in openshift 3.7, it would be great to update the "everything" alias to reflect all types in 3.7. But I figured out how to work around this with explicitly passing all types, will paste my successful cmd here once I included all types.

vbehar commented 6 years ago

ok great. feel free to submit a PR if you have the time ;-)

varac commented 6 years ago

Ok, here we go:

These are services aliased by everything without types not supported by os 3.7:

ns,pv,scc,users,groups,bc,dc,rc,pods,is,svc,routes,templates,secrets,limits,quota,pvc,sa

And these additional types work with os 3.7:

configmaps,endpoints,imagestreamtags,limitranges,projects,replicationcontrollers,resourcequotas,rolebindings,roles,services

varac commented 6 years ago

I haven't written a line in go, plus a PR would need to check the os version before aliasing so sorry, I can't come up with a PR :(

varac commented 6 years ago

So just for the record, to export all available resources in openshift 3.7 (no guarantee for completeness):

export TYPES='ns,pv,scc,users,groups,bc,dc,rc,pods,is,svc,routes,templates,secrets,limits,quota,pvc,sa,configmaps,endpoints,imagestreamtags,limitranges,projects,replicationcontrollers,resourcequotas,rolebindings,roles,services'

openshift-git export $TYPES --config=/home/varac/.kube/cad.admin.kubeconfig --all-namespaces --repository-path=/home/varac/cad/infrastructure/openshift/openshift-git
vbehar commented 6 years ago

thanks. I'll add that to the README