Skip to content

Commit

Permalink
Fixed logging type
Browse files Browse the repository at this point in the history
  • Loading branch information
psav committed Jun 10, 2022
1 parent 16e66a2 commit 833ced7
Show file tree
Hide file tree
Showing 11 changed files with 220 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
apiVersion: v1
kind: Namespace
metadata:
name: test-log-app-interface
spec:
finalizers:
- kubernetes
13 changes: 13 additions & 0 deletions bundle/tests/scorecard/kuttl/test-log-app-interface/01-assert.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
apiVersion: v1
kind: Secret
metadata:
name: puptoo
namespace: test-log-app-interface
labels:
app: puptoo
ownerReferences:
- apiVersion: cloud.redhat.com/v1alpha1
kind: ClowdApp
name: puptoo
type: Opaque
66 changes: 66 additions & 0 deletions bundle/tests/scorecard/kuttl/test-log-app-interface/01-pods.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
---
apiVersion: cloud.redhat.com/v1alpha1
kind: ClowdEnvironment
metadata:
name: test-log-app-interface
spec:
targetNamespace: test-log-app-interface
providers:
web:
port: 8000
mode: operator
metrics:
port: 9000
mode: operator
path: "/metrics"
kafka:
mode: none
db:
mode: none
logging:
mode: app-interface
objectStore:
mode: none
inMemoryDb:
mode: none
resourceDefaults:
limits:
cpu: 400m
memory: 1024Mi
requests:
cpu: 30m
memory: 512Mi
---
apiVersion: cloud.redhat.com/v1alpha1
kind: ClowdApp
metadata:
name: puptoo
namespace: test-log-app-interface
spec:
envName: test-log-app-interface
deployments:
- name: processor
podSpec:
image: quay.io/psav/clowder-hello
env:
- name: ENV_VAR_1
value: env_var_1
- name: ENV_VAR_2
value: env_var_2
webServices:
public:
enabled: true
private:
enabled: true
---
apiVersion: v1
data:
aws_access_key_id: YXdzX2FjY2Vzc19rZXk=
aws_region: dXMtZWFzdA==
aws_secret_access_key: YXdzX3NlY3JldF9rZXk=
log_group_name: dGVzdC1hcHAtaW50ZXJmYWNlLXMz
kind: Secret
metadata:
name: cloudwatch
namespace: test-log-app-interface
type: Opaque
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
apiVersion: kuttl.dev/v1beta1
kind: TestStep
commands:
- script: sleep 5
- script: kubectl get secret --namespace=test-log-app-interface puptoo -o json > /tmp/test-log-app-interface
- script: jq -r '.data["cdappconfig.json"]' < /tmp/test-log-app-interface | base64 -d > /tmp/test-log-app-interface-json

- script: jq -r '.logging.type == "cloudwatch"' -e < /tmp/test-log-app-interface-json
- script: jq -r '.logging.cloudwatch.region == "us-east"' -e < /tmp/test-log-app-interface-json
13 changes: 13 additions & 0 deletions bundle/tests/scorecard/kuttl/test-log-app-interface/03-delete.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
apiVersion: kuttl.dev/v1beta1
kind: TestStep
delete:
- apiVersion: v1
kind: Namespace
name: test-log-app-interface
- apiVersion: cloud.redhat.com/v1alpha1
kind: ClowdEnvironment
name: test-log-app-interface
- apiVersion: v1
kind: Namespace
name: test-log-app-interface-secret
8 changes: 8 additions & 0 deletions bundle/tests/scorecard/kuttl/test-log-none/00-install.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
apiVersion: v1
kind: Namespace
metadata:
name: test-log-none
spec:
finalizers:
- kubernetes
13 changes: 13 additions & 0 deletions bundle/tests/scorecard/kuttl/test-log-none/01-assert.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
apiVersion: v1
kind: Secret
metadata:
name: puptoo
namespace: test-log-none
labels:
app: puptoo
ownerReferences:
- apiVersion: cloud.redhat.com/v1alpha1
kind: ClowdApp
name: puptoo
type: Opaque
66 changes: 66 additions & 0 deletions bundle/tests/scorecard/kuttl/test-log-none/01-pods.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
---
apiVersion: cloud.redhat.com/v1alpha1
kind: ClowdEnvironment
metadata:
name: test-log-none
spec:
targetNamespace: test-log-none
providers:
web:
port: 8000
mode: operator
metrics:
port: 9000
mode: operator
path: "/metrics"
kafka:
mode: none
db:
mode: none
logging:
mode: none
objectStore:
mode: none
inMemoryDb:
mode: none
resourceDefaults:
limits:
cpu: 400m
memory: 1024Mi
requests:
cpu: 30m
memory: 512Mi
---
apiVersion: cloud.redhat.com/v1alpha1
kind: ClowdApp
metadata:
name: puptoo
namespace: test-log-none
spec:
envName: test-log-none
deployments:
- name: processor
podSpec:
image: quay.io/psav/clowder-hello
env:
- name: ENV_VAR_1
value: env_var_1
- name: ENV_VAR_2
value: env_var_2
webServices:
public:
enabled: true
private:
enabled: true
---
apiVersion: v1
data:
aws_access_key_id: YXdzX2FjY2Vzc19rZXk=
aws_region: dXMtZWFzdA==
aws_secret_access_key: YXdzX3NlY3JldF9rZXk=
log_group_name: dGVzdC1hcHAtaW50ZXJmYWNlLXMz
kind: Secret
metadata:
name: cloudwatch
namespace: test-log-none
type: Opaque
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
apiVersion: kuttl.dev/v1beta1
kind: TestStep
commands:
- script: sleep 5
- script: kubectl get secret --namespace=test-log-none puptoo -o json > /tmp/test-log-none
- script: jq -r '.data["cdappconfig.json"]' < /tmp/test-log-none | base64 -d > /tmp/test-log-none-json

- script: jq -r '.logging.type == "null"' -e < /tmp/test-log-none-json
13 changes: 13 additions & 0 deletions bundle/tests/scorecard/kuttl/test-log-none/03-delete.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
apiVersion: kuttl.dev/v1beta1
kind: TestStep
delete:
- apiVersion: v1
kind: Namespace
name: test-log-none
- apiVersion: cloud.redhat.com/v1alpha1
kind: ClowdEnvironment
name: test-log-none
- apiVersion: v1
kind: Namespace
name: test-log-none-secret
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ func setCloudwatchSecret(ns string, p *providers.Provider, c *config.LoggingConf
Region: string(secret.Data["aws_region"]),
LogGroup: string(secret.Data["log_group_name"]),
}
c.Type = "cloudwatch"

return nil
}

0 comments on commit 833ced7

Please sign in to comment.