istio.io/istio@v0.0.0-20240520182934-d79c90f27776/istioctl/pkg/writer/ztunnel/configdump/api.go (about) 1 // Copyright Istio Authors 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 15 package configdump 16 17 type Locality struct { 18 Region string `json:"region,omitempty"` 19 Zone string `json:"zone,omitempty"` 20 Subzone string `json:"subzone,omitempty"` 21 } 22 23 type ZtunnelWorkload struct { 24 WorkloadIPs []string `json:"workloadIps"` 25 Waypoint *Waypoint `json:"waypoint,omitempty"` 26 Protocol string `json:"protocol"` 27 Name string `json:"name"` 28 Namespace string `json:"namespace"` 29 ServiceAccount string `json:"serviceAccount"` 30 WorkloadName string `json:"workloadName"` 31 WorkloadType string `json:"workloadType"` 32 CanonicalName string `json:"canonicalName"` 33 CanonicalRevision string `json:"canonicalRevision"` 34 ClusterID string `json:"clusterId"` 35 TrustDomain string `json:"trustDomain,omitempty"` 36 Locality Locality `json:"locality,omitempty"` 37 Node string `json:"node"` 38 Network string `json:"network,omitempty"` 39 Status string `json:"status"` 40 ApplicationTunnel ApplicationTunnel `json:"applicationTunnel,omitempty"` 41 } 42 43 type ApplicationTunnel struct { 44 Protocol string `json:"protocol"` 45 Port *uint16 `json:"port,omitempty"` 46 } 47 48 type Waypoint struct { 49 Destination string `json:"destination"` 50 } 51 52 type LoadBalancer struct { 53 Mode string `json:"mode"` 54 RoutingPreferences []string `json:"routingPreferences"` 55 } 56 57 type ZtunnelService struct { 58 Name string `json:"name"` 59 Namespace string `json:"namespace"` 60 Hostname string `json:"hostname"` 61 Addresses []string `json:"vips"` 62 Ports map[string]int `json:"ports"` 63 LoadBalancer *LoadBalancer `json:"loadBalancer"` 64 Waypoint *Waypoint `json:"waypoint"` 65 } 66 67 type PolicyMatch struct { 68 Namespaces []StringMatch `json:"namespaces,omitempty"` 69 NotNamespaces []StringMatch `json:"notNamespaces,omitempty"` 70 Principals []StringMatch `json:"principals,omitempty"` 71 NotPrincipals []StringMatch `json:"notPrincipals,omitempty"` 72 SourceIps []string `json:"sourceIps,omitempty"` 73 NotSourceIps []string `json:"notSourceIps,omitempty"` 74 DestinationIps []string `json:"destinationIps,omitempty"` 75 NotDestinationIps []string `json:"notDestinationIps,omitempty"` 76 DestinationPorts []uint16 `json:"destinationPorts,omitempty"` 77 NotDestinationPorts []uint16 `json:"notDestinationPorts,omitempty"` 78 } 79 80 type StringMatch struct { 81 Exact string `json:"Exact,omitempty"` 82 Suffix string `json:"Suffix,omitempty"` 83 Prefix string `json:"Prefix,omitempty"` 84 Presence any `json:"Presence,omitempty"` 85 } 86 87 type ZtunnelPolicy struct { 88 Name string `json:"name"` 89 Namespace string `json:"namespace"` 90 Scope string `json:"scope"` 91 Action string `json:"action"` 92 Rules [][][]*PolicyMatch `json:"rules"` 93 } 94 95 type ZtunnelDump struct { 96 Workloads map[string]*ZtunnelWorkload `json:"workloads"` 97 Services map[string]*ZtunnelService `json:"services"` 98 Policies map[string]*ZtunnelPolicy `json:"policies"` 99 Certificates []*CertsDump `json:"certificates"` 100 WorkloadState map[string]WorkloadState `json:"workloadState"` 101 } 102 103 type CertsDump struct { 104 Identity string `json:"identity"` 105 State string `json:"state"` 106 CertChain []*Cert `json:"certChain"` 107 } 108 109 type Cert struct { 110 Pem string `json:"pem"` 111 SerialNumber string `json:"serialNumber"` 112 ValidFrom string `json:"validFrom"` 113 ExpirationTime string `json:"expirationTime"` 114 } 115 116 type WorkloadState struct { 117 State string `json:"state,omitempty"` 118 Connections WorkloadConnections `json:"connections,omitempty"` 119 Info WorkloadInfo `json:"info"` 120 } 121 122 type WorkloadConnections struct { 123 Inbound []InboundConnection `json:"inbound"` 124 Outbound []OutboundConnection `json:"outbound"` 125 } 126 127 type WorkloadInfo struct { 128 Name string `json:"name"` 129 Namespace string `json:"namespace"` 130 TrustDomain string `json:"trustDomain"` 131 ServiceAccount string `json:"serviceAccount"` 132 } 133 134 type InboundConnection struct { 135 Src string `json:"src"` 136 OriginalDst string `json:"originalDst"` 137 ActualDst string `json:"actualDst"` 138 } 139 140 type OutboundConnection struct { 141 Src string `json:"src"` 142 OriginalDst string `json:"originalDst"` 143 ActualDst string `json:"actualDst"` 144 } 145 146 type WorkloadConnection struct { 147 Src string `json:"src"` 148 Dst string `json:"dst"` 149 SrcIdentity string `json:"src_identity"` 150 DstNetwork string `json:"dst_network"` 151 }