Skip to content

Commit

Permalink
fix: validation errors on fixtures
Browse files Browse the repository at this point in the history
  • Loading branch information
moshloop committed Feb 11, 2025
1 parent bda6acd commit 77e0c66
Show file tree
Hide file tree
Showing 11 changed files with 53 additions and 40 deletions.
26 changes: 13 additions & 13 deletions fixtures/aws/aws_config_pass.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,25 @@ metadata:
spec:
schedule: "@every 5m"
awsConfig:
- query: |
- name: aws config pass
query: |
SELECT
configuration.complianceType,
COUNT(*)
WHERE
resourceType = 'AWS::Config::ResourceCompliance'
GROUP BY
configuration.complianceType
awsConnection:
accessKeyID:
valueFrom:
secretKeyRef:
name: aws-credentials
key: AWS_ACCESS_KEY_ID
secretKey:
valueFrom:
secretKeyRef:
name: aws-credentials
key: AWS_SECRET_ACCESS_KEY
region: af-south-1
accessKey:
valueFrom:
secretKeyRef:
name: aws-credentials
key: AWS_ACCESS_KEY_ID
secretKey:
valueFrom:
secretKeyRef:
name: aws-credentials
key: AWS_SECRET_ACCESS_KEY
region: af-south-1
display:
template: "{{ .results }}"
27 changes: 14 additions & 13 deletions fixtures/aws/cloudwatch_pass.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,17 @@ metadata:
spec:
schedule: "@every 5m"
cloudwatch:
region: "eu-west-1"
transform:
expr: |
results.MetricAlarms.filter(i, i.StateValue != 'OK' ).map(i,
{
'name': i.MetricName,
'icon': 'aws-cloudwatch-alarm',
'duration': time.Since(timestamp(i.StateTransitionedTimestamp)).getMilliseconds(),
'labels': fromAWSMap(i.Dimensions).
merge({'arn': i.AlarmArn}),
'message': "%s (%s) %s".format([i.AlarmDescription, i.AlarmArn, fromAWSMap(i.Dimensions)]),
}
).toJSON()
- name: cloudwatch test
region: "eu-west-1"
transform:
expr: |
results.MetricAlarms.filter(i, i.StateValue != 'OK' ).map(i,
{
'name': i.MetricName,
'icon': 'aws-cloudwatch-alarm',
'duration': time.Since(timestamp(i.StateTransitionedTimestamp)).getMilliseconds(),
'labels': fromAWSMap(i.Dimensions).
merge({'arn': i.AlarmArn}),
'message': "%s (%s) %s".format([i.AlarmDescription, i.AlarmArn, fromAWSMap(i.Dimensions)]),
}
).toJSON()
5 changes: 3 additions & 2 deletions fixtures/azure/devops.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@ metadata:
spec:
schedule: "@every 5m"
azureDevops:
- project: Demo1
- name: ado test
project: Demo1
pipeline: ^windows-
personalAccessToken:
value: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
organization: flanksource
variable:
variables:
env: prod
branch:
- main
Expand Down
2 changes: 1 addition & 1 deletion fixtures/elasticsearch/stateful_metrics.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: canaries.flanksource.com/v1
kind: Canary
metadata:
name: "container-log-counts"
namespace: observability
spec:
# The schedule can be as short or as long as you want, the query will always search for log
# since the last query
schedule: "@every 5m"
Expand Down
7 changes: 4 additions & 3 deletions fixtures/external/dynatrace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ spec:
- name: dynatrace
scheme: https
host: <HOST>
apiKey:
value: '<ACCESS_TOKEN>' # https://www.dynatrace.com/support/help/manage/access-control/access-tokens/personal-access-token
javascript: |
apiKey:
value: "<ACCESS_TOKEN>" # https://www.dynatrace.com/support/help/manage/access-control/access-tokens/personal-access-token
display:
javascript: |
var out = _.map(results, function(r) {
return {
name: r.title,
Expand Down
4 changes: 2 additions & 2 deletions fixtures/k8s/kubernetes_pass.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ metadata:
spec:
schedule: "@every 5m"
kubernetes:
- namspaceSelector:
- namespaceSelector:
name: canaries
name: k8s-ready pods
kind: Pod
resource:
labelSelector: app=k8s-ready
- namspaceSelector:
- namespaceSelector:
name: canaries
kind: Pod
name: k8s-ready pods
Expand Down
3 changes: 2 additions & 1 deletion fixtures/minimal/http_template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ spec:
url: https://webhook.site/#!/9f1392a6-718a-4ef5-a8e2-bfb55b08afca/f93d307b-0aaf-4a38-b9b3-db5daaae5657/1
responseCodes: [200]
templateBody: true
envVar:

env:
- name: db
valueFrom:
secretKeyRef:
Expand Down
3 changes: 2 additions & 1 deletion fixtures/minimal/icmp_fail.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ metadata:
spec:
schedule: "@every 5m"
icmp:
- url: https://github.com
- name: github
endpoint: https://github.com
thresholdMillis: 1
packetLossThreshold: 5
packetCount: 2
6 changes: 3 additions & 3 deletions fixtures/minimal/jmeter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ kind: Canary
metadata:
name: jmeter-check
spec:
schedule: '@every 30s'
schedule: "@every 30s"
jmeter:
- name: jmeter check
url: 192.168.1.5
host: 192.168.1.5
port: 1099
jmx:
valueFrom:
configMapKeyRef:
name: jmeter-config
key: sample
key: sample
2 changes: 1 addition & 1 deletion fixtures/minimal/tcp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ spec:
schedule: "*/1 * * * *"
tcp:
- name: "flanksource website"
url: www.flanksource.com:80
endpoint: www.flanksource.com:80
thresholdMillis: 1200
8 changes: 8 additions & 0 deletions test/e2e-operator.sh
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,14 @@ CANARY_COUNT=$(echo "$CANARY_COUNT" | xargs)
STATUS_COUNT_POSTGRES=$(curl -s http://0.0.0.0:8080/api/summary | jq ".checks_summary | length")


for fixture in minimal datasources k8s git ldap opensearch prometheus external elasticsearch aws azure; do

for f in $(find ./fixtures/$fixture -name "*.yaml" ! -name "kustomization.yaml" ! -name "_*" )
kubectl apply -f $f --dry-run=server

done


echo "Canary count: ${CANARY_COUNT}"
echo "Postgres count: ${STATUS_COUNT_POSTGRES}"

Expand Down

0 comments on commit 77e0c66

Please sign in to comment.