This documentation is for a release that is no longer maintained
See documentation for the latest supported version 3 or the latest supported version 4.5.4.2.4. 修改管理者
更新您的 Operator 项目,以提供协调逻辑,其格式为 Ansible 角色,它在每次创建、更新或删除 Memcached
资源时运行。
流程
用下列结构更新
roles/memcached/tasks/main.yml
文件:Copy to Clipboard Copied! Toggle word wrap Toggle overflow 这个
memcached
角色可确保存在memcached
部署并设置部署大小。通过编辑
roles/memcached/defaults/main.yml
文件,为您的 Ansible 角色中使用的变量设置默认值:--- # defaults file for Memcached size: 1
--- # defaults file for Memcached size: 1
Copy to Clipboard Copied! Toggle word wrap Toggle overflow 使用以下结构更新
config/samples/cache_v1_memcached.yaml
文件中的Memcached
示例资源:Copy to Clipboard Copied! Toggle word wrap Toggle overflow 自定义资源(CR)spec 中的键值对作为额外变量传递给 Ansible。
在运行 Ansible 前,Operator 会将 spec
字段中所有变量的名称转换为 snake case,即小写并附带下划线。例如,spec 中的 serviceAccount
在 Ansible 中会变成 service_account
。
您可以通过在 watches.yaml
文件中将 snakeCaseParameters
选项设置为 false
来禁用大小写转换。建议您在 Ansible 中对变量执行一些类型验证,以确保应用程序收到所需输入。