From 54d115ecc67a4c14b5da0af005dc7872b961d59f Mon Sep 17 00:00:00 2001 From: mathieu bultel Date: Mon, 15 Apr 2024 22:11:35 +0200 Subject: [PATCH 1/5] Add documentation for configuring os-diff --- README.md | 139 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 139 insertions(+) diff --git a/README.md b/README.md index 9db0720..acc6dad 100644 --- a/README.md +++ b/README.md @@ -8,6 +8,145 @@ OpenStack to OpenStack on OpenShift migration. ### Usage +#### Setup our environment + +##### Setup Ssh access + +In order to allow Os-diff to connect to our clouds and pull files from the services you describe in the `config.yaml`file you need to properly set the option in the `os-diff.cfg`: + +``` +[Default] + +local_config_dir=/tmp/ +service_config_file=config.yaml + +[Tripleo] + +ssh_cmd=ssh -F ssh.config +director_host=standalone +container_engine=podman +connection=ssh +remote_config_path=/tmp/tripleo +local_config_path=/tmp/ + +[Openshift] + +ocp_local_config_path=/tmp/ocp +connection=local +ssh_cmd="" + +``` + +The `ssh_cmd` will be used by os-diff to access via ssh to your TripleO Undercloud/Director host or the host where your cloud is accessible and the podman/docker binary is installed and allowed to interract with the running containers. +This option could have different form: + +``` +ssh_cmd=ssh -F ssh.config standalone +director_host= +``` + +``` +ssh_cmd=ssh -F ssh.config +director_host=standalone +``` + +or without a ssh config file: + +``` +ssh_cmd=ssh -i /home/user/.ssh/id_rsa stack@my.undercloud.local +director_host= +``` + +or + +``` +ssh_cmd=ssh -i /home/user/.ssh/id_rsa stack@ +director_host=my.undercloud.local +``` + +Note that the concat of ssh_cmd + director_host should be a "successful ssh access". + +##### Generate ssh.config file from inventory or hosts file + +Os-diff can use an ssh.config file for getting access to your TripleO/OSP environment. +A command can help you to generate this ssh config file from your Ansible inventory (like tripleo-ansible-inventory.yaml file): + +``` +os-diff configure -i tripleo-ansible-inventory.yaml -o ssh.config --yaml +``` + +The ssh.config file will looks like this (for a Standalone deployment): + +``` +Host standalone + HostName standalone + User root + StrictHostKeyChecking no + UserKnownHostsFile /dev/null + +Host undercloud + HostName undercloud + User root + StrictHostKeyChecking no + UserKnownHostsFile /dev/null +``` + +Note: You will have to set the IdentityFile key in the file in order to get a fully working acces: + +``` +Host standalone + HostName standalone + User root + IdentityFile ~/.ssh/id_rsa + StrictHostKeyChecking no + UserKnownHostsFile /dev/null + +Host undercloud + HostName undercloud + User root + IdentityFile ~/.ssh/id_rsa + StrictHostKeyChecking no + UserKnownHostsFile /dev/null +``` + +#### Non-standard services settings + +It's important to configure correctly a ssh config file or equivalent for non standard services such as OVS. +The ovs_external_ids is not a service which runs in a container and the ovs data are stored on each hosts of our cloud: controller_1/controller_2/... + +The hosts key in the config.yaml will allow os-diff to loop and get for all hosts specified the output of the command or the file or the data that you need to pull from our deployment in order to compare it later: + +``` + ovs_external_ids: + path: + - ovs_external_ids.json + hosts: + - standalone +``` + +The `service_command` is the command which provides the required informations. It could a simple cat from a config file. +`cat_output` should be set to true if you want os-diff to get the output of the command and stored the output in a file specified by the key `path` + +Then you can provide a mapping between, in this case the EDPM CRD and the ovs-vsctl output with `config_mapping` + +``` + service_command: 'ovs-vsctl list Open_vSwitch . | grep external_ids | awk -F '': '' ''{ print $2; }''' + cat_output: true + config_mapping: + ovn-bridge: edpm_ovn_bridge + ovn-bridge-mappings: edpm_ovn_bridge_mappings + ovn-encap-type: edpm_ovn_encap_type + ovn-match-northd-version: ovn_match_northd_version + ovn-monitor-all: ovn_monitor_all + ovn-ofctrl-wait-before-clear: edpm_ovn_ofctrl_wait_before_clear + ovn-remote-probe-interval: edpm_ovn_remote_probe_interval +``` +Then you can use this command to compare the values: + +``` +os-diff diff ovs_external_ids.json edpm.crd --crd --service ovs_external_ids +``` + #### Pull configuration step Before running the Pull command you need to configure the SSH access to your environments (OpenStack and OCP). From 869aab5fc5878efeeec29a4b660215c9e4be4ea0 Mon Sep 17 00:00:00 2001 From: mathieu bultel Date: Tue, 16 Apr 2024 10:55:10 +0200 Subject: [PATCH 2/5] Add diff documentation and --update config.yaml doc --- README.md | 151 +++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 133 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index acc6dad..acc0160 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # OS-diff -OpenStack / OpenShift diff tool +OpenStack/OpenShift diff tool This tool collects OpenStack/OpenShift service configurations, compares configuration files, makes a diff and creates a report to the user @@ -151,33 +151,40 @@ os-diff diff ovs_external_ids.json edpm.crd --crd --service ovs_external_ids Before running the Pull command you need to configure the SSH access to your environments (OpenStack and OCP). Edit os-diff.cfg and/or the ssh.config provided with this project and make sure you can ssh on your hosts -without password or host key verification, with the command: +without password or host key verification, refer to the section below for more informations. + +When everything is setup correctly you can tweak the config.yaml file at the root of the project which will contain the description of the services you want to extract configuration from: ``` -ssh -F ssh.config crc -ssh -F ssh.config standalone + config.yaml ``` -When everything is setup correctly you can tweak the config.yaml file at the root of the project which will contain the description of the services you want to extract configuration from: +You can ask os-diff to automaticaly fill the config.yaml from your TripleO/OSP environment: ``` - config.yaml +os-diff pull --update-only # will update your config.yaml but it won't pull the config + +os-diff pull --update # will update the config.yaml and pull the configuration ``` You can add your own service(s) according to the following: ``` +services: # Service name keystone: # Bool to enable/disable a service (not implemented yet) enable: true # Pod name, in both OCP and podman context. - # It could be strict match with strict_pod_name_match set to true - # or by default it will just grep the podman and work with all the pods - # which matched with pod_name. + # It could be strict match or will only just grep the podman_name + # and work with all the pods which matched with pod_name. + # To enable/disable use strict_pod_name_match: true/false podman_name: keystone pod_name: keystone container_name: keystone-api + # pod options + # strict match for getting pod id in TripleO and podman context + strict_pod_name_match: false # Path of the config files you want to analyze. # It could be whatever path you want: # /etc/ or /etc or /usr/share/ or even / @@ -189,25 +196,106 @@ You can add your own service(s) according to the following: - /etc/keystone - /etc/keystone/keystone.conf - /etc/keystone/logging.conf + ovs_external_ids: + hosts: + - standalone + service_command: "ovs-vsctl list Open_vSwitch . | grep external_ids | awk -F ': ' '{ print $2; }'" + cat_output: true + path: + - ovs_external_ids.json + config_mapping: + ovn-bridge-mappings: edpm_ovn_bridge_mappings + ovn-bridge: edpm_ovn_bridge + ovn-encap-type: edpm_ovn_encap_type + ovn-match-northd-version: ovn_match_northd_version + ovn-monitor-all: ovn_monitor_all + ovn-remote-probe-interval: edpm_ovn_remote_probe_interval + ovn-ofctrl-wait-before-clear: edpm_ovn_ofctrl_wait_before_clear +``` + +Note that `ovs_external_ids`is a non-standard service. This service is not an Openstack services executed in a container, so the description and the behavior is different. +You can refer to the section bellow for the non-standard configuration. +OVS is an example, but you can simply add whatever your want to check on all your nodes. + +Lets take the example of checking the /etc/yum.conf on every hosts, you will have to put this statement in the config.yaml, lets call it `yum_config` + +``` +services: + yum_config: + hosts: + - undercloud + - controller_1 + - compute_1 + - compute_2 + service_command: "cat /etc/yum.conf" + cat_output: true + path: + - yum.conf +``` + +Then when you will execute the pull command, you will get the content of your yum.conf file: + ``` +os-diff pull + +ls /tmp/tripleo/yum_config/undercloud/yum.conf + +# Make the diff with your yum.conf file: +os-diff diff /tmp/tripleo/yum_config/undercloud/yum.conf /etc/yum.conf +Source file path: /tmp/tripleo/yum_config/undercloud/yum.conf, difference with: /etc/yum.conf +[main] ++sslverify=0 +``` + +#### Build os-diff Once everything is correctly setup you can start to pull configuration: ``` -# build os-diff +# You will need to install Golang before building +export PATH=$PATH:/usr/local/go/bin +# Build os-diff make build -# run pull configuration for TripleO standalone: -./os-diff pull --env=tripleo -# run pull configuration for OCP with a specific output directory and a specific service config file: -./os-diff pull -e ocp -o /tmp/myconfigdir -s my-service-config-file +# Run pull configuration for TripleO standalone, by default the environment is TripleO/Openstack +os-diff pull +# Add --update if you want to update your config.yaml file. +os-diff pull --update + +# Note that you can also pull configuration from Openshift Openstack operators if you have already deployed and adopted your cloud. +# It could be useful to post check your configurations: +os-diff pull -e ocp -o /tmp/myconfigdir -s my-service-config-file ``` Note: The CLI arguments take precedence on the configuration file values. #### Compare configuration files steps -Once you have collected all the data per services you need, you can start to run comparison between -your two source directories. +Os-diff provides multiple ways to compare files and directories. +You can compare: + - file vs file + - directory vs directory (and sub directories) + - file vs CRD (Openshift custom resource definition) + - file from a running container vs file + - file from a running pod vs file + - do remote diff + - configmap vs file + +##### Simple files diff + +Files comparison is the most simplest way to use os-diff: + +``` +os-diff diff tripleo/keystone.conf ocp/keystone.conf +``` + +##### Directories diff + +Directory comparison and sub directory: + +``` +os-diff diff tripleo ocp +``` + A results file is written at the root of this project `results.log` and a *.diff file is created for each file where a difference has been detected @@ -223,13 +311,40 @@ Source file path: /tmp/collect_crc_configs/nova/nova-api-0/etc/nova/nova.conf, d ``` The log INFO/WARN and ERROR will be print to the console as well so you can have colored info regarding the current file processing. -Run the compare command: + + +##### File Vs CRDs + +For file comparison with a CRD, you have to provide the --crd option. +The name of the service might be needed if the service is describe in the config.yaml previoulsy configured, with a config mapping: ``` -./os-diff diff /tmp/collect_tripleo_configs /tmp/collect_crc_configs +os-diff diff examples/glance/glance.conf examples/glance/glance.patch --crd +# With a config mapping in config.yaml: +os-diff diff ovs_external_ids.json edpm.crd --crd --service ovs_external_ids ``` +Where the edpm.crd may looks like this: + +``` +apiVersion: dataplane.openstack.org/v1beta1 +kind: OpenStackDataPlaneNodeSet +metadata: + name: openstack +spec: + nodeTemplate: + ansibleSSHPrivateKeySecret: dataplane-adoption-secret + managementNetwork: ctlplane + ansible: + ansibleVars: + edpm_ovn_bridge_mappings: ['datacentre:br-ctlplane'] + edpm_ovn_bridge: br-int +``` + + + + ### Examples: diff command compares file to file only and ouput a diff with color on the console. From 6a5b8a997a2cd88ee383ee68e6eaaf5435c00ae4 Mon Sep 17 00:00:00 2001 From: mathieu bultel Date: Tue, 16 Apr 2024 11:23:25 +0200 Subject: [PATCH 3/5] Complete documentation for all type of diff --- README.md | 97 +++++++++++++++++++++-------------------------------- cmd/diff.go | 4 +++ 2 files changed, 43 insertions(+), 58 deletions(-) diff --git a/README.md b/README.md index acc0160..53d786b 100644 --- a/README.md +++ b/README.md @@ -6,13 +6,13 @@ compares configuration files, makes a diff and creates a report to the user in order to provide information and warnings after a migration from OpenStack to OpenStack on OpenShift migration. -### Usage +## Usage -#### Setup our environment +### Setup your environment -##### Setup Ssh access +#### Setup Ssh access -In order to allow Os-diff to connect to our clouds and pull files from the services you describe in the `config.yaml`file you need to properly set the option in the `os-diff.cfg`: +In order to allow Os-diff to connect to your clouds and pull files from the services you describe in the `config.yaml`file you need to properly set the option in the `os-diff.cfg`: ``` [Default] @@ -66,7 +66,7 @@ director_host=my.undercloud.local Note that the concat of ssh_cmd + director_host should be a "successful ssh access". -##### Generate ssh.config file from inventory or hosts file +#### Generate ssh.config file from inventory or hosts file Os-diff can use an ssh.config file for getting access to your TripleO/OSP environment. A command can help you to generate this ssh config file from your Ansible inventory (like tripleo-ansible-inventory.yaml file): @@ -147,7 +147,7 @@ Then you can use this command to compare the values: os-diff diff ovs_external_ids.json edpm.crd --crd --service ovs_external_ids ``` -#### Pull configuration step +### Pull configuration step Before running the Pull command you need to configure the SSH access to your environments (OpenStack and OCP). Edit os-diff.cfg and/or the ssh.config provided with this project and make sure you can ssh on your hosts @@ -280,7 +280,7 @@ You can compare: - do remote diff - configmap vs file -##### Simple files diff +#### Simple files diff Files comparison is the most simplest way to use os-diff: @@ -288,7 +288,7 @@ Files comparison is the most simplest way to use os-diff: os-diff diff tripleo/keystone.conf ocp/keystone.conf ``` -##### Directories diff +#### Directories diff Directory comparison and sub directory: @@ -313,7 +313,7 @@ Source file path: /tmp/collect_crc_configs/nova/nova-api-0/etc/nova/nova.conf, d The log INFO/WARN and ERROR will be print to the console as well so you can have colored info regarding the current file processing. -##### File Vs CRDs +#### File Vs CRDs For file comparison with a CRD, you have to provide the --crd option. The name of the service might be needed if the service is describe in the config.yaml previoulsy configured, with a config mapping: @@ -342,16 +342,43 @@ spec: edpm_ovn_bridge: br-int ``` +#### Diff from a running container or pod +To be fixed... +#### Diff from remote -### Examples: +For remote diff, you need to provide the --remote option in the CLI and then provide a remote command which will be used by the tool to get the config and perform the diff: + +Note that this option will be simplified in the future. + +``` +CMD2="ssh -F ssh.config standalone podman exec ff2d8edc25b6" +os-diff diff examples/glance/glance-api.conf /etc/glance/glance-api.conf --file2-cmd "$CMD2" --remote +``` + +#### Diff from a configmap + +Os-diff can query the Openshift configmap in order to perform diff between a provided file and a config file stored in the configmap: + +``` +os-diff cfgmap-diff --configmap keystone-config-data --config /tmp/collect_tripleo_configs/keystone/etc/keystone + +# From a file: +os-diff cfgmap-diff --configmap keystone-config-data.yaml --config /tmp/collect_tripleo_configs/keystone/etc/keystone + +# Or from a remote container: +CMD1="ssh -F ssh.config standalone podman exec a6e1ca049eee" +os-diff cfgmap-diff --configmap keystone-config-data --config /etc/keystone --remote --remode-cmd $CMD +``` + +## Examples: diff command compares file to file only and ouput a diff with color on the console. Example for YAML file: ```diff -./os-diff diff tests/podman/key.yaml tests/ocp/key.yaml +os-diff diff tests/podman/key.yaml tests/ocp/key.yaml Source file path: tests/podman/key.yaml, difference with: tests/ocp/key.yaml @@ line: 8 + pod_name: foo @@ -420,7 +447,7 @@ spec: Run service command: ```service -./os-diff cdiff -s glance -o examples/glance/glance.patch -c /tmp/glance.conf +./os-diff cdiff /tmp/glance.conf examples/glance/glance.patch --crd Source file path: examples/glance/glance.patch, difference with: /tmp/glance.conf -enabled_backends=default_backend:rbd -[glance_store] @@ -432,52 +459,6 @@ Source file path: examples/glance/glance.patch, difference with: /tmp/glance.con -store_description=Ceph glance store backend. ``` -Run comparison against the deployed pod: - -```service -./os-diff cdiff -s glance -o examples/glance/glance.patch -c /etc/glance/glance-api.conf \ ---frompod -p glance-external-api-678c6c79d7-24t7t - -Source file path: examples/glance/glance.patch, difference with: /etc/glance/glance-api.conf -[DEFAULT] --enabled_backends=default_backend:rbd -[glance_store] --default_backend=default_backend --[default_backend] --rbd_store_ceph_conf=/etc/ceph/ceph.conf --rbd_store_user=openstack --rbd_store_pool=images --store_description=Ceph glance store backend. -``` - -### Add service - -If you want to add a new OpenStack service to this tool follow those instructions: - -* Convert your OpenShift configmap to a GO struct with: -https://zhwt.github.io/yaml-to-go/ -* Create a .go file into pkg/servicecfg/ -* Paste your generated structure and the following code: -``` -package servicecfg - -import ( - "io/ioutil" - "strings" - - "gopkg.in/yaml.v2" -) - -type YourServiceName struct { - Spec struct { - YourServiceName struct { - Template: { - CustomServiceConfig string `yaml:"customServiceConfig"` - } - } - } -} -``` ### Asciinema demo https://asciinema.org/a/618124 diff --git a/cmd/diff.go b/cmd/diff.go index 8101a4b..61542b1 100644 --- a/cmd/diff.go +++ b/cmd/diff.go @@ -75,6 +75,9 @@ CMD1=oc exec -t neutron-cd94d8ccb-vq2gk -c neutron-api -- path1 := args[0] path2 := args[1] configPath := CheckFilesPresence(serviceCfgFile) + // Fix this, in the case where the --frompod or --frompodman is used, the service should be provided but not the podname + // because we already have the podname associated to the service. + if crd { if frompod { if podname == "" { @@ -129,6 +132,7 @@ func init() { diffCmd.Flags().BoolVar(&crd, "crd", false, "Compare a CRDs with a config file.") diffCmd.Flags().StringVarP(&serviceCfgFile, "service-config", "f", "config.yaml", "Path for the Yaml config where the services are described, default is config.yaml located in /etc/os-diff/config.yaml.") diffCmd.Flags().StringVarP(&service, "service", "s", "", "Service to compare with a crd, could be one of the services: cinder, glance, ovs_external_ids, edpm... Should be used with --crd option..") + diffCmd.Flags().StringVarP(&podname, "podname", "p", "", "Container or podname from where to get the config file.") diffCmd.Flags().BoolVar(&frompod, "frompod", false, "Get config file directly from OpenShift service Pod.") diffCmd.Flags().BoolVar(&frompodman, "frompodman", false, "Get config file directly from OpenStack podman container.") rootCmd.AddCommand(diffCmd) From e6a1ea42435aab4816e667f03b02767ebf309274 Mon Sep 17 00:00:00 2001 From: mathieu bultel Date: Tue, 16 Apr 2024 11:30:34 +0200 Subject: [PATCH 4/5] Add documentation for crd generation --- README.md | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/README.md b/README.md index 53d786b..3ae5760 100644 --- a/README.md +++ b/README.md @@ -459,6 +459,46 @@ Source file path: examples/glance/glance.patch, difference with: /tmp/glance.con -store_description=Ceph glance store backend. ``` +## CRD Generation from configuration file + +Os-diff can generate CRD file from a given configuration file with the following command: + +``` +os-diff gen --service glance --config my-conf.ini --output glance.patch +YAML file generated: glance.patch +``` + +Note that the `service` (Glance in this example), must be implemented in the servicecfg package in os-diff. +Follow the instruction to add new services in the documentation + +### Add service + +If you want to add a new OpenStack service to this tool follow those instructions: + +* Convert your OpenShift configmap to a GO struct with: +https://zhwt.github.io/yaml-to-go/ +* Create a .go file into pkg/servicecfg/ +* Paste your generated structure and the following code: +``` +package servicecfg + +import ( + "io/ioutil" + "strings" + + "gopkg.in/yaml.v2" +) + +type YourServiceName struct { + Spec struct { + YourServiceName struct { + Template: { + CustomServiceConfig string `yaml:"customServiceConfig"` + } + } + } +} +``` ### Asciinema demo https://asciinema.org/a/618124 From 22f3f67c9c672b70af6a356b43eb0ab4087221d1 Mon Sep 17 00:00:00 2001 From: David J Peacock Date: Mon, 29 Apr 2024 17:57:36 -0400 Subject: [PATCH 5/5] Tweaked for grammatical and typographical errors --- README.md | 57 +++++++++++++++++++++++++++---------------------------- 1 file changed, 28 insertions(+), 29 deletions(-) diff --git a/README.md b/README.md index 3ae5760..f6c9d31 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ OpenStack to OpenStack on OpenShift migration. #### Setup Ssh access -In order to allow Os-diff to connect to your clouds and pull files from the services you describe in the `config.yaml`file you need to properly set the option in the `os-diff.cfg`: +In order to allow os-diff to connect to your clouds and pull files from the services you describe in the `config.yaml` file you need to properly set the option in the `os-diff.cfg`: ``` [Default] @@ -37,7 +37,7 @@ ssh_cmd="" ``` -The `ssh_cmd` will be used by os-diff to access via ssh to your TripleO Undercloud/Director host or the host where your cloud is accessible and the podman/docker binary is installed and allowed to interract with the running containers. +The `ssh_cmd` will be used by os-diff to access your TripleO Undercloud/Director host via SSH, or the host where your cloud is accessible and the podman/docker binary is installed and allowed to interract with the running containers. This option could have different form: ``` @@ -50,7 +50,7 @@ ssh_cmd=ssh -F ssh.config director_host=standalone ``` -or without a ssh config file: +or without an SSH config file: ``` ssh_cmd=ssh -i /home/user/.ssh/id_rsa stack@my.undercloud.local @@ -64,18 +64,18 @@ ssh_cmd=ssh -i /home/user/.ssh/id_rsa stack@ director_host=my.undercloud.local ``` -Note that the concat of ssh_cmd + director_host should be a "successful ssh access". +Note that the result of ssh_cmd + director_host should be a "successful ssh access". #### Generate ssh.config file from inventory or hosts file -Os-diff can use an ssh.config file for getting access to your TripleO/OSP environment. -A command can help you to generate this ssh config file from your Ansible inventory (like tripleo-ansible-inventory.yaml file): +os-diff can use an ssh.config file for getting access to your TripleO/OSP environment. +A command can help you to generate this SSH config file from your Ansible inventory (like tripleo-ansible-inventory.yaml file): ``` os-diff configure -i tripleo-ansible-inventory.yaml -o ssh.config --yaml ``` -The ssh.config file will looks like this (for a Standalone deployment): +The ssh.config file will look like this (for a Standalone deployment): ``` Host standalone @@ -91,7 +91,7 @@ Host undercloud UserKnownHostsFile /dev/null ``` -Note: You will have to set the IdentityFile key in the file in order to get a fully working acces: +Note: You will have to set the IdentityFile key in the file in order to get full working acces: ``` Host standalone @@ -111,10 +111,10 @@ Host undercloud #### Non-standard services settings -It's important to configure correctly a ssh config file or equivalent for non standard services such as OVS. -The ovs_external_ids is not a service which runs in a container and the ovs data are stored on each hosts of our cloud: controller_1/controller_2/... +It's important to correctly configure an SSH config file or equivalent for non standard services such as OVS. +The ovs_external_ids is not a service which runs in a container and the ovs data is stored on each host of our cloud: controller_1/controller_2/... -The hosts key in the config.yaml will allow os-diff to loop and get for all hosts specified the output of the command or the file or the data that you need to pull from our deployment in order to compare it later: +The hosts key in the config.yaml will allow os-diff to loop over all hosts specified the output of the command, or the file or data that you need to pull from our deployment in order to compare it later: ``` ovs_external_ids: @@ -124,10 +124,10 @@ The hosts key in the config.yaml will allow os-diff to loop and get for all host - standalone ``` -The `service_command` is the command which provides the required informations. It could a simple cat from a config file. -`cat_output` should be set to true if you want os-diff to get the output of the command and stored the output in a file specified by the key `path` +The `service_command` is the command which provides the required information. It could be a simple cat from a config file. +`cat_output` should be set to true if you want os-diff to get the output of the command and store the output in a file specified by the key `path` -Then you can provide a mapping between, in this case the EDPM CRD and the ovs-vsctl output with `config_mapping` +Then you can provide a mapping between in this case the EDPM CRD, and the ovs-vsctl output with `config_mapping` ``` service_command: 'ovs-vsctl list Open_vSwitch . | grep external_ids | awk -F '': '' ''{ print $2; }''' @@ -150,7 +150,7 @@ os-diff diff ovs_external_ids.json edpm.crd --crd --service ovs_external_ids ### Pull configuration step Before running the Pull command you need to configure the SSH access to your environments (OpenStack and OCP). -Edit os-diff.cfg and/or the ssh.config provided with this project and make sure you can ssh on your hosts +Edit os-diff.cfg and/or the ssh.config provided with this project and make sure you can SSH to your hosts without password or host key verification, refer to the section below for more informations. When everything is setup correctly you can tweak the config.yaml file at the root of the project which will contain the description of the services you want to extract configuration from: @@ -213,7 +213,7 @@ services: ovn-ofctrl-wait-before-clear: edpm_ovn_ofctrl_wait_before_clear ``` -Note that `ovs_external_ids`is a non-standard service. This service is not an Openstack services executed in a container, so the description and the behavior is different. +Note that `ovs_external_ids`is a non-standard service. This service is not an Openstack service executed in a container, so the description and the behavior is different. You can refer to the section bellow for the non-standard configuration. OVS is an example, but you can simply add whatever your want to check on all your nodes. @@ -270,7 +270,7 @@ Note: The CLI arguments take precedence on the configuration file values. #### Compare configuration files steps -Os-diff provides multiple ways to compare files and directories. +os-diff provides multiple ways to compare files and directories. You can compare: - file vs file - directory vs directory (and sub directories) @@ -280,15 +280,15 @@ You can compare: - do remote diff - configmap vs file -#### Simple files diff +#### Simple file diff -Files comparison is the most simplest way to use os-diff: +File comparison is the simplest way to use os-diff: ``` os-diff diff tripleo/keystone.conf ocp/keystone.conf ``` -#### Directories diff +#### Directory diff Directory comparison and sub directory: @@ -296,7 +296,7 @@ Directory comparison and sub directory: os-diff diff tripleo ocp ``` -A results file is written at the root of this project `results.log` and a *.diff file is created for each +A results file is written at the root of this project, `results.log`, and a *.diff file is created for each file where a difference has been detected ```diff @@ -316,7 +316,7 @@ The log INFO/WARN and ERROR will be print to the console as well so you can have #### File Vs CRDs For file comparison with a CRD, you have to provide the --crd option. -The name of the service might be needed if the service is describe in the config.yaml previoulsy configured, with a config mapping: +The name of the service might be needed if the service is described in the config.yaml previously configured, with a config mapping: ``` os-diff diff examples/glance/glance.conf examples/glance/glance.patch --crd @@ -325,7 +325,7 @@ os-diff diff examples/glance/glance.conf examples/glance/glance.patch --crd os-diff diff ovs_external_ids.json edpm.crd --crd --service ovs_external_ids ``` -Where the edpm.crd may looks like this: +Where the edpm.crd may look like this: ``` apiVersion: dataplane.openstack.org/v1beta1 @@ -359,7 +359,7 @@ os-diff diff examples/glance/glance-api.conf /etc/glance/glance-api.conf --file2 #### Diff from a configmap -Os-diff can query the Openshift configmap in order to perform diff between a provided file and a config file stored in the configmap: +os-diff can query the OpenShift configmap in order to perform diff between a provided file and a config file stored in the configmap: ``` os-diff cfgmap-diff --configmap keystone-config-data --config /tmp/collect_tripleo_configs/keystone/etc/keystone @@ -417,10 +417,10 @@ Source file path: /tmp/collect_ocp_configs/keystone/etc/keystone/keystone.conf, ### OpenShift Pod config comparison -When you prepare the adoption of your TripleO cloud to your OpenShift cluster, you might want to compare and verify if the config described in your OpenShift config desc file has no difference with your Tripleo service config or even, want to verify that after patching the OpenShift config, the service is correctly configured. +When you prepare the adoption of your TripleO cloud to your OpenShift cluster, you might want to compare and verify if the config described in your OpenShift config desc file has no difference with your TripleO service config or even, want to verify that after patching the OpenShift config, the service is correctly configured. The service command allow you to compare YAML OpenShift config patch with OpenStack Ini configuration file from your services. -You can also query OpenShift pods to check if the configuration are correct. +You can also query OpenShift pods to check if the configuration is correct. Example: @@ -461,7 +461,7 @@ Source file path: examples/glance/glance.patch, difference with: /tmp/glance.con ## CRD Generation from configuration file -Os-diff can generate CRD file from a given configuration file with the following command: +os-diff can generate CRD file from a given configuration file with the following command: ``` os-diff gen --service glance --config my-conf.ini --output glance.patch @@ -469,11 +469,10 @@ YAML file generated: glance.patch ``` Note that the `service` (Glance in this example), must be implemented in the servicecfg package in os-diff. -Follow the instruction to add new services in the documentation ### Add service -If you want to add a new OpenStack service to this tool follow those instructions: +If you want to add a new OpenStack service to this tool follow these instructions: * Convert your OpenShift configmap to a GO struct with: https://zhwt.github.io/yaml-to-go/