-
Notifications
You must be signed in to change notification settings - Fork 312
Upgrade fluentbit-operator to fluent-operator #779
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,80 @@ | ||||||
| #!/bin/bash | ||||||
| namespace=kubesphere-logging-system | ||||||
| deployment="fluentbit-operator" | ||||||
|
|
||||||
| function error_exit { | ||||||
| echo "$1" 1>&2 | ||||||
| exit 1 | ||||||
| } | ||||||
|
|
||||||
| function converting(){ | ||||||
|
||||||
| ## Converting an existing configuration to a new one | ||||||
| local resource=$1 | ||||||
wenchajun marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||
| local kind=$2 | ||||||
wenchajun marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||
| local list=$(kubectl get $resource.logging.kubesphere.io -A -o json) || error_exit "Cannot get resource $reresource" | ||||||
| local name=($(echo $list | jq -r '.items[].metadata.name | @json')) | ||||||
| local labels=($(echo $list | jq -r '.items[].metadata.labels | @json')) | ||||||
| local spec=($(echo $list | jq -r '.items[].spec | @json')) | ||||||
| local ns=($(echo $list | jq -r '.items[].metadata.namespace | @json')) | ||||||
| local size=${#spec[*]} | ||||||
| echo "Number of original $resource configuration files:$size" | ||||||
| for((i=0;i<${size};i++));do | ||||||
| if [[ "${kind}" = "fluentbits" ]]; then | ||||||
| cluster_resource_list[i]="{ | ||||||
| \"apiVersion\": \"fluentbit.fluent.io/v1alpha2\", | ||||||
| \"kind\": \"${kind}\", | ||||||
| \"metadata\": { | ||||||
| \"name\": ${name[i]}, | ||||||
| \"labels\": ${labels[i]}, | ||||||
| \"namespace\": \"${ns}\" | ||||||
| }, | ||||||
| \"spec\": ${spec[i]} | ||||||
| }" | ||||||
| else | ||||||
| cluster_resource_list[i]="{ | ||||||
| \"apiVersion\": \"fluentbit.fluent.io/v1alpha2\", | ||||||
| \"kind\": \"${kind}\", | ||||||
| \"metadata\": { | ||||||
| \"name\": ${name[i]}, | ||||||
| \"labels\": ${labels[i]} | ||||||
| }, | ||||||
| \"spec\": ${spec[i]} | ||||||
| }" | ||||||
| fi | ||||||
| done | ||||||
|
|
||||||
| ## Uninstall the fluentbit-operator and the original configuration | ||||||
| for((i=0;i<${size};i++));do | ||||||
| echo "${name[i]}" | ||||||
| temp=$(echo ${name[i]} | sed 's/"//g') | ||||||
| echo "$temp" | ||||||
| kubectl delete $resource.logging.kubesphere.io $temp -n ${namespace} | ||||||
| done | ||||||
|
|
||||||
| for((i=0;i<${size};i++));do | ||||||
| echo ${cluster_resource_list[i]} | kubectl apply -f - || error_exit "Cannot apply resource $reresource" | ||||||
| done | ||||||
| } | ||||||
|
|
||||||
| converting "inputs" "ClusterInput" | ||||||
wenchajun marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||||||
| converting "parsers" "ClusterParser" | ||||||
| converting "filters" "ClusterFilter" | ||||||
| converting "outputs" "ClusterOutput" | ||||||
| converting "fluentbitconfigs" "ClusterFluentBitConfig" | ||||||
| converting "fluentbits" "FluentBit" | ||||||
|
|
||||||
| # Determine if Deployment exists | ||||||
| if kubectl get deployment -n $namespace $deployment >/dev/null 2>&1; then | ||||||
|
||||||
| if kubectl get deployment -n $namespace $deployment >/dev/null 2>&1; then | |
| if kubectl get deployment -n $namespace $fluentbit-operator >/dev/null 2>&1; then |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| kubectl delete deployment -n $namespace $deployment | |
| kubectl delete deployment -n $namespace $fluentbit-operator |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It has been modified, it is better not to have
-in the shell name, I modified it toFluentbitOperator