Skip to content

Commit c67e5e2

Browse files
Merge pull request #349 from RaphaelBut/switch-to-remediation
Switch kube-api access to backplane remediations
2 parents 08dda76 + cd8df3b commit c67e5e2

File tree

12 files changed

+334
-240
lines changed

12 files changed

+334
-240
lines changed

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,8 @@ Grafana dashboard configmaps are stored in the [Dashboards](./dashboards/) direc
130130

131131
### Required ENV variables
132132

133+
**Note:** For local execution, these can exported from vault with `source test/set_stage_env.sh`
134+
133135
* `CAD_OCM_CLIENT_ID`: refers to the OCM client ID used by CAD to initialize the OCM client
134136
* `CAD_OCM_CLIENT_SECRET`: refers to the OCM client secret used by CAD to initialize the OCM client
135137
* `CAD_OCM_URL`: refers to the used OCM url used by CAD to initialize the OCM client
@@ -150,8 +152,10 @@ Grafana dashboard configmaps are stored in the [Dashboards](./dashboards/) direc
150152

151153
### Optional ENV variables
152154

153-
* `BACKPLANE_PROXY`: refers to the proxy CAD uses for the isolated backplane access flow.
155+
- `BACKPLANE_PROXY`: refers to the proxy CAD uses for the isolated backplane access flow.
154156

155157
**Note:** `BACKPLANE_PROXY` is required for local development, as a backplane api is only accessible through the proxy.
156158

159+
- `CAD_EXPERIMENTAL_ENABLED`: enables experimental investigations when set to `true`, see mapping.go
160+
157161
For Red Hat employees, these environment variables can be found in the SRE-P vault.

