Documentation ¶
Index ¶
- Constants
- func ParseAnnotationResources(resource kates.Object) ([]*kates.Unstructured, error)
- func ValidateAndConvertObject(ctx context.Context, in *kates.Unstructured) (out kates.Object, err error)
- type APIDoc
- type AmbassadorMetaInfo
- type AnnotationList
- type ConsulSnapshot
- type Ingress
- type IngressClass
- type KubernetesSnapshot
- type SecretRef
- type Snapshot
Constants ¶
const ApiVersion = "v1"
const ContentTypeJSON = "application/json"
Variables ¶
This section is empty.
Functions ¶
func ParseAnnotationResources ¶ added in v2.1.2
func ParseAnnotationResources(resource kates.Object) ([]*kates.Unstructured, error)
ParseAnnotationResources parses the annotations on an object, and munges them to be Kubernetes-structured objects. It does not do any validation or version conversion.
You should probably not be calling this directly; the only reason it's public is for use by tests.
func ValidateAndConvertObject ¶ added in v2.1.2
func ValidateAndConvertObject( ctx context.Context, in *kates.Unstructured, ) (out kates.Object, err error)
ValidateAndConvertObject validates an apiGroup=getambassador.io resource, and converts it to the preferred version.
This is meant for use on objects that come from annotations. You should probably not be calling this directly; the only reason it's public is for use by tests.
Types ¶
type APIDoc ¶
type APIDoc struct { *kates.TypeMeta Metadata *kates.ObjectMeta `json:"metadata,omitempty"` TargetRef *kates.ObjectReference `json:"targetRef,omitempty"` Data []byte `json:"data,omitempty"` }
The APIDoc type is custom object built in the style of a Kubernetes resource (name, type, version) which holds a reference to a Kubernetes object from which an OpenAPI document was scrapped (Data field)
type AmbassadorMetaInfo ¶
type AnnotationList ¶ added in v2.1.2
AnnotationList is a []kates.Object that round-trips through JSON (kates.Object is an interface, and you can't normally unmarshal in to an interface).
The kates.Object will be the appropriate struct(-pointer) type for valid resources, and a *kates.Unstructured for invalid resources.
func (*AnnotationList) UnmarshalJSON ¶ added in v2.1.2
func (al *AnnotationList) UnmarshalJSON(bs []byte) error
UnmarshalJSON implements json.Unmarshaler, and exists because unmarshalling directly in to an interface (kates.Object) doesn't work.
type ConsulSnapshot ¶ added in v2.1.2
type ConsulSnapshot struct {
Endpoints map[string]consulwatch.Endpoints `json:",omitempty"`
}
type IngressClass ¶
type IngressClass struct {
k8s_resource_types.IngressClass
}
func (*IngressClass) UnmarshalJSON ¶
func (ingressclass *IngressClass) UnmarshalJSON(bs []byte) error
type KubernetesSnapshot ¶
type KubernetesSnapshot struct { // k8s resources IngressClasses []*IngressClass `json:"ingressclasses"` Ingresses []*Ingress `json:"ingresses"` Services []*kates.Service `json:"service"` Endpoints []*kates.Endpoints `json:"Endpoints"` // ambassador resources Listeners []*amb.Listener `json:"Listener"` Hosts []*amb.Host `json:"Host"` Mappings []*amb.Mapping `json:"Mapping"` TCPMappings []*amb.TCPMapping `json:"TCPMapping"` Modules []*amb.Module `json:"Module"` TLSContexts []*amb.TLSContext `json:"TLSContext"` // plugin services AuthServices []*amb.AuthService `json:"AuthService"` RateLimitServices []*amb.RateLimitService `json:"RateLimitService"` LogServices []*amb.LogService `json:"LogService"` TracingServices []*amb.TracingService `json:"TracingService"` DevPortals []*amb.DevPortal `json:"DevPortal"` // resolvers ConsulResolvers []*amb.ConsulResolver `json:"ConsulResolver"` KubernetesEndpointResolvers []*amb.KubernetesEndpointResolver `json:"KubernetesEndpointResolver"` KubernetesServiceResolvers []*amb.KubernetesServiceResolver `json:"KubernetesServiceResolver"` // gateway api GatewayClasses []*gw.GatewayClass Gateways []*gw.Gateway HTTPRoutes []*gw.HTTPRoute KNativeClusterIngresses []*kates.Unstructured `json:"clusteringresses.networking.internal.knative.dev,omitempty"` KNativeIngresses []*kates.Unstructured `json:"ingresses.networking.internal.knative.dev,omitempty"` FilterPolicies []*kates.Unstructured `json:"filterpolicies.v3alpha1.getambassador.io,omitempty"` Filters []*kates.Unstructured `json:"filters.v3alpha1.getambassador.io,omitempty"` K8sSecrets []*kates.Secret `json:"-"` // Secrets from Kubernetes FSSecrets map[SecretRef]*kates.Secret `json:"-"` // Secrets from the filesystem Secrets []*kates.Secret `json:"secret"` // Secrets we'll feed to Ambassador ConfigMaps []*kates.ConfigMap `json:"ConfigMaps,omitempty"` // [kind/name.namespace][]kates.Object Annotations map[string]AnnotationList `json:"annotations"` // Pods and Deployments were added to be used by Ambassador Agent so it can // report to AgentCom in Ambassador Cloud. Pods []*kates.Pod `json:"Pods,omitempty"` Deployments []*kates.Deployment `json:"Deployments,omitempty"` // ArgoRollouts represents the argo-rollout CRD state of the world that may or may not be present // in the client's cluster. For this reason, Rollouts resources are fetched making use of the // k8s dynamic client that returns an unstructured.Unstructured object. This is a better strategy // for Ambassador code base for the following reasons: // - it is forward compatible // - no need to maintain types defined by the Argo projects // - no unnecessary overhead Marshaling/Unmarshaling it into json as the state is opaque to // Ambassador. ArgoRollouts []*kates.Unstructured `json:"ArgoRollouts,omitempty"` // ArgoApplications represents the argo-rollout CRD state of the world that may or may not be present // in the client's cluster. For reasons why this is defined as unstructured see ArgoRollouts attribute. ArgoApplications []*kates.Unstructured `json:"ArgoApplications,omitempty"` }
func (*KubernetesSnapshot) PopulateAnnotations ¶ added in v2.1.2
func (s *KubernetesSnapshot) PopulateAnnotations(ctx context.Context) error
func (*KubernetesSnapshot) Sanitize ¶
func (ambInputs *KubernetesSnapshot) Sanitize() error
type Snapshot ¶
type Snapshot struct { // meta information to identify the ambassador AmbassadorMeta *AmbassadorMetaInfo // The Kubernetes field contains all the ambassador inputs from kubernetes. Kubernetes *KubernetesSnapshot // The Consul field contains endpoint data for any mappings setup to use a // consul resolver. Consul *ConsulSnapshot // The Deltas field contains a list of deltas to indicate what has changed // since the prior snapshot. This is only computed for the Kubernetes // portion of the snapshot. Changes in the Consul endpoint data are not // reflected in this field. Deltas []*kates.Delta // The APIDocs field contains a list of OpenAPI documents scrapped from // Ambassador Mappings part of the KubernetesSnapshot APIDocs []*APIDoc `json:"APIDocs,omitempty"` // The Invalid field contains any kubernetes resources that have failed // validation. Invalid []*kates.Unstructured Raw json.RawMessage `json:"-"` }
The snapshot type represents a complete configuration snapshot as sent to diagd.
func (*Snapshot) Sanitize ¶
Currently, this only removes "sensitive" information, which, for now, is just Secrets.data and anything that's not object metadata from Invalid objects. (since we couldn't parse the things in "invalid", we actually don't know what they are so they could contain secrets.)
TODO:(@acookin) Could also remove server generated bits from here, e.g. the last applied configuration annotation that the kube server applies. The benefit of that would be to reduce bits sent across the wire.