Compare commits

..

26 Commits

Author SHA1 Message Date
Foysal Iqbal
75ce6caa2b random prefix
Signed-off-by: Foysal Iqbal <mqb@qlik.com>
2020-04-06 00:17:54 -04:00
Ashwathi Shiva
d05b119a68 remove namespace from role, rolebinding and SA checks 2020-04-05 23:31:47 -04:00
Ashwathi Shiva
ed26e692c9 Merge branch 'master' into preflight_pretty_print
# Conflicts:
#	pkg/preflight/role_check.go
#	pkg/qliksense/kuz.go
2020-04-05 21:28:05 -04:00
Ashwathi Shiva
5909c728ab - possible fix for restricting role and role binding checks to only install their specific types
- moved kubectl delete to defer to force clean up
2020-04-05 21:25:19 -04:00
Ashwathi Shiva
d77654e763 Updated readme 2020-04-05 19:05:03 -04:00
Ashwathi Shiva
73c3ac1d58 Merge branch 'master' into preflight_roles 2020-04-05 17:30:59 -04:00
Ashwathi Shiva
083203128c passed mongo url to preflight all command, addressed some PR comments 2020-04-05 17:27:54 -04:00
Foysal Iqbal
ccc2997745 fix entity creation
Signed-off-by: Foysal Iqbal <mqb@qlik.com>
2020-04-04 13:44:18 -04:00
Ashwathi Shiva
1f5ee3d487 Merge branch 'master' into preflight_roles 2020-04-04 01:37:58 -04:00
Ashwathi Shiva
87ace81dee renamed some commands and cleaned up some messages 2020-04-04 01:33:20 -04:00
Ashwathi Shiva
2618e72a46 display the mongodb url 2020-04-03 11:18:13 -04:00
Ashwathi Shiva
1aac550f66 mongodbUrl inferred from CR 2020-04-03 08:04:29 -04:00
Ashwathi Shiva
bacaea1b92 Merge branch 'master' into preflight_roles
# Conflicts:
#	pkg/preflight/deployability.go
2020-04-03 01:23:09 -04:00
Ashwathi Shiva
acfa1f16a1 updated readme 2020-04-03 01:18:59 -04:00
Ashwathi Shiva
8b68a4d305 updated qliksense preflight all to update mongodb check 2020-04-03 01:08:06 -04:00
Ashwathi Shiva
114d0a13c8 preflight mongo --url=url working 2020-04-03 00:47:49 -04:00
Ashwathi Shiva
c733d2821e Merge branch 'preflight_roles' of github.com:qlik-oss/sense-installer into preflight_roles 2020-04-02 23:38:11 -04:00
Ashwathi Shiva
69306605a3 preflight createRole, createRoleBinding, createServiceAccount, createRB working 2020-04-02 23:34:55 -04:00
Foysal Iqbal
67ec3105f0 fix yaml trim
Signed-off-by: Foysal Iqbal <mqb@qlik.com>
2020-04-02 20:48:43 -04:00
Ashwathi Shiva
e69149ec64 finished initial functional role check 2020-04-02 19:44:13 -04:00
Ashwathi Shiva
cedb7f8fca WIP - intermediate commit 2020-04-02 19:09:34 -04:00
Ashwathi Shiva
fee81b25a6 WIP preflight createRole 2020-04-02 16:31:48 -04:00
Ashwathi Shiva
b5eea11050 Merge branch 'master' into preflight_roles 2020-04-02 14:44:23 -04:00
Ashwathi Shiva
dbf6f6debc preflight createRB working and updated readme 2020-04-02 00:00:48 -04:00
Ashwathi Shiva
002b0faaa1 Merge branch 'master' into preflight_roles 2020-04-01 23:33:47 -04:00
Ashwathi Shiva
a676d10ed0 preflight role, roleBinding, serviceAccount working 2020-04-01 23:31:28 -04:00
4 changed files with 30 additions and 18 deletions

View File

