diff --git a/CHANGELOG.md b/CHANGELOG.md index 0a467368..4f0f69e1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # LeanIX Kubernetes Connector Changelog +## Release 2022-03-07 - 6.3.3 +* Increased logging and added more precise log messages + ## Release 2022-01-20 - 6.3.2 * Error messages can be captured and accessed via connector logs in iHub, if the connector configuration is not correct. diff --git a/Makefile b/Makefile index a0491e00..bd7f54cf 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ PROJECT ?= leanix-k8s-connector DOCKER_NAMESPACE ?= leanixacrpublic.azurecr.io -VERSION := 6.3.2 +VERSION := 6.3.3 FULL_VERSION := $(VERSION)-$(shell git describe --tags --always) IMAGE := $(DOCKER_NAMESPACE)/$(PROJECT):$(VERSION) diff --git a/README.md b/README.md index 0b9b39e7..5b7d4005 100644 --- a/README.md +++ b/README.md @@ -572,6 +572,7 @@ e.g `--set args.storageBackend=file` | Release date | Connector version | Integration version | Helm chart version | Container image tag | | :----------: | :---------------: | :-----------------: | :----------------: | :-----------------: | +| 2022-03-07 | 6.3.3 | 1.0.0 | 6.3.3 | 6.3.3 | | 2022-01-20 | 6.3.2 | 1.0.0 | 6.3.2 | 6.3.2 | | 2022-01-10 | 6.3.1 | 1.0.0 | 6.3.1 | 6.3.1 | | 2022-01-03 | 6.3.0 | 1.0.0 | 6.3.0 | 6.3.0 | diff --git a/cmd/leanix-k8s-connector/main.go b/cmd/leanix-k8s-connector/main.go index a4a36715..a30f7122 100644 --- a/cmd/leanix-k8s-connector/main.go +++ b/cmd/leanix-k8s-connector/main.go @@ -65,7 +65,7 @@ func main() { if err != nil { log.Error(err) } - log.Debug("Uploading connector logs to iHub") + log.Info("Uploading connector logs to iHub") err = storage.UploadConnectorLog(startResponse.ConnectorLoggingUrl, debugLogBuffer.Bytes()) if err != nil { log.Error(err) @@ -78,11 +78,14 @@ func KubernetesScan(debugLogBuffer *bytes.Buffer) (response *leanix.SelfStartRes accessToken, err := leanix.Authenticate(viper.GetString(integrationAPIFqdnFlag), viper.GetString(integrationAPITokenFlag)) if err != nil { log.Error(err) + log.Info("Failed to authenticate. Terminating..") + return nil, err } + log.Info("Integration Hub authentication successful.") startResponse, err := leanix.SelfStartRun(viper.GetString(integrationAPIFqdnFlag), accessToken, viper.GetString(integrationAPIDatasourceNameFlag)) if err != nil { - log.Info("Failed to start Integration Hub. Terminating..") + log.Info("Main: Failed to start Integration Hub. Terminating..") return startResponse, err } log.Info("Getting connector config...") @@ -90,7 +93,7 @@ func KubernetesScan(debugLogBuffer *bytes.Buffer) (response *leanix.SelfStartRes log.Infof("Successfully self started via Integration Hub. Progress call back - %s", startResponse.ProgressCallbackUrl) _, err = leanix.UpdateInProgressStatus(startResponse.ProgressCallbackUrl, "Successfully self started via Integration Hub. Connector is in progress") if err != nil { - log.Infof("Failed to update progress[%s] to Integration Hub", leanix.IN_PROGRESS) + log.Infof("KubernetesScan: Failed to update progress[%s] to Integration Hub", leanix.IN_PROGRESS) } } @@ -148,7 +151,7 @@ func KubernetesScan(debugLogBuffer *bytes.Buffer) (response *leanix.SelfStartRes } _, err = leanix.UpdateInProgressStatus(startResponse.ProgressCallbackUrl, "Discovery of Version Resources is done. Moving on to mapping nodes") if err != nil { - log.Infof("Failed to update progress[%s] to Integration Hub", leanix.IN_PROGRESS) + log.Infof("KubernetesScan: Before scan: Failed to update progress[%s] to Integration Hub", leanix.IN_PROGRESS) } log.Debug("Listing nodes...") nodes, err := kubernetesAPI.Nodes() @@ -168,7 +171,7 @@ func KubernetesScan(debugLogBuffer *bytes.Buffer) (response *leanix.SelfStartRes kubernetesObjects = append(kubernetesObjects, *clusterKubernetesObject) _, err = leanix.UpdateInProgressStatus(startResponse.ProgressCallbackUrl, "Mapping nodes is done. Moving on to collecting kubernetes objects from Version Resources.") if err != nil { - log.Infof("Failed to update progress[%s] to Integration Hub", leanix.IN_PROGRESS) + log.Infof("KubernetesScan: After Scan: Failed to update progress[%s] to Integration Hub", leanix.IN_PROGRESS) } resourceGroupWhitelist := map[string]map[string]interface{}{ "": map[string]interface{}{ @@ -218,7 +221,7 @@ func KubernetesScan(debugLogBuffer *bytes.Buffer) (response *leanix.SelfStartRes for gvr := range groupVersionResources { if _, ok := resourceGroupWhitelist[gvr.Group][gvr.Resource]; !ok { - log.Debugf("Not scanning resouce %s", strings.Join([]string{gvr.Group, gvr.Version, gvr.Resource}, "/")) + log.Debugf("Not scanning resource %s", strings.Join([]string{gvr.Group, gvr.Version, gvr.Resource}, "/")) continue } instances, err := dynClient.Resource(gvr).List(context.Background(), metav1.ListOptions{}) @@ -259,7 +262,7 @@ func KubernetesScan(debugLogBuffer *bytes.Buffer) (response *leanix.SelfStartRes _, err = leanix.UpdateInProgressStatus(startResponse.ProgressCallbackUrl, "Successfully collected required kubernetes data.") if err != nil { - log.Infof("Failed to progress[%s] to Integration Hub", leanix.IN_PROGRESS) + log.Infof("KubernetesScan: After mapping: Failed to progress[%s] to Integration Hub", leanix.IN_PROGRESS) } log.Debug("Marshal ldif") ldifByte, err := storage.Marshal(ldif) diff --git a/helm/index.yaml b/helm/index.yaml index bce2aef3..41bd3a57 100644 --- a/helm/index.yaml +++ b/helm/index.yaml @@ -1,9 +1,19 @@ apiVersion: v1 entries: leanix-k8s-connector: + - apiVersion: v1 + appVersion: 6.3.3 + created: "2022-03-07T13:02:45.487725+01:00" + description: Retrieves information from Kubernetes cluster + digest: f0785c889298cac1eb58ae9380e62457c2b1b73fbfbdccb35f2d85410b50293c + kubeVersion: '>= 1.19.0-0' + name: leanix-k8s-connector + urls: + - leanix-k8s-connector-6.3.3.tgz + version: 6.3.3 - apiVersion: v1 appVersion: 6.3.2 - created: "2022-01-20T15:50:11.994812+01:00" + created: "2022-03-07T13:02:45.487146+01:00" description: Retrieves information from Kubernetes cluster digest: 918ec561f0ab03c5039144e7d151e447dac40ad1bace19435ae4be0c21ab6ad2 kubeVersion: '>= 1.19.0-0' @@ -13,7 +23,7 @@ entries: version: 6.3.2 - apiVersion: v1 appVersion: 6.3.1 - created: "2022-01-20T15:50:11.990534+01:00" + created: "2022-03-07T13:02:45.486187+01:00" description: Retrieves information from Kubernetes cluster digest: e4ff6114e41c6f7694be5ab006f64ae6620758774610fcbb41357feb71da547c kubeVersion: '>= 1.19.0-0' @@ -23,7 +33,7 @@ entries: version: 6.3.1 - apiVersion: v1 appVersion: 6.3.0 - created: "2022-01-20T15:50:11.989594+01:00" + created: "2022-03-07T13:02:45.485163+01:00" description: Retrieves information from Kubernetes cluster digest: 44973672d6054cd0660a94e71b23bf9cf472f27bc532133981af6f6055e87424 kubeVersion: '>= 1.19.0-0' @@ -33,7 +43,7 @@ entries: version: 6.3.0 - apiVersion: v1 appVersion: 6.2.0 - created: "2022-01-20T15:50:11.988611+01:00" + created: "2022-03-07T13:02:45.483783+01:00" description: Retrieves information from Kubernetes cluster digest: 5774478e89bc749ba21ec7f2477bb348788f2bbf6e8b76956eee5c4739de9e46 kubeVersion: '>= 1.19.0-0' @@ -43,7 +53,7 @@ entries: version: 6.2.0 - apiVersion: v1 appVersion: 6.1.0 - created: "2022-01-20T15:50:11.98794+01:00" + created: "2022-03-07T13:02:45.483027+01:00" description: Retrieves information from Kubernetes cluster digest: eabf3e49a9d4a0722228cb24872e6dfcc7b9db6b764bc714a74c0941f0d3ea4f name: leanix-k8s-connector @@ -52,7 +62,7 @@ entries: version: 6.1.0 - apiVersion: v1 appVersion: 6.0.3 - created: "2022-01-20T15:50:11.987089+01:00" + created: "2022-03-07T13:02:45.482201+01:00" description: Retrieves information from Kubernetes cluster digest: 5f1be6a80fc173d45ca60f5da8937abc0fcb2cc14652d6149d9ff2e405568a71 name: leanix-k8s-connector @@ -61,7 +71,7 @@ entries: version: 6.0.3 - apiVersion: v1 appVersion: 6.0.2 - created: "2022-01-20T15:50:11.985469+01:00" + created: "2022-03-07T13:02:45.4812+01:00" description: Retrieves information from Kubernetes cluster digest: ccd112d1de601bfa796c4413ddc2b394f93ec4b66604338a736593168523b327 name: leanix-k8s-connector @@ -70,7 +80,7 @@ entries: version: 6.0.2 - apiVersion: v1 appVersion: 6.0.1 - created: "2022-01-20T15:50:11.984088+01:00" + created: "2022-03-07T13:02:45.480092+01:00" description: Retrieves information from Kubernetes cluster digest: f3b959e24bdbf55314fa6d0a05681ec41dd34b1493b026a3450bf147e62a4b1b name: leanix-k8s-connector @@ -79,7 +89,7 @@ entries: version: 6.0.1 - apiVersion: v1 appVersion: 6.0.0 - created: "2022-01-20T15:50:11.982122+01:00" + created: "2022-03-07T13:02:45.479027+01:00" description: Retrieves information from Kubernetes cluster digest: c51f68b592c6f608a2f982e8c322280b8fc3aa4ac6ed0d823b2baf24b0877e6b name: leanix-k8s-connector @@ -88,7 +98,7 @@ entries: version: 6.0.0 - apiVersion: v1 appVersion: 5.0.0 - created: "2022-01-20T15:50:11.981207+01:00" + created: "2022-03-07T13:02:45.478112+01:00" description: Retrieves information from Kubernetes cluster digest: 549a753cf9875ca4eeaf5ecb5c64e76149b30bb8e82eee821f6c81cca27c37cf name: leanix-k8s-connector @@ -97,7 +107,7 @@ entries: version: 5.0.0 - apiVersion: v1 appVersion: 4.0.0 - created: "2022-01-20T15:50:11.979753+01:00" + created: "2022-03-07T13:02:45.476295+01:00" description: Retrieves information from Kubernetes cluster digest: adf5c8ef024857c4a0845a5c659f27bd7f21cdf568fff3445a192425c44fc9a8 name: leanix-k8s-connector @@ -106,7 +116,7 @@ entries: version: 4.0.0 - apiVersion: v1 appVersion: 3.0.0 - created: "2022-01-20T15:50:11.978602+01:00" + created: "2022-03-07T13:02:45.474897+01:00" description: Retrieves information from Kubernetes cluster digest: 2927aebc215a1c5175e986135e36a10101e90fa69e7ab22a183049d086f7eddb name: leanix-k8s-connector @@ -115,7 +125,7 @@ entries: version: 3.0.0 - apiVersion: v1 appVersion: 2.0.0 - created: "2022-01-20T15:50:11.97724+01:00" + created: "2022-03-07T13:02:45.473985+01:00" description: Retrieves information from Kubernetes cluster digest: 3481723d2374757038495117518c47f634054408ccbd55112a6260d5a15e18c9 name: leanix-k8s-connector @@ -124,7 +134,7 @@ entries: version: 2.0.0 - apiVersion: v1 appVersion: 2.0.0-beta7 - created: "2022-01-20T15:50:11.976073+01:00" + created: "2022-03-07T13:02:45.473088+01:00" description: Retrieves information from Kubernetes cluster digest: 0ade89d01236286f11ebf70290e2c4c82740fac11ec755be9dddd2375c74246f name: leanix-k8s-connector @@ -133,11 +143,11 @@ entries: version: 2.0.0-beta7 - apiVersion: v1 appVersion: 1.1.0 - created: "2022-01-20T15:50:11.975278+01:00" + created: "2022-03-07T13:02:45.471974+01:00" description: Retrieves information from Kubernetes cluster digest: aa3ee10eefe30e61e37058762b031bdee11cb9dd67afecdf6e831335d5c16e0f name: leanix-k8s-connector urls: - leanix-k8s-connector-1.0.0.tgz version: 1.0.0 -generated: "2022-01-20T15:50:11.971746+01:00" +generated: "2022-03-07T13:02:45.47074+01:00" diff --git a/helm/leanix-k8s-connector-6.3.3.tgz b/helm/leanix-k8s-connector-6.3.3.tgz new file mode 100644 index 00000000..87315186 Binary files /dev/null and b/helm/leanix-k8s-connector-6.3.3.tgz differ diff --git a/helm/leanix-k8s-connector/Chart.yaml b/helm/leanix-k8s-connector/Chart.yaml index 4c440427..dd460fd6 100644 --- a/helm/leanix-k8s-connector/Chart.yaml +++ b/helm/leanix-k8s-connector/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v1 -appVersion: "6.3.2" +appVersion: "6.3.3" description: Retrieves information from Kubernetes cluster name: leanix-k8s-connector -version: 6.3.2 +version: 6.3.3 kubeVersion: '>= 1.19.0-0' \ No newline at end of file diff --git a/helm/leanix-k8s-connector/values.yaml b/helm/leanix-k8s-connector/values.yaml index e19fe6bc..3d494f6e 100644 --- a/helm/leanix-k8s-connector/values.yaml +++ b/helm/leanix-k8s-connector/values.yaml @@ -15,7 +15,7 @@ schedule: image: repository: leanixacrpublic.azurecr.io/leanix-k8s-connector - tag: 6.3.2 + tag: 6.3.3 pullPolicy: Always securityContext: diff --git a/pkg/leanix/auth.go b/pkg/leanix/auth.go index a2937a4a..37908b9d 100644 --- a/pkg/leanix/auth.go +++ b/pkg/leanix/auth.go @@ -28,6 +28,7 @@ type SyncRunResponse struct { func Authenticate(fqdn string, token string) (string, error) { body := strings.NewReader("grant_type=client_credentials") req, err := http.NewRequest("POST", "https://"+fqdn+"/services/mtm/v1/oauth2/token", body) + log.Infof("LeanIX integration api fqdn : %s", fqdn) req.Header.Set("Content-Type", "application/x-www-form-urlencoded") if err != nil { return "", err diff --git a/pkg/leanix/integration_hub.go b/pkg/leanix/integration_hub.go index 79e34260..12b4cc08 100644 --- a/pkg/leanix/integration_hub.go +++ b/pkg/leanix/integration_hub.go @@ -42,6 +42,7 @@ func SelfStartRun(fqdn string, accessToken string, datasource string) (*SelfStar req.Header.Set("Content-Type", "application/json") req.Header.Set("Authorization", "Bearer "+accessToken) if err != nil { + log.Infof("SelfStartRun: Error while starting run for datasource: %s", datasourceRunUrl) return nil, err } log.Infof("Initiating connection to Integration Hub API with dataSource name: %s with region value: %s\n", datasource, fqdn) @@ -69,7 +70,7 @@ func SelfStartRun(fqdn string, accessToken string, datasource string) (*SelfStar if error != nil { _, err = UpdateFailedProgressStatus(startResponse.ProgressCallbackUrl, "INVALID CONNECTOR CONFIGURATION: ABORTING IHUB RUN.") if err != nil { - log.Errorf("Failed to update progress[%s] to Integration Hub", FAILED) + log.Errorf("SelfStartRun: Failed to update progress[%s] to Integration Hub", FAILED) } return &startResponse, error }