cadctl/cmd/investigate/investigate.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,13 +120,13 @@ func run(_ *cobra.Command, _ []string) error {
120120

121121
customerAwsClient, err := managedcloud.CreateCustomerAWSClient(cluster, ocmClient)
122122
if err != nil {
123-
ccamResources := &investigation.Resources{Cluster: cluster, ClusterDeployment: clusterDeployment, AwsClient: customerAwsClient, OcmClient: ocmClient, PdClient: pdClient, AdditionalResources: map[string]interface{}{"error": err}}
123+
ccamResources := &investigation.Resources{Name: "ccam", Cluster: cluster, ClusterDeployment: clusterDeployment, AwsClient: customerAwsClient, OcmClient: ocmClient, PdClient: pdClient, AdditionalResources: map[string]interface{}{"error": err}}
124124
result, err := ccam.Investigate(ccamResources)
125125
updateMetrics(alertInvestigation.Name, &result)
126126
return err
127127
}
128128

129-
investigationResources := &investigation.Resources{Cluster: cluster, ClusterDeployment: clusterDeployment, AwsClient: customerAwsClient, OcmClient: ocmClient, PdClient: pdClient}
129+
investigationResources := &investigation.Resources{Name: alertInvestigation.Name, Cluster: cluster, ClusterDeployment: clusterDeployment, AwsClient: customerAwsClient, OcmClient: ocmClient, PdClient: pdClient}
130130

131131
logging.Infof("Starting investigation for %s", alertInvestigation.Name)
132132
result, err := alertInvestigation.Run(investigationResources)

go.mod

Lines changed: 52 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,61 @@
11
module github.com/openshift/configuration-anomaly-detection
22

3-
go 1.21
3+
go 1.22.7
4+
5+
toolchain go1.22.12
46

57
require (
68
github.com/PagerDuty/go-pagerduty v1.8.0
7-
github.com/aws/aws-sdk-go-v2 v1.30.4
8-
github.com/aws/aws-sdk-go-v2/config v1.27.15
9-
github.com/aws/aws-sdk-go-v2/credentials v1.17.15
9+
github.com/aws/aws-sdk-go-v2 v1.36.0
10+
github.com/aws/aws-sdk-go-v2/config v1.29.2
11+
github.com/aws/aws-sdk-go-v2/credentials v1.17.57
1012
github.com/aws/aws-sdk-go-v2/service/cloudtrail v1.42.5
1113
github.com/aws/aws-sdk-go-v2/service/ec2 v1.137.1
12-
github.com/aws/aws-sdk-go-v2/service/sts v1.28.9
13-
github.com/onsi/gomega v1.33.1
14-
github.com/openshift-online/ocm-sdk-go v0.1.427
14+
github.com/aws/aws-sdk-go-v2/service/sts v1.33.12
15+
github.com/onsi/gomega v1.36.2
16+
github.com/openshift-online/ocm-sdk-go v0.1.458
1517
github.com/openshift/api v0.0.0-20230720094506-afcbe27aec7c
1618
github.com/openshift/aws-account-operator/api v0.0.0-20231122143531-33ce90caf221
17-
github.com/openshift/backplane-cli v0.1.31-0.20240520050157-59d5cbca19b4
19+
github.com/openshift/backplane-cli v0.1.39
1820
github.com/openshift/hive/apis v0.0.0-20231116161336-9dd47f8bfa1f
1921
github.com/openshift/osd-network-verifier v1.2.1
2022
github.com/prometheus/client_golang v1.19.1
2123
github.com/prometheus/common v0.54.0
22-
github.com/spf13/cobra v1.8.0
24+
github.com/spf13/cobra v1.8.1
2325
go.uber.org/mock v0.4.0
2426
go.uber.org/zap v1.27.0
2527
gopkg.in/yaml.v2 v2.4.0
26-
k8s.io/api v0.28.3
27-
k8s.io/apimachinery v0.28.4
28+
k8s.io/api v0.30.3
29+
k8s.io/apimachinery v0.30.3
2830
sigs.k8s.io/controller-runtime v0.12.1
2931
)
3032

3133
require (
34+
github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect
35+
github.com/99designs/keyring v1.2.2 // indirect
36+
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect
3237
github.com/Masterminds/semver v1.5.0 // indirect
38+
github.com/alessio/shellescape v1.4.1 // indirect
3339
github.com/apapsch/go-jsonmerge/v2 v2.0.0 // indirect
34-
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.3 // indirect
35-
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.16 // indirect
36-
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.16 // indirect
37-
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.0 // indirect
38-
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.2 // indirect
39-
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.9 // indirect
40-
github.com/aws/aws-sdk-go-v2/service/sso v1.20.8 // indirect
41-
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.24.2 // indirect
42-
github.com/aws/smithy-go v1.20.4 // indirect
40+
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.27 // indirect
41+
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.31 // indirect
42+
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.31 // indirect
43+
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.2 // indirect
44+
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.2 // indirect
45+
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.12 // indirect
46+
github.com/aws/aws-sdk-go-v2/service/sso v1.24.14 // indirect
47+
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.13 // indirect
48+
github.com/aws/smithy-go v1.22.2 // indirect
4349
github.com/aymerick/douceur v0.2.0 // indirect
4450
github.com/beorn7/perks v1.0.1 // indirect
4551
github.com/blang/semver/v4 v4.0.0 // indirect
4652
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
4753
github.com/cespare/xxhash/v2 v2.3.0 // indirect
54+
github.com/danieljoos/wincred v1.2.0 // indirect
4855
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
4956
github.com/deepmap/oapi-codegen v1.12.4 // indirect
50-
github.com/emicklei/go-restful/v3 v3.9.0 // indirect
57+
github.com/dvsekhvalnov/jose2go v1.6.0 // indirect
58+
github.com/emicklei/go-restful/v3 v3.11.0 // indirect
5159
github.com/evanphx/json-patch v4.12.0+incompatible // indirect
5260
github.com/fsnotify/fsnotify v1.7.0 // indirect
5361
github.com/getkin/kin-openapi v0.113.0 // indirect
@@ -60,20 +68,23 @@ require (
6068
github.com/go-playground/universal-translator v0.18.1 // indirect
6169
github.com/go-playground/validator v9.31.0+incompatible // indirect
6270
github.com/go-task/slim-sprig/v3 v3.0.0 // indirect
71+
github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 // indirect
72+
github.com/godbus/dbus/v5 v5.1.0 // indirect
6373
github.com/gogo/protobuf v1.3.2 // indirect
64-
github.com/golang-jwt/jwt/v4 v4.5.0 // indirect
74+
github.com/golang-jwt/jwt/v4 v4.5.1 // indirect
6575
github.com/golang/protobuf v1.5.4 // indirect
6676
github.com/google/btree v1.1.3 // indirect
6777
github.com/google/gnostic-models v0.6.8 // indirect
6878
github.com/google/go-cmp v0.6.0 // indirect
6979
github.com/google/go-github/v63 v63.0.0 // indirect
7080
github.com/google/go-querystring v1.1.0 // indirect
7181
github.com/google/gofuzz v1.2.0 // indirect
72-
github.com/google/pprof v0.0.0-20240424215950-a892ee059fd6 // indirect
82+
github.com/google/pprof v0.0.0-20241210010833-40e02aabc2ad // indirect
7383
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
7484
github.com/google/uuid v1.6.0 // indirect
7585
github.com/gorilla/css v1.0.1 // indirect
7686
github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7 // indirect
87+
github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c // indirect
7788
github.com/hashicorp/hcl v1.0.0 // indirect
7889
github.com/imdario/mergo v0.3.13 // indirect
7990
github.com/inconshreveable/mousetrap v1.1.0 // indirect
@@ -92,14 +103,16 @@ require (
92103
github.com/microcosm-cc/bluemonday v1.0.26 // indirect
93104
github.com/mitchellh/go-homedir v1.1.0 // indirect
94105
github.com/mitchellh/mapstructure v1.5.0 // indirect
106+
github.com/moby/term v0.0.0-20221205130635-1aeaba878587 // indirect
95107
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect
96108
github.com/monochromegane/go-gitignore v0.0.0-20200626010858-205db1a8cc00 // indirect
109+
github.com/mtibben/percent v0.2.1 // indirect
97110
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
98111
github.com/olekukonko/tablewriter v0.0.5 // indirect
99-
github.com/openshift-online/ocm-cli v0.1.66 // indirect
100-
github.com/openshift/backplane-api v0.0.0-20230919035427-a52e4ae498fb // indirect
112+
github.com/openshift-online/ocm-cli v1.0.3 // indirect
113+
github.com/openshift/backplane-api v0.0.0-20241127094828-0f66644ff53d // indirect
101114
github.com/openshift/custom-resource-status v1.1.3-0.20220503160415-f2fdb4999d87 // indirect
102-
github.com/pelletier/go-toml/v2 v2.1.0 // indirect
115+
github.com/pelletier/go-toml/v2 v2.2.2 // indirect
103116
github.com/perimeterx/marshmallow v1.1.4 // indirect
104117
github.com/peterbourgon/diskv v2.0.1+incompatible // indirect
105118
github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect
@@ -113,35 +126,35 @@ require (
113126
github.com/sourcegraph/conc v0.3.0 // indirect
114127
github.com/spf13/afero v1.12.0 // indirect
115128
github.com/spf13/cast v1.6.0 // indirect
116-
github.com/spf13/pflag v1.0.5 // indirect
117-
github.com/spf13/viper v1.18.2 // indirect
129+
github.com/spf13/pflag v1.0.6 // indirect
130+
github.com/spf13/viper v1.19.0 // indirect
118131
github.com/subosito/gotenv v1.6.0 // indirect
119132
github.com/xlab/treeprint v1.2.0 // indirect
120-
go.starlark.net v0.0.0-20230525235612-a134d8f9ddca // indirect
133+
github.com/zalando/go-keyring v0.2.3 // indirect
121134
go.uber.org/multierr v1.10.0 // indirect
122-
golang.org/x/exp v0.0.0-20230905200255-921286631fa9 // indirect
135+
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect
123136
golang.org/x/net v0.33.0 // indirect
124137
golang.org/x/oauth2 v0.25.0 // indirect
125138
golang.org/x/sync v0.10.0 // indirect
126139
golang.org/x/term v0.28.0 // indirect
127140
golang.org/x/text v0.21.0 // indirect
128141
golang.org/x/time v0.8.0 // indirect
129-
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect
142+
golang.org/x/tools v0.28.0 // indirect
130143
google.golang.org/protobuf v1.36.1 // indirect
131144
gopkg.in/AlecAivazis/survey.v1 v1.8.8 // indirect
132145
gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect
133146
gopkg.in/inf.v0 v0.9.1 // indirect
134147
gopkg.in/ini.v1 v1.67.0 // indirect
135148
gopkg.in/yaml.v3 v3.0.1 // indirect
136-
k8s.io/cli-runtime v0.28.3 // indirect
137-
k8s.io/client-go v0.28.3 // indirect
138-
k8s.io/klog/v2 v2.100.1 // indirect
139-
k8s.io/kube-openapi v0.0.0-20231113174909-778a5567bc1e // indirect
149+
k8s.io/cli-runtime v0.30.3 // indirect
150+
k8s.io/client-go v0.30.3 // indirect
151+
k8s.io/klog/v2 v2.120.1 // indirect
152+
k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340 // indirect
140153
k8s.io/utils v0.0.0-20230726121419-3b25d923346b // indirect
141154
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
142-
sigs.k8s.io/kustomize/api v0.17.1 // indirect
143-
sigs.k8s.io/kustomize/kyaml v0.17.0 // indirect
144-
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
155+
sigs.k8s.io/kustomize/api v0.18.0 // indirect
156+
sigs.k8s.io/kustomize/kyaml v0.18.1 // indirect
157+
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect
145158
sigs.k8s.io/yaml v1.4.0 // indirect
146159
)
147160

@@ -150,7 +163,7 @@ require (
150163
github.com/json-iterator/go v1.1.12 // indirect
151164
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
152165
github.com/modern-go/reflect2 v1.0.2 // indirect
153-
github.com/onsi/ginkgo/v2 v2.17.2
166+
github.com/onsi/ginkgo/v2 v2.22.1
154167
golang.org/x/sys v0.29.0 // indirect
155168
gotest.tools/v3 v3.5.1
156169
)

0 commit comments

Comments
 (0)