Skip to content

Conversation

@wenchajun
Copy link
Member

What this PR does / why we need it:

During the process of upgrading the fluentbit-operator, this script helps the user to convert the original configuration to the new one and to uninstall the fluentbit-operator.

Which issue(s) this PR fixes:

Fixes #

Does this PR introduced a user-facing change?


Additional documentation, usage docs, etc.:


@benjaminhuo
Copy link
Member

@wanjunlei pls help to review

@wanjunlei
Copy link
Collaborator

There have two questions:

  • The clusterrole and clusterrolebinding were not deleted.
  • There may also be resources in other namespaces, so we cannot only deal with resources under kubesphere-logging-system. At the same time, it is necessary to realize that resources under different namespaces may have the same name. This will not be a problem when they are namespace-level resources, but conflicts will occur when they are upgraded to cluster-level resources.

@wenchajun wenchajun force-pushed the upgrade branch 3 times, most recently from 253efcc to 43e7793 Compare June 28, 2023 02:00
echo "${name[i]}"
temp=$(echo ${name[i]} | sed 's/"//g')
echo "$temp"
kubectl delete $resource.logging.kubesphere.io $temp -n ${namespace} || error_exit "Cannot delete resource $reresource"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Here you need to ignore the error that the resource does not exist

converting "outputs" "ClusterOutput"
converting "fluentbitconfigs" "ClusterFluentBitConfig"

fluentbit_list=$(kubectl get fluentbits.logging.kubesphere.io -A -o json) || error_exit "Cannot get resource fluentbit"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Pass the namespace as a parameter. When the namespace is not empty, it is a namespace-level resource, so you don’t have to deal with FluentBit CRD separately.

@@ -0,0 +1,11 @@
FROM alpine:latest
Copy link
Collaborator

Choose a reason for hiding this comment

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

There are many images of kubectl, such as bitnami/kubectl, kubesphere/kubectl, you don’t need to install kubectl and jq yourself.

Copy link
Member

Choose a reason for hiding this comment

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

@wanjunlei are u ok with the new change?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Still need to modify

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed

Copy link
Member

Choose a reason for hiding this comment

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

fixed

@wanjunlei need to take another look

@wenchajun wenchajun force-pushed the upgrade branch 2 times, most recently from ca0cf56 to 96cc49f Compare July 4, 2023 07:57
wanjunlei
wanjunlei previously approved these changes Jul 4, 2023
@@ -0,0 +1,80 @@
#!/bin/bash
namespace=kubesphere-logging-system
deployment="fluentbit-operator"
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
deployment="fluentbit-operator"
fluentbit-operator="fluentbit-operator"

Copy link
Member Author

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 to FluentbitOperator

converting "fluentbits" "FluentBit"

# Determine if Deployment exists
if kubectl get deployment -n $namespace $deployment >/dev/null 2>&1; then
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
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

# Determine if Deployment exists
if kubectl get deployment -n $namespace $deployment >/dev/null 2>&1; then
# Delete Deployment if it exists
kubectl delete deployment -n $namespace $deployment
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
kubectl delete deployment -n $namespace $deployment
kubectl delete deployment -n $namespace $fluentbit-operator

exit 1
}

function converting(){
Copy link
Member

Choose a reason for hiding this comment

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

converting can be renamed to migrate

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed

Change function name
@benjaminhuo benjaminhuo merged commit 5b16383 into fluent:master Jul 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants