コード例 #1
0
        /// <summary>
        ///     Create a new internally-facing <see cref="ServiceV1"/> for the specified database server.
        /// </summary>
        /// <param name="server">
        ///     A <see cref="DatabaseServer"/> representing the target server.
        /// </param>
        /// <param name="kubeNamespace">
        ///     An optional target Kubernetes namespace.
        /// </param>
        /// <returns>
        ///     The configured <see cref="ServiceV1"/>.
        /// </returns>
        public ServiceV1 InternalService(DatabaseServer server, string kubeNamespace = null)
        {
            if (server == null)
            {
                throw new ArgumentNullException(nameof(server));
            }

            return(Service(
                       name: Names.BaseName(server),
                       kubeNamespace: kubeNamespace,
                       spec: Specs.InternalService(server),
                       labels: new Dictionary <string, string>
            {
                ["k8s-app"] = Names.BaseName(server),
                ["cloud.dimensiondata.daas.server-id"] = server.Id,
                ["cloud.dimensiondata.daas.service-type"] = "internal"
            }
                       ));
        }