Repository: replicatedhq/troubleshoot
Pull request #1106 (2023-04-11 00:03:36)

chore(deps): bump github.com/spf13/cobra from 1.6.1 to 1.7.0
Bumps [github.com/spf13/cobra](https://github.com/spf13/cobra) from 1.6.1 to 1.7.0.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a href="https://github.com/spf13/cobra/releases">github.com/spf13/cobra's releases</a>.</em></p>
<blockquote>
<h2>v1.7.0</h2>
<h3>✨ Features</h3>
<ul>
<li>Allow to preserve ordering of completions in <code>bash</code>, <code>zsh</code>, <code>pwsh</code>, &amp; <code>fish</code>: <a href="https://github.com/h4ck3rk3y"><code>@​h4ck3rk3y</code></a> <a href="https://redirect.github.com/spf13/cobra/issues/1903">#1903</a></li>
<li>Add support for PowerShell 7.2+ in completions: <a href="https://github.com/oldium"><code>@​oldium</code></a> <a href="https://redirect.github.com/spf13/cobra/issues/1916">#1916</a></li>
<li>Allow sourcing zsh completion script: <a href="https://github.com/marckhouzam"><code>@​marckhouzam</code></a> <a href="https://redirect.github.com/spf13/cobra/issues/1917">#1917</a></li>
</ul>
<h3>🐛 Bug fixes</h3>
<ul>
<li>Don't remove flag values that match sub-command name: <a href="https://github.com/brianpursley"><code>@​brianpursley</code></a> <a href="https://redirect.github.com/spf13/cobra/issues/1781">#1781</a></li>
<li>Fix powershell completions not returning single word: <a href="https://github.com/totkeks"><code>@​totkeks</code></a> <a href="https://redirect.github.com/spf13/cobra/issues/1850">#1850</a></li>
<li>Remove masked <code>template</code> import variable name: <a href="https://github.com/yashLadha"><code>@​yashLadha</code></a> <a href="https://redirect.github.com/spf13/cobra/issues/1879">#1879</a></li>
<li>Correctly detect completions with dash in argument: <a href="https://github.com/oncilla"><code>@​oncilla</code></a> <a href="https://redirect.github.com/spf13/cobra/issues/1817">#1817</a></li>
</ul>
<h3>🧪 Testing &amp; CI/CD</h3>
<ul>
<li>Deprecate Go 1.15 in CI: <a href="https://github.com/umarcor"><code>@​umarcor</code></a> <a href="https://redirect.github.com/spf13/cobra/issues/1866">#1866</a></li>
<li>Deprecate Go 1.16 in CI: <a href="https://github.com/umarcor"><code>@​umarcor</code></a> <a href="https://redirect.github.com/spf13/cobra/issues/1926">#1926</a></li>
<li>Add testing for Go 1.20 in CI: <a href="https://github.com/umarcor"><code>@​umarcor</code></a> <a href="https://redirect.github.com/spf13/cobra/issues/1925">#1925</a></li>
<li>Add tests to illustrate unknown flag bug: <a href="https://github.com/brianpursley"><code>@​brianpursley</code></a> <a href="https://redirect.github.com/spf13/cobra/issues/1854">#1854</a></li>
</ul>
<h3>🔧 Maintenance</h3>
<ul>
<li>Update main image to better handle dark backgrounds: <a href="https://github.com/Deleplace"><code>@​Deleplace</code></a> and <a href="https://github.com/marckhouzam"><code>@​marckhouzam</code></a> <a href="https://redirect.github.com/spf13/cobra/issues/1883">#1883</a></li>
<li>Fix <code>stale.yaml</code> mispellings: <a href="https://github.com/enrichman"><code>@​enrichman</code></a> <a href="https://redirect.github.com/spf13/cobra/issues/1863">#1863</a></li>
<li>Remove stale bot from GitHub actions: <a href="https://github.com/jpmcb"><code>@​jpmcb</code></a> <a href="https://redirect.github.com/spf13/cobra/issues/1908">#1908</a></li>
<li>Add makefile target for installing dependencies: <a href="https://github.com/umarcor"><code>@​umarcor</code></a> <a href="https://redirect.github.com/spf13/cobra/issues/1865">#1865</a></li>
<li>Add Sia to projects using Cobra: <a href="https://github.com/mike76-dev"><code>@​mike76-dev</code></a> <a href="https://redirect.github.com/spf13/cobra/issues/1844">#1844</a></li>
<li>Add <code>Vitess</code> and <code>Arewefastyet</code> to projects using cobra: <a href="https://github.com/frouioui"><code>@​frouioui</code></a> <a href="https://redirect.github.com/spf13/cobra/issues/1932">#1932</a></li>
<li>Fixup for Kubescape github org: <a href="https://github.com/dwertent"><code>@​dwertent</code></a> <a href="https://redirect.github.com/spf13/cobra/issues/1874">#1874</a></li>
<li>Fix route for GitHub workflows badge: <a href="https://github.com/sh-cho"><code>@​sh-cho</code></a> <a href="https://redirect.github.com/spf13/cobra/issues/1884">#1884</a></li>
<li>Fixup for GoDoc style documentation: <a href="https://github.com/yashLadha"><code>@​yashLadha</code></a> <a href="https://redirect.github.com/spf13/cobra/issues/1885">#1885</a></li>
<li>Various bash scripting improvements for completion: <a href="https://github.com/scop"><code>@​scop</code></a> <a href="https://redirect.github.com/spf13/cobra/issues/1702">#1702</a></li>
<li>Add Constellation to projects using Cobra: <a href="https://github.com/datosh"><code>@​datosh</code></a> <a href="https://redirect.github.com/spf13/cobra/issues/1829">#1829</a></li>
</ul>
<h3>✏️ Documentation</h3>
<ul>
<li>Add documentation about disabling completion descriptions: <a href="https://github.com/Shihta"><code>@​Shihta</code></a> <a href="https://redirect.github.com/spf13/cobra/issues/1901">#1901</a></li>
<li>Improve <code>MarkFlagsMutuallyExclusive</code> example in user guide: <a href="https://github.com/janhn"><code>@​janhn</code></a> <a href="https://redirect.github.com/spf13/cobra/issues/1904">#1904</a></li>
<li>Update <code>shell_completions.md</code>: <a href="https://github.com/gusega"><code>@​gusega</code></a> <a href="https://redirect.github.com/spf13/cobra/issues/1907">#1907</a></li>
<li>Update copywrite year: <a href="https://github.com/umarcor"><code>@​umarcor</code></a> <a href="https://redirect.github.com/spf13/cobra/issues/1927">#1927</a></li>
<li>Document suggested layout of subcommands: <a href="https://github.com/lcarva"><code>@​lcarva</code></a> <a href="https://redirect.github.com/spf13/cobra/issues/1930">#1930</a></li>
<li>Replace deprecated ExactValidArgs with MatchAll in doc: <a href="https://github.com/doniacld"><code>@​doniacld</code></a> <a href="https://redirect.github.com/spf13/cobra/issues/1836">#1836</a></li>
</ul>
<hr />
<p>This release contains several long running fixes, improvements to powershell completions, and further optimizations for completions.</p>
<p>Thank you everyone who contributed to this release and all your hard work! Cobra and this community would never be possible without all of you! 🐍</p>
<p>Full changelog:  <a href="https://github.com/spf13/cobra/compare/v1.6.1...v1.7.0">https://github.com/spf13/cobra/compare/v1.6.1...v1.7.0</a></p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a href="https://github.com/spf13/cobra/commit/4dd4b25de38418174a6e859e8a32eaccca32dccc"><code>4dd4b25</code></a> Update main image to better handle dark background (<a href="https://redirect.github.com/spf13/cobra/issues/1883">#1883</a>)</li>
<li><a href="https://github.com/spf13/cobra/commit/45360a55ccccf909b35f4290242bfb8a6bfbef66"><code>45360a5</code></a> Allow sourcing zsh completion script (<a href="https://redirect.github.com/spf13/cobra/issues/1917">#1917</a>)</li>
<li><a href="https://github.com/spf13/cobra/commit/c8a20a16bafa2dc85d304b59b2e677c7f75a73a6"><code>c8a20a1</code></a> Document suggested layout for subcommands (<a href="https://redirect.github.com/spf13/cobra/issues/1930">#1930</a>)</li>
<li><a href="https://github.com/spf13/cobra/commit/b197a24504fb0c99318ad0f07cb899e6074d315a"><code>b197a24</code></a> Update projects_using_cobra.md (<a href="https://redirect.github.com/spf13/cobra/issues/1932">#1932</a>)</li>
<li><a href="https://github.com/spf13/cobra/commit/9e6b58afc70c60a6b3c8a0138fb25acc734d47e3"><code>9e6b58a</code></a> update copyright year (<a href="https://redirect.github.com/spf13/cobra/issues/1927">#1927</a>)</li>
<li><a href="https://github.com/spf13/cobra/commit/fb3652402b30b582975880f652e7ed81343e8312"><code>fb36524</code></a> ci: test Golang 1.20 (<a href="https://redirect.github.com/spf13/cobra/issues/1925">#1925</a>)</li>
<li><a href="https://github.com/spf13/cobra/commit/c7300f0bdd22311c9a823ea0ea773bf968100eac"><code>c7300f0</code></a> ci: deprecate go 1.16 (<a href="https://redirect.github.com/spf13/cobra/issues/1926">#1926</a>)</li>
<li><a href="https://github.com/spf13/cobra/commit/567ea8ebc9b4385ae671486415cd203fc2a3bab9"><code>567ea8e</code></a> Add support for PowerShell 7.2+ (<a href="https://redirect.github.com/spf13/cobra/issues/1916">#1916</a>)</li>
<li><a href="https://github.com/spf13/cobra/commit/3daa4b9c36617509a756832a3d0ee2b6f4b8c129"><code>3daa4b9</code></a> Add keeporder to shell completion (<a href="https://redirect.github.com/spf13/cobra/issues/1903">#1903</a>)</li>
<li><a href="https://github.com/spf13/cobra/commit/a516d4132c811a4101ce6d99ac12671217d1ac37"><code>a516d41</code></a> Removes stale bot from GitHub action (<a href="https://redirect.github.com/spf13/cobra/issues/1908">#1908</a>)</li>
<li>Additional commits viewable in <a href="https://github.com/spf13/cobra/compare/v1.6.1...v1.7.0">compare view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=github.com/spf13/cobra&package-manager=go_modules&previous-version=1.6.1&new-version=1.7.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)


</details>


Patch:
diff --git a/config/crds/troubleshoot.sh_collectors.yaml b/config/crds/troubleshoot.sh_collectors.yaml
index 56426279..7cf96242 100644
--- a/config/crds/troubleshoot.sh_collectors.yaml
+++ b/config/crds/troubleshoot.sh_collectors.yaml
@@ -82,6 +82,27 @@ spec:
                       required:
                       - namespace
                       type: object
+                    certificates:
+                      properties:
+                        collectorName:
+                          type: string
+                        configMaps:
+                          additionalProperties:
+                            items:
+                              type: string
+                            type: array
+                          type: object
+                        exclude:
+                          type: BoolString
+                        name:
+                          type: string
+                        secrets:
+                          additionalProperties:
+                            items:
+                              type: string
+                            type: array
+                          type: object
+                      type: object
                     clusterInfo:
                       properties:
                         collectorName:
diff --git a/config/crds/troubleshoot.sh_preflights.yaml b/config/crds/troubleshoot.sh_preflights.yaml
index 9c4bc949..7e697839 100644
--- a/config/crds/troubleshoot.sh_preflights.yaml
+++ b/config/crds/troubleshoot.sh_preflights.yaml
@@ -1526,6 +1526,27 @@ spec:
                       required:
                       - namespace
                       type: object
+                    certificates:
+                      properties:
+                        collectorName:
+                          type: string
+                        configMaps:
+                          additionalProperties:
+                            items:
+                              type: string
+                            type: array
+                          type: object
+                        exclude:
+                          type: BoolString
+                        name:
+                          type: string
+                        secrets:
+                          additionalProperties:
+                            items:
+                              type: string
+                            type: array
+                          type: object
+                      type: object
                     clusterInfo:
                       properties:
                         collectorName:
diff --git a/config/crds/troubleshoot.sh_supportbundles.yaml b/config/crds/troubleshoot.sh_supportbundles.yaml
index 43b0a29e..d8a9a2b6 100644
--- a/config/crds/troubleshoot.sh_supportbundles.yaml
+++ b/config/crds/troubleshoot.sh_supportbundles.yaml
@@ -1557,6 +1557,27 @@ spec:
                       required:
                       - namespace
                       type: object
+                    certificates:
+                      properties:
+                        collectorName:
+                          type: string
+                        configMaps:
+                          additionalProperties:
+                            items:
+                              type: string
+                            type: array
+                          type: object
+                        exclude:
+                          type: BoolString
+                        name:
+                          type: string
+                        secrets:
+                          additionalProperties:
+                            items:
+                              type: string
+                            type: array
+                          type: object
+                      type: object
                     clusterInfo:
                       properties:
                         collectorName:
diff --git a/go.mod b/go.mod
index 4d92acd4..0b7f1c0d 100644
--- a/go.mod
+++ b/go.mod
@@ -31,7 +31,7 @@ require (
 	github.com/segmentio/ksuid v1.0.4
 	github.com/shirou/gopsutil/v3 v3.23.3
 	github.com/sirupsen/logrus v1.9.0
-	github.com/spf13/cobra v1.6.1
+	github.com/spf13/cobra v1.7.0
 	github.com/spf13/pflag v1.0.5
 	github.com/spf13/viper v1.15.0
 	github.com/stretchr/testify v1.8.2
@@ -134,7 +134,7 @@ require (
 	github.com/hashicorp/go-version v1.6.0
 	github.com/hashicorp/hcl v1.0.0 // indirect
 	github.com/imdario/mergo v0.3.13 // indirect
-	github.com/inconshreveable/mousetrap v1.0.1 // indirect
+	github.com/inconshreveable/mousetrap v1.1.0 // indirect
 	github.com/jmespath/go-jmespath v0.4.0 // indirect
 	github.com/josharian/intern v1.0.0 // indirect
 	github.com/json-iterator/go v1.1.12 // indirect
diff --git a/go.sum b/go.sum
index f5899daf..c3efc103 100644
--- a/go.sum
+++ b/go.sum
@@ -545,8 +545,8 @@ github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:
 github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
 github.com/imdario/mergo v0.3.13 h1:lFzP57bqS/wsqKssCGmtLAb8A0wKjLGrve2q3PPVcBk=
 github.com/imdario/mergo v0.3.13/go.mod h1:4lJ1jqUDcsbIECGy0RUJAXNIhg+6ocWgb1ALK2O4oXg=
-github.com/inconshreveable/mousetrap v1.0.1 h1:U3uMjPSQEBMNp1lFxmllqCPM6P5u/Xq7Pgzkat/bFNc=
-github.com/inconshreveable/mousetrap v1.0.1/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
+github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
+github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
 github.com/jackc/pgpassfile v1.0.0 h1:/6Hmqy13Ss2zCq62VdNG8tM1wchn8zjSGOBJ6icpsIM=
 github.com/jackc/pgpassfile v1.0.0/go.mod h1:CEx0iS5ambNFdcRtxPj5JhEz+xB6uRky5eyVu/W2HEg=
 github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a h1:bbPeKD0xmW/Y25WS6cokEszi5g+S0QxI/d45PkRi7Nk=
@@ -785,8 +785,8 @@ github.com/spf13/afero v1.9.3 h1:41FoI0fD7OR7mGcKE/aOiLkGreyf8ifIOQmJANWogMk=
 github.com/spf13/afero v1.9.3/go.mod h1:iUV7ddyEEZPO5gA3zD4fJt6iStLlL+Lg4m2cihcDf8Y=
 github.com/spf13/cast v1.5.0 h1:rj3WzYc11XZaIZMPKmwP96zkFEnnAmV8s6XbB2aY32w=
 github.com/spf13/cast v1.5.0/go.mod h1:SpXXQ5YoyJw6s3/6cMTQuxvgRl3PCJiyaX9p6b155UU=
-github.com/spf13/cobra v1.6.1 h1:o94oiPyS4KD1mPy2fmcYYHHfCxLqYjJOhGsCHFZtEzA=
-github.com/spf13/cobra v1.6.1/go.mod h1:IOw/AERYS7UzyrGinqmz6HLUo219MORXGxhbaJUqzrY=
+github.com/spf13/cobra v1.7.0 h1:hyqWnYt1ZQShIddO5kBpj3vu05/++x6tJ6dg8EC572I=
+github.com/spf13/cobra v1.7.0/go.mod h1:uLxZILRyS/50WlhOIKD7W6V5bgeIt+4sICxh6uRMrb0=
 github.com/spf13/jwalterweatherman v1.1.0 h1:ue6voC5bR5F8YxI5S67j9i582FU4Qvo2bmqnqMYADFk=
 github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo=
 github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
diff --git a/pkg/analyze/host_tcp_connect.go b/pkg/analyze/host_tcp_connect.go
index 1ebfc1fc..ef16681b 100644
--- a/pkg/analyze/host_tcp_connect.go
+++ b/pkg/analyze/host_tcp_connect.go
@@ -40,9 +40,9 @@ func (a *AnalyzeHostTCPConnect) Analyze(getCollectedFileContents func(string) ([
 	}
 
 	var coll resultCollector
+	result := &AnalyzeResult{Title: a.Title()}
 
 	for _, outcome := range hostAnalyzer.Outcomes {
-		result := &AnalyzeResult{Title: a.Title()}
 
 		if outcome.Fail != nil {
 			if outcome.Fail.When == "" {
@@ -51,7 +51,7 @@ func (a *AnalyzeHostTCPConnect) Analyze(getCollectedFileContents func(string) ([
 				result.URI = outcome.Fail.URI
 
 				coll.push(result)
-
+				break
 			}
 
 			if string(actual.Status) == outcome.Fail.When {
@@ -60,6 +60,7 @@ func (a *AnalyzeHostTCPConnect) Analyze(getCollectedFileContents func(string) ([
 				result.URI = outcome.Fail.URI
 
 				coll.push(result)
+				break
 			}
 		} else if outcome.Warn != nil {
 			if outcome.Warn.When == "" {
@@ -68,7 +69,7 @@ func (a *AnalyzeHostTCPConnect) Analyze(getCollectedFileContents func(string) ([
 				result.URI = outcome.Warn.URI
 
 				coll.push(result)
-
+				break
 			}
 
 			if string(actual.Status) == outcome.Warn.When {
@@ -77,6 +78,7 @@ func (a *AnalyzeHostTCPConnect) Analyze(getCollectedFileContents func(string) ([
 				result.URI = outcome.Warn.URI
 
 				coll.push(result)
+				break
 			}
 		} else if outcome.Pass != nil {
 			if outcome.Pass.When == "" {
@@ -85,7 +87,7 @@ func (a *AnalyzeHostTCPConnect) Analyze(getCollectedFileContents func(string) ([
 				result.URI = outcome.Pass.URI
 
 				coll.push(result)
-
+				break
 			}
 
 			if string(actual.Status) == outcome.Pass.When {
@@ -94,6 +96,7 @@ func (a *AnalyzeHostTCPConnect) Analyze(getCollectedFileContents func(string) ([
 				result.URI = outcome.Pass.URI
 
 				coll.push(result)
+				break
 			}
 		}
 	}
diff --git a/pkg/apis/troubleshoot/v1beta2/collector_shared.go b/pkg/apis/troubleshoot/v1beta2/collector_shared.go
index 70f4387b..506c0595 100644
--- a/pkg/apis/troubleshoot/v1beta2/collector_shared.go
+++ b/pkg/apis/troubleshoot/v1beta2/collector_shared.go
@@ -216,6 +216,13 @@ type RegistryImages struct {
 	ImagePullSecrets *ImagePullSecrets `json:"imagePullSecret,omitempty" yaml:"imagePullSecret,omitempty"`
 }
 
+type Certificates struct {
+	CollectorMeta `json:",inline" yaml:",inline"`
+	Name          string              `json:"name,omitempty" yaml:"name,omitempty"`
+	Secrets       map[string][]string `json:"secrets,omitempty" yaml:"secrets,omitempty"`
+	ConfigMaps    map[string][]string `json:"configMaps,omitempty" yaml:"configMaps,omitempty"`
+}
+
 type Collect struct {
 	ClusterInfo      *ClusterInfo      `json:"clusterInfo,omitempty" yaml:"clusterInfo,omitempty"`
 	ClusterResources *ClusterResources `json:"clusterResources,omitempty" yaml:"clusterResources,omitempty"`
@@ -238,6 +245,7 @@ type Collect struct {
 	Longhorn         *Longhorn         `json:"longhorn,omitempty" yaml:"longhorn,omitempty"`
 	RegistryImages   *RegistryImages   `json:"registryImages,omitempty" yaml:"registryImages,omitempty"`
 	Sysctl           *Sysctl           `json:"sysctl,omitempty" yaml:"sysctl,omitempty"`
+	Certificates     *Certificates     `json:"certificates,omitempty" yaml:"certificates,omitempty"`
 }
 
 func (c *Collect) AccessReviewSpecs(overrideNS string) []authorizationv1.SelfSubjectAccessReviewSpec {
@@ -539,6 +547,10 @@ func (c *Collect) GetName() string {
 		collector = "sysctl"
 		name = c.Sysctl.Name
 	}
+	if c.Certificates != nil {
+		collector = "certificates"
+		name = c.Certificates.CollectorName
+	}
 
 	if collector == "" {
 		return "<none>"
diff --git a/pkg/apis/troubleshoot/v1beta2/zz_generated.deepcopy.go b/pkg/apis/troubleshoot/v1beta2/zz_generated.deepcopy.go
index 48f4dd5d..7a6068ff 100644
--- a/pkg/apis/troubleshoot/v1beta2/zz_generated.deepcopy.go
+++ b/pkg/apis/troubleshoot/v1beta2/zz_generated.deepcopy.go
@@ -559,6 +559,52 @@ func (in *CertificateAnalyze) DeepCopy() *CertificateAnalyze {
 	return out
 }
 
+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
+func (in *Certificates) DeepCopyInto(out *Certificates) {
+	*out = *in
+	in.CollectorMeta.DeepCopyInto(&out.CollectorMeta)
+	if in.Secrets != nil {
+		in, out := &in.Secrets, &out.Secrets
+		*out = make(map[string][]string, len(*in))
+		for key, val := range *in {
+			var outVal []string
+			if val == nil {
+				(*out)[key] = nil
+			} else {
+				in, out := &val, &outVal
+				*out = make([]string, len(*in))
+				copy(*out, *in)
+			}
+			(*out)[key] = outVal
+		}
+	}
+	if in.ConfigMaps != nil {
+		in, out := &in.ConfigMaps, &out.ConfigMaps
+		*out = make(map[string][]string, len(*in))
+		for key, val := range *in {
+			var outVal []string
+			if val == nil {
+				(*out)[key] = nil
+			} else {
+				in, out := &val, &outVal
+				*out = make([]string, len(*in))
+				copy(*out, *in)
+			}
+			(*out)[key] = outVal
+		}
+	}
+}
+
+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Certificates.
+func (in *Certificates) DeepCopy() *Certificates {
+	if in == nil {
+		return nil
+	}
+	out := new(Certificates)
+	in.DeepCopyInto(out)
+	return out
+}
+
 // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
 func (in *ClusterInfo) DeepCopyInto(out *ClusterInfo) {
 	*out = *in
@@ -790,6 +836,11 @@ func (in *Collect) DeepCopyInto(out *Collect) {
 		*out = new(Sysctl)
 		(*in).DeepCopyInto(*out)
 	}
+	if in.Certificates != nil {
+		in, out := &in.Certificates, &out.Certificates
+		*out = new(Certificates)
+		(*in).DeepCopyInto(*out)
+	}
 }
 
 // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Collect.
diff --git a/pkg/collect/certificates.go b/pkg/collect/certificates.go
new file mode 100644
index 00000000..86776bba
--- /dev/null
+++ b/pkg/collect/certificates.go
@@ -0,0 +1,254 @@
+package collect
+
+import (
+	"bytes"
+	"context"
+	"crypto/tls"
+	"crypto/x509"
+	"encoding/json"
+	"encoding/pem"
+	"time"
+
+	troubleshootv1beta2 "github.com/replicatedhq/troubleshoot/pkg/apis/troubleshoot/v1beta2"
+	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
+	"k8s.io/client-go/kubernetes"
+	"k8s.io/client-go/rest"
+)
+
+type CollectCertificates struct {
+	Collector    *troubleshootv1beta2.Certificates
+	BundlePath   string
+	Namespace    string
+	ClientConfig *rest.Config
+	Client       kubernetes.Interface
+	Context      context.Context
+	RBACErrors
+}
+
+// Certificate collection struct
+type CertCollection struct {
+	Source           *CertificateSource  `json:"source"`
+	Errors           []string            `json:"errors"`
+	CertificateChain []ParsedCertificate `json:"certificateChain"`
+}
+
+// Certificate source
+type CertificateSource struct {
+	SecretName    string `json:"secret,omitempty"`
+	ConfigMapName string `json:"configMap,omitempty"`
+	Namespace     string `json:"namespace,omitempty"`
+}
+
+// Certificate Struct
+type ParsedCertificate struct {
+	CertName                string    `json:"certificate"`
+	Subject                 string    `json:"subject"`
+	SubjectAlternativeNames []string  `json:"subjectAlternativeNames"`
+	Issuer                  string    `json:"issuer"`
+	NotAfter                time.Time `json:"notAfter"`
+	NotBefore               time.Time `json:"notBefore"`
+	IsValid                 bool      `json:"isValid"`
+	IsCA                    bool      `json:"isCA"`
+}
+
+func (c *CollectCertificates) Title() string {
+	return getCollectorName(c)
+}
+
+func (c *CollectCertificates) IsExcluded() (bool, error) {
+	return isExcluded(c.Collector.Exclude)
+}
+
+func (c *CollectCertificates) Collect(progressChan chan<- interface{}) (CollectorResult, error) {
+
+	output := NewResult()
+	results := []CertCollection{}
+
+	// collect certificates from secrets
+	for secretName, namespaces := range c.Collector.Secrets {
+		for _, namespace := range namespaces {
+
+			secretCollections := secretCertCollector(secretName, namespace, c.Client)
+			results = append(results, secretCollections...)
+		}
+	}
+
+	// collect certificates from configMaps
+	for configMapName, namespaces := range c.Collector.ConfigMaps {
+		for _, namespace := range namespaces {
+			configMapCollections := configMapCertCollector(configMapName, namespace, c.Client)
+			results = append(results, configMapCollections...)
+		}
+	}
+
+	certsJson, errCertJson := json.MarshalIndent(results, "", "\t")
+	if errCertJson != nil {
+		return nil, errCertJson
+	}
+
+	filePath := "certificates/certificates.json"
+
+	err := output.SaveResult(c.BundlePath, filePath, bytes.NewBuffer(certsJson))
+	if err != nil {
+		return nil, err
+	}
+
+	return output, nil
+}
+
+// configmap certificate collector
+func configMapCertCollector(configMapName string, namespace string, client kubernetes.Interface) []CertCollection {
+
+	results := []CertCollection{}
+	trackErrors := []string{}
+	collection := []ParsedCertificate{}
+
+	getOptions := metav1.GetOptions{}
+
+	// Collect from configMaps
+	configMap, err := client.CoreV1().ConfigMaps(namespace).Get(context.Background(), configMapName, getOptions)
+	if err != nil {
+
+		// collect certificate source information
+		source := &CertificateSource{
+			SecretName: configMapName,
+			Namespace:  namespace,
+		}
+		trackErrors = append(trackErrors, "Either the configMap does not exist in this namespace or RBAC permissions are preventing certificate collection")
+
+		results = append(results, CertCollection{
+			Source:           source,
+			Errors:           trackErrors,
+			CertificateChain: collection,
+		})
+
+		return results
+
+	}
+
+	//Collect from configMap
+	source := &CertificateSource{
+		ConfigMapName: configMap.Name,
+		Namespace:     configMap.Namespace,
+	}
+	for certName, c := range configMap.Data {
+
+		certs := []byte(c)
+
+		certInfo, _ := CertParser(certName, certs)
+
+		collection = append(collection, certInfo...)
+	}
+	results = append(results, CertCollection{
+		Source:           source,
+		Errors:           trackErrors,
+		CertificateChain: collection,
+	})
+
+	return results
+}
+
+// secret certificate collector
+func secretCertCollector(secretName string, namespace string, client kubernetes.Interface) []CertCollection {
+
+	results := []CertCollection{}
+	trackErrors := []string{}
+	collection := []ParsedCertificate{}
+
+	getOptions := metav1.GetOptions{}
+	// Collect from secrets
+	secret, err := client.CoreV1().Secrets(namespace).Get(context.Background(), secretName, getOptions)
+	if err != nil {
+
+		// collect certificate source information
+		source := &CertificateSource{
+			SecretName: secretName,
+			Namespace:  namespace,
+		}
+		trackErrors = append(trackErrors, "Either the secret does not exist in this namespace or RBAC permissions are prenventing certificate collection")
+
+		results = append(results, CertCollection{
+			Source:           source,
+			Errors:           trackErrors,
+			CertificateChain: collection,
+		})
+
+		return results
+
+	}
+
+	// Collect from secret
+	source := &CertificateSource{
+		SecretName: secret.Name,
+		Namespace:  secret.Namespace,
+	}
+
+	for certName, certs := range secret.Data {
+		certInfo, _ := CertParser(certName, certs)
+
+		collection = append(collection, certInfo...)
+
+	}
+	results = append(results, CertCollection{
+		Source:           source,
+		Errors:           trackErrors,
+		CertificateChain: collection,
+	})
+
+	return results
+}
+
+// decode pem and validate data source contains
+func decodePem(certInput string) (tls.Certificate, []string) {
+	var cert tls.Certificate
+	trackErrors := []string{}
+	certPEMBlock := []byte(certInput)
+	var certDERBlock *pem.Block
+	for {
+		certDERBlock, certPEMBlock = pem.Decode(certPEMBlock)
+		if certDERBlock == nil {
+			trackErrors = append(trackErrors, "decodePem function error: cert block is empty")
+
+			break
+		}
+		if certDERBlock.Type == "CERTIFICATE" {
+			cert.Certificate = append(cert.Certificate, certDERBlock.Bytes)
+		}
+	}
+	return cert, trackErrors
+}
+
+// Certificate parser
+func CertParser(certName string, certs []byte) ([]ParsedCertificate, []string) {
+	//TODO: return trackErrors as well.
+	currentTime := time.Now()
+	data := string(certs)
+	certInfo := []ParsedCertificate{}
+	trackErrors := []string{}
+
+	certChain, decodePemTrackErrors := decodePem(data)
+
+	trackErrors = append(trackErrors, decodePemTrackErrors...)
+
+	for _, cert := range certChain.Certificate {
+
+		//parsed SSL certificate
+		parsedCert, errParse := x509.ParseCertificate(cert)
+		if errParse != nil {
+			trackErrors = append(trackErrors, errParse.Error())
+			continue
+		}
+
+		certInfo = append(certInfo, ParsedCertificate{
+			CertName:                certName,
+			Subject:                 parsedCert.Subject.ToRDNSequence().String(),
+			SubjectAlternativeNames: parsedCert.DNSNames,
+			Issuer:                  parsedCert.Issuer.ToRDNSequence().String(),
+			NotAfter:                parsedCert.NotAfter,
+			NotBefore:               parsedCert.NotBefore,
+			IsValid:                 currentTime.Before(parsedCert.NotAfter),
+			IsCA:                    parsedCert.IsCA,
+		})
+	}
+	return certInfo, trackErrors
+}
diff --git a/pkg/collect/collector.go b/pkg/collect/collector.go
index 72ffde1c..90d6c08c 100644
--- a/pkg/collect/collector.go
+++ b/pkg/collect/collector.go
@@ -101,6 +101,8 @@ func GetCollector(collector *troubleshootv1beta2.Collect, bundlePath string, nam
 		return &CollectRegistry{collector.RegistryImages, bundlePath, namespace, clientConfig, client, ctx, RBACErrors}, true
 	case collector.Sysctl != nil:
 		return &CollectSysctl{collector.Sysctl, bundlePath, namespace, clientConfig, client, ctx, RBACErrors}, true
+	case collector.Certificates != nil:
+		return &CollectCertificates{collector.Certificates, bundlePath, namespace, clientConfig, client, ctx, RBACErrors}, true
 	default:
 		return nil, false
 	}
@@ -176,6 +178,9 @@ func getCollectorName(c interface{}) string {
 	case *CollectSysctl:
 		collector = "sysctl"
 		name = v.Collector.Name
+	case *CollectCertificates:
+		collector = "certificates"
+		name = v.Collector.Name
 	default:
 		collector = "<none>"
 	}
diff --git a/schemas/collector-troubleshoot-v1beta2.json b/schemas/collector-troubleshoot-v1beta2.json
index e0c8b7fb..69975137 100644
--- a/schemas/collector-troubleshoot-v1beta2.json
+++ b/schemas/collector-troubleshoot-v1beta2.json
@@ -88,6 +88,38 @@
                   }
                 }
               },
+              "certificates": {
+                "type": "object",
+                "properties": {
+                  "collectorName": {
+                    "type": "string"
+                  },
+                  "configMaps": {
+                    "type": "object",
+                    "additionalProperties": {
+                      "type": "array",
+                      "items": {
+                        "type": "string"
+                      }
+                    }
+                  },
+                  "exclude": {
+                    "oneOf": [{"type": "string"},{"type": "boolean"}]
+                  },
+                  "name": {
+                    "type": "string"
+                  },
+                  "secrets": {
+                    "type": "object",
+                    "additionalProperties": {
+                      "type": "array",
+                      "items": {
+                        "type": "string"
+                      }
+                    }
+                  }
+                }
+              },
               "clusterInfo": {
                 "type": "object",
                 "properties": {
diff --git a/schemas/preflight-troubleshoot-v1beta2.json b/schemas/preflight-troubleshoot-v1beta2.json
index 8a9f3ffa..162e38f5 100644
--- a/schemas/preflight-troubleshoot-v1beta2.json
+++ b/schemas/preflight-troubleshoot-v1beta2.json
@@ -2312,6 +2312,38 @@
                   }
                 }
               },
+              "certificates": {
+                "type": "object",
+                "properties": {
+                  "collectorName": {
+                    "type": "string"
+                  },
+                  "configMaps": {
+                    "type": "object",
+                    "additionalProperties": {
+                      "type": "array",
+                      "items": {
+                        "type": "string"
+                      }
+                    }
+                  },
+                  "exclude": {
+                    "oneOf": [{"type": "string"},{"type": "boolean"}]
+                  },
+                  "name": {
+                    "type": "string"
+                  },
+                  "secrets": {
+                    "type": "object",
+                    "additionalProperties": {
+                      "type": "array",
+                      "items": {
+                        "type": "string"
+                      }
+                    }
+                  }
+                }
+              },
               "clusterInfo": {
                 "type": "object",
                 "properties": {
diff --git a/schemas/supportbundle-troubleshoot-v1beta2.json b/schemas/supportbundle-troubleshoot-v1beta2.json
index 170b19df..d646288e 100644
--- a/schemas/supportbundle-troubleshoot-v1beta2.json
+++ b/schemas/supportbundle-troubleshoot-v1beta2.json
@@ -2358,6 +2358,38 @@
                   }
                 }
               },
+              "certificates": {
+                "type": "object",
+                "properties": {
+                  "collectorName": {
+                    "type": "string"
+                  },
+                  "configMaps": {
+                    "type": "object",
+                    "additionalProperties": {
+                      "type": "array",
+                      "items": {
+                        "type": "string"
+                      }
+                    }
+                  },
+                  "exclude": {
+                    "oneOf": [{"type": "string"},{"type": "boolean"}]
+                  },
+                  "name": {
+                    "type": "string"
+                  },
+                  "secrets": {
+                    "type": "object",
+                    "additionalProperties": {
+                      "type": "array",
+                      "items": {
+                        "type": "string"
+                      }
+                    }
+                  }
+                }
+              },
               "clusterInfo": {
                 "type": "object",
                 "properties": {


Test patch:
diff --git a/.github/workflows/build-test-deploy.yaml b/.github/workflows/build-test-deploy.yaml
index a9f0b9c9..403b1821 100644
--- a/.github/workflows/build-test-deploy.yaml
+++ b/.github/workflows/build-test-deploy.yaml
@@ -75,6 +75,8 @@ jobs:
           echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
         shell: bash
       - uses: actions/checkout@v3
+        with:
+          fetch-depth: 0
       - run: make check-schemas
 
   compile-preflight:
diff --git a/pkg/analyze/host_tcp_connect_test.go b/pkg/analyze/host_tcp_connect_test.go
index df30a3bb..08897016 100644
--- a/pkg/analyze/host_tcp_connect_test.go
+++ b/pkg/analyze/host_tcp_connect_test.go
@@ -31,6 +31,11 @@ func TestAnalyzeTCPConnect(t *testing.T) {
 							Message: "Connection was refused",
 						},
 					},
+					{
+						Warn: &troubleshootv1beta2.SingleOutcome{
+							Message: "Unexpected TCP connection status",
+						},
+					},
 				},
 			},
 			result: []*AnalyzeResult{
@@ -60,6 +65,11 @@ func TestAnalyzeTCPConnect(t *testing.T) {
 							Message: "Connection was successful",
 						},
 					},
+					{
+						Warn: &troubleshootv1beta2.SingleOutcome{
+							Message: "Unexpected TCP connection status",
+						},
+					},
 				},
 			},
 			result: []*AnalyzeResult{
diff --git a/pkg/collect/certificates_test.go b/pkg/collect/certificates_test.go
new file mode 100644
index 00000000..ccaa5a04
--- /dev/null
+++ b/pkg/collect/certificates_test.go
@@ -0,0 +1,222 @@
+package collect
+
+import (
+	"strings"
+	"testing"
+)
+
+var chain = `-----BEGIN CERTIFICATE-----
+MIIB0zCCAX2gAwIBAgIJAI/M7BYjwB+uMA0GCSqGSIb3DQEBBQUAMEUxCzAJBgNV
+BAYTAkFVMRMwEQYDVQQIDApTb21lLVN0YXRlMSEwHwYDVQQKDBhJbnRlcm5ldCBX
+aWRnaXRzIFB0eSBMdGQwHhcNMTIwOTEyMjE1MjAyWhcNMTUwOTEyMjE1MjAyWjBF
+MQswCQYDVQQGEwJBVTETMBEGA1UECAwKU29tZS1TdGF0ZTEhMB8GA1UECgwYSW50
+ZXJuZXQgV2lkZ2l0cyBQdHkgTHRkMFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBANLJ
+hPHhITqQbPklG3ibCVxwGMRfp/v4X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HDXFtGm3WRggZRcrjasyodSKK6szbf96+9
+6syzAwvg9xxNtFxwbhRqqplMEz2sDWaggTrxCQzd
+-----END CERTIFICATE-----
+`
+
+var chain4 = `-----BEGIN CERTIFICATE-----
+Oy1is0whDArLNwIDAQABo4G9MIG6
+MA4GA1UdDwEB/wQEAwIE8DAdBgNVHQ4EFgQUbAavOY+vIXgc44k8GvLHH6mdzzYw
+HwYDVR0jBBgwFoAUb+S3Mu7cbwZiqZaEHTEMyUhLyH4waAYDVR0RBGEwX4IFZW52
+b3mCFGVudm95LnByb2plY3Rjb250b3VyghhlbnZveS5wcm9qZWN0Y29udG91ci5z
+dmOCJmVudm95LnByb2plY3Rjb250b3VyLnN2Yy5jbHVzdGVyLmxvY2FsMA0GCSqG
+SIb3DQEBCwUAA4IBAQBIKpBD1T9tugzJF7lajbdulXTb9qGibwQALqauskX9Sq57
+po/R2TjyxywLn4DgM7BAzzu9qfHWf+S4eQjRUHQshPbUEX9CEsSd5tCu8ZHVbBds
+6qFagl2+YQ9ng0Xwta9ezvctM3T6Dy9Kkf5OOe9ysMEsBX7s8NFxe68Qku+cExr3
+78oERlIoNOlT0cNbFLAlH2svNv1uB4qOThRDha52L+mlUdZfTMYZAwNDJWm52t/M
+NCIm5NJ5jAJpcJmoEb+JMP3j0x6wydHDXFtGm3WRggZRcrjasyodSKK6szbf96+9
+6syzAwvg9xxNtFxwbhRqqplMEz2sDWaggTrxCQzd
+-----END CERTIFICATE-----
+`
+
+// tests validate that the certParser function correctly parses a certificate
+func TestCertParser(t *testing.T) {
+
+	expiredCert := []byte(chain)
+	multiCert := []byte(chain2)
+	validCert := []byte(chain3)
+	nonCert := []byte(chain4)
+	//add docs
+
+	certParserTests := []struct {
+		Name      string
+		Certs     []byte
+		CertQty   int
+		IsSubject bool
+		IsCert    bool
+		IsValid   bool
+	}{
+		// Name, Certs, CertQty, IsSubject, IsCert, IsValid
+		{"Widgits", expiredCert, 1, true, true, false},
+		{"digicert", multiCert, 2, true, true, false}, //IsValid will not be evaluated for multicerts
+		{"envoy", validCert, 1, true, true, true},
+		{"non.crt", nonCert, 1, false, false, false}, // IsSubject and IsValid n/a for non.crt
+	}
+
+	for _, e := range certParserTests {
+
+		results, _ := CertParser(e.Name, e.Certs)
+
+		// tests if results contains a list of parsed certificates
+		var isCert bool
+		if len(results) == 0 {
+			isCert = false
+		} else {
+			isCert = true
+		}
+
+		if isCert != e.IsCert {
+			t.Errorf("Expected %v, but got %v that %s is a certificate", e.IsCert, isCert, e.Name)
+			continue
+		}
+
+		for _, cert := range results {
+
+			t.Log(e.Name, cert.Subject)
+
+			// test checks if certificate subject contains a matching string; validates that can parse cert and pull back information
+			if !strings.Contains(cert.Subject, e.Name) {
+				t.Error("unable to parse certificate: ", e.Name)
+
+			} else {
+				isSubject := true
+				if e.IsSubject != isSubject {
+					t.Errorf("You expected that %s certificate contains %s in the Subject line but it was not present; here is the entire subject string: %v", e.Name, e.Name, cert.Subject)
+				}
+			}
+
+			// test checks for expected quantity of certificates in a certificate file
+			numCerts := len(results)
+			if numCerts != e.CertQty {
+				t.Errorf("expected %d certificates in slice but got %d", e.CertQty, numCerts)
+			}
+			if numCerts > 1 {
+				continue
+			}
+
+			// test checks for expected certificate expired
+			if cert.IsValid != e.IsValid {
+				t.Errorf("When checing that %v certificate is expired, you expected %v, but got %v ", e.Name, e.IsValid, cert.IsValid)
+			}
+
+		}
+
+	}
+
+}
+
+// validates that certificate count is correct when parsing a certificate input string.
+func Test_decodePem(t *testing.T) {
+	certDecoderTests := []struct {
+		Name      string
+		certInput string
+		certCount int
+	}{
+		{"widgets-cert", chain, 1},
+		{"digi-cert", chain2, 2},
+	}
+	for _, e := range certDecoderTests {
+		results, _ := decodePem(e.certInput)
+		certCount := 0
+
+		for _, cert := range results.Certificate {
+			t.Log(cert)
+			certCount++
+		}
+		if certCount != e.certCount {
+			t.Errorf("cert count -- expected %d, but got %d", e.certCount, certCount)
+		}
+
+	}
+}