github.com/GoogleContainerTools/skaffold@v1.39.18/pkg/skaffold/debug/types/types.go (about) 1 /* 2 Copyright 2021 The Skaffold Authors 3 4 Licensed under the Apache License, Version 2.0 (the "License"); 5 you may not use this file except in compliance with the License. 6 You may obtain a copy of the License at 7 8 http://www.apache.org/licenses/LICENSE-2.0 9 10 Unless required by applicable law or agreed to in writing, software 11 distributed under the License is distributed on an "AS IS" BASIS, 12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 See the License for the specific language governing permissions and 14 limitations under the License. 15 */ 16 17 package types 18 19 const ( 20 // DebugConfig is the name of the podspec annotation that records debugging configuration information. 21 // The annotation should be a JSON-encoded map of container-name to a `ContainerDebugConfiguration` object. 22 DebugConfig = "debug.cloud.google.com/config" 23 24 // DebugProbesAnnotation is the name of the podspec annotation that disables rewriting of probe timeouts. 25 // The annotation value should be `skip`. 26 DebugProbeTimeouts = "debug.cloud.google.com/probe/timeouts" 27 ) 28 29 // ContainerDebugConfiguration captures debugging information for a specific container. 30 // This structure is serialized out and included in the pod metadata. 31 type ContainerDebugConfiguration struct { 32 // Artifact is the corresponding artifact's image name used in the skaffold.yaml 33 Artifact string `json:"artifact,omitempty"` 34 // Runtime represents the underlying language runtime (`go`, `jvm`, `nodejs`, `python`, `netcore`) 35 Runtime string `json:"runtime,omitempty"` 36 // WorkingDir is the working directory in the image configuration; may be empty 37 WorkingDir string `json:"workingDir,omitempty"` 38 // Ports is the list of debugging ports, keyed by protocol type 39 Ports map[string]uint32 `json:"ports,omitempty"` 40 } 41 42 // ContainerAdapter provides a surface to abstract away the underlying container 43 // representation which can be operated on by the debug transformers. 44 type ContainerAdapter interface { 45 GetContainer() *ExecutableContainer 46 Apply() 47 } 48 49 // ExecutableContainer holds shared fields between container representations. 50 // These fields are mutated by the debug transformers, and are eventually 51 // propagated back to the underlying container representation in the adapter. 52 type ExecutableContainer struct { 53 Name string 54 Command []string 55 Args []string 56 Env ContainerEnv 57 Ports []ContainerPort 58 } 59 60 // adapted from github.com/kubernetes/api/core/v1/types.go 61 type ContainerPort struct { 62 Name string 63 HostPort int32 64 ContainerPort int32 65 Protocol string 66 HostIP string 67 } 68 69 type ContainerEnv struct { 70 Order []string 71 Env map[string]string 72 }