-
Notifications
You must be signed in to change notification settings - Fork 1
/
api_test.sh
executable file
·43 lines (36 loc) · 10.4 KB
/
api_test.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/bash
# Copyright AppsCode Inc. and Contributors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
curl 'http://localhost:4000/clusters/appscode/editor?installCRDs=true' \
-X 'PUT' \
-H 'Accept: application/json, text/plain, */*' \
-H 'Content-Type: application/json;charset=UTF-8' \
--data-raw '{"metadata":{"release":{"name":"db-12","namespace":"demo"},"resource":{"group":"kubedb.com","kind":"Postgres","name":"postgreses","scope":"Namespaced","version":"v1alpha2"}},"resources":{"kubedbComPostgres":{"apiVersion":"kubedb.com/v1alpha2","kind":"Postgres","metadata":{"labels":{"app.kubernetes.io/instance":"db-12","app.kubernetes.io/managed-by":"Helm","app.kubernetes.io/name":"postgreses.kubedb.com"},"name":"db-12","namespace":"demo"},"spec":{"clientAuthMode":"md5","leaderElection":{"electionTick":10,"heartbeatTick":1,"maximumLagBeforeFailover":33554432,"period":"100ms"},"podTemplate":{"spec":{"resources":{"limits":{"cpu":"1","memory":"1024Mi"}}}},"replicas":3,"standbyMode":"Hot","storage":{"accessModes":["ReadWriteOnce"],"resources":{"requests":{"storage":"10Gi"}},"storageClassName":"linode-block-storage"},"storageType":"Durable","terminationPolicy":"WipeOut","version":"9.6.21-debian","sslMode":"require","tls":{"issuerRef":{"apiGroup":"cert-manager.io","kind":"Issuer","name":"postgres-ca-issuer"}},"monitor":{"agent":"prometheus.io/operator","prometheus":{"serviceMonitor":{"labels":{"release":"prometheus"}}}},"configSecret":{"name":"db-12-config"}}},"secret_config":{"stringData":{"user.conf":"max_connections = 121\nshared_buffers = 121MB"}}},"spec":{"version":"9.6.21-debian"}}'
curl 'http://localhost:4000/clusters/appscode/editor?installCRDs=true' \
-X 'PUT' \
-H 'Accept: application/json, text/plain, */*' \
-H 'Content-Type: application/json;charset=UTF-8' \
--data-raw '{"metadata":{"release":{"name":"db-12","namespace":"demo"},"resource":{"group":"kubedb.com","kind":"Postgres","name":"postgreses","scope":"Namespaced","version":"v1alpha2"}},"patch":[{"op":"remove","path":"/resources/kubedbComPostgres/spec/podTemplate/spec/containerSecurityContext/capabilities"},{"op":"remove","path":"/resources/kubedbComPostgres/spec/podTemplate/metadata"},{"op":"remove","path":"/resources/kubedbComPostgres/spec/podTemplate/controller"},{"op":"remove","path":"/resources/kubedbComPostgres/spec/monitor/prometheus/exporter/resources"}]}'
curl 'http://localhost:4000/editor/resources?skipCRDs=true' \
-X 'PUT' \
-H 'Accept: application/json, text/plain, */*' \
-H 'Content-Type: application/json;charset=UTF-8' \
--data-raw '{"metadata":{"release":{"name":"db-12","namespace":"demo"},"resource":{"group":"kubedb.com","kind":"Postgres","name":"postgreses","scope":"Namespaced","version":"v1alpha2"}},"resources":{"kubedbComPostgres":{"apiVersion":"kubedb.com/v1alpha2","kind":"Postgres","metadata":{"annotations":{"kubectl.kubernetes.io/last-applied-configuration":"{\"apiVersion\":\"kubedb.com/v1alpha2\",\"kind\":\"Postgres\",\"metadata\":{\"annotations\":{\"meta.helm.sh/release-name\":\"db-12\",\"meta.helm.sh/release-namespace\":\"demo\"},\"labels\":{\"app.kubernetes.io/instance\":\"db-12\",\"app.kubernetes.io/managed-by\":\"Helm\",\"app.kubernetes.io/name\":\"postgreses.kubedb.com\"},\"name\":\"db-12\",\"namespace\":\"demo\"},\"spec\":{\"clientAuthMode\":\"md5\",\"configSecret\":{\"name\":\"db-12-config\"},\"leaderElection\":{\"electionTick\":10,\"heartbeatTick\":1,\"maximumLagBeforeFailover\":33554432,\"period\":\"100ms\"},\"monitor\":{\"agent\":\"prometheus.io/operator\",\"prometheus\":{\"serviceMonitor\":{\"labels\":{\"release\":\"prometheus\"}}}},\"podTemplate\":{\"spec\":{\"resources\":{\"limits\":{\"cpu\":\"1\",\"memory\":\"1024Mi\"}}}},\"replicas\":3,\"sslMode\":\"require\",\"standbyMode\":\"Hot\",\"storage\":{\"accessModes\":[\"ReadWriteOnce\"],\"resources\":{\"requests\":{\"storage\":\"10Gi\"}},\"storageClassName\":\"linode-block-storage\"},\"storageType\":\"Durable\",\"terminationPolicy\":\"WipeOut\",\"tls\":{\"issuerRef\":{\"apiGroup\":\"cert-manager.io\",\"kind\":\"Issuer\",\"name\":\"postgres-ca-issuer\"}},\"version\":\"9.6.21-debian\"}}\n","meta.helm.sh/release-name":"db-12","meta.helm.sh/release-namespace":"demo"},"creationTimestamp":"2021-07-13T07:45:38Z","finalizers":["kubedb.com"],"generation":2,"labels":{"app.kubernetes.io/instance":"db-12","app.kubernetes.io/managed-by":"Helm","app.kubernetes.io/name":"postgreses.kubedb.com"},"managedFields":[{"apiVersion":"kubedb.com/v1alpha2","fieldsType":"FieldsV1","fieldsV1":{"f:metadata":{"f:annotations":{".":{},"f:kubectl.kubernetes.io/last-applied-configuration":{},"f:meta.helm.sh/release-name":{},"f:meta.helm.sh/release-namespace":{}},"f:labels":{".":{},"f:app.kubernetes.io/instance":{},"f:app.kubernetes.io/managed-by":{},"f:app.kubernetes.io/name":{}}},"f:spec":{".":{},"f:clientAuthMode":{},"f:configSecret":{".":{},"f:name":{}},"f:leaderElection":{".":{},"f:electionTick":{},"f:heartbeatTick":{},"f:maximumLagBeforeFailover":{},"f:period":{}},"f:monitor":{".":{},"f:agent":{},"f:prometheus":{".":{},"f:serviceMonitor":{".":{},"f:labels":{".":{},"f:release":{}}}}},"f:podTemplate":{".":{},"f:spec":{".":{},"f:resources":{".":{},"f:limits":{".":{},"f:cpu":{},"f:memory":{}}}}},"f:replicas":{},"f:sslMode":{},"f:standbyMode":{},"f:storage":{".":{},"f:accessModes":{},"f:resources":{".":{},"f:requests":{".":{},"f:storage":{}}},"f:storageClassName":{}},"f:storageType":{},"f:terminationPolicy":{},"f:tls":{".":{},"f:issuerRef":{".":{},"f:apiGroup":{},"f:kind":{},"f:name":{}}},"f:version":{}}},"manager":"Go-http-client","operation":"Update","time":"2021-07-13T07:45:38Z"},{"apiVersion":"kubedb.com/v1alpha2","fieldsType":"FieldsV1","fieldsV1":{"f:metadata":{"f:finalizers":{".":{},"v:\"kubedb.com\"":{}}},"f:spec":{"f:authSecret":{".":{},"f:name":{}}},"f:status":{".":{},"f:conditions":{},"f:observedGeneration":{},"f:phase":{}}},"manager":"operator","operation":"Update","time":"2021-07-13T09:56:30Z"}],"name":"db-12","namespace":"demo","resourceVersion":"31783700","uid":"34383de7-121b-4fb1-91cc-6f1472797feb"},"spec":{"authSecret":{"name":"db-12-auth"},"clientAuthMode":"md5","configSecret":{"name":"db-12-config"},"leaderElection":{"electionTick":10,"heartbeatTick":1,"maximumLagBeforeFailover":33554432,"period":"100ms"},"monitor":{"agent":"prometheus.io/operator","prometheus":{"exporter":{"port":56790},"serviceMonitor":{"labels":{"release":"prometheus"}}}},"podTemplate":{"spec":{"resources":{"requests":{"cpu":"1","memory":"1Gi"},"limits":{"cpu":"1","memory":"1Gi"}},"containerSecurityContext":{"runAsGroup":999,"runAsUser":999,"privileged":false},"securityContext":{"fsGroup":999,"runAsGroup":999,"runAsUser":999},"affinity":{"podAntiAffinity":{"preferredDuringSchedulingIgnoredDuringExecution":[{"podAffinityTerm":{"labelSelector":{"matchLabels":{"app.kubernetes.io/instance":"db-12","app.kubernetes.io/managed-by":"kubedb.com","app.kubernetes.io/name":"postgreses.kubedb.com"}},"namespaces":["demo"],"topologyKey":"kubernetes.io/hostname"},"weight":100},{"podAffinityTerm":{"labelSelector":{"matchLabels":{"app.kubernetes.io/instance":"db-12","app.kubernetes.io/managed-by":"kubedb.com","app.kubernetes.io/name":"postgreses.kubedb.com"}},"namespaces":["demo"],"topologyKey":"failure-domain.beta.kubernetes.io/zone"},"weight":50}]}},"serviceAccountName":"db-12"}},"replicas":3,"sslMode":"require","standbyMode":"Hot","storage":{"accessModes":["ReadWriteOnce"],"resources":{"requests":{"storage":"10Gi"}},"storageClassName":"linode-block-storage"},"storageType":"Durable","terminationPolicy":"Halt","tls":{"certificates":[{"alias":"server","secretName":"db-12-server-cert"},{"alias":"client","secretName":"db-12-client-cert"},{"alias":"metrics-exporter","secretName":"db-12-metrics-exporter-cert"}],"issuerRef":{"apiGroup":"cert-manager.io","kind":"Issuer","name":"postgres-ca-issuer"}},"version":"9.6.21-debian"}},"secret_config":{"apiVersion":"v1","data":{"user.conf":"bWF4X2Nvbm5lY3Rpb25zID0gMTIxCnNoYXJlZF9idWZmZXJzID0gMTIxTUI="},"kind":"Secret","metadata":{"annotations":{"kubectl.kubernetes.io/last-applied-configuration":"{\"apiVersion\":\"v1\",\"kind\":\"Secret\",\"metadata\":{\"annotations\":{\"meta.helm.sh/release-name\":\"db-12\",\"meta.helm.sh/release-namespace\":\"demo\"},\"labels\":{\"app.kubernetes.io/instance\":\"db-12\",\"app.kubernetes.io/managed-by\":\"Helm\",\"app.kubernetes.io/name\":\"postgreses.kubedb.com\"},\"name\":\"db-12-config\",\"namespace\":\"demo\"},\"stringData\":{\"user.conf\":\"max_connections = 121\\nshared_buffers = 121MB\"}}\n","meta.helm.sh/release-name":"db-12","meta.helm.sh/release-namespace":"demo"},"creationTimestamp":"2021-07-13T07:45:37Z","labels":{"app.kubernetes.io/instance":"db-12","app.kubernetes.io/managed-by":"Helm","app.kubernetes.io/name":"postgreses.kubedb.com"},"managedFields":[{"apiVersion":"v1","fieldsType":"FieldsV1","fieldsV1":{"f:data":{".":{},"f:user.conf":{}},"f:metadata":{"f:annotations":{".":{},"f:kubectl.kubernetes.io/last-applied-configuration":{},"f:meta.helm.sh/release-name":{},"f:meta.helm.sh/release-namespace":{}},"f:labels":{".":{},"f:app.kubernetes.io/instance":{},"f:app.kubernetes.io/managed-by":{},"f:app.kubernetes.io/name":{}}},"f:type":{}},"manager":"Go-http-client","operation":"Update","time":"2021-07-13T07:45:37Z"}],"name":"db-12-config","namespace":"demo","resourceVersion":"28410239","uid":"2249ee81-4025-4717-842d-6ca0f894cd5f"},"type":"Opaque","stringData":{"user.conf":"max_connections = 121\nshared_buffers = 121MB"}}}}'
curl 'http://localhost:4000/clusters/appscode/editor/model?installCRDs=true' \
-X 'PUT' \
-H 'Accept: application/json, text/plain, */*' \
-H 'Content-Type: application/json;charset=UTF-8' \
--data-raw '{"metadata":{"release":{"name":"test-elastic","namespace":"demo"},"resource":{"group":"kubedb.com","version":"v1alpha2","name":"elasticsearches","resourceTitle":"Elasticsearch","scope":"Namespaced"}}}'
# Load Preset
curl 'http://localhost:4000/packageview/values?name=kubedbcom-mongodb-editor-options&url=https://bundles.byte.builders/ui/&version=v0.4.8&presetKind=ClusterChartPreset&presetName=kubedb.com-v1alpha2-mongodbs&format=json'