@@ -11,6 +11,7 @@ import (
"net/http"
"os"
"path/filepath"
"regexp"
"strings"
"time"
@@ -68,23 +69,20 @@ func ProcessConfigArgs(args []string) ([]*ServiceKeyValue, error) {
err := fmt.Errorf("No args were provided. Please provide args to configure the current context")
return nil, err
}
notValidErr := fmt.Errorf("Please provide valid args for this command")
resultSvcKV := make([]*ServiceKeyValue, len(args))
// qliksense.mongodb=somethig
re1 := regexp.MustCompile(`([\w\-]{1,}).([\w\-]{1,})=("*[\w\-?=_/:0-9\.]+"*)`)
for i, arg := range args {
LogDebugMessage("Arg received: %s", arg)
first := strings.SplitN(arg, "=", 2)
if len(first) != 2 {
return nil, notValidErr
}
second := strings.SplitN(first[0], ".", 2)
if len(second) != 2 {
return nil, notValidErr
result := re1.FindStringSubmatch(arg)
// check if result array's length is == 4 (index 0 - is the full match & indices 1,2,3- are the fields we need)
if len(result) != 4 {
err := fmt.Errorf("Please provide valid args for this command")
return nil, err
}
resultSvcKV[i] = &ServiceKeyValue{
SvcName: second[0],
Key: second[1],
Value: strings.ReplaceAll(first[1], `"`, ""),
SvcName: result[1],
Key: result[2],
Value: strings.ReplaceAll(result[3], `"`, ""),
}
}
return resultSvcKV, nil

View File

@@ -11,11 +11,10 @@ func TestProcessConfigArgs(t *testing.T) {
"test-dash.dash-key=value-dash",
"test-dot.dot-key=127.0.0.1",
"test123.key123=value123",
"test-equal.keyequal=newvalue=@hj",
}
expectedKeys := []string{"mongodb", "test", "dash-key", "dot-key", "key123", "keyequal"}
expectedValue := []string{"mongouri://something?ffall", "value_under", "value-dash", "127.0.0.1", "value123", "newvalue=@hj"}
exppectedSvc := []string{"qliksense", "test_under", "test-dash", "test-dot", "test123", "test-equal"}
expectedKeys := []string{"mongodb", "test", "dash-key", "dot-key", "key123"}
expectedValue := []string{"mongouri://something?ffall", "value_under", "value-dash", "127.0.0.1", "value123"}
exppectedSvc := []string{"qliksense", "test_under", "test-dash", "test-dot", "test123"}
sv, err := ProcessConfigArgs(args)
if err != nil {
t.Log(err)

View File

@@ -73,8 +73,8 @@ func mongoConnCheck(kubeConfigContents []byte, namespace, mongodbUrl string) err
return err
}
api.LogDebugMessage("stdout:%v\n", stdout)
api.LogDebugMessage("stderr:%v\n", stderr)
api.LogDebugMessage("stdout:", stdout)
api.LogDebugMessage("stderr:", stderr)
stringToCheck := "Implicit session"
if strings.Contains(stdout, stringToCheck) || strings.Contains(stderr, stringToCheck) {
fmt.Println("Preflight mongo check: PASSED")

View File

@@ -2,8 +2,11 @@ package preflight
import (
"fmt"
"path"
"path/filepath"
"github.com/mitchellh/go-homedir"
"github.com/qlik-oss/k-apis/pkg/cr"
"github.com/qlik-oss/sense-installer/pkg/api"
qapi "github.com/qlik-oss/sense-installer/pkg/api"
"github.com/qlik-oss/sense-installer/pkg/qliksense"
@@ -66,6 +69,18 @@ func (qp *QliksensePreflight) checkCreateEntity(namespace, entityToTest string)
} else {
kusDir = filepath.Join(mfroot, "manifests", currentCR.Spec.Profile)
}
currentCR.SetName("random")
currentCR.Spec.RotateKeys = "None"
currentCR.Spec.ManifestsRoot = mfroot
userHomeDir, err := homedir.Dir()
if err != nil {
fmt.Printf(`error fetching user's home directory: %v\n`, err)
return err
}
cr.GeneratePatches(&currentCR.KApiCr, path.Join(userHomeDir, ".kube", "config"))
resultYamlString, err := qliksense.ExecuteKustomizeBuild(kusDir)
if err != nil {
fmt.Printf("Unable to retrieve manifests from executing kustomize: %v\n", err)