Bug 1569870

Summary: [RFE] The content in configmap is hard to read and maintain and is error-prone
Product: OpenShift Container Platform Reporter: Weihua Meng <wmeng>
Component: RFEAssignee: Maciej Szulik <maszulik>
Status: CLOSED DEFERRED QA Contact: Xiaoli Tian <xtian>
Severity: low Docs Contact:
Priority: medium    
Version: 3.10.0CC: ansverma, aos-bugs, ckoep, dapark, dmoessne, jokerman, jvallejo, maszulik, mifiedle, mmccomas, suchaudh, wjiang
Target Milestone: ---Keywords: RFE
Target Release: 4.1.0   
Hardware: Unspecified   
OS: Unspecified   
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1634059 (view as bug list) Environment:
Last Closed: 2018-12-18 11:27:42 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Bug Depends On:    
Bug Blocks: 1634059    

Description Weihua Meng 2018-04-20 07:40:21 UTC
Description of problem:
The content in configmap is hard to read and maintain and is error-prone.

Version-Release number of the following components:

How reproducible:

Steps to Reproduce:
1. try to modify configmap
# oc edit cm node-config-master -n openshift-node

Actual results:

apiVersion: v1
  node-config.yaml: "kind: NodeConfig\napiVersion: v1\nauthConfig:\n  authenticationCacheSize:
    1000\n  authenticationCacheTTL: 5m\n  authorizationCacheSize: 1000\n  authorizationCacheTTL:
    5m\ndnsBindAddress: \"\"\ndnsDomain: cluster.local\ndnsIP:\ndnsNameservers:
    null\ndnsRecursiveResolvConf: /etc/origin/node/resolv.conf\ndockerConfig:\n  dockerShimRootDirectory:
    /var/lib/dockershim\n  dockerShimSocket: /var/run/dockershim.sock\n  execHandlerName:
    native\nenableUnidling: true\nimageConfig:\n  format: \"registry.reg-aws.openshift.com:443/openshift3/ose-${component}:v3.10\"\n
    \ latest: false\niptablesSyncPeriod: 30s\nkubeletArguments:\n  pod-manifest-path:\n
    \ - /etc/origin/node/pods\n  bootstrap-kubeconfig:\n  - /etc/origin/node/bootstrap.kubeconfig\n
    \ feature-gates:\n  - RotateKubeletClientCertificate=true,RotateKubeletServerCertificate=true\n
    \ rotate-certificates:\n  - \"true\"\n  cert-dir:\n  - /etc/origin/node/certificates\n
    \ cloud-config:\n  - /etc/origin/cloudprovider/aws.conf\n  cloud-provider:\n  -
    aws\n  node-labels: \n  - \"node-role.kubernetes.io/master=true\"\n  enable-controller-attach-detach:\n
    \ - 'true'\nmasterClientConnectionOverrides:\n  acceptContentTypes: application/vnd.kubernetes.protobuf,application/json\n
    \ burst: 40\n  contentType: application/vnd.kubernetes.protobuf\n  qps: 20\nmasterKubeConfig:
    node.kubeconfig\nnetworkConfig:\n  mtu: 8951\n  networkPluginName: redhat/openshift-ovs-networkpolicy\nservingInfo:\n
    \ bindAddress:\n  bindNetwork: tcp4\n  clientCA: client-ca.crt\nvolumeConfig:\n
    \ localQuota:\n    perFSGroup: null\nvolumeDirectory: /var/lib/origin/openshift.local.volumes\n"
kind: ConfigMap

Expected results:
style easy to read and understand by human

kind: NodeConfig
apiVersion: v1
  authenticationCacheSize: 1000
  authenticationCacheTTL: 5m
  authorizationCacheSize: 1000
  authorizationCacheTTL: 5m
dnsBindAddress: ""
dnsDomain: cluster.local
dnsNameservers: null
dnsRecursiveResolvConf: /etc/origin/node/resolv.conf
  dockerShimRootDirectory: /var/lib/dockershim
  dockerShimSocket: /var/run/dockershim.sock
  execHandlerName: native
enableUnidling: true
  format: "registry.reg-aws.openshift.com:443/openshift3/ose-${component}:v3.10"
  latest: false
iptablesSyncPeriod: 30s

Comment 1 weiwei jiang 2018-04-20 08:11:26 UTC
Better use literal block scalar styles instead of the strings.

# oc get cm -n openshift-template-service-broker  apiserver-config -o yaml 
apiVersion: v1
  apiserver-config.yaml: |
    kind: TemplateServiceBrokerConfig
    apiVersion: config.templateservicebroker.openshift.io/v1
    - openshift
kind: ConfigMap
    kubectl.kubernetes.io/last-applied-configuration: |
      {"apiVersion":"v1","data":{"apiserver-config.yaml":"kind: TemplateServiceBrokerConfig\napiVersion: config.templateservicebroker.openshift.io/v1\ntemplateNamespaces:\n- openshift\n"},"kind":"ConfigMap","metadata":{"annotations":{},"name":"apiserver-config","namespace":"openshift-template-service-broker"}}
  creationTimestamp: 2018-04-20T03:37:03Z
  name: apiserver-config
  namespace: openshift-template-service-broker
  resourceVersion: "2720"
  selfLink: /api/v1/namespaces/openshift-template-service-broker/configmaps/apiserver-config
  uid: 1756c6b6-444c-11e8-adbc-42010af00059

Comment 2 DeShuai Ma 2018-05-07 07:13:44 UTC
Currently we can use below command to update a node-config.yaml for configmap:

1. oc extract cm/node-config-compute -n openshift-node --to=/tmp
2. Update the extracted file in local (eg: vim /tmp/node-config.yaml)
3. oc create cm node-config-compute -n openshift-node --from-file=/tmp/node-config.yaml --dry-run -o yaml | oc replace -f -

Comment 5 Maciej Szulik 2018-12-18 11:04:55 UTC
*** Bug 1571933 has been marked as a duplicate of this bug. ***

Comment 6 Maciej Szulik 2018-12-18 11:06:48 UTC
I'm going to convert this to RFE, similarly how https://bugzilla.redhat.com/show_bug.cgi?id=1571933 was.
Also moving the target date for 4.1 or even later, this was discussed upstream but there are not action
in that direction, yet.

Comment 7 Maciej Szulik 2018-12-18 11:27:42 UTC
Moving to JIRA: https://jira.coreos.com/browse/MSTR-282