...

Source file src/edge-infra.dev/pkg/edge/api/graph/mapper/constants.go

Documentation: edge-infra.dev/pkg/edge/api/graph/mapper

     1  package mapper
     2  
     3  import (
     4  	"time"
     5  
     6  	"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
     7  	"k8s.io/apimachinery/pkg/util/intstr"
     8  
     9  	"edge-infra.dev/pkg/edge/api/graph/model"
    10  )
    11  
    12  // Namespace for flux components changes and is used in a number of components
    13  // Update here accordingly to update all instances of flux namespace within project
    14  const (
    15  	HelmReleaseNamespace     = "flux-system"
    16  	TimeFormat               = "2006-01-02 15:04:05"
    17  	testSecret               = "test-secret"
    18  	workloadLabel            = "workload.edge.ncr.com"
    19  	testOrganization         = "orgname"
    20  	organization             = "test-org" // is namespace
    21  	storeClusterName         = "test-store"
    22  	SecretManagerSecretLabel = "secret-mamager.edge.ncr.com"
    23  	HelmReleaseTimeout       = 15
    24  	apiVersion               = "clusterregistry.k8s.io/v1alpha1"
    25  	AddNamespaceKind         = "AddNamespace"
    26  	AddHelmRepoKind          = "AddHelmRepository"
    27  	AddExternalSecretKind    = "AddExternalSecret" //nolint not credentials
    28  	TenantPrefix             = "tenant-"
    29  	DeleteResourceKind       = "DeleteResource"
    30  	AddClusterKind           = "AddCluster"
    31  	kubeconfig               = `
    32  apiVersion: v1
    33  clusters:
    34  - k3sTask:
    35     certificate-authority-data: will-be-redacted
    36     server: https://localhost
    37   name: k8s
    38  contexts:
    39  - context:
    40     k3sTask: k8s
    41     user: test
    42   name: k8s
    43  current-context: k8s
    44  kind: Config
    45  preferences: {}
    46  users:
    47  - name: test
    48   user:
    49     password: will-be-redacted
    50     username: test-name
    51  `
    52  	sMock = `
    53  apiVersion: v1
    54  kind: Secret
    55  data:
    56  	clientCert:	""
    57  	clientKey:	""
    58  	clusterCA: %s
    59  	endpoint: https://localhost
    60  	password: ""
    61  	username: default-agent
    62  	namespace: test-namespace
    63  metadata:
    64  	namespace: test-namespace
    65  	name: test
    66  ` //nolint test
    67  	configValues = `
    68  {
    69     "global": {
    70        "deploymentMode": "store",
    71        "gcloud": {
    72           "serviceAccount": {
    73              "enabled": true,
    74              "secret": "ewog-testing"
    75  		}
    76        }
    77     }
    78  }`
    79  )
    80  
    81  var (
    82  	SAName          = "bff-sa"
    83  	SANamespace     = "edge-system"
    84  	EdgeNamespace   = "edge-system"
    85  	Region          = "region-infra"
    86  	helmRepository  = "test-helm-repository"
    87  	helmChart       = "test-helm-chart"
    88  	name            = "test-name"
    89  	version         = "test-version"
    90  	namespace       = "test-namespace"
    91  	projectID       = "test"
    92  	privateKey      = "fawef2234"
    93  	privateKeyID    = "werwerwe"
    94  	clientEmail     = "test123@acc.com"
    95  	tokenURI        = "23423423"
    96  	httpPort        = intstr.FromInt(8000)
    97  	conditionTime   = time.Now()
    98  	startedPointer  = Started
    99  	testPodlist     = GetTestWorkloadPodList(conditionTime, startedPointer)
   100  	testDeployment  = GetTestWorkloadDeployment(httpPort)
   101  	testStatefulSet = GetTestWorkloadStatefulSet(httpPort)
   102  	testDaemonSet   = GetTestWorkloadDaemonSet(httpPort)
   103  
   104  	badServiceAccount        = []byte(`{"project_id":wef323!}`)
   105  	fakeServiceAccountSecret = []byte(`{"type":"servAcc",
   106  "project_id":"test",
   107  "private_key_id":"werwerwe",
   108  "private_key":"fawef2234",
   109  "client_email":"test123@acc.com",
   110  "token_uri":"23423423"}`)
   111  
   112  	unstruct = map[string]interface{}{
   113  		"testkey": "testval1",
   114  		"testkey2": struct {
   115  			source string
   116  			test   float64
   117  		}{"test4", 1.75},
   118  		"bool": true,
   119  	}
   120  	unstructarr = &unstructured.UnstructuredList{Items: []unstructured.Unstructured{
   121  		{
   122  			Object: unstruct,
   123  		},
   124  		{
   125  			Object: unstruct,
   126  		},
   127  	}}
   128  
   129  	testValsSuccess = []*model.KeyValues{
   130  		{
   131  			Key:   "helmUrl",
   132  			Value: "iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAYA",
   133  		},
   134  	}
   135  )
   136  

View as plain text