Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can I create a Catalog Source and Subscription using the Kubernetes or the OpenShift Client #2321

Closed
prabhjotbawa opened this issue Jul 1, 2020 · 1 comment · Fixed by #2412
Assignees
Labels
platform/openshift Specific to OpenShift question

Comments

@prabhjotbawa
Copy link

Hi ,
This could be more of a question rather than an issue .However I am not able to figure out how to make it work.I would like to install a CatalogSource and Subscription to the cluster using the client,

Below is the code snippet I am using -

void createResourcefromYaml(File resourceYaml){
KubernetesClient client = new DefaultKubernetesClient()
FileInputStream fileInputStream = new FileInputStream(resourceYaml)
client.load(fileInputStream).createOrReplace()
}

Below is sample catalogsource.yaml

apiVersion: operators.coreos.com/v1alpha1
kind: CatalogSource
metadata:
  name: some-name
spec:
  sourceType: valid source type
  image: some image
  imagePullPolicy: Always
  displayName: some name
  publisher: some name

However I get the below error

Caused by: com.fasterxml.jackson.databind.JsonMappingException: No resource type found for:operators.coreos.com/v1alpha1#CatalogSource
 at [Source: (BufferedInputStream); line: 11, column: 1]
	at com.fasterxml.jackson.databind.JsonMappingException.from(JsonMappingException.java:274)
	at io.fabric8.kubernetes.internal.KubernetesDeserializer.fromObjectNode(KubernetesDeserializer.java:85)
	at io.fabric8.kubernetes.internal.KubernetesDeserializer.deserialize(KubernetesDeserializer.java:57)
	at io.fabric8.kubernetes.internal.KubernetesDeserializer.deserialize(KubernetesDeserializer.java:46)
	at com.fasterxml.jackson.databind.ObjectReader._bindAndClose(ObjectReader.java:1719)
	at com.fasterxml.jackson.databind.ObjectReader.readValue(ObjectReader.java:1228)
	at io.fabric8.kubernetes.client.utils.Serialization.unmarshal(Serialization.java:138)
	... 7 more

I can do the above without any issue through commandline
oc apply -f catalog-source.yaml
but not via the client.

Could you advice what am I missing here please?

Thank you

@manusa
Copy link
Member

manusa commented Jul 13, 2020

There are many OpenShift APIs we are missing, one of them being https://docs.openshift.com/container-platform/4.4/rest_api/operator_apis/operator-apis-index.html.

We may be able to provide model for this API structs.

rohanKanojia added a commit to rohanKanojia/kubernetes-client that referenced this issue Aug 13, 2020
@rohanKanojia rohanKanojia self-assigned this Aug 13, 2020
rohanKanojia added a commit to rohanKanojia/kubernetes-client that referenced this issue Aug 18, 2020
rohanKanojia added a commit to rohanKanojia/kubernetes-client that referenced this issue Aug 19, 2020
+ Add new OpenShift resources in OpenShift Model as per listed
  resources in https://docs.openshift.com/container-platform/4.4/rest_api/operator_apis/operator-apis-index.html

+ Added these new modules in kubernetes-model-generator:
  - openshift-console-model
  - openshift-monitoring-model
  - openshift-operatorhub-model
  - openshift-operator-model
+ Added new endpoints in openshift-client DSL:
  - client.config() - config.openshift.io/v1
  - client.operator() - operator.openshift.io/v1 and operator.openshift.io/v1alpha1
  - client.operatorHub() - operators.coreos.com/v1alpha1
  - client.console() - console.openshift.io/v1
  - client.quota() - quota.openshift.io/v1
  - client.monitoring() - monitoring.coreosc.com/v1
rohanKanojia added a commit to rohanKanojia/kubernetes-client that referenced this issue Aug 19, 2020
+ Add new OpenShift resources in OpenShift Model as per listed
  resources in https://docs.openshift.com/container-platform/4.4/rest_api/operator_apis/operator-apis-index.html

+ Added these new modules in kubernetes-model-generator:
  - openshift-console-model
  - openshift-monitoring-model
  - openshift-operatorhub-model
  - openshift-operator-model
+ Added new endpoints in openshift-client DSL:
  - client.config() - config.openshift.io/v1
  - client.operator() - operator.openshift.io/v1 and operator.openshift.io/v1alpha1
  - client.operatorHub() - operators.coreos.com/v1alpha1
  - client.console() - console.openshift.io/v1
  - client.quota() - quota.openshift.io/v1
  - client.monitoring() - monitoring.coreosc.com/v1
rohanKanojia added a commit to rohanKanojia/kubernetes-client that referenced this issue Aug 19, 2020
+ Add new OpenShift resources in OpenShift Model as per listed
  resources in https://docs.openshift.com/container-platform/4.4/rest_api/operator_apis/operator-apis-index.html

+ Added these new modules in kubernetes-model-generator:
  - openshift-console-model
  - openshift-monitoring-model
  - openshift-operatorhub-model
  - openshift-operator-model
+ Added new endpoints in openshift-client DSL:
  - client.config() - config.openshift.io/v1
  - client.operator() - operator.openshift.io/v1 and operator.openshift.io/v1alpha1
  - client.operatorHub() - operators.coreos.com/v1alpha1
  - client.console() - console.openshift.io/v1
  - client.quota() - quota.openshift.io/v1
  - client.monitoring() - monitoring.coreosc.com/v1
rohanKanojia added a commit to rohanKanojia/kubernetes-client that referenced this issue Aug 20, 2020
+ Add new OpenShift resources in OpenShift Model as per listed
  resources in https://docs.openshift.com/container-platform/4.4/rest_api/operator_apis/operator-apis-index.html

+ Added these new modules in kubernetes-model-generator:
  - openshift-console-model
  - openshift-monitoring-model
  - openshift-operatorhub-model
  - openshift-operator-model
+ Added new endpoints in openshift-client DSL:
  - client.config() - config.openshift.io/v1
  - client.operator() - operator.openshift.io/v1 and operator.openshift.io/v1alpha1
  - client.operatorHub() - operators.coreos.com/v1alpha1
  - client.console() - console.openshift.io/v1
  - client.quota() - quota.openshift.io/v1
  - client.monitoring() - monitoring.coreosc.com/v1
manusa pushed a commit to rohanKanojia/kubernetes-client that referenced this issue Aug 20, 2020
+ Add new OpenShift resources in OpenShift Model as per listed
  resources in https://docs.openshift.com/container-platform/4.4/rest_api/operator_apis/operator-apis-index.html

+ Added these new modules in kubernetes-model-generator:
  - openshift-console-model
  - openshift-monitoring-model
  - openshift-operatorhub-model
  - openshift-operator-model
+ Added new endpoints in openshift-client DSL:
  - client.config() - config.openshift.io/v1
  - client.operator() - operator.openshift.io/v1 and operator.openshift.io/v1alpha1
  - client.operatorHub() - operators.coreos.com/v1alpha1
  - client.console() - console.openshift.io/v1
  - client.quota() - quota.openshift.io/v1
  - client.monitoring() - monitoring.coreosc.com/v1
@manusa manusa added the platform/openshift Specific to OpenShift label Aug 20, 2020
rohanKanojia added a commit to rohanKanojia/kubernetes-client that referenced this issue Aug 25, 2020
+ Add new OpenShift resources in OpenShift Model as per listed
  resources in https://docs.openshift.com/container-platform/4.4/rest_api/operator_apis/operator-apis-index.html

+ Added these new modules in kubernetes-model-generator:
  - openshift-console-model
  - openshift-monitoring-model
  - openshift-operatorhub-model
  - openshift-operator-model
+ Added new endpoints in openshift-client DSL:
  - client.config() - config.openshift.io/v1
  - client.operator() - operator.openshift.io/v1 and operator.openshift.io/v1alpha1
  - client.operatorHub() - operators.coreos.com/v1alpha1
  - client.console() - console.openshift.io/v1
  - client.quota() - quota.openshift.io/v1
  - client.monitoring() - monitoring.coreosc.com/v1
rohanKanojia added a commit to rohanKanojia/kubernetes-client that referenced this issue Aug 25, 2020
+ Add new OpenShift resources in OpenShift Model as per listed
  resources in https://docs.openshift.com/container-platform/4.4/rest_api/operator_apis/operator-apis-index.html

+ Added these new modules in kubernetes-model-generator:
  - openshift-console-model
  - openshift-monitoring-model
  - openshift-operatorhub-model
  - openshift-operator-model
+ Added new endpoints in openshift-client DSL:
  - client.config() - config.openshift.io/v1
  - client.operator() - operator.openshift.io/v1 and operator.openshift.io/v1alpha1
  - client.operatorHub() - operators.coreos.com/v1alpha1
  - client.console() - console.openshift.io/v1
  - client.quota() - quota.openshift.io/v1
  - client.monitoring() - monitoring.coreosc.com/v1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform/openshift Specific to OpenShift question
Projects
None yet
3 participants