Beispiel #1
0
        //---------------------------------------------------------------------
        // $note(jefflill):
        //
        // The prebuilder tool is not able to generate the Kubernetes client related extensions
        // defined in [Neon.Kube.KubernetesExtensions] due to a chicken-and-egg situation, so
        // we're just going to implement these here manually.

        /// <summary>
        /// Adds a new Kubernetes secret or updates an existing secret.
        /// </summary>
        /// <param name="secret">The secret.</param>
        /// <param name="namespace">Optionally overrides the default namespace.</param>
        /// <returns>The updated secret.</returns>
        public async Task <V1Secret> UpsertSecretAsync(V1Secret secret, string @namespace = null)
        {
            await SyncContext.Clear;

            return(await NormalizedRetryPolicy.InvokeAsync(
                       async() =>
            {
                return await k8s.UpsertSecretAsync(secret, @namespace);
            }));
        }
Beispiel #2
0
        /// <summary>
        /// Executes a program within a pod container.
        /// </summary>
        /// <param name="namespace">Specifies the namespace hosting the pod.</param>
        /// <param name="name">Specifies the target pod name.</param>
        /// <param name="container">Identifies the target container within the pod.</param>
        /// <param name="command">Specifies the program and arguments to be executed.</param>
        /// <param name="noSuccessCheck">Optionally disables the <see cref="ExecuteResponse.EnsureSuccess"/> check.</param>
        /// <param name="cancellationToken">Optionally specifies a cancellation token.</param>
        /// <returns>An <see cref="ExecuteResponse"/> with the command exit code and output and error text.</returns>
        /// <exception cref="ExecuteException">Thrown if the exit code isn't zero and <paramref name="noSuccessCheck"/><c>=false</c>.</exception>
        public async Task <ExecuteResponse> NamespacedPodExecAsync(
            string @namespace,
            string name,
            string container,
            string[] command,
            bool noSuccessCheck = false,
            CancellationToken cancellationToken = default)
        {
            await SyncContext.Clear;

            return(await NormalizedRetryPolicy.InvokeAsync(
                       async() =>
            {
                return await k8s.NamespacedPodExecAsync(@namespace, name, container, command, noSuccessCheck, cancellationToken);
            }));
        }