コード例 #1
0
        /// <summary>
        /// Writes in this format to file:
        ///
        /// apiVersion: extensions/v1beta1
        /// kind: Ingress
        /// metadata:
        ///   name: ingress-name
        ///
        /// </summary>
        /// <param name="file">The structure of the file to write to, in this context its an ingress yml.</param>
        /// <param name="ingressName">Name for the ingress in the kubernetes cluster</param>
        List <string> WriteIngressMetadata(List <string> file, string ingressName, string name)
        {
            SharedMethods indent = new SharedMethods();

            file.Add("apiVersion: extensions/v1beta1");
            file.Add("kind: Ingress");
            file.Add("metadata:");
            file.Add(indent.Padding(1, string.Format("name: {0}", ingressName)));
            file.Add(indent.Padding(1, string.Format("namespace: {0}", name)));
            file.Add(indent.Padding(1, "annotations:"));
            file.Add(indent.Padding(2, "ingress.kubernetes.io/rewrite-target: /"));
            file.Add(indent.Padding(2, "kubernetes.io/ingress.class: \"traefik\""));
            file.Add(indent.Padding(1, "labels:"));
            file.Add(indent.Padding(2, "traeffik/balancer-name: private"));
            file.Add(indent.Padding(2, string.Format("app: {0}", name)));
            file.Add(indent.Padding(2, "autoGenerated: true"));
            file.Add(indent.Padding(2, string.Format("generated: {0}", DateTime.Now)));

            return(file);
        }