This repository has been archived by the owner on Apr 27, 2023. It is now read-only.
forked from istio/istio
/
resource.go
70 lines (59 loc) · 2.81 KB
/
resource.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
// Copyright 2017 Istio Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package config
import (
"github.com/golang/protobuf/proto"
)
// Meta is metadata attached to each configuration unit.
// The revision is optional, and if provided, identifies the
// last update operation on the object.
type Meta struct {
// Type is a short configuration name that matches the content message type
// (e.g. "route-rule")
Type string `json:"type,omitempty"`
// Name is a unique immutable identifier in a namespace
Name string `json:"name,omitempty"`
// Namespace defines the space for names (optional for some types),
// applications may choose to use namespaces for a variety of purposes
// (security domains, fault domains, organizational domains)
Namespace string `json:"namespace,omitempty"`
// Namespace where istio control plane is installed
IstioNamespace string `json:"istioNamespace,omitempty"`
// Map of string keys and values that can be used to organize and categorize
// (scope and select) objects.
Labels map[string]string `json:"labels,omitempty"`
// Annotations is an unstructured key value map stored with a resource that may be
// set by external tools to store and retrieve arbitrary metadata. They are not
// queryable and should be preserved when modifying objects.
Annotations map[string]string `json:"annotations,omitempty"`
// ResourceVersion is an opaque identifier for tracking updates to the config registry.
// The implementation may use a change index or a commit log for the revision.
// The config client should not make any assumptions about revisions and rely only on
// exact equality to implement optimistic concurrency of read-write operations.
//
// The lifetime of an object of a particular revision depends on the underlying data store.
// The data store may compactify old revisions in the interest of storage optimization.
//
// An empty revision carries a special meaning that the associated object has
// not been stored and assigned a revision.
ResourceVersion string `json:"resourceVersion,omitempty"`
}
// Entry is a configuration unit consisting of the type of configuration, the
// key identifier that is unique per type, and the content represented as a
// protobuf message.
type Entry struct {
Meta
// Spec holds the configuration object as a protobuf message
Spec proto.Message
}