Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

config gen initial work #7923

Merged
merged 1 commit into from Jul 20, 2023
Merged

config gen initial work #7923

merged 1 commit into from Jul 20, 2023

Conversation

vivek-yadav
Copy link
Collaborator

@vivek-yadav vivek-yadav commented May 27, 2023

🔩 Description: What code changed, and why?

Initial work on the Config gen is added here.
This will help generate Automate configs very easily with less mistakes.

This PR will contain Automate HA on Premise deployment config generation.

⛓️ Related Resources

https://chefio.atlassian.net/browse/CHEF-3313

FINAL DEMO VIDEO:
https://progresssoftware.sharepoint.com/:v:/s/ChefCoreC/EZJxepsuv25NtwXVpffEWRABib0VYzb14gc3ILaxpd2XPA?e=nugEyf

👍 Definition of Done

👟 How to Build and Test the Change

To build:

  1. cd components/automate-cli
  2. make darwin or make linux
  3. sudo ./bin/darwin/chef-automate config gen config.toml or sudo ./bin/linux/chef-automate config gen config.toml

✅ Checklist

All PRs must tick these:

With occasional exceptions, all PRs from Progress employees must tick these:

  • Is the code clear? (complicated code or lots of comments--subdivide and use well-named methods, meaningful variable names, etc.)
  • Consistency checked? (user notifications, user prompts, visual patterns, code patterns, variable names)
  • Repeated code blocks eliminated? (adapt and reuse existing components, blocks, functions, etc.)
  • Spelling, grammar, typos checked? (at a minimum use make spell in any component directory)
  • Code well-formatted? (indents, line breaks, etc. improve rather than hinder readability)

All PRs from Progress employees should tick these if appropriate:

  • Tests added/updated? (all new code needs new tests)
  • Docs added/updated? (all customer-facing changes)

Please add a note next to any checkbox above if you are NOT ticking it.

📷 Screenshots, if applicable

FINAL DEMO VIDEO: https://progresssoftware.sharepoint.com/:v:/s/ChefCoreC/EZJxepsuv25NtwXVpffEWRABib0VYzb14gc3ILaxpd2XPA?e=nugEyf

Screenshot 2023-05-27 at 11 11 35 AM
Screenshot 2023-05-27 at 11 12 12 AM

@netlify
Copy link

netlify bot commented May 27, 2023

👷 Deploy Preview for chef-automate processing.

Name Link
🔨 Latest commit 3d7b667
🔍 Latest deploy log https://app.netlify.com/sites/chef-automate/deploys/64b920deb139f900083cc0ff

@sonarqube-for-infrastructure-prod

SonarQube Quality Gate

Quality Gate failed

Failed condition 5.4% 5.4% Coverage on New Code (is less than 80%)

See analysis details on SonarQube

@semgrep-app
Copy link
Contributor

semgrep-app bot commented Jun 7, 2023

Semgrep found 1 ssc-6c040726-d493-4854-b380-987107b4c1bb finding:

Risk: github.com/docker/docker versions >= 23.0.0 before 23.0.3, >= 1.12.0 before 20.10.24 are vulnerable to Unprotected Alternate Channel / Not Failing Securely ('Failing Open'). Affected configurations silently accept cleartext VXLAN datagrams, enabling attackers to inject arbitrary Ethernet frames into the encrypted network. This can result in denial of service attacks or further escalations,

Fix: Upgrade this library to at least version 20.10.24 at automate/go.mod:146.

Reference(s): GHSA-232p-vwff-86mp, CVE-2023-28840

Ignore this finding from ssc-6c040726-d493-4854-b380-987107b4c1bb.

Semgrep found 1 ssc-734e9dad-4614-4af6-ae5e-35d15d0e7175 finding:

Risk: github.com/docker/distribution versions before 2.8.2-beta.1 are vulnerable to Uncontrolled Resource Consumption. The /v2/_catalog endpoint accepts a parameter to control the maximum amount of records returned (query string: n). When not given the default n=100 is used. The server trusts that n has an acceptable value, however when using a maliciously large value, it allocates an array/slice of n of strings before filling the slice with data.

Fix: Upgrade this library to at least version 2.8.2-beta.1 at automate/go.mod:145.

Reference(s): GHSA-hqxw-f8mx-cpmw, CVE-2023-2253

Ignore this finding from ssc-734e9dad-4614-4af6-ae5e-35d15d0e7175.

@vivek-yadav vivek-yadav force-pushed the config-gen branch 7 times, most recently from c778f5c to 02f6c20 Compare July 4, 2023 05:59
@vivek-yadav vivek-yadav force-pushed the config-gen branch 5 times, most recently from 55e88d4 to 8b4a146 Compare July 11, 2023 12:14
@vivek-yadav vivek-yadav force-pushed the config-gen branch 8 times, most recently from 711d54f to 740f9a2 Compare July 18, 2023 14:44
@vivek-yadav vivek-yadav changed the title [WIP] config gen initial work config gen initial work Jul 19, 2023
@vivek-yadav vivek-yadav removed the WIP label Jul 20, 2023
lib/config/genconfig/awshaprovisionconfig.go Show resolved Hide resolved
lib/config/genconfig/awshaprovisionconfig.go Show resolved Hide resolved
lib/config/genconfig/hadeployconfig.go Show resolved Hide resolved
lib/config/genconfig/hadeployconfig.go Show resolved Hide resolved
lib/config/genconfig/hadeployconfig.go Show resolved Hide resolved
lib/config/genconfig/hadeployconfig.go Show resolved Hide resolved
lib/config/genconfig/hadeployconfig.go Show resolved Hide resolved
lib/config/genconfig/genconfig.go Show resolved Hide resolved
lib/config/genconfig/hadeployconfig.go Outdated Show resolved Hide resolved
lib/config/genconfig/hadeployconfig.go Outdated Show resolved Hide resolved
lib/hardwarecal/hardwarecalprompt.go Outdated Show resolved Hide resolved
lib/pmt/prompt.go Show resolved Hide resolved
Signed-off-by: Vivek Yadav <vivek.yadav@progress.com>

added gen subcmd to config cmd

Signed-off-by: Vivek Yadav <vivek.yadav@progress.com>

add test for aws regions option list

Signed-off-by: Vivek Yadav <vivek.yadav@progress.com>

refactored based on main hadeployconfig model

Signed-off-by: Vivek Yadav <vivek.yadav@progress.com>

prompt moved

Signed-off-by: Vivek Yadav <vivek.yadav@progress.com>

on-prem flow completed

Signed-off-by: Vivek Yadav <vivek.yadav@progress.com>

custom certs added to ha onprem

Signed-off-by: Vivek Yadav <vivek.yadav@progress.com>

fix the config change based on main branch

Signed-off-by: Vivek Yadav <vivek.yadav@progress.com>

added password and paragraph support in prompt

Signed-off-by: Vivek Yadav <vivek.yadav@progress.com>

hardware cal added

Signed-off-by: Vivek Yadav <vivek.yadav@progress.com>

aws flow added and cert via file added

Signed-off-by: Vivek Yadav <vivek.yadav@progress.com>

added AWS Provision Config Gen with few tests

Signed-off-by: Vivek Yadav <vivek.yadav@progress.com>

aws ha deployment working

Signed-off-by: Vivek Yadav <vivek.yadav@progress.com>

fix custom certs

Signed-off-by: Vivek Yadav <vivek.yadav@progress.com>

regex fix

Signed-off-by: Vivek Yadav <vivek.yadav@progress.com>

fix fqdn regex

Signed-off-by: Vivek Yadav <vivek.yadav@progress.com>

regex made common

Signed-off-by: Vivek Yadav <vivek.yadav@progress.com>

added test for aws cidr managed flow

Signed-off-by: Vivek Yadav <vivek.yadav@progress.com>

changed ioutil to os in config.go cmd

Signed-off-by: Vivek Yadav <vivek.yadav@progress.com>

added test for AWS config gen flow

Signed-off-by: Vivek Yadav <vivek.yadav@progress.com>

unit tests added

Signed-off-by: Vivek Yadav <vivek.yadav@progress.com>

pg and os limit set to min 3

Signed-off-by: Vivek Yadav <vivek.yadav@progress.com>

added more unit test

Signed-off-by: Vivek Yadav <vivek.yadav@progress.com>

fix complexity

Signed-off-by: Vivek Yadav <vivek.yadav@progress.com>

fix code smells

Signed-off-by: Vivek Yadav <vivek.yadav@progress.com>

added tests

Signed-off-by: Vivek Yadav <vivek.yadav@progress.com>

fix pipeline

Signed-off-by: Vivek Yadav <vivek.yadav@progress.com>

added more unit tests

Signed-off-by: Vivek Yadav <vivek.yadav@progress.com>

revendor fix .bldr.toml

Signed-off-by: Vivek Yadav <vivek.yadav@progress.com>

simplified code

Signed-off-by: Vivek Yadav <vivek.yadav@progress.com>

removed not used code from prompt lib

Signed-off-by: Vivek Yadav <vivek.yadav@progress.com>

increased unit test coverage

Signed-off-by: Vivek Yadav <vivek.yadav@progress.com>

added unit tests for Init func in hadeployconfig

Signed-off-by: Vivek Yadav <vivek.yadav@progress.com>

make config gen command visible

Signed-off-by: Vivek Yadav <vivek.yadav@progress.com>

code review comment fix

Signed-off-by: Vivek Yadav <vivek.yadav@progress.com>

PR comment change

Signed-off-by: Vivek Yadav <vivek.yadav@progress.com>

removed comment

Signed-off-by: Vivek Yadav <vivek.yadav@progress.com>
@sonarqube-for-infrastructure-prod

@vivek-yadav vivek-yadav merged commit 8766db5 into main Jul 20, 2023
5 of 7 checks passed
@vivek-yadav vivek-yadav deleted the config-gen branch July 20, 2023 12:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants