-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add method for AKS data gatherer to load data from file rather than using AKS API Signed-off-by: wwwil <wwwil.squires@gmail.com> * Add local data gatherer for loading data from local files Signed-off-by: wwwil <wwwil.squires@gmail.com> * If any data gatherer specifies a data-path then use a LocalDataGatherer to impersonate it Signed-off-by: wwwil <wwwil.squires@gmail.com> * Remove data-path handling from AKS data gatherer Signed-off-by: wwwil <wwwil.squires@gmail.com> * Add an example fake data for AKS and GKE with config for using fake data Signed-off-by: wwwil <wwwil.squires@gmail.com> * Fake -> stubbed As discussed on standup this morning Signed-off-by: Charlie Egan <charlieegan3@users.noreply.github.com> Co-authored-by: William Squires <williamsquires@spatialos.com>
- Loading branch information
1 parent
33cfa96
commit 9d4a340
Showing
7 changed files
with
261 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# Local Data Gatherer | ||
|
||
This is intended to be used for reading data for evaluation from the local file | ||
system. It can also be used for 'stubbing' remote data sources when testing | ||
other data gatherers. An example of this can be seen | ||
[here](../../examples/stubbed.preflight.yaml). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
{ | ||
"aks": { | ||
"Cluster": { | ||
"properties": { | ||
"networkProfile": { | ||
"dockerBridgeCidr": "172.17.0.1/16", | ||
"dnsServiceIP": "10.0.0.10", | ||
"serviceCidr": "10.0.0.0/16", | ||
"podCidr": "10.244.0.0/16", | ||
"networkPlugin": "kubenet" | ||
}, | ||
"enableRBAC": true, | ||
"nodeResourceGroup": "MC_preflight_preflight-test_uksouth", | ||
"addonProfiles": { | ||
"httpApplicationRouting": { | ||
"config": null, | ||
"enabled": false | ||
} | ||
}, | ||
"servicePrincipalProfile": { | ||
"clientId": "***********************" | ||
}, | ||
"agentPoolProfiles": [ | ||
{ | ||
"osType": "Linux", | ||
"maxPods": 110, | ||
"storageProfile": "ManagedDisks", | ||
"osDiskSizeGB": 100, | ||
"vmSize": "Standard_B2s", | ||
"count": 1, | ||
"name": "agentpool" | ||
} | ||
], | ||
"fqdn": "preflight-test-dns-f2de96e5.hcp.uksouth.azmk8s.io", | ||
"dnsPrefix": "preflight-test-dns", | ||
"kubernetesVersion": "1.14.8", | ||
"provisioningState": "Succeeded" | ||
}, | ||
"type": "Microsoft.ContainerService/ManagedClusters", | ||
"name": "preflight-test", | ||
"location": "uksouth", | ||
"id": "/subscriptions/*****************/resourcegroups/preflight/providers/Microsoft.ContainerService/managedClusters/preflight-test" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,144 @@ | ||
{ | ||
"addonsConfig": { | ||
"horizontalPodAutoscaling": {}, | ||
"httpLoadBalancing": {}, | ||
"istioConfig": { | ||
"disabled": true | ||
}, | ||
"kubernetesDashboard": { | ||
"disabled": true | ||
}, | ||
"networkPolicyConfig": { | ||
"disabled": true | ||
} | ||
}, | ||
"authenticatorGroupsConfig": {}, | ||
"clusterIpv4Cidr": "10.4.0.0/14", | ||
"clusterTelemetry": { | ||
"type": "ENABLED" | ||
}, | ||
"createTime": "2020-01-15T18:55:55+00:00", | ||
"currentMasterVersion": "1.14.8-gke.12", | ||
"currentNodeCount": 3, | ||
"currentNodeVersion": "1.14.8-gke.12", | ||
"databaseEncryption": { | ||
"state": "DECRYPTED" | ||
}, | ||
"defaultMaxPodsConstraint": { | ||
"maxPodsPerNode": "110" | ||
}, | ||
"endpoint": "104.155.177.255", | ||
"initialClusterVersion": "1.14.8-gke.12", | ||
"instanceGroupUrls": [ | ||
"https://www.googleapis.com/compute/v1/projects/jetstack-wil/zones/us-central1-a/instanceGroupManagers/gke-standard-cluster-2-default-pool-83d58bed-grp" | ||
], | ||
"ipAllocationPolicy": { | ||
"clusterIpv4Cidr": "10.4.0.0/14", | ||
"clusterIpv4CidrBlock": "10.4.0.0/14", | ||
"clusterSecondaryRangeName": "gke-standard-cluster-2-pods-fddd6f46", | ||
"servicesIpv4Cidr": "10.70.0.0/20", | ||
"servicesIpv4CidrBlock": "10.70.0.0/20", | ||
"servicesSecondaryRangeName": "gke-standard-cluster-2-services-fddd6f46", | ||
"useIpAliases": true | ||
}, | ||
"labelFingerprint": "a9dc16a7", | ||
"legacyAbac": {}, | ||
"location": "us-central1-a", | ||
"locations": [ | ||
"us-central1-a" | ||
], | ||
"loggingService": "logging.googleapis.com/kubernetes", | ||
"maintenancePolicy": { | ||
"resourceVersion": "e3b0c442" | ||
}, | ||
"masterAuth": { | ||
"clusterCaCertificate": "LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURERENDQWZTZ0F3SUJBZ0lSQUtQT2NXc0JGTzFiZTJrbWZxMFZZNzh3RFFZSktvWklodmNOQVFFTEJRQXcKTHpFdE1Dc0dBMVVFQXhNa1pXSmtPVGxqTlRNdE5XRTRZaTAwT1dRMUxUZzJOV1V0TUdVell6a3daakJsWldGaApNQjRYRFRJd01ERXhOVEUzTlRVMU5Wb1hEVEkxTURFeE16RTROVFUxTlZvd0x6RXRNQ3NHQTFVRUF4TWtaV0prCk9UbGpOVE10TldFNFlpMDBPV1ExTFRnMk5XVXRNR1V6WXprd1pqQmxaV0Z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L0YKS2FSaG0xVWp3M1oxZTNZeno0cUQ4UT09Ci0tLS0tRU5EIENFUlRJRklDQVRFLS0tLS0K" | ||
}, | ||
"masterAuthorizedNetworksConfig": {}, | ||
"monitoringService": "monitoring.googleapis.com/kubernetes", | ||
"name": "standard-cluster-2", | ||
"network": "default", | ||
"networkConfig": { | ||
"network": "projects/jetstack-wil/global/networks/default", | ||
"subnetwork": "projects/jetstack-wil/regions/us-central1/subnetworks/default" | ||
}, | ||
"networkPolicy": {}, | ||
"nodeConfig": { | ||
"diskSizeGb": 100, | ||
"diskType": "pd-standard", | ||
"imageType": "COS", | ||
"machineType": "n1-standard-1", | ||
"metadata": { | ||
"disable-legacy-endpoints": "true" | ||
}, | ||
"oauthScopes": [ | ||
"https://www.googleapis.com/auth/devstorage.read_only", | ||
"https://www.googleapis.com/auth/logging.write", | ||
"https://www.googleapis.com/auth/monitoring", | ||
"https://www.googleapis.com/auth/servicecontrol", | ||
"https://www.googleapis.com/auth/service.management.readonly", | ||
"https://www.googleapis.com/auth/trace.append" | ||
], | ||
"serviceAccount": "default", | ||
"shieldedInstanceConfig": { | ||
"enableIntegrityMonitoring": true | ||
} | ||
}, | ||
"nodePools": [ | ||
{ | ||
"autoscaling": {}, | ||
"config": { | ||
"diskSizeGb": 100, | ||
"diskType": "pd-standard", | ||
"imageType": "COS", | ||
"machineType": "n1-standard-1", | ||
"metadata": { | ||
"disable-legacy-endpoints": "true" | ||
}, | ||
"oauthScopes": [ | ||
"https://www.googleapis.com/auth/devstorage.read_only", | ||
"https://www.googleapis.com/auth/logging.write", | ||
"https://www.googleapis.com/auth/monitoring", | ||
"https://www.googleapis.com/auth/servicecontrol", | ||
"https://www.googleapis.com/auth/service.management.readonly", | ||
"https://www.googleapis.com/auth/trace.append" | ||
], | ||
"serviceAccount": "default", | ||
"shieldedInstanceConfig": { | ||
"enableIntegrityMonitoring": true | ||
} | ||
}, | ||
"initialNodeCount": 3, | ||
"instanceGroupUrls": [ | ||
"https://www.googleapis.com/compute/v1/projects/jetstack-wil/zones/us-central1-a/instanceGroupManagers/gke-standard-cluster-2-default-pool-83d58bed-grp" | ||
], | ||
"locations": [ | ||
"us-central1-a" | ||
], | ||
"management": { | ||
"autoRepair": true, | ||
"autoUpgrade": true | ||
}, | ||
"maxPodsConstraint": { | ||
"maxPodsPerNode": "110" | ||
}, | ||
"name": "default-pool", | ||
"podIpv4CidrSize": 24, | ||
"selfLink": "https://container.googleapis.com/v1beta1/projects/jetstack-wil/zones/us-central1-a/clusters/standard-cluster-2/nodePools/default-pool", | ||
"status": "RUNNING", | ||
"version": "1.14.8-gke.12" | ||
} | ||
], | ||
"releaseChannel": { | ||
"channel": "REGULAR" | ||
}, | ||
"selfLink": "https://container.googleapis.com/v1beta1/projects/jetstack-wil/zones/us-central1-a/clusters/standard-cluster-2", | ||
"servicesIpv4Cidr": "10.70.0.0/20", | ||
"shieldedNodes": {}, | ||
"status": "RUNNING", | ||
"subnetwork": "default", | ||
"tierSettings": { | ||
"tier": "STANDARD" | ||
}, | ||
"zone": "us-central1-a" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
cluster-name: my-stubbed-cluster | ||
|
||
data-gatherers: | ||
aks: | ||
# Stubbed data for AKS. | ||
data-path: ./examples/data/aks.json | ||
gke: | ||
# Stubbed data for GKE. | ||
data-path: ./examples/data/gke.json | ||
|
||
package-sources: | ||
- type: local | ||
dir: preflight-packages/ | ||
|
||
enabled-packages: | ||
- "examples.jetstack.io/aks_basic" | ||
- "examples.jetstack.io/gke_basic" | ||
|
||
outputs: | ||
# Write the report to the CLI. | ||
- type: cli |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package local | ||
|
||
import "io/ioutil" | ||
|
||
type LocalDataGatherer struct { | ||
dataPath string | ||
} | ||
|
||
// NewLocalDataGatherer returns a LocalDatagatherer with the dataPath provided. | ||
func NewLocalDataGatherer(dataPath string) *LocalDataGatherer { | ||
return &LocalDataGatherer{ | ||
dataPath: dataPath, | ||
} | ||
} | ||
|
||
// Fetch loads and returns the data from the LocalDatagatherer's dataPath | ||
func (g *LocalDataGatherer) Fetch() (interface{}, error) { | ||
dataBytes, err := ioutil.ReadFile(g.dataPath) | ||
if err != nil { | ||
return nil, err | ||
} | ||
return dataBytes, nil | ||
} |