Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RHCLOUD-19829] Fixed logging type #627

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought we left null keys absent these days, but I can see this has been in place in the code for awhile so probably not worth changing just for this simple fix.

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
}