def delete_secret(secret_id): """Delete a given secret id.""" # If this fails, it's most likely because we're trying to delete a secret # that doesn't exist. Let the caller decide if failure is a problem. return kubernetes_common.kubectl_success( "delete", "secret", "-n", AUTH_SECRET_NS, secret_id )
def upgrade_charm(): # migrate to new flags if is_state('kubernetes-worker.restarted-for-cloud'): remove_state('kubernetes-worker.restarted-for-cloud') set_state('kubernetes-worker.cloud.ready') if is_state('kubernetes-worker.cloud-request-sent'): # minor change, just for consistency remove_state('kubernetes-worker.cloud-request-sent') set_state('kubernetes-worker.cloud.request-sent') # Trigger removal of PPA docker installation if it was previously set. set_state('config.changed.install_from_upstream') hookenv.atexit(remove_state, 'config.changed.install_from_upstream') cleanup_pre_snap_services() migrate_resource_checksums(checksum_prefix, snap_resources) if check_resources_for_upgrade_needed(checksum_prefix, snap_resources): set_upgrade_needed() # Remove the RC for nginx ingress if it exists if hookenv.config().get('ingress'): kubectl_success('delete', 'rc', 'nginx-ingress-controller') # Remove gpu.enabled state so we can reconfigure gpu-related kubelet flags, # since they can differ between k8s versions if is_state('kubernetes-worker.gpu.enabled'): remove_state('kubernetes-worker.gpu.enabled') try: disable_gpu() except ApplyNodeLabelFailed: # Removing node label failed. Probably the master is unavailable. # Proceed with the upgrade in hope GPUs will still be there. hookenv.log('Failed to remove GPU labels. Proceed with upgrade.') remove_state('kubernetes-worker.cni-plugins.installed') remove_state('kubernetes-worker.config.created') remove_state('kubernetes-worker.ingress.available') remove_state('worker.auth.bootstrapped') set_state('kubernetes-worker.restart-needed')
def delete_secret(secret_id): '''Delete a given secret id.''' # If this fails, it's most likely because we're trying to delete a secret # that doesn't exist. Let the caller decide if failure is a problem. return kubernetes_common.kubectl_success( 'delete', 'secret', '-n', AUTH_SECRET_NS, secret_id)