async _upsertKubernetesSecret () {
    const kubeNamespace = this._kubeClient.api.v1.namespaces(this._namespace)

    // check if namespace is allowed to fetch this secret
    const ns = await kubeNamespace.get()
    const verdict = this._isPermitted(ns.body, this._spec)

    if (!verdict.allowed) {
      throw (new Error(`not allowed to fetch secret: ${this._namespace}/${this._name}: ${verdict.reason}`))
    }

    const secretManifest = await this._createSecretManifest()
    const kubeSecret = kubeNamespace.secrets(this._name)
    let existingSecret

    try {
      this._logger.info(`getting secret ${this._namespace}/${this._name}`)
      const secretResponse = await kubeSecret.get()
      existingSecret = secretResponse.body
    } catch (err) {
      if (err.statusCode !== 404) throw err
      // do nothing if the secret is not found
    }

    if (existingSecret && this._equalSecretData(existingSecret, secretManifest)) {
      this._logger.info(`skipping secret ${this._namespace}/${this._name} upsert, objects are the same`)
      return Promise.resolve(true)
    } else if (existingSecret === undefined) {
      this._logger.info(`creating secret ${this._namespace}/${this._name}`)
      return await kubeNamespace.secrets.post({ body: secretManifest })
    } else {
      this._logger.info(`updating secret ${this._namespace}/${this._name}`)
      return kubeSecret.put({ body: secretManifest })
    }
  }
Create or update Kubernetes secret in the cluster.
@returns {Promise} Promise object representing operation result.