github.phpd.cn/cilium/cilium@v1.6.12/test/helpers/policygen/const.go (about)

     1  // Copyright 2017 Authors of Cilium
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //     http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  package policygen
    15  
    16  import (
    17  	"time"
    18  
    19  	"github.com/cilium/cilium/test/helpers"
    20  )
    21  
    22  var (
    23  	ConnTests              = []string{Ping, HTTP, HTTPPrivate}
    24  	ConnTestsFailedResults = []ResultType{
    25  		ResultTimeout,
    26  		ResultAuth,
    27  	}
    28  	ConnTestsActions = map[string]func(srcPod string, dest TargetDetails, kub *helpers.Kubectl) ResultType{
    29  		Ping:        PingAction,
    30  		HTTP:        HTTPActionPublic,
    31  		HTTPPrivate: HTTPActionPrivate,
    32  	}
    33  
    34  	ConnResultAllOK = ConnTestSpec{
    35  		HTTP:        ResultOK,
    36  		HTTPPrivate: ResultOK,
    37  		Ping:        ResultOK,
    38  		UDP:         ResultOK,
    39  	}
    40  
    41  	ConnResultAllTimeout = ConnTestSpec{
    42  		HTTP:        ResultTimeout,
    43  		HTTPPrivate: ResultTimeout,
    44  		Ping:        ResultTimeout,
    45  		UDP:         ResultTimeout,
    46  	}
    47  
    48  	ConnResultOnlyHTTP = ConnTestSpec{
    49  		HTTP:        ResultOK,
    50  		HTTPPrivate: ResultOK,
    51  		Ping:        ResultTimeout,
    52  		UDP:         ResultTimeout,
    53  	}
    54  
    55  	ConnResultOnlyHTTPPrivate = ConnTestSpec{
    56  		HTTP:        ResultAuth,
    57  		HTTPPrivate: ResultOK,
    58  		Ping:        ResultTimeout,
    59  		UDP:         ResultTimeout,
    60  	}
    61  
    62  	DestinationsTypes = []Target{
    63  		{Kind: service},
    64  		{Kind: nodePort},
    65  		{Kind: direct},
    66  	}
    67  
    68  	NodePortStart = 10000
    69  
    70  	ResultTimeout = ResultType{"timeout", false}
    71  	ResultAuth    = ResultType{"reply", false}
    72  	ResultOK      = ResultType{"reply", true}
    73  )
    74  
    75  const (
    76  	ingress = "ingress"
    77  	egress  = "egress"
    78  	toPorts = "ToPorts"
    79  
    80  	HTTP        = "HTTP"
    81  	HTTPPrivate = "HTTPPrivate"
    82  	Ping        = "Ping"
    83  	UDP         = "UDP"
    84  
    85  	service  = "service"
    86  	nodePort = "NodePort"
    87  	direct   = "Direct"
    88  
    89  	destroyDelay time.Duration = 30 * time.Minute
    90  )