kubeblocks icon indicating copy to clipboard operation
kubeblocks copied to clipboard

[BUG]mogdb configure not work

Open ahjing99 opened this issue 1 year ago • 1 comments

https://github.com/apecloud/kubeblocks/actions/runs/8842028044/job/24280726954

➜ ~ kbcli version Kubernetes: v1.28.7-gke.1026000 KubeBlocks: 0.9.0-beta.15 kbcli: 0.9.0-beta.3

# Add Helm repo 
helm repo add kubeblocks-addons https://apecloud.github.io/helm-charts
# If github is not accessible or very slow for you, please use following repo instead
helm repo add kubeblocks-addons https://jihulab.com/api/v4/projects/150246/packages/helm/stable
# Update helm repo
helm repo update
# Update mogdb to enable hostnetwork
helm upgrade -i kb-addon-mogdb kubeblocks-addons/mogdb  -n kb-system --version 0.9.0

  1. Create cluster ,k apply -f cluster.yaml
apiVersion: apps.kubeblocks.io/v1alpha1
kind: Cluster
metadata:
  name: mogdb-cluster
  namespace: default
spec:
  clusterDefinitionRef: mogdb
  clusterVersionRef: mogdb-5.0.5
  terminationPolicy: Delete
  componentSpecs:
  - name: mogdb
    componentDefRef: mogdb
    enabledLogs:
    - running
    serviceAccountName: kb-mogdb-cluster
    replicas: 2
    resources:
      limits:
        cpu: '0.5'
        memory: 0.5Gi
      requests:
        cpu: '0.5'
        memory: 0.5Gi
    volumeClaimTemplates:
    - name: data
      spec:
        accessModes:
        - ReadWriteOnce
        resources:
          requests:
            storage: 20Gi
  1. config, k apply -f config.yaml
apiVersion: apps.kubeblocks.io/v1alpha1
kind: OpsRequest
metadata:
  name: mogdb-reconfiguring
  namespace: default
spec:
  # References the cluster object.
  clusterRef: mogdb-cluster
  # Indicates if pre-checks should be bypassed, allowing the opsRequest to execute immediately. If set to true, pre-checks are skipped except for 'Start' type. Particularly useful when concurrent execution of VerticalScaling and HorizontalScaling opsRequests is required, achievable through the use of the Force flag.
  force: false
  # Deprecated: replace by reconfigures. Defines the variables that need to input when updating configuration.
  reconfigure:
    # Specifies the name of the cluster component.
    componentName: mogdb
    # Specifies the components that will perform the operation.
    configurations:
      # Sets the parameters to be updated. It should contain at least one item.
      # The keys are merged and retained during patch operations.
    - keys:
        # Represents the unique identifier for the ConfigMap.
      - key: postgresql.conf
        # Defines a list of key-value pairs for a single configuration file.
        # These parameters are used to update the specified configuration settings.
        parameters:
          # Represents the name of the parameter that is to be updated.
        - key: shared_buffers
          # Represents the parameter values that are to be updated.
          # If set to nil, the parameter defined by the Key field will be removed from the configuration file.
          value: 512MB
        - key: max_connections
          value: '200'
      # Specifies the name of the configuration template.
      name: mogdb-configuration
  # OpsRequest will wait at most TTLSecondsBeforeAbort seconds for start-conditions to be met. If not specified, the default value is 0, which means that the start-conditions must be met immediately.
  ttlSecondsBeforeAbort: 0
  type: Reconfiguring
  1. Ops success, but parameters not change
MogDB=> show shared_buffers;
 shared_buffers
----------------
 32MB
(1 row)

MogDB=> show max_connections
MogDB-> ;
 max_connections
-----------------
 200
(1 row)

➜  ~ k describe ops mogdb-reconfiguring
Name:         mogdb-reconfiguring
Namespace:    default
Labels:       app.kubernetes.io/instance=mogdb-cluster
              max_connections=200
              ops.kubeblocks.io/ops-type=Reconfiguring
              shared_buffers=512MB
Annotations:  postgresql.conf: {"max_connections":"200","shared_buffers":"32MB"}
API Version:  apps.kubeblocks.io/v1alpha1
Kind:         OpsRequest
Metadata:
  Creation Timestamp:  2024-04-26T05:14:22Z
  Finalizers:
    opsrequest.kubeblocks.io/finalizer
  Generation:  2
  Managed Fields:
    API Version:  apps.kubeblocks.io/v1alpha1
    Fields Type:  FieldsV1
    fieldsV1:
      f:metadata:
        f:annotations:
          .:
          f:kubectl.kubernetes.io/last-applied-configuration:
      f:spec:
        .:
        f:clusterRef:
        f:reconfigure:
          .:
          f:componentName:
          f:configurations:
            .:
            k:{"name":"mogdb-configuration"}:
              .:
              f:keys:
                .:
                k:{"key":"postgresql.conf"}:
                  .:
                  f:key:
                  f:parameters:
              f:name:
        f:ttlSecondsBeforeAbort:
        f:type:
    Manager:      kubectl-client-side-apply
    Operation:    Update
    Time:         2024-04-26T05:14:22Z
    API Version:  apps.kubeblocks.io/v1alpha1
    Fields Type:  FieldsV1
    fieldsV1:
      f:metadata:
        f:annotations:
          f:postgresql.conf:
        f:finalizers:
          .:
          v:"opsrequest.kubeblocks.io/finalizer":
        f:labels:
          .:
          f:app.kubernetes.io/instance:
          f:max_connections:
          f:ops.kubeblocks.io/ops-type:
          f:shared_buffers:
        f:ownerReferences:
          .:
          k:{"uid":"4da69eee-3d87-4614-815f-db62842d58da"}:
    Manager:      manager
    Operation:    Update
    Time:         2024-04-26T05:14:22Z
    API Version:  apps.kubeblocks.io/v1alpha1
    Fields Type:  FieldsV1
    fieldsV1:
      f:status:
        .:
        f:clusterGeneration:
        f:completionTimestamp:
        f:conditions:
          .:
          k:{"type":"Reconfigure"}:
            .:
            f:lastTransitionTime:
            f:message:
            f:reason:
            f:status:
            f:type:
          k:{"type":"Succeed"}:
            .:
            f:lastTransitionTime:
            f:message:
            f:reason:
            f:status:
            f:type:
          k:{"type":"Validated"}:
            .:
            f:lastTransitionTime:
            f:message:
            f:reason:
            f:status:
            f:type:
          k:{"type":"WaitForProgressing"}:
            .:
            f:lastTransitionTime:
            f:message:
            f:reason:
            f:status:
            f:type:
        f:phase:
        f:progress:
        f:reconfiguringStatus:
          .:
          f:conditions:
            .:
            k:{"type":"Finished"}:
              .:
              f:lastTransitionTime:
              f:message:
              f:reason:
              f:status:
              f:type:
            k:{"type":"Pending"}:
              .:
              f:lastTransitionTime:
              f:message:
              f:reason:
              f:status:
              f:type:
            k:{"type":"ReconfigurePersisted"}:
              .:
              f:lastTransitionTime:
              f:message:
              f:reason:
              f:status:
              f:type:
            k:{"type":"Upgrading"}:
              .:
              f:lastTransitionTime:
              f:message:
              f:reason:
              f:status:
              f:type:
          f:configurationStatus:
            .:
            k:{"name":"mogdb-configuration"}:
              .:
              f:expectedCount:
              f:lastStatus:
              f:name:
              f:status:
              f:succeedCount:
              f:updatePolicy:
              f:updatedParameters:
                .:
                f:updatedKeys:
                  .:
                  f:postgresql.conf:
        f:startTimestamp:
    Manager:      manager
    Operation:    Update
    Subresource:  status
    Time:         2024-04-26T05:15:55Z
  Owner References:
    API Version:     apps.kubeblocks.io/v1alpha1
    Kind:            Cluster
    Name:            mogdb-cluster
    UID:             4da69eee-3d87-4614-815f-db62842d58da
  Resource Version:  1669718
  UID:               a6cdf049-8862-475a-a569-f7ebf1ecab18
Spec:
  Cluster Ref:  mogdb-cluster
  Reconfigure:
    Component Name:  mogdb
    Configurations:
      Keys:
        Key:  postgresql.conf
        Parameters:
          Key:               shared_buffers
          Value:             512MB
          Key:               max_connections
          Value:             200
      Name:                  mogdb-configuration
  Ttl Seconds Before Abort:  0
  Type:                      Reconfiguring
Status:
  Cluster Generation:    7
  Completion Timestamp:  2024-04-26T05:15:55Z
  Conditions:
    Last Transition Time:  2024-04-26T05:14:22Z
    Message:               wait for the controller to process the OpsRequest: mogdb-reconfiguring in Cluster: mogdb-cluster
    Reason:                WaitForProgressing
    Status:                True
    Type:                  WaitForProgressing
    Last Transition Time:  2024-04-26T05:14:22Z
    Message:               OpsRequest: mogdb-reconfiguring is validated
    Reason:                ValidateOpsRequestPassed
    Status:                True
    Type:                  Validated
    Last Transition Time:  2024-04-26T05:14:22Z
    Message:               Start to reconfigure in Cluster: mogdb-cluster, Component: mogdb
    Reason:                ReconfigureStarted
    Status:                True
    Type:                  Reconfigure
    Last Transition Time:  2024-04-26T05:15:55Z
    Message:               Successfully processed the OpsRequest: mogdb-reconfiguring in Cluster: mogdb-cluster
    Reason:                OpsRequestProcessedSuccessfully
    Status:                True
    Type:                  Succeed
  Phase:                   Succeed
  Progress:                2/2
  Reconfiguring Status:
    Conditions:
      Last Transition Time:  2024-04-26T05:14:23Z
      Message:               Reconfiguring in Cluster: mogdb-cluster, Component: mogdb, ConfigSpec: mogdb-configuration, info: updated: map[postgresql.conf:{"shared_buffers":"512MB"}], added: map[], deleted:map[]
      Reason:                ReconfigurePersisted
      Status:                True
      Type:                  ReconfigurePersisted
      Last Transition Time:  2024-04-26T05:14:23Z
      Message:               Reconfiguring in Cluster: mogdb-cluster, Component: mogdb, ConfigSpec: mogdb-configuration
      Reason:                Pending
      Status:                True
      Type:                  Pending
      Last Transition Time:  2024-04-26T05:14:23Z
      Message:               Reconfiguring in Cluster: mogdb-cluster, Component: mogdb, ConfigSpec: mogdb-configuration
      Reason:                Upgrading
      Status:                True
      Type:                  Upgrading
      Last Transition Time:  2024-04-26T05:15:55Z
      Message:               Reconfiguring in Cluster: mogdb-cluster, Component: mogdb, ConfigSpec: mogdb-configuration
      Reason:                Finished
      Status:                True
      Type:                  Finished
    Configuration Status:
      Expected Count:  2
      Last Status:     None
      Name:            mogdb-configuration
      Status:          Finished
      Succeed Count:   2
      Update Policy:   simple
      Updated Parameters:
        Updated Keys:
          postgresql.conf:  {"shared_buffers":"512MB"}
  Start Timestamp:          2024-04-26T05:14:22Z
Events:
  Type    Reason                           Age                From                    Message
  ----    ------                           ----               ----                    -------
  Normal  WaitForProgressing               19m                ops-request-controller  wait for the controller to process the OpsRequest: mogdb-reconfiguring in Cluster: mogdb-cluster
  Normal  ValidateOpsRequestPassed         19m (x2 over 19m)  ops-request-controller  OpsRequest: mogdb-reconfiguring is validated
  Normal  ReconfigureStarted               19m (x2 over 19m)  ops-request-controller  Start to reconfigure in Cluster: mogdb-cluster, Component: mogdb
  Normal  ReconfigurePersisted             19m (x2 over 19m)  ops-request-controller  the reconfiguring operation of component[mogdb] in cluster[mogdb-cluster] merged successfully
  Normal  OpsRequestProcessedSuccessfully  18m                ops-request-controller  Successfully processed the OpsRequest: mogdb-reconfiguring in Cluster: mogdb-cluster
➜  ~ k get ops
NAME                  TYPE            CLUSTER         STATUS    PROGRESS   AGE
mogdb-reconfiguring   Reconfiguring   mogdb-cluster   Succeed   2/2        19m

ahjing99 avatar Apr 26 '24 05:04 ahjing99

dup https://github.com/apecloud/kubeblocks-addons/issues/367

JashBook avatar Apr 26 '24 06:04 JashBook

This issue has been marked as stale because it has been open for 30 days with no activity

github-actions[bot] avatar May 27 '24 00:05 github-actions[bot]

fixed: https://github.com/apecloud/kubeblocks/pull/7310

sophon-zt avatar May 27 '24 02:05 sophon-zt