-
Notifications
You must be signed in to change notification settings - Fork 1
/
model.go
158 lines (135 loc) · 6.24 KB
/
model.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
/**
Copyright 2022 DataStax, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
**/
package model
import (
"github.com/gruntwork-io/terratest/modules/k8s"
corev1 "k8s.io/api/core/v1"
)
type PoolRackConfig struct {
Name string `json:"name,omitempty"`
Label string `json:"label,omitempty"`
Location string `json:"location,omitempty"`
}
type CloudConfig struct {
Type string `json:"type,omitempty"`
Locations []string `json:"locations,omitempty"`
PoolRackConfigs []PoolRackConfig `json:"poolRackConfigs,omitempty"`
Zones []string `json:"zones,omitempty"`
Region string `json:"region,omitempty"`
Project string `json:"project,omitempty"`
Name string `json:"name,omitempty"`
CredPath string `json:"cred_path,omitempty"`
CredKey string `json:"cred_key,omitempty"`
Environment string `json:"environment,omitempty"`
MachineType string `json:"machine_type,omitempty"`
Bucket string `json:"bucket,omitempty"`
}
type TFConfig struct {
ModuleFolder string `json:"module_folder,omitempty"`
}
type HelmConfig struct {
ChartPath string `json:"chart_path,omitempty"`
}
type K8cConfig struct {
Version string `json:"version,omitempty"`
MedusaSecretName string `json:"medusa_secret_name,omitempty"`
MedusaSecretFromFileKey string `json:"medusa_secret_from_file_key,omitempty"`
MedusaSecretFromFile string `json:"medusa_secret_from_file,omitempty"`
ValuesFilePath string `json:"values_file_path,omitempty"`
ClusterScoped bool `json:"cluster_scoped,omitempty"`
ClusterName string `json:"cluster_name,omitempty"`
}
type NetworkConfig struct {
TraefikValuesFile string `json:"traefik_values_file,omitempty"`
TraefikVersion string `json:"traefik_version"`
SubnetCidrBlock string `json:"subnetCidrBlock"`
MasterIpv4CidrBlock string `json:"master_ipv_4_cidr_block"`
SecondaryCidrBlock string `json:"secondary_cidr_block"`
}
type ProvisionConfig struct {
DefaultRetries int `json:"default_retries,omitempty"`
DefaultSleepSecs int `json:"default_sleep_secs,omitempty"`
DefaultTimeoutSecs int `json:"default_timeout_secs,omitempty"`
HelmConfig HelmConfig `json:"helm_config"`
TFConfig TFConfig `json:"tf_config"`
K8cConfig K8cConfig `json:"k8c_config"`
}
type ProvisionResult struct {
Success bool `json:"success,omitempty"`
}
type ContextConfig struct {
Name string `json:"name,omitempty"`
Namespace string `json:"namespace,omitempty"`
ClusterLabels []string `json:"cluster_labels,omitempty"`
NetworkConfig NetworkConfig `json:"network_config,omitempty"`
CloudConfig CloudConfig `json:"cloud_config,omitempty"`
}
type ContextOption struct {
ShortName string `json:"short_name" yaml:"short_name"`
FullName string `json:"full_name,omitempty" yaml:"full_name,omitempty"`
KubectlOptions *k8s.KubectlOptions `json:"kubectl_options,omitempty"`
AdminOptions *k8s.KubectlOptions `json:"admin_options,omitempty"`
ServiceAccount *ContextServiceAccount `json:"service_account" yaml:"service_account,omitempty"`
ServerAddress string `json:"server_address" yaml:"server_address,omitempty"`
ProvisionMeta ProvisionMeta `json:"provision_meta" yaml:"provision_meta"`
}
type ReadinessConfig struct {
ProvisionConfig ProvisionConfig `json:"provision_config"`
KubectlConfigPath string `json:"kubectl_config_path,omitempty"`
UniqueId string `json:"unique_id,omitempty"`
RootFolder string `json:"root_folder,omitempty"`
Contexts map[string]ContextConfig `json:"contexts,omitempty"`
ServiceAccountNameSuffix string `json:"service_account_name_suffix,omitempty"`
ExpectedNodeCount int `json:"expected_node_count,omitempty"`
}
type ContextServiceAccount struct {
Name string `json:"name" yaml:"name,omitempty"`
Secret string `json:"secret" yaml:"secret,omitempty"`
Token string `json:"token" yaml:"token,omitempty"`
Cert []byte `json:"cert"`
Namespace string `json:"namespace" yaml:"namespace,omitempty"`
}
type ContextTestManifest struct {
Name string `json:"name"`
ModulesFolder string `json:"modules_folder"`
ReadinessConfig ReadinessConfig `json:"readiness_config,omitempty"`
}
type ProvisionMeta struct {
Enable EnableConfig `json:"enable,omitempty"`
ProvisionId string `json:"provision_id,omitempty"`
KubeConfigs map[string]string `json:"kube_configs,omitempty"`
ArtifactsRootDir string `json:"artifacts_root_dir"`
DefaultConfigPath string `json:"default_config_path"`
DefaultConfigDir string `json:"default_config_dir"`
AdminIdentity string `json:"admin_identity"`
}
type EnableConfig struct {
Simulate bool `json:"simulate,omitempty"`
RemoveAll bool `json:"remove_all,omitempty"`
Install bool `json:"install_enabled,omitempty"`
ProvisionInfra bool `json:"provision_enabled,omitempty"`
PreInstallSetup bool `json:"pre_install_setup,omitempty"`
}
type ObjectMeta struct {
Name string `yaml:"name"`
}
type ClientConfigSpec struct {
ContextName string `yaml:"contextName"`
KubeConfigSecret corev1.LocalObjectReference `yaml:"kubeConfigSecret"`
}
type ClientConfig struct {
ApiVersion string `yaml:"apiVersion"`
Kind string `yaml:"kind"`
Metadata ObjectMeta `yaml:"metadata"`
Spec ClientConfigSpec `yaml:"spec"`
}