Skip to content

Some users for operator are not passed into "init" container and will cause init not completed. #801

Open
@von1994

Description

@von1994

run initContainer "init"(clone-and-init) with bellow error:
2022-04-07T06:21:15.594988Z 1 [ERROR] 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '@'%';' at line 1

operator-init.sql like this:
SET @@SESSION.SQL_LOG_BIN = 0; SET GLOBAL READ_ONLY = 1; CREATE DATABASE IF NOT EXISTS sys_operator; DROP USER IF EXISTS @'%'; CREATE USER @'%' IDENTIFIED BY ''; GRANT SUPER, SHOW DATABASES, PROCESS, RELOAD, CREATE, SELECT ON *.* TO @'%'; GRANT REPLICATION SLAVE ON *.* TO @'%'; GRANT ALL ON sys_operator.* TO @'%'; DROP USER IF EXISTS @'%'; CREATE USER @'%' IDENTIFIED BY ''; GRANT SELECT, PROCESS, RELOAD, LOCK TABLES, REPLICATION CLIENT, REPLICATION SLAVE ON *.* TO @'%'; DROP USER IF EXISTS @'127.0.0.1'; CREATE USER @'127.0.0.1' IDENTIFIED BY ''; GRANT SELECT, PROCESS, REPLICATION CLIENT ON *.* TO @'127.0.0.1'; GRANT SELECT, CREATE ON sys_operator.heartbeat TO @'127.0.0.1'; ALTER USER @'127.0.0.1' WITH MAX_USER_CONNECTIONS 3; DROP USER IF EXISTS sys_heartbeat@'127.0.0.1'; CREATE USER sys_heartbeat@'127.0.0.1' IDENTIFIED BY 'nOlYerUg82'; GRANT CREATE, SELECT, DELETE, UPDATE, INSERT ON sys_operator.heartbeat TO sys_heartbeat@'127.0.0.1'; GRANT REPLICATION CLIENT ON *.* TO sys_heartbeat@'127.0.0.1'; DROP TABLE IF EXISTS sys_operator.status; CREATE TABLE IF NOT EXISTS sys_operator.status ( name varchar(64) PRIMARY KEY, value varchar(8192) NOT NULL );

The sql contains "create user" is incomplete. The info in secret generated by operator are not passed into environments and caused sql syntax is invalid.

Maybe should inject envs like bellow:
image

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions