Skip to content

snowdrop/query-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Export resources

The purpose of this project is to define an approach and FluentBuilder to query the resources from a K8s Custom Resource such as a Component that we would like to export as Helm chart, kubernetes list, ...

https://github.com/snowdrop/query-api/blob/master/cmd/export.go#L84-L106

Instructions

Build the go tool

  • Build the go tool locally
git clone https://github.com/snowdrop/query-api.git && cd query-api 
make all

Query resources using Field

./bin/tool search

Generate list of k8s yaml resources

  • Build the go tool locally and use it as cobra command
./bin/tool export -c my-spring-boot > result.yml
  • Next, create a new project/namespace and deploy the list of the k8s resource
oc new-project dummy
oc create -f result.yml
  • Check if all the resources have been well created like the replicationController and Pod
oc get all,pvc
NAME                         READY     STATUS    RESTARTS   AGE
pod/my-spring-boot-1-8bfds   1/1       Running   0          3m

NAME                                     DESIRED   CURRENT   READY     AGE
replicationcontroller/my-spring-boot-1   1         1         1         3m

NAME                     TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)    AGE
service/my-spring-boot   ClusterIP   172.30.207.131   <none>        8080/TCP   3m

NAME                                                REVISION   DESIRED   CURRENT   TRIGGERED BY
deploymentconfig.apps.openshift.io/my-spring-boot   1          1         1         image(copy-supervisord:latest),image(dev-runtime-spring-boot:latest)

NAME                                                     DOCKER REPO                                               TAGS      UPDATED
imagestream.image.openshift.io/copy-supervisord          172.30.1.1:5000/my-spring-boot1/copy-supervisord          latest    3 minutes ago
imagestream.image.openshift.io/dev-runtime-spring-boot   172.30.1.1:5000/my-spring-boot1/dev-runtime-spring-boot   latest    3 minutes ago

NAME                                           STATUS    VOLUME    CAPACITY   ACCESS MODES   STORAGECLASS   AGE
persistentvolumeclaim/m2-data-my-spring-boot   Bound     pv0068    100Gi      RWO,ROX,RWX                   3m

Export resources as helm chart

  • Export the resources as Helm Chart
./bin/tool export -c my-spring-boot -o helm
  • Check the chart project created locally for my-spring-boot component
tree my-spring-boot 
my-spring-boot
├── Chart.yaml
├── charts
├── templates
│   ├── NOTES.txt
│   ├── _helpers.tpl
│   ├── deploymentconfig.yml
│   ├── imagestream.yml
│   ├── persistentvolumeclaim.yml
│   └── service.yml
└── values.yaml

2 directories, 8 files

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published