def handle_etcd_relation(reldata):
    ' Save the client credentials and set appropriate daemon flags when\n    etcd declares itself as available'
    connection_string = reldata.get_connection_string()
    etcd_dir = '/root/cdk/etcd'
    ca = os.path.join(etcd_dir, 'client-ca.pem')
    key = os.path.join(etcd_dir, 'client-key.pem')
    cert = os.path.join(etcd_dir, 'client-cert.pem')
    reldata.save_client_credentials(key, cert, ca)
    api_opts = FlagManager('kube-apiserver')
    data = api_opts.data
    if (data.get('etcd-servers-strict') or data.get('etcd-servers')):
        api_opts.destroy('etcd-cafile')
        api_opts.destroy('etcd-keyfile')
        api_opts.destroy('etcd-certfile')
        api_opts.destroy('etcd-servers', strict=True)
        api_opts.destroy('etcd-servers')
    api_opts.add('etcd-cafile', ca)
    api_opts.add('etcd-keyfile', key)
    api_opts.add('etcd-certfile', cert)
    api_opts.add('etcd-servers', connection_string, strict=True)
Save the client credentials and set appropriate daemon flags when
etcd declares itself as available
def handle_etcd_relation(reldata):
    ' Save the client credentials and set appropriate daemon flags when\n    etcd declares itself as available'
    connection_string = reldata.get_connection_string()
    etcd_dir = '/root/cdk/etcd'
    ca = os.path.join(etcd_dir, 'client-ca.pem')
    key = os.path.join(etcd_dir, 'client-key.pem')
    cert = os.path.join(etcd_dir, 'client-cert.pem')
    reldata.save_client_credentials(key, cert, ca)
    api_opts = FlagManager('kube-apiserver')
    data = api_opts.data
    if (data.get('etcd-servers-strict') or data.get('etcd-servers')):
        api_opts.destroy('etcd-cafile')
        api_opts.destroy('etcd-keyfile')
        api_opts.destroy('etcd-certfile')
        api_opts.destroy('etcd-servers', strict=True)
        api_opts.destroy('etcd-servers')
    api_opts.add('etcd-cafile', ca)
    api_opts.add('etcd-keyfile', key)
    api_opts.add('etcd-certfile', cert)
    api_opts.add('etcd-servers', connection_string, strict=True)