Skip to content

Commit b55c1f5

Browse files
JoaoFulatremesRicardo Lüdersrhrmoopenshift-bot
authored
Rebasing IO stage branch (#755)
* OCPBUGS-2249: fix the schema checking conditional gathering rules (#687) * refactor(workloads_info): improving code reability (#650) This was the first try to improve workloads_info reability. It still have space to improve, but at least it reduces the funlen. * OCPBUGS-2915: Updated info link in insights recommendations (#683) * Updated info link in insights recommendations * updated AdvisorURI in insightsreport * unit tests update * updated code in case of GetClusterVersion() error * small fix in recommendation link * reworking how info link gets cluster ID * update of GetClusterVersion() in case of error * Updated where clusterID is being set, created interface for mocking insightsClient inside unit tests * updated interface name and noop-ed function in unit tests * Use cgroups memory usage data in the archive metadata (#693) * Update README.md Just a dummy commit for a dummy PR. Only to run tests * PR template preview and changelog update (#692) * PR template preview and changelog update fixed enhancements not being collected * Enhancements in changelog fix * Update CHANGELOG * tiny changelog readme update * removing backports from changelog * OCPBUGS-3377: fix: storage/ceph path structure (#691) * fix: storage/ceph path structure * fix: archive filename path in docs * docs(storage): adding storage to sample archive * docs(gathered-data): update docs format * docs(gathered-data): update cephcluster * docs(gathered-data): update storagecluster * docs(gathered-data): fix docs * Change of kube-system namespace configmap location according to docs. (#694) * Changed the path of kube system namespace cluster config file to match the documented structure. * Update of sample archive * code updated according to review * Updating ose-insights-operator images to be consistent with ART (#700) Reconciling with https://github.com/openshift/ocp-build-data/tree/61541c1c730569d20db98c885bb07d7ee96e648c/images/ose-insights-operator.yml Co-authored-by: AOS Automation Release Team <[email protected]> * Update OpenShift versions & new Download time field (#705) * OpenShift API update * OpenShift client update * Set the new download time field * Update the CRD as well * chore(golanglint-ci) disabling some linters for *_test.go files (#703) * refactor(scheduler): move GatherSchedulerLogs to its own file (#701) * refactor(webhookconfigurations): remove asset method and split tests (#702) * OCPBUGS-5257 do not get disabled rules (#706) There are two ways to disable a rule. First is to do that for particular cluster. This would work with this original query parameter. Second is to do that for your organization (multiple clusters) and this is not currently supported by the API (and the query parameter). * Update operator name in the OWNERS file (#712) * OCPBUGS-5347: do not periodically update Available clusteroperator co… (#709) * OCPBUGS-5347: do not periodically update Available clusteroperator condition in disabled state * Make sure the conditions time are correct * OCPBUGS-5347: additional fix (#716) * Revert "OCPBUGS-5347: additional fix (#716)" (#717) This reverts commit c857982. * operators gatherer - handle ingresscontroller relatedObject & simplify (#714) the code * arch docs update - explain disabled=true status more (#721) * arch docs update - explain disabled=true status more * Minor wording fix * chore(docs): update gathered documentation (#704) * chore(docs): update gathered documentation * chore(docs): conditional/pod_definition updated * chore(docs): clusterconfig/pod_network_connectivity_checks updated * chore(docs): clusterconfig/tsdb_status updated * chore(docs): clusterconfig/silenced_alerts updated * chore(docs): clusterconfig/sap_license_management_logs updated * chore(docs): clusterconfig/sap_pods updated * chore(docs): update gathered-data * chore(docs): clusterconfig/openshift_snd_logs updated * chore(docs): clusterconfig/openshift_machine_api_events updated * chore(docs): clusterconfig/openshift_logging updated * chore(docs): update gathered-data * chore(docs): clusterconfig/sheduler updated * chore(docs): clusterconfig/sheduler_logs updated * chore(docs): clusterconfig/openshift_authentication_logs updated * chore(docs): clusterconfig/openshift_apiserver_operator_logs updated * chore(docs): fixes scheduler_logs and openshift_authentication_logs docs * chore(docs): clusterconfig/olm_operators updated * chore(docs): clusterconfig/nodes updated * chore(docs): clusterconfig/node_logs updated * docs(chore): fixes clusterconfig/olm_operatos bp version * chore(docs): clusterconfig/netnamespaces updated * chore(docs): clusterconfig/mutating_webhook_configurations updated * chore(docs): clusterconfig/machine_sets updated * chore(docs): clusterconfig/machine_healthchecks updated * chore(docs): clusterconfig/machine_configs updated * feat(gendoc): generate link to sample files * chore(docs): update gathered-data * chore(docs): fixes bp versions * chore(docs): clusterconfig/machine_configs updated * chore(docs): clusterconfig/machine_autoscalers updated * chore(docs): clusterconfig/kube_controller_manager_logs updated * chore(docs): clusterconfig/jaegers updated * chore(docs): clusterconfig/install_plans updated + clean global var * chore(docs): clusterconfig/ceph_cluster updated * chore(docs): update clusterconfig/active_alerts + unecessary global const * chore(docs): update clusterconfig/certificate_signing_requests + unecessary global const * chore(docs): clusterconfig/authentications updated * chore(docs): clusterconfig/feature_gates updated * chore(docs): clusterconfig/image updated * chore(docs): clusterconfig/image_pruners updated * chore(docs): clusterconfig/infrastructure updated * chore(docs): clusterconfig/ingress updated * chore(docs): clusterconfig/networks updated * fix(image_registries) remove var from package scope * chore(docs): clusterconfig/oauths updated * chore(docs): clusterconfig/proxies updated * refactor(service_accounts): remove global constant * chore(docs): update gathered-data for preview * chore(docs): clusterconfig/container_images updated * chore(docs): clusterconfig/container_runtime_configs updated * chore(docs): clusterconfig/cost_management_metrics_configs updated * chore(docs): clusterconfig/custom_resource_definitions updated * refactor(dvo_metrics): remove global scope variables * chore(docs): clusterconfig/dvo_metrics updated * chore(docs): clusterconfig/host_subnets updated * chore(docs): clusterconfig/operators_pods_events updated * chore(docs): update gathered-data * chore(docs): clusterconfig/image_registries updated * chore(docs): clusterconfig/operators updated * chore(version): remove TODOs and create tracking task for it * chore(docs): conditional/api_request_counts_of_resource_from_alert updated * chore(docs): conditional/containers_logs * chore(docs): conditional/logs_of_namespace updated * chore(gendoc): clean up blankline * chore(gendoc): simplify samplearchive regex * chore(docs): conditional/image_streams_of_namespace updated * chore(docs): fix missing sample data * chore(docs): clusterconfig/config_maps updated * chore(docs): clusterconfig/recent_metrics updated * chore(docs): explicit minor version * chore(docs): clusterconfig/namespaces_with_overlapping_uids updated * chore(docs): clusterconfig/openshift_sdn_controller_logs updated * chore(docs): clusterconfig/openshift_sdn_controller_logs and gathered-data updated * chore(docs): remove conditional data notes * chore(docs): fix imagE_registries note about pv * chore(docs): fix typo * chore(docs): fix version for archive on image_pruners * chore(docs): fix version for archive on ceph_cluster * chore(docs): rename notes to changes * chore(docs): fix wrong sample path for csr * chore(docs): fix version for clusterconfig/container_images * chore(docs): missing clusteroperator config id * chore(docs): adjust location in archive * chore(docs): fix config_maps bp version * chore(docs): fix release version for clusterconfig/mutating_webhook_configurations * chore(docs): updating bp version for clusterconfig/openshift_sdn_logs * chore(docs): update bp versions for clusterconfig/pdbs * chore(docs): fix bp version for clusterconfig/service_accounts * chore(docs): fix clusterconfig/validating_webhook_configurations versions * chore(docs): rephrase changes for clusterconfig/operators_pods_and_events * Update docs/gathered-data.md Co-authored-by: Jan Holeček <[email protected]> * Update docs/gathered-data.md Co-authored-by: Jan Holeček <[email protected]> * Update docs/gathered-data.md Co-authored-by: Jan Holeček <[email protected]> * chore(docs): update based on review * chore(docs): update gathered-data * chore(docs): update clusterconfig/machine_configs versions * chore(docs): update clusterconfig/operators_pods_and_events * docs(chore): fix clusterconfig/version location in archive * chore(docs): update clusterconfig/operators * chore(docs): document should be data oriented to conditional gathering as well * chore(docs): update code style --------- Co-authored-by: Jan Holeček <[email protected]> * OCPBUGS-6781: Create gatherer for gathering machines. (#725) * Created gatherer for gathering machine objects. * Fixing names of functions, variables, etc * fixing file names * Docs update with new gathered data and new sample data. * formatted json files to human readable format * documentation and code fixes * Fixed location of sample files in docs * Updated docs based on new format. * tiny fix of go comment * fixes * unit test fixes * lint fix * unit test fixes * OCPBUGS-6832: feat(recent_metrics) adds openshift_apps_deploymentconfigs_strategy_total (#726) * feat(recent_metrics) adds openshift_apps_deploymentconfigs_strategy_total * chore(docs): update gathered data * fix(status/controller): fix status error for UnknownError * OCPBUGS-6731: Anonymize env vars from containers: HTTP_PROXY, HTTPS_PROXY (#723) * WIP draft overwriting env vars values * Add unit test for env var obfuscation on container images gatherer * Refactor obfuscate env vars functionality * Fix obfusctation functionality and tests lint issues * Move sensitive env vars obfuscation logic to anonymize utils package * Add env vars obfuscation to pod recording * Use assert library * Add PR 723 Obfuscate HTTP_PROXY and HTTPS_PROXY * Fix PR 723 type to bugfix * Add unit tests to openshift sdn controller logs gatherer (#733) * Rename sdn controller log gatherer file * Refactor messagesfilter to open testing * Add sdn controller logs gather unit tests * Refactor SDNControllerLogs aux function name * Update changelog #733 SDN controller log gatherer file renamed * Refactor SDN controller logs unit tests * Fix tests to work in parallel and minor refactor * Fix lint complaining about loopclosure * gather logs - update "FilterLogFromScanner" function and add some tests (#735) * test(oauth): add unit test for oauth.go and rename it to gather_cluster_oauth.go (#738) * rename oauth.go and create unit tests for it * lint fix * refactoring * test(clusterconfig): add unit test for ingresses.go and rename it to gather_cluster_ingress.go (#729) * chore(cluster_ingress): rename ingressess.go to gather_cluster_ingress.go * test(clusteR_ingress): add missing unit test * test(clusterconfig): add unit test for silenced_alerts.go and rename it to gather_silenced_alerts.go (#728) * test(silenced_alerts): adding unit tests * chore(clusterconfig): rename silenced_alerts.go to gather_silenced_alerts.go * test(silenced_alerts): convert unit test to table-driven * test(clusterconfig): review slienced_alerts tests * test(clusterconfig): handle errs on gather_silenced_alerts_test.go * Updating ose-insights-operator images to be consistent with ART (#748) Reconciling with https://github.com/openshift/ocp-build-data/tree/e18d948b6ec9fc99c368102cffc1eea0c01f5765/images/ose-insights-operator.yml Co-authored-by: AOS Automation Release Team <[email protected]> * OCPBUGS-8082: service_accounts.go Marshal fix (#744) * fixed code in service_accounts.go * updated unit tests for service accounts gathering * updated archive sample * Updated code based on review * updated code based on review and tremes input * updated code and unit tests based on review * OCPBUGS-7870: Collect info about monitoring pods pv (#741) * DRAFT First approach to get PVs from openshift-monitoring namespace * DRAFT unit tests trying to mockup PVs * WIP Rework PV gatherer to allow unit tests, missing Doc yet * WIP Rework PV Gatherer simple unit test * Rename monitor PVs gatherer filename * Rename unit tests for monitoring PVs gatherer * Add monitoring PVs gatherer to clusterconfig * Refactor adding possible errors track on getting persistent volumes * Add sample file for Prometheus Persistent Volumes * Rework unit tests to table format and Add two more tests * Update changelog conflicts from rebase * Rework monitoring pv gatherer checking configmaps * Fix unit tests to new gather function * Add new use case for not matching persistent volumes * Add functions documentation and linting fixes * Fix lint about variable names without underscore * Fix monitoring persistent volume sample misleading name * Fix context bad practice (inside struct) moved to parameter * Fix missing removal of debug log printing * Add new unit tests for monitoring gatherer private logic * Refactor GatherMonitoringPVs logic to work with exact configuration data * Update changelog and docs with new versioning * Minor refactor to getDefaultPrometheusName tests * Fix linting errors: too long lines * Fixed unknown backport versions * Refactor mock to an external file on testdata folder * Refactor functions naming and doc to better suit logic * Refactor context Background method * Rework gatherer without ConfigMap search as redundant * Fix linting * update periodic_test.go & run unit tests with -race param (#745) * Update docs & remove gathering of non-existing 'etcd_object_counts' m… (#743) * Update docs & remove gathering of non-existing 'etcd_object_counts' metric * reword backport versions * test(clusterconfig): add unit test for active_alerts.go and rename it to gather_active_alerts.go (#730) * chore(clusterconfig): rename active_alerts.go to gather_active_alerts.go * test(active_alerts): adding unit tests * test(clusterconfig): add unit tests for cluster proxy gatherer (#756) * Rename file to follow naming convention * Add unit tests for cluster proxy gatherer * Update changelog with last PR * Fix linting * Fix gocritic linter recommendations * Fix revive linting recommendation * test(clusterconfig): add unit test for nodes.go and rename it to gather_nodes.go (#731) * chore(clusterconfig): rename nodes.go to gather_nodes.go * test(nodes): add unit tests to gather * test(gathere_nodes): fix assert * test(clusterconfig): adjust gather_node_test context * docs(gathered-data): adds anonymization info for gather_nodes * docs(gathered-data): update gather_node docs * test(clusterconfig): add unit test for version.go and rename it to gather_cluster_version.go (#732) * chore(clusterconfig): rename version.go to gather_cluster_version.go * test(clusterconfig): adds unit test for gather_cluster_version * test(clusterconfig): reduce dups for gather_cluster_version_test * changelog update (#760) * changelog update * deleted duplicate of #723 * update of latest hash --------- Co-authored-by: Tomas Remes <[email protected]> Co-authored-by: Ricardo Lüders <[email protected]> Co-authored-by: Richard Hrmo <[email protected]> Co-authored-by: OpenShift Bot <[email protected]> Co-authored-by: AOS Automation Release Team <[email protected]> Co-authored-by: Deep Mistry <[email protected]> Co-authored-by: Jan Holeček <[email protected]> Co-authored-by: Isaac Jimeno <[email protected]> Co-authored-by: Isaac Jimeno <[email protected]>
1 parent 06b3f91 commit b55c1f5

File tree

110 files changed

+7474
-2141
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

110 files changed

+7474
-2141
lines changed

.ci-operator.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
build_root_image:
22
name: release
33
namespace: openshift
4-
tag: rhel-8-release-golang-1.19-openshift-4.13
4+
tag: rhel-8-release-golang-1.19-openshift-4.14

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,6 @@ devspace.yaml
1010

1111
cover.out
1212
_output
13+
14+
# MacOS
15+
.DS_Store

CHANGELOG.md

+40-1
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,48 @@
11
# Note: This CHANGELOG is only for the changes in insights operator.
2-
Please see OpenShift release notes for official changes\n<!--Latest hash: 76cc46b739c27281db0f7b2a23eb091b2a70f698-->
2+
Please see OpenShift release notes for official changes\n<!--Latest hash: e761abf647746c56fb8c2a59fb683984795a0624-->
3+
## 4.14
4+
5+
### Data Enhancement
6+
- [#741](https://github.com/openshift/insights-operator/pull/685) Gather openshift-monitoring persistent volumes
7+
8+
### Others
9+
- [#756](https://github.com/openshift/insights-operator/pull/756) add unit tests for cluster proxy gatherer
10+
311
## 4.13
412

13+
### Data Enhancement
14+
- [#726](https://github.com/openshift/insights-operator/pull/726) feat(recent_metrics) adds openshift_apps_deploymentconfigs_strategy_total
15+
- [#725](https://github.com/openshift/insights-operator/pull/725) Create gatherer for gathering machines.
16+
- [#714](https://github.com/openshift/insights-operator/pull/714) operators gatherer - handle ingresscontroller relatedObject & simplify
17+
18+
### Bugfix
19+
- [#723](https://github.com/openshift/insights-operator/pull/723) Obfuscate HTTP_PROXY and HTTPS_PROXY env variables on containers
20+
- [#716](https://github.com/openshift/insights-operator/pull/716) additional fix
21+
- [#709](https://github.com/openshift/insights-operator/pull/709) do not periodically update Available clusteroperator co…
22+
- [#706](https://github.com/openshift/insights-operator/pull/706) do not get disabled rules
23+
- [#694](https://github.com/openshift/insights-operator/pull/694) Change of kube-system namespace configmap location according to docs.
24+
- [#691](https://github.com/openshift/insights-operator/pull/691) storage/ceph path structure
25+
526
### Others
27+
- [#728](https://github.com/openshift/insights-operator/pull/728) add unit test for silenced_alerts.go and rename it to gather_silenced_alerts.go
28+
- [#729](https://github.com/openshift/insights-operator/pull/729) add unit test for ingresses.go and rename it to gather_cluster_ingress.go
29+
- [#738](https://github.com/openshift/insights-operator/pull/738) add unit test for oauth.go and rename it to gather_cluster_oauth.go
30+
- [#735](https://github.com/openshift/insights-operator/pull/735) gather logs - update "FilterLogFromScanner" function and add some tests
31+
- [#733](https://github.com/openshift/insights-operator/pull/733) Add unit tests to openshift sdn controller logs gatherer
32+
- [#704](https://github.com/openshift/insights-operator/pull/704) update gathered documentation
33+
- [#721](https://github.com/openshift/insights-operator/pull/721) arch docs update - explain disabled=true status more
34+
- [#712](https://github.com/openshift/insights-operator/pull/712) Update operator name in the OWNERS file
35+
- [#702](https://github.com/openshift/insights-operator/pull/702) remove asset method and split tests
36+
- [#701](https://github.com/openshift/insights-operator/pull/701) move GatherSchedulerLogs to its own file
37+
- [#703](https://github.com/openshift/insights-operator/pull/703) chore(golanglint-ci) disabling some linters for *_test.go files
38+
- [#705](https://github.com/openshift/insights-operator/pull/705) Update OpenShift versions & new Download time field
39+
- [#692](https://github.com/openshift/insights-operator/pull/692) PR template preview and changelog update
640
- [#693](https://github.com/openshift/insights-operator/pull/693) Use cgroups memory usage data in the archive metadata
41+
- [#733](https://github.com/openshift/insights-operator/pull/733) Renamed log gatherer file (SDN controller) and unit tests
42+
43+
### Misc
44+
- [#717](https://github.com/openshift/insights-operator/pull/717) additional fix"
45+
- [#700](https://github.com/openshift/insights-operator/pull/700) Updating ose-insights-operator images to be consistent with ART
746

847
## 4.12
948

Dockerfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
FROM registry.ci.openshift.org/ocp/builder:rhel-8-golang-1.19-openshift-4.13 AS builder
1+
FROM registry.ci.openshift.org/ocp/builder:rhel-8-golang-1.19-openshift-4.14 AS builder
22
WORKDIR /go/src/github.com/openshift/insights-operator
33
COPY . .
44
RUN make build
55

6-
FROM registry.ci.openshift.org/ocp/4.13:base
6+
FROM registry.ci.openshift.org/ocp/4.14:base
77
COPY --from=builder /go/src/github.com/openshift/insights-operator/bin/insights-operator /usr/bin/
88
COPY config/pod.yaml /etc/insights-operator/server.yaml
99
COPY manifests /manifests

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ test: unit ## Run all the tests
5858
# Run the unit tests
5959
.PHONY: unit
6060
unit: ## Run the unit tests
61-
go test $(GO_TEST_FLAGS) -coverprofile $(COVER_PROFILE) ./...
61+
go test -race $(GO_TEST_FLAGS) -coverprofile $(COVER_PROFILE) ./...
6262

6363
.PHONY: coverage
6464
coverage:

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ This cluster operator gathers anonymized system configuration and reports it to
44
standard OpenShift distribution. The data collected allows for debugging in the event of cluster failures or
55
unanticipated errors.
66

7+
78
# Table of Contents
89

910
- [Insights Operator](#insights-operator)

cmd/changelog/main.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -206,14 +206,14 @@ func createCHANGELOG(releaseBlocks map[ReleaseVersion]MarkdownReleaseBlock) {
206206
defer file.Close()
207207
_, _ = file.WriteString(`# Note: This CHANGELOG is only for the changes in insights operator.
208208
Please see OpenShift release notes for official changes\n`)
209-
_, _ = file.WriteString(fmt.Sprintf("<!--Latest hash: %s-->\n", latestHash))
209+
_, _ = fmt.Fprintf(file, "<!--Latest hash: %s-->\n", latestHash)
210210
var releases ReleaseVersions
211211
for k := range releaseBlocks {
212212
releases = append(releases, k)
213213
}
214214
sort.Sort(sort.Reverse(releases))
215215
for _, release := range releases {
216-
_, _ = file.WriteString(fmt.Sprintf("## %d.%d\n\n", release.Major, release.Minor))
216+
_, _ = fmt.Fprintf(file, "## %d.%d\n\n", release.Major, release.Minor)
217217

218218
dataEnhancements := releaseBlocks[release].dataEnhancements
219219
createReleaseBlock(file, dataEnhancements, DATAENHANCEMENT)
@@ -234,8 +234,8 @@ func createCHANGELOG(releaseBlocks map[ReleaseVersion]MarkdownReleaseBlock) {
234234

235235
func createReleaseBlock(file *os.File, release, title string) {
236236
if len(release) > 0 {
237-
_, _ = file.WriteString(fmt.Sprintf("### %s\n", title))
238-
_, _ = file.WriteString(fmt.Sprintf("%s\n", release))
237+
_, _ = fmt.Fprintf(file, "### %s\n", title)
238+
_, _ = fmt.Fprintf(file, "%s\n", release)
239239
}
240240
}
241241

cmd/gendoc/main.go

+33-33
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,13 @@ import (
1818
)
1919

2020
var (
21-
inPath string
22-
outPath string
23-
mdf *os.File
24-
randSource = rand.NewSource(time.Now().UnixNano())
25-
reGather = regexp.MustCompile(`^((Build)?Gather)(.*)`)
26-
reExample = regexp.MustCompile(`^(Example)(.*)`)
21+
inPath string
22+
outPath string
23+
mdf *os.File
24+
randSource = rand.NewSource(time.Now().UnixNano())
25+
reGather = regexp.MustCompile(`^((Build)?Gather)(.*)`)
26+
reExample = regexp.MustCompile(`^(Example)(.*)`)
27+
reSampleArchive = regexp.MustCompile(`docs/(insights-archive-sample/.*)`)
2728
)
2829

2930
type DocBlock struct {
@@ -50,7 +51,7 @@ func main() {
5051
if err != nil {
5152
fmt.Print(err)
5253
}
53-
// second pass will gather Sample..
54+
// second pass will gather Sample...
5455
err = walkDir(cleanRoot, md)
5556
if err != nil {
5657
fmt.Print(err)
@@ -76,9 +77,9 @@ func main() {
7677
fmt.Print(err)
7778
}
7879
for _, k := range keys {
79-
_, err = mdf.WriteString(fmt.Sprintf(
80+
_, err := fmt.Fprintf(mdf,
8081
"## %s\n\n"+
81-
"%s\n\n", k, md[k].Doc))
82+
"%s\n\n", k, md[k].Doc)
8283
if err != nil {
8384
fmt.Print(err)
8485
}
@@ -89,16 +90,16 @@ func main() {
8990
size = len(e)
9091
}
9192
size /= len(md[k].Examples)
92-
_, err := mdf.WriteString(fmt.Sprintf(
93+
_, err := fmt.Fprintf(mdf,
9394
"Output raw size: %d\n\n"+
94-
"### Examples\n\n", size))
95+
"### Examples\n\n", size)
9596
if err != nil {
9697
fmt.Print(err)
9798
}
9899
for n, e := range md[k].Examples {
99-
_, err := mdf.WriteString(fmt.Sprintf(
100+
_, err := fmt.Fprintf(mdf,
100101
"#### %s\n"+
101-
"```%s```\n\n", n, e))
102+
"```%s```\n\n", n, e)
102103
if err != nil {
103104
fmt.Print(err)
104105
}
@@ -263,23 +264,22 @@ func mustGetPackageName(astRoot string, f *ast.Package) string {
263264
}
264265
if firstKey == "" {
265266
log.Fatalf("Package %q is composed of %d source files", f.Name, len(f.Files))
266-
} else {
267-
pkgAbs, err := filepath.Abs(filepath.Join(astRoot, filepath.Dir(firstKey)))
268-
if err != nil {
269-
log.Fatal(err)
270-
}
271-
goModPath, relPkgPath, err := findGoMod(pkgAbs)
272-
if err != nil {
273-
log.Fatal(err)
274-
}
275-
moduleName, err := getModuleNameFromGoMod(goModPath)
276-
if err != nil {
277-
log.Fatal(err)
278-
}
279-
importPath := filepath.Join(moduleName, relPkgPath)
280-
return importPath
281267
}
282-
return ""
268+
269+
pkgAbs, err := filepath.Abs(filepath.Join(astRoot, filepath.Dir(firstKey)))
270+
if err != nil {
271+
log.Fatal(err)
272+
}
273+
goModPath, relPkgPath, err := findGoMod(pkgAbs)
274+
if err != nil {
275+
log.Fatal(err)
276+
}
277+
moduleName, err := getModuleNameFromGoMod(goModPath)
278+
if err != nil {
279+
log.Fatal(err)
280+
}
281+
importPath := filepath.Join(moduleName, relPkgPath)
282+
return importPath
283283
}
284284

285285
// execExampleMethod executes the method by starting go run and capturing the produced standard output
@@ -298,16 +298,15 @@ func execExampleMethod(methodFullPackage, methodPackage, methodName string) (str
298298
fmt.Print(err)
299299
}
300300
}()
301-
302-
_, err = tf.WriteString(fmt.Sprintf(`package main
301+
_, err = fmt.Fprintf(tf, `package main
303302
import "%s"
304303
import "fmt"
305304
306305
func main() {
307306
str, _ := %s.%s()
308307
fmt.Print(str)
309308
}
310-
`, methodFullPackage, methodPackage, methodName))
309+
`, methodFullPackage, methodPackage, methodName)
311310
if err != nil {
312311
fmt.Print(err)
313312
}
@@ -337,7 +336,8 @@ func parseDoc(method, doc string) *DocBlock {
337336
doc = strings.TrimLeft(doc, method)
338337
}
339338
doc = strings.TrimLeft(doc, " ")
340-
339+
// generates the link to the sample archive
340+
doc = reSampleArchive.ReplaceAllString(doc, "[$0](./$1)")
341341
db := &DocBlock{Doc: doc}
342342
return db
343343
}

docs/arch.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,9 @@ oc get co insights -o=json | jq '.status.conditions'
244244
A condition is defined by its type. You may notice that there are some non-standard clusteroperator conditions. They are:
245245
- `SCAAvailable` - based on the SCA (Simple Content Access) controller in `pkg/ocm/sca/sca.go` and provides information about the status of downloading the SCA entitlements.
246246
- `ClusterTransferAvailable` - based on the cluster transfer controller in `pkg/ocm/clustertransfer/cluster_transfer.go` and provides information about the availability of cluster transfers.
247-
- `Disabled` - indicates whether data gathering is disabled or enabled.
247+
- `Disabled` - indicates whether data gathering is disabled or enabled. Note that when the operator is `Disabled=True`, it is still also `Available=True`, which is strange at first glance, but the Cluster Version Operator (CVO) checks that all the clusteroperators are `Available=True` during the OpenShift installation. If they are not, the installation will fail, which happens in disconnected environments/clusters where the Insights operator is usually `Disabled=True` (because there is no `cloud.openshift.com` token in the `pull-secret`). You can find more about this topic in:
248+
- https://pkg.go.dev/github.com/openshift/api/config/v1#ClusterStatusConditionType - note that when the Insights Operator is `Disabled=True` then it does not require immediate administrator intervention (and thus it still reports `Available=True`) - i.e nobody should be paged in this situation
249+
- https://github.com/openshift/enhancements/blob/master/dev-guide/cluster-version-operator/dev/clusteroperator.md#conditions
248250

249251
In addition to the above clusteroperator conditions, there are some intermediate clusteroperator conditions. These are:
250252
- `UploadDegraded` - this condition occurs when there is any unsuccessful upload of the Insights data (if the number of the upload attemp is equal or greater than 5 then the operator is marked as **Degraded**). Example is:

0 commit comments

Comments
 (0)