def _add_volumes_to_sts_spec()

in mysqloperator/controller/innodbcluster/cluster_api.py [0:0]


    def _add_volumes_to_sts_spec(self, sts: Union[dict, api_client.V1StatefulSet], patcher: 'InnoDBClusterObjectModifier', add: bool, logger: Logger) -> None:
        volumes = []
        # if there is web_config and we have to add it - add it
        # if there don't have to add, the patch won't be added but still be used to clean up from remnants of previous add
        if (self.web_config and add) or (not add):
            volumes.append(
                {
                    "name": f"{self.container_name}-web-config",
                    "configMap": {
                        "name" : self.web_config,
                        "defaultMode": 0o444,
                    }
                }
            )
        if (self.tls_secret and add) or (not add):
            volumes.append(
                {
                    "name": f"{self.container_name}-tls",
                    "secret": {
                        "name" : self.tls_secret,
                        "defaultMode": 0o444,
                    }
                }
            )

        patch = {
            "volumes" : volumes
        }

        patch_sts_spec_template_complex_attribute(sts, patcher, patch, "volumes", add)