Closed jstrachan closed 7 years ago
Only issue I see currently is that the schema in your example doesn't match the keys in the object, so we'd have to do some extra work in the controller to copy the form values into the object once it's changed. If you had the schema like this (or have the keys in the data matching) there'd be less work in the controller:
kind: ConfigMap
apiVersion: v1
metadata:
name: hubot-irc
namespace: default
selfLink: /api/v1/namespaces/default/configmaps/hubot-irc
uid: 3626c7f6-607c-11e6-b2e2-8266870469e4
resourceVersion: '110848'
creationTimestamp: '2016-08-12T11:02:08Z'
labels:
group: io.fabric8.devops.apps
project: hubot-irc
provider: fabric8
version: 2.2-SNAPSHOT
annotations:
description: >-
Chat bot app using [Hubot](https://hubot.github.com/) and an IRC server to
communicate with fabric8.
fabric8.hubot-irc/iconUrl: >-
https://cdn.rawgit.com/fabric8io/fabric8-devops/master/hubot-irc/src/main/fabric8/icon.png
fabric8.hubot-irc/summary: '[Hubot](http://hubot.github.com) IRC chat bot'
fabric8.io/json-schema: |-
{
"type" : "object",
"properties" : {
"hubot-irc-usessl" : {
"type" : "string",
"description" : "Use SSL",
"default" : "1"
},
"hubot-grafana-api-key" : {
"type" : "string",
"description" : "API key for a particular user"
},
"hubot-irc-nick" : {
"type" : "string",
"description" : "The name that hubot should joing the room as",
"default" : "fabric8"
},
"hubot-irc-debug" : {
"type" : "string",
"description" : "Enables debug logging",
"default" : "true"
},
"hubot-irc-rooms" : {
"type" : "string",
"description" : "List of rooms to join including '#' prefix",
"default" : "#fabric8_default,#random"
},
"hubot-grafana-host" : {
"type" : "string",
"description" : "Host for your Grafana 2.0 install, e.g. 'http://play.grafana.org'"
},
"hubot-irc-unflood" : {
"type" : "string",
"description" : "Unflood",
"default" : "false"
},
"hubot-jenkins-url" : {
"type" : "string",
"description" : "The URL for the Jenkins CI server",
"default" : "http://jenkins"
},
"hubot-irc-server" : {
"type" : "string",
"description" : "The IRC server",
"default" : "irc.freenode.net"
},
"hubot-irc-nickserv-password" : {
"type" : "string",
"description" : "IRC nick password"
},
"hubot-irc-password" : {
"type" : "string",
"description" : "IRC password"
}
}
}
data:
hubot-grafana-api-key: ''
hubot-grafana-host: ''
hubot-irc-debug: 'true'
hubot-irc-nick: fabric8
hubot-irc-nickserv-password: ''
hubot-irc-password: ''
hubot-irc-rooms: '#fabric8_default,#random'
hubot-irc-server: irc.freenode.net
hubot-irc-unflood: 'false'
hubot-irc-usessl: '1'
hubot-jenkins-url: 'http://jenkins'
DOH! Lemme fix up the json schema so that the properties refer to the keys in data!
Sounds good, I'll do it locally, am halfway through implementing this :-)
On Fri, Aug 12, 2016 at 11:14 AM, James Strachan notifications@github.com wrote:
DOH! Lemme fix up the json schema so that the properties refer to the keys in data!
— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub https://github.com/hawtio/hawtio-kubernetes/issues/122#issuecomment-239473825, or mute the thread https://github.com/notifications/unsubscribe-auth/AAVdrB5Yle5KyBuWyafIqLOxBKk2Uxprks5qfI28gaJpZM4JjAr8 .
@gashcrumb yeah, its just toLowerCase().replace('_', '-')
;) but will fix up the JsonSchema's anyway soon!
awesome BTW!
Am migrating all the apps to use Deployment + ConfigMap for their configuration parameters (instead of OpenShift Templates) so that folks can reconfigure things at any time!
We'll also wanna look for ConfigMap's when Running stuff and let folks edit them in the UI before using the Run...
UI (also taking into account any current existing ConfigMap of the same name)
Hmm, it looks like suddenly angular has a problem with names like 'foo-bar' might be best to stick with camel case property names?
sounds good!
Yeah, I think since we're using the name in an expresion angularjs interpretes kebab-case names as foo - bar
, a subtraction expression! :-)
ah - no - has to be lower case in ConfigMap :(
I guess we could create a custom model that translates them; then swizzle them back again when writing to ConfigMap?
maybe we just replace '-', '_' internally first, then swizzle back again when we're about to write back to ConfigMap?
balls yeah, I'll swizzle the data instead, don't change anything :-)
we now attach a json schema via annotation
fabric8.io/json-schema
to a ConfigMap to help folks edit/generate them with default values, description, required and generate expressions etcIt'd be nice if the UI used those by default (rather than the YAML); though would be nice to still let folks go to the YAML too if they wish.
here's an example ConfigMap