-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e66db6b
commit 879c748
Showing
19 changed files
with
900 additions
and
25 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
3 changes: 3 additions & 0 deletions
3
.../golden/log-forwarding/openshift4-logging/console-patching/openshift4_console_params.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,3 @@ | ||
config: | ||
plugins: | ||
- logging-view-plugin |
9 changes: 9 additions & 0 deletions
9
tests/golden/log-forwarding/openshift4-logging/openshift4-logging/00_namespace.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,9 @@ | ||
apiVersion: v1 | ||
kind: Namespace | ||
metadata: | ||
annotations: | ||
openshift.io/node-selector: '' | ||
labels: | ||
name: openshift-logging | ||
openshift.io/cluster-monitoring: 'true' | ||
name: openshift-logging |
11 changes: 11 additions & 0 deletions
11
tests/golden/log-forwarding/openshift4-logging/openshift4-logging/10_operator_group.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,11 @@ | ||
apiVersion: operators.coreos.com/v1 | ||
kind: OperatorGroup | ||
metadata: | ||
annotations: {} | ||
labels: | ||
name: cluster-logging | ||
name: cluster-logging | ||
namespace: openshift-logging | ||
spec: | ||
targetNamespaces: | ||
- openshift-logging |
43 changes: 43 additions & 0 deletions
43
tests/golden/log-forwarding/openshift4-logging/openshift4-logging/20_subscriptions.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,43 @@ | ||
apiVersion: operators.coreos.com/v1alpha1 | ||
kind: Subscription | ||
metadata: | ||
annotations: {} | ||
labels: | ||
name: cluster-logging | ||
name: cluster-logging | ||
namespace: openshift-logging | ||
spec: | ||
channel: stable-5.9 | ||
config: | ||
resources: | ||
limits: | ||
memory: 256Mi | ||
requests: | ||
cpu: 10m | ||
memory: 128Mi | ||
installPlanApproval: Automatic | ||
name: cluster-logging | ||
source: redhat-operators | ||
sourceNamespace: openshift-operators-redhat | ||
--- | ||
apiVersion: operators.coreos.com/v1alpha1 | ||
kind: Subscription | ||
metadata: | ||
annotations: {} | ||
labels: | ||
name: loki-operator | ||
name: loki-operator | ||
namespace: openshift-operators-redhat | ||
spec: | ||
channel: stable-5.9 | ||
config: | ||
resources: | ||
limits: | ||
memory: 512Mi | ||
requests: | ||
cpu: 50m | ||
memory: 381Mi | ||
installPlanApproval: Automatic | ||
name: loki-operator | ||
source: openshift-operators-redhat | ||
sourceNamespace: openshift-operators-redhat |
17 changes: 17 additions & 0 deletions
17
tests/golden/log-forwarding/openshift4-logging/openshift4-logging/30_cluster_logging.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,17 @@ | ||
apiVersion: logging.openshift.io/v1 | ||
kind: ClusterLogging | ||
metadata: | ||
annotations: | ||
argocd.argoproj.io/sync-options: SkipDryRunOnMissingResource=true | ||
labels: | ||
name: instance | ||
name: instance | ||
namespace: openshift-logging | ||
spec: | ||
collection: | ||
type: vector | ||
logStore: | ||
lokistack: | ||
name: loki | ||
type: lokistack | ||
managementState: Managed |
46 changes: 46 additions & 0 deletions
46
...golden/log-forwarding/openshift4-logging/openshift4-logging/31_cluster_logforwarding.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,46 @@ | ||
apiVersion: logging.openshift.io/v1 | ||
kind: ClusterLogForwarder | ||
metadata: | ||
annotations: {} | ||
labels: | ||
name: instance | ||
name: instance | ||
namespace: openshift-logging | ||
spec: | ||
filters: | ||
- drop: | ||
- test: | ||
- field: .message | ||
notMatches: .*org\.keycloak\.events.* | ||
name: keycloak-filter | ||
type: drop | ||
inputs: | ||
- application: | ||
namespaces: | ||
- vshn-keycloak-prod | ||
name: keycloak-logs | ||
outputs: | ||
- loki: | ||
tenantKey: keycloak | ||
name: appuio-loki-keycloak | ||
type: loki | ||
url: https://my-loki-url.com | ||
pipelines: | ||
- inputRefs: | ||
- application | ||
name: application-logs | ||
outputRefs: | ||
- default | ||
- inputRefs: | ||
- infrastructure | ||
name: infrastructure-logs | ||
outputRefs: | ||
- default | ||
- filterRefs: | ||
- keycloak-filter | ||
inputRefs: | ||
- keycloak-logs | ||
name: keycloak-logs | ||
outputRefs: | ||
- appuio-loki-keycloak | ||
- default |
153 changes: 153 additions & 0 deletions
153
tests/golden/log-forwarding/openshift4-logging/openshift4-logging/50_loki_ingester_fix.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,153 @@ | ||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
annotations: {} | ||
labels: | ||
name: loki-ingester-check | ||
name: loki-ingester-check | ||
namespace: openshift-logging | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: Role | ||
metadata: | ||
annotations: {} | ||
labels: | ||
name: loki-ingester-check | ||
name: loki-ingester-check | ||
namespace: openshift-logging | ||
rules: | ||
- apiGroups: | ||
- '' | ||
resources: | ||
- pods | ||
- pods/exec | ||
verbs: | ||
- get | ||
- list | ||
- watch | ||
- create | ||
- delete | ||
- patch | ||
- update | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: RoleBinding | ||
metadata: | ||
annotations: {} | ||
labels: | ||
name: loki-ingester-check | ||
name: loki-ingester-check | ||
namespace: openshift-logging | ||
roleRef: | ||
apiGroup: rbac.authorization.k8s.io | ||
kind: Role | ||
name: loki-ingester-check | ||
subjects: | ||
- kind: ServiceAccount | ||
name: loki-ingester-check | ||
--- | ||
apiVersion: v1 | ||
data: | ||
wal-check.sh: | | ||
#!/bin/bash | ||
set -e -o pipefail | ||
# Check if pod is in stuck state. | ||
function check_pod() { | ||
POD_NAME="loki-ingester-${1}" | ||
echo "checking POD ${POD_NAME}" | ||
PHASE=$(kubectl -n openshift-logging get po ${POD_NAME} -oyaml | yq '.status.phase') | ||
if [ ${PHASE} != "Running" ]; then | ||
return 0 | ||
fi | ||
READY=$(kubectl -n openshift-logging get po ${POD_NAME} -oyaml | yq '.status.conditions[] | select(.type == "ContainersReady") | .status') | ||
if [ ${READY} == "True" ]; then | ||
return 0 | ||
fi | ||
return 1 | ||
} | ||
# Check directories of pod and remove non-existing checkpoint if present. | ||
function check_dir() { | ||
shopt -s extglob | ||
POD_NAME="loki-ingester-${1}" | ||
echo "checking DIR ${POD_NAME}" | ||
DIR_CHP=$(kubectl -n openshift-logging exec -i ${POD_NAME} -- ls /tmp/wal | grep -o "^checkpoint\.[0-9]*$") | ||
PATTERN=$(echo ${DIR_CHP} | sed 's/[^0-9]*//g') | ||
DIR_WAL=$(kubectl -n openshift-logging exec -i ${POD_NAME} -- ls /tmp/wal | grep -o "^0*${PATTERN}$" || exit 0) | ||
if [ -z $DIR_WAL ]; then | ||
kubectl -n openshift-logging exec -i ${POD_NAME} -- rm -rf /tmp/wal/${DIR_CHP} | ||
kubectl -n openshift-logging delete po ${POD_NAME} | ||
fi | ||
} | ||
# Check if pods are in stuck state for longer than ${SLEEP_TIME}. | ||
# Only fix 1 pod at a time and immediatly exit if it is fixed. | ||
function fix_pod() { | ||
if ! check_pod $1; then | ||
echo "stuck POD, waiting ${SLEEP_TIME}" | ||
sleep ${SLEEP_TIME} | ||
if ! check_pod $1; then | ||
check_dir $1 | ||
exit 0 | ||
fi | ||
fi | ||
} | ||
fix_pod 0 | ||
fix_pod 1 | ||
exit 0 | ||
kind: ConfigMap | ||
metadata: | ||
annotations: {} | ||
labels: | ||
name: loki-ingester-check | ||
name: loki-ingester-check | ||
namespace: openshift-logging | ||
--- | ||
apiVersion: batch/v1 | ||
kind: CronJob | ||
metadata: | ||
annotations: {} | ||
labels: | ||
name: loki-ingester-check | ||
name: loki-ingester-check | ||
namespace: openshift-logging | ||
spec: | ||
concurrencyPolicy: Forbid | ||
failedJobsHistoryLimit: 0 | ||
jobTemplate: | ||
spec: | ||
activeDeadlineSeconds: 360 | ||
backoffLimit: 1 | ||
template: | ||
spec: | ||
containers: | ||
- command: | ||
- /usr/local/bin/wal-check.sh | ||
env: | ||
- name: SLEEP_TIME | ||
value: 2m | ||
image: quay.io/appuio/oc:v4.14 | ||
imagePullPolicy: IfNotPresent | ||
name: check-pod | ||
ports: [] | ||
stdin: false | ||
tty: false | ||
volumeMounts: | ||
- mountPath: /usr/local/bin/wal-check.sh | ||
name: wal-check | ||
readOnly: true | ||
subPath: wal-check.sh | ||
nodeSelector: | ||
node-role.kubernetes.io/infra: '' | ||
restartPolicy: Never | ||
serviceAccountName: loki-ingester-check | ||
volumes: | ||
- configMap: | ||
defaultMode: 364 | ||
name: loki-ingester-check | ||
name: wal-check | ||
schedule: '*/10 * * * *' |
17 changes: 17 additions & 0 deletions
17
tests/golden/log-forwarding/openshift4-logging/openshift4-logging/50_loki_logreader_fix.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,17 @@ | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRole | ||
metadata: | ||
annotations: {} | ||
labels: | ||
name: logging-application-logs-reader-aggregate | ||
rbac.authorization.k8s.io/aggregate-to-admin: 'true' | ||
name: logging-application-logs-reader-aggregate | ||
rules: | ||
- apiGroups: | ||
- loki.grafana.com | ||
resourceNames: | ||
- logs | ||
resources: | ||
- application | ||
verbs: | ||
- get |
14 changes: 14 additions & 0 deletions
14
tests/golden/log-forwarding/openshift4-logging/openshift4-logging/50_loki_logstore.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,14 @@ | ||
apiVersion: v1 | ||
data: {} | ||
kind: Secret | ||
metadata: | ||
annotations: {} | ||
labels: | ||
name: loki-logstore | ||
name: loki-logstore | ||
stringData: | ||
access_key_id: '' | ||
access_key_secret: '' | ||
bucketnames: c-green-test-1234-logstore | ||
endpoint: '' | ||
type: Opaque |
Oops, something went wrong.