mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-08 03:33:56 +00:00
Typos and englishify federation
This commit is contained in:
parent
aff7dfcaab
commit
6aaad93908
@ -42,12 +42,12 @@ var Unversioned = unversioned.GroupVersion{Group: "", Version: "v1"}
|
|||||||
// ParameterCodec handles versioning of objects that are converted to query parameters.
|
// ParameterCodec handles versioning of objects that are converted to query parameters.
|
||||||
var ParameterCodec = runtime.NewParameterCodec(Scheme)
|
var ParameterCodec = runtime.NewParameterCodec(Scheme)
|
||||||
|
|
||||||
// Kind takes an unqualified kind and returns back a Group qualified GroupKind
|
// Kind takes an unqualified kind and returns a Group qualified GroupKind
|
||||||
func Kind(kind string) unversioned.GroupKind {
|
func Kind(kind string) unversioned.GroupKind {
|
||||||
return SchemeGroupVersion.WithKind(kind).GroupKind()
|
return SchemeGroupVersion.WithKind(kind).GroupKind()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Resource takes an unqualified resource and returns back a Group qualified GroupResource
|
// Resource takes an unqualified resource and returns a Group qualified GroupResource
|
||||||
func Resource(resource string) unversioned.GroupResource {
|
func Resource(resource string) unversioned.GroupResource {
|
||||||
return SchemeGroupVersion.WithResource(resource).GroupResource()
|
return SchemeGroupVersion.WithResource(resource).GroupResource()
|
||||||
}
|
}
|
||||||
|
@ -28,12 +28,12 @@ const GroupName = "federation"
|
|||||||
// SchemeGroupVersion is group version used to register these objects
|
// SchemeGroupVersion is group version used to register these objects
|
||||||
var SchemeGroupVersion = unversioned.GroupVersion{Group: GroupName, Version: runtime.APIVersionInternal}
|
var SchemeGroupVersion = unversioned.GroupVersion{Group: GroupName, Version: runtime.APIVersionInternal}
|
||||||
|
|
||||||
// Kind takes an unqualified kind and returns back a Group qualified GroupKind
|
// Kind takes an unqualified kind and returns a Group qualified GroupKind
|
||||||
func Kind(kind string) unversioned.GroupKind {
|
func Kind(kind string) unversioned.GroupKind {
|
||||||
return SchemeGroupVersion.WithKind(kind).GroupKind()
|
return SchemeGroupVersion.WithKind(kind).GroupKind()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Resource takes an unqualified resource and returns back a Group qualified GroupResource
|
// Resource takes an unqualified resource and returns a Group qualified GroupResource
|
||||||
func Resource(resource string) unversioned.GroupResource {
|
func Resource(resource string) unversioned.GroupResource {
|
||||||
return SchemeGroupVersion.WithResource(resource).GroupResource()
|
return SchemeGroupVersion.WithResource(resource).GroupResource()
|
||||||
}
|
}
|
||||||
|
@ -75,7 +75,7 @@ type ClusterCondition struct {
|
|||||||
type ClusterStatus struct {
|
type ClusterStatus struct {
|
||||||
// Conditions is an array of current cluster conditions.
|
// Conditions is an array of current cluster conditions.
|
||||||
Conditions []ClusterCondition `json:"conditions,omitempty"`
|
Conditions []ClusterCondition `json:"conditions,omitempty"`
|
||||||
// Zones is the list of avaliability zones in which the nodes of the cluster exist, e.g. 'us-east1-a'.
|
// Zones is the list of availability zones in which the nodes of the cluster exist, e.g. 'us-east1-a'.
|
||||||
// These will always be in the same region.
|
// These will always be in the same region.
|
||||||
Zones []string `json:"zones,omitempty"`
|
Zones []string `json:"zones,omitempty"`
|
||||||
// Region is the name of the region in which all of the nodes in the cluster exist. e.g. 'us-east1'.
|
// Region is the name of the region in which all of the nodes in the cluster exist. e.g. 'us-east1'.
|
||||||
@ -109,7 +109,7 @@ type ClusterList struct {
|
|||||||
Items []Cluster `json:"items"`
|
Items []Cluster `json:"items"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Temporary/alpha stuctures to support custom replica assignments within FederatedReplicaSet.
|
// Temporary/alpha structures to support custom replica assignments within FederatedReplicaSet.
|
||||||
|
|
||||||
// A set of preferences that can be added to federated version of ReplicaSet as a json-serialized annotation.
|
// A set of preferences that can be added to federated version of ReplicaSet as a json-serialized annotation.
|
||||||
// The preferences allow the user to express in which culsters he wants to put his replicas within the
|
// The preferences allow the user to express in which culsters he wants to put his replicas within the
|
||||||
|
@ -95,7 +95,7 @@ message ClusterStatus {
|
|||||||
// Conditions is an array of current cluster conditions.
|
// Conditions is an array of current cluster conditions.
|
||||||
repeated ClusterCondition conditions = 1;
|
repeated ClusterCondition conditions = 1;
|
||||||
|
|
||||||
// Zones is the list of avaliability zones in which the nodes of the cluster exist, e.g. 'us-east1-a'.
|
// Zones is the list of availability zones in which the nodes of the cluster exist, e.g. 'us-east1-a'.
|
||||||
// These will always be in the same region.
|
// These will always be in the same region.
|
||||||
repeated string zones = 5;
|
repeated string zones = 5;
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@ type ClusterCondition struct {
|
|||||||
type ClusterStatus struct {
|
type ClusterStatus struct {
|
||||||
// Conditions is an array of current cluster conditions.
|
// Conditions is an array of current cluster conditions.
|
||||||
Conditions []ClusterCondition `json:"conditions,omitempty" protobuf:"bytes,1,rep,name=conditions"`
|
Conditions []ClusterCondition `json:"conditions,omitempty" protobuf:"bytes,1,rep,name=conditions"`
|
||||||
// Zones is the list of avaliability zones in which the nodes of the cluster exist, e.g. 'us-east1-a'.
|
// Zones is the list of availability zones in which the nodes of the cluster exist, e.g. 'us-east1-a'.
|
||||||
// These will always be in the same region.
|
// These will always be in the same region.
|
||||||
Zones []string `json:"zones,omitempty" protobuf:"bytes,5,rep,name=zones"`
|
Zones []string `json:"zones,omitempty" protobuf:"bytes,5,rep,name=zones"`
|
||||||
// Region is the name of the region in which all of the nodes in the cluster exist. e.g. 'us-east1'.
|
// Region is the name of the region in which all of the nodes in the cluster exist. e.g. 'us-east1'.
|
||||||
|
@ -75,7 +75,7 @@ func (ClusterSpec) SwaggerDoc() map[string]string {
|
|||||||
var map_ClusterStatus = map[string]string{
|
var map_ClusterStatus = map[string]string{
|
||||||
"": "ClusterStatus is information about the current status of a cluster updated by cluster controller peridocally.",
|
"": "ClusterStatus is information about the current status of a cluster updated by cluster controller peridocally.",
|
||||||
"conditions": "Conditions is an array of current cluster conditions.",
|
"conditions": "Conditions is an array of current cluster conditions.",
|
||||||
"zones": "Zones is the list of avaliability zones in which the nodes of the cluster exist, e.g. 'us-east1-a'. These will always be in the same region.",
|
"zones": "Zones is the list of availability zones in which the nodes of the cluster exist, e.g. 'us-east1-a'. These will always be in the same region.",
|
||||||
"region": "Region is the name of the region in which all of the nodes in the cluster exist. e.g. 'us-east1'.",
|
"region": "Region is the name of the region in which all of the nodes in the cluster exist. e.g. 'us-east1'.",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ type Route53API interface {
|
|||||||
|
|
||||||
// Route53APIStub is a minimal implementation of Route53API, used primarily for unit testing.
|
// Route53APIStub is a minimal implementation of Route53API, used primarily for unit testing.
|
||||||
// See http://http://docs.aws.amazon.com/sdk-for-go/api/service/route53.html for descriptions
|
// See http://http://docs.aws.amazon.com/sdk-for-go/api/service/route53.html for descriptions
|
||||||
// of all of it's methods.
|
// of all of its methods.
|
||||||
type Route53APIStub struct {
|
type Route53APIStub struct {
|
||||||
zones map[string]*route53.HostedZone
|
zones map[string]*route53.HostedZone
|
||||||
recordSets map[string]map[string][]*route53.ResourceRecordSet
|
recordSets map[string]map[string][]*route53.ResourceRecordSet
|
||||||
@ -86,7 +86,7 @@ func (r *Route53APIStub) ChangeResourceRecordSets(input *route53.ChangeResourceR
|
|||||||
recordSets[key] = append(recordSets[key], change.ResourceRecordSet)
|
recordSets[key] = append(recordSets[key], change.ResourceRecordSet)
|
||||||
case route53.ChangeActionDelete:
|
case route53.ChangeActionDelete:
|
||||||
if _, found := recordSets[key]; !found {
|
if _, found := recordSets[key]; !found {
|
||||||
return nil, fmt.Errorf("Attempt to delete non-existant rrset %s", key) // TODO: Check other fields too
|
return nil, fmt.Errorf("Attempt to delete non-existent rrset %s", key) // TODO: Check other fields too
|
||||||
}
|
}
|
||||||
delete(recordSets, key)
|
delete(recordSets, key)
|
||||||
case route53.ChangeActionUpsert:
|
case route53.ChangeActionUpsert:
|
||||||
@ -94,7 +94,7 @@ func (r *Route53APIStub) ChangeResourceRecordSets(input *route53.ChangeResourceR
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
r.recordSets[*input.HostedZoneId] = recordSets
|
r.recordSets[*input.HostedZoneId] = recordSets
|
||||||
return output, nil // TODO: We should ideally return status etc, but we dont' use that yet.
|
return output, nil // TODO: We should ideally return status etc, but we don't' use that yet.
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *Route53APIStub) ListHostedZonesPages(input *route53.ListHostedZonesInput, fn func(p *route53.ListHostedZonesOutput, lastPage bool) (shouldContinue bool)) error {
|
func (r *Route53APIStub) ListHostedZonesPages(input *route53.ListHostedZonesInput, fn func(p *route53.ListHostedZonesOutput, lastPage bool) (shouldContinue bool)) error {
|
||||||
|
@ -25,7 +25,7 @@ package stubs
|
|||||||
import dns "google.golang.org/api/dns/v1"
|
import dns "google.golang.org/api/dns/v1"
|
||||||
|
|
||||||
type (
|
type (
|
||||||
// TODO: We dont' need these yet, so they remain unimplemented. Add later as required.
|
// TODO: We don't need these yet, so they remain unimplemented. Add later as required.
|
||||||
Project struct{ impl *dns.Project }
|
Project struct{ impl *dns.Project }
|
||||||
ProjectsGetCall struct{ impl *dns.ProjectsGetCall }
|
ProjectsGetCall struct{ impl *dns.ProjectsGetCall }
|
||||||
ProjectsService struct{ impl *dns.ProjectsService }
|
ProjectsService struct{ impl *dns.ProjectsService }
|
||||||
|
@ -30,7 +30,7 @@ type ManagedZonesDeleteCall struct {
|
|||||||
Service *ManagedZonesService
|
Service *ManagedZonesService
|
||||||
Project string
|
Project string
|
||||||
ZoneName string
|
ZoneName string
|
||||||
Error *error // Use this to overide response for testing if required
|
Error *error // Use this to override response for testing if required
|
||||||
}
|
}
|
||||||
|
|
||||||
func (call ManagedZonesDeleteCall) Do(opts ...googleapi.CallOption) error {
|
func (call ManagedZonesDeleteCall) Do(opts ...googleapi.CallOption) error {
|
||||||
|
@ -28,8 +28,8 @@ type ManagedZonesGetCall struct {
|
|||||||
Service *ManagedZonesService
|
Service *ManagedZonesService
|
||||||
Project string
|
Project string
|
||||||
ZoneName string
|
ZoneName string
|
||||||
Response interfaces.ManagedZone // Use this to overide response if required
|
Response interfaces.ManagedZone // Use this to override response if required
|
||||||
Error *error // Use this to overide response if required
|
Error *error // Use this to override response if required
|
||||||
DnsName_ string
|
DnsName_ string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,8 +29,8 @@ var _ interfaces.ManagedZonesListCall = &ManagedZonesListCall{}
|
|||||||
type ManagedZonesListCall struct {
|
type ManagedZonesListCall struct {
|
||||||
Service *ManagedZonesService
|
Service *ManagedZonesService
|
||||||
Project string
|
Project string
|
||||||
Response *interfaces.ManagedZonesListResponse // Use this to overide response if required
|
Response *interfaces.ManagedZonesListResponse // Use this to override response if required
|
||||||
Error *error // Use this to overide response if required
|
Error *error // Use this to override response if required
|
||||||
DnsName_ string
|
DnsName_ string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,12 +45,12 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type IngressController struct {
|
type IngressController struct {
|
||||||
// For triggering single ingress reconcilation. This is used when there is an
|
// For triggering single ingress reconciliation. This is used when there is an
|
||||||
// add/update/delete operation on an ingress in either federated API server or
|
// add/update/delete operation on an ingress in either federated API server or
|
||||||
// in some member of the federation.
|
// in some member of the federation.
|
||||||
ingressDeliverer *util.DelayingDeliverer
|
ingressDeliverer *util.DelayingDeliverer
|
||||||
|
|
||||||
// For triggering reconcilation of all ingresses. This is used when
|
// For triggering reconciliation of all ingresses. This is used when
|
||||||
// a new cluster becomes available.
|
// a new cluster becomes available.
|
||||||
clusterDeliverer *util.DelayingDeliverer
|
clusterDeliverer *util.DelayingDeliverer
|
||||||
|
|
||||||
@ -94,7 +94,7 @@ func NewIngressController(client federation_release_1_4.Interface) *IngressContr
|
|||||||
eventRecorder: recorder,
|
eventRecorder: recorder,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Build deliverers for triggering reconcilations.
|
// Build deliverers for triggering reconciliations.
|
||||||
ic.ingressDeliverer = util.NewDelayingDeliverer()
|
ic.ingressDeliverer = util.NewDelayingDeliverer()
|
||||||
ic.clusterDeliverer = util.NewDelayingDeliverer()
|
ic.clusterDeliverer = util.NewDelayingDeliverer()
|
||||||
|
|
||||||
@ -131,8 +131,8 @@ func NewIngressController(client federation_release_1_4.Interface) *IngressContr
|
|||||||
},
|
},
|
||||||
&extensions_v1beta1.Ingress{},
|
&extensions_v1beta1.Ingress{},
|
||||||
controller.NoResyncPeriodFunc(),
|
controller.NoResyncPeriodFunc(),
|
||||||
// Trigger reconcilation whenever something in federated cluster is changed. In most cases it
|
// Trigger reconciliation whenever something in federated cluster is changed. In most cases it
|
||||||
// would be just confirmation that some ingress operation suceeded.
|
// would be just confirmation that some ingress operation succeeded.
|
||||||
util.NewTriggerOnAllChanges(
|
util.NewTriggerOnAllChanges(
|
||||||
func(obj pkg_runtime.Object) {
|
func(obj pkg_runtime.Object) {
|
||||||
ic.deliverIngressObj(obj, ic.ingressReviewDelay, false)
|
ic.deliverIngressObj(obj, ic.ingressReviewDelay, false)
|
||||||
@ -219,7 +219,7 @@ func (ic *IngressController) deliverIngress(ingress types.NamespacedName, delay
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check whether all data stores are in sync. False is returned if any of the informer/stores is not yet
|
// Check whether all data stores are in sync. False is returned if any of the informer/stores is not yet
|
||||||
// synced with the coresponding api server.
|
// synced with the corresponding api server.
|
||||||
func (ic *IngressController) isSynced() bool {
|
func (ic *IngressController) isSynced() bool {
|
||||||
if !ic.ingressFederatedInformer.ClustersSynced() {
|
if !ic.ingressFederatedInformer.ClustersSynced() {
|
||||||
glog.V(2).Infof("Cluster list not synced")
|
glog.V(2).Infof("Cluster list not synced")
|
||||||
@ -238,7 +238,7 @@ func (ic *IngressController) isSynced() bool {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
// The function triggers reconcilation of all federated ingresses.
|
// The function triggers reconciliation of all federated ingresses.
|
||||||
func (ic *IngressController) reconcileIngressesOnClusterChange() {
|
func (ic *IngressController) reconcileIngressesOnClusterChange() {
|
||||||
glog.V(4).Infof("Reconciling ingresses on cluster change")
|
glog.V(4).Infof("Reconciling ingresses on cluster change")
|
||||||
if !ic.isSynced() {
|
if !ic.isSynced() {
|
||||||
|
@ -46,12 +46,12 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type NamespaceController struct {
|
type NamespaceController struct {
|
||||||
// For triggering single namespace reconcilation. This is used when there is an
|
// For triggering single namespace reconciliation. This is used when there is an
|
||||||
// add/update/delete operation on a namespace in either federated API server or
|
// add/update/delete operation on a namespace in either federated API server or
|
||||||
// in some member of the federation.
|
// in some member of the federation.
|
||||||
namespaceDeliverer *util.DelayingDeliverer
|
namespaceDeliverer *util.DelayingDeliverer
|
||||||
|
|
||||||
// For triggering all namespaces reconcilation. This is used when
|
// For triggering all namespaces reconciliation. This is used when
|
||||||
// a new cluster becomes available.
|
// a new cluster becomes available.
|
||||||
clusterDeliverer *util.DelayingDeliverer
|
clusterDeliverer *util.DelayingDeliverer
|
||||||
|
|
||||||
@ -95,7 +95,7 @@ func NewNamespaceController(client federation_release_1_4.Interface) *NamespaceC
|
|||||||
eventRecorder: recorder,
|
eventRecorder: recorder,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Build delivereres for triggering reconcilations.
|
// Build delivereres for triggering reconciliations.
|
||||||
nc.namespaceDeliverer = util.NewDelayingDeliverer()
|
nc.namespaceDeliverer = util.NewDelayingDeliverer()
|
||||||
nc.clusterDeliverer = util.NewDelayingDeliverer()
|
nc.clusterDeliverer = util.NewDelayingDeliverer()
|
||||||
|
|
||||||
@ -128,8 +128,8 @@ func NewNamespaceController(client federation_release_1_4.Interface) *NamespaceC
|
|||||||
},
|
},
|
||||||
&api_v1.Namespace{},
|
&api_v1.Namespace{},
|
||||||
controller.NoResyncPeriodFunc(),
|
controller.NoResyncPeriodFunc(),
|
||||||
// Trigger reconcilation whenever something in federated cluster is changed. In most cases it
|
// Trigger reconciliation whenever something in federated cluster is changed. In most cases it
|
||||||
// would be just confirmation that some namespace opration suceeded.
|
// would be just confirmation that some namespace opration succeeded.
|
||||||
util.NewTriggerOnMetaAndSpecChanges(
|
util.NewTriggerOnMetaAndSpecChanges(
|
||||||
func(obj pkg_runtime.Object) { nc.deliverNamespaceObj(obj, nc.namespaceReviewDelay, false) },
|
func(obj pkg_runtime.Object) { nc.deliverNamespaceObj(obj, nc.namespaceReviewDelay, false) },
|
||||||
))
|
))
|
||||||
@ -204,7 +204,7 @@ func (nc *NamespaceController) deliverNamespace(namespace string, delay time.Dur
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check whether all data stores are in sync. False is returned if any of the informer/stores is not yet
|
// Check whether all data stores are in sync. False is returned if any of the informer/stores is not yet
|
||||||
// synced with the coresponding api server.
|
// synced with the corresponding api server.
|
||||||
func (nc *NamespaceController) isSynced() bool {
|
func (nc *NamespaceController) isSynced() bool {
|
||||||
if !nc.namespaceFederatedInformer.ClustersSynced() {
|
if !nc.namespaceFederatedInformer.ClustersSynced() {
|
||||||
glog.V(2).Infof("Cluster list not synced")
|
glog.V(2).Infof("Cluster list not synced")
|
||||||
@ -221,7 +221,7 @@ func (nc *NamespaceController) isSynced() bool {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
// The function triggers reconcilation of all federated namespaces.
|
// The function triggers reconciliation of all federated namespaces.
|
||||||
func (nc *NamespaceController) reconcileNamespacesOnClusterChange() {
|
func (nc *NamespaceController) reconcileNamespacesOnClusterChange() {
|
||||||
if !nc.isSynced() {
|
if !nc.isSynced() {
|
||||||
nc.clusterDeliverer.DeliverAfter(allClustersKey, nil, nc.clusterAvailableDelay)
|
nc.clusterDeliverer.DeliverAfter(allClustersKey, nil, nc.clusterAvailableDelay)
|
||||||
|
@ -54,7 +54,7 @@ func NewPlanner(preferences *fed_api.FederatedReplicaSetPreferences) *Planner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Distribute the desired number of replicas among the given cluster according to the planner preferences.
|
// Distribute the desired number of replicas among the given cluster according to the planner preferences.
|
||||||
// The function tries its best to assign each cluster the prefered number of replicas, however if
|
// The function tries its best to assign each cluster the preferred number of replicas, however if
|
||||||
// sum of MinReplicas for all cluster is bigger thant replicasToDistribute then some cluster will not
|
// sum of MinReplicas for all cluster is bigger thant replicasToDistribute then some cluster will not
|
||||||
// have all of the replicas assigned. In such case a cluster with higher weight has priority over
|
// have all of the replicas assigned. In such case a cluster with higher weight has priority over
|
||||||
// cluster with lower weight (or with lexicographically smaller name in case of draw).
|
// cluster with lower weight (or with lexicographically smaller name in case of draw).
|
||||||
|
@ -44,12 +44,12 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type SecretController struct {
|
type SecretController struct {
|
||||||
// For triggering single secret reconcilation. This is used when there is an
|
// For triggering single secret reconciliation. This is used when there is an
|
||||||
// add/update/delete operation on a secret in either federated API server or
|
// add/update/delete operation on a secret in either federated API server or
|
||||||
// in some member of the federation.
|
// in some member of the federation.
|
||||||
secretDeliverer *util.DelayingDeliverer
|
secretDeliverer *util.DelayingDeliverer
|
||||||
|
|
||||||
// For triggering all secrets reconcilation. This is used when
|
// For triggering all secrets reconciliation. This is used when
|
||||||
// a new cluster becomes available.
|
// a new cluster becomes available.
|
||||||
clusterDeliverer *util.DelayingDeliverer
|
clusterDeliverer *util.DelayingDeliverer
|
||||||
|
|
||||||
@ -93,7 +93,7 @@ func NewSecretController(client federation_release_1_4.Interface) *SecretControl
|
|||||||
eventRecorder: recorder,
|
eventRecorder: recorder,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Build delivereres for triggering reconcilations.
|
// Build delivereres for triggering reconciliations.
|
||||||
secretcontroller.secretDeliverer = util.NewDelayingDeliverer()
|
secretcontroller.secretDeliverer = util.NewDelayingDeliverer()
|
||||||
secretcontroller.clusterDeliverer = util.NewDelayingDeliverer()
|
secretcontroller.clusterDeliverer = util.NewDelayingDeliverer()
|
||||||
|
|
||||||
@ -126,8 +126,8 @@ func NewSecretController(client federation_release_1_4.Interface) *SecretControl
|
|||||||
},
|
},
|
||||||
&api_v1.Secret{},
|
&api_v1.Secret{},
|
||||||
controller.NoResyncPeriodFunc(),
|
controller.NoResyncPeriodFunc(),
|
||||||
// Trigger reconcilation whenever something in federated cluster is changed. In most cases it
|
// Trigger reconciliation whenever something in federated cluster is changed. In most cases it
|
||||||
// would be just confirmation that some secret opration suceeded.
|
// would be just confirmation that some secret opration succeeded.
|
||||||
util.NewTriggerOnAllChanges(
|
util.NewTriggerOnAllChanges(
|
||||||
func(obj pkg_runtime.Object) {
|
func(obj pkg_runtime.Object) {
|
||||||
secretcontroller.deliverSecretObj(obj, secretcontroller.secretReviewDelay, false)
|
secretcontroller.deliverSecretObj(obj, secretcontroller.secretReviewDelay, false)
|
||||||
@ -216,7 +216,7 @@ func (secretcontroller *SecretController) deliverSecret(namespace string, name s
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check whether all data stores are in sync. False is returned if any of the informer/stores is not yet
|
// Check whether all data stores are in sync. False is returned if any of the informer/stores is not yet
|
||||||
// synced with the coresponding api server.
|
// synced with the corresponding api server.
|
||||||
func (secretcontroller *SecretController) isSynced() bool {
|
func (secretcontroller *SecretController) isSynced() bool {
|
||||||
if !secretcontroller.secretFederatedInformer.ClustersSynced() {
|
if !secretcontroller.secretFederatedInformer.ClustersSynced() {
|
||||||
glog.V(2).Infof("Cluster list not synced")
|
glog.V(2).Infof("Cluster list not synced")
|
||||||
@ -233,7 +233,7 @@ func (secretcontroller *SecretController) isSynced() bool {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
// The function triggers reconcilation of all federated secrets.
|
// The function triggers reconciliation of all federated secrets.
|
||||||
func (secretcontroller *SecretController) reconcileSecretsOnClusterChange() {
|
func (secretcontroller *SecretController) reconcileSecretsOnClusterChange() {
|
||||||
if !secretcontroller.isSynced() {
|
if !secretcontroller.isSynced() {
|
||||||
secretcontroller.clusterDeliverer.DeliverAt(allClustersKey, nil, time.Now().Add(secretcontroller.clusterAvailableDelay))
|
secretcontroller.clusterDeliverer.DeliverAt(allClustersKey, nil, time.Now().Add(secretcontroller.clusterAvailableDelay))
|
||||||
|
@ -126,7 +126,7 @@ func getRrset(dnsName string, rrsetsInterface dnsprovider.ResourceRecordSets) (d
|
|||||||
return returnVal, nil
|
return returnVal, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
/* getResolvedEndpoints perfoms DNS resolution on the provided slice of endpoints (which might be DNS names or IPv4 addresses)
|
/* getResolvedEndpoints performs DNS resolution on the provided slice of endpoints (which might be DNS names or IPv4 addresses)
|
||||||
and returns a list of IPv4 addresses. If any of the endpoints are neither valid IPv4 addresses nor resolvable DNS names,
|
and returns a list of IPv4 addresses. If any of the endpoints are neither valid IPv4 addresses nor resolvable DNS names,
|
||||||
non-nil error is also returned (possibly along with a partially complete list of resolved endpoints.
|
non-nil error is also returned (possibly along with a partially complete list of resolved endpoints.
|
||||||
*/
|
*/
|
||||||
@ -135,7 +135,7 @@ func getResolvedEndpoints(endpoints []string) ([]string, error) {
|
|||||||
for _, endpoint := range endpoints {
|
for _, endpoint := range endpoints {
|
||||||
if net.ParseIP(endpoint) == nil {
|
if net.ParseIP(endpoint) == nil {
|
||||||
// It's not a valid IP address, so assume it's a DNS name, and try to resolve it,
|
// It's not a valid IP address, so assume it's a DNS name, and try to resolve it,
|
||||||
// replacing it's DNS name with it's IP addresses in expandedEndpoints
|
// replacing its DNS name with its IP addresses in expandedEndpoints
|
||||||
ipAddrs, err := net.LookupHost(endpoint)
|
ipAddrs, err := net.LookupHost(endpoint)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return resolvedEndpoints, err
|
return resolvedEndpoints, err
|
||||||
|
@ -62,7 +62,7 @@ func BuildClusterConfig(c *federation_v1beta1.Cluster) (*restclient.Config, erro
|
|||||||
}
|
}
|
||||||
if serverAddress != "" {
|
if serverAddress != "" {
|
||||||
if c.Spec.SecretRef == nil {
|
if c.Spec.SecretRef == nil {
|
||||||
glog.Infof("didnt find secretRef for cluster %s. Trying insecure access", c.Name)
|
glog.Infof("didn't find secretRef for cluster %s. Trying insecure access", c.Name)
|
||||||
clusterConfig, err = clientcmd.BuildConfigFromFlags(serverAddress, "")
|
clusterConfig, err = clientcmd.BuildConfigFromFlags(serverAddress, "")
|
||||||
} else {
|
} else {
|
||||||
kubeconfigGetter := KubeconfigGetterForCluster(c)
|
kubeconfigGetter := KubeconfigGetterForCluster(c)
|
||||||
@ -78,14 +78,14 @@ func BuildClusterConfig(c *federation_v1beta1.Cluster) (*restclient.Config, erro
|
|||||||
}
|
}
|
||||||
|
|
||||||
// This is to inject a different kubeconfigGetter in tests.
|
// This is to inject a different kubeconfigGetter in tests.
|
||||||
// We dont use the standard one which calls NewInCluster in tests to avoid having to setup service accounts and mount files with secret tokens.
|
// We don't use the standard one which calls NewInCluster in tests to avoid having to setup service accounts and mount files with secret tokens.
|
||||||
var KubeconfigGetterForCluster = func(c *federation_v1beta1.Cluster) clientcmd.KubeconfigGetter {
|
var KubeconfigGetterForCluster = func(c *federation_v1beta1.Cluster) clientcmd.KubeconfigGetter {
|
||||||
return func() (*clientcmdapi.Config, error) {
|
return func() (*clientcmdapi.Config, error) {
|
||||||
secretRefName := ""
|
secretRefName := ""
|
||||||
if c.Spec.SecretRef != nil {
|
if c.Spec.SecretRef != nil {
|
||||||
secretRefName = c.Spec.SecretRef.Name
|
secretRefName = c.Spec.SecretRef.Name
|
||||||
} else {
|
} else {
|
||||||
glog.Infof("didnt find secretRef for cluster %s. Trying insecure access", c.Name)
|
glog.Infof("didn't find secretRef for cluster %s. Trying insecure access", c.Name)
|
||||||
}
|
}
|
||||||
return KubeconfigGetterForSecret(secretRefName)()
|
return KubeconfigGetterForSecret(secretRefName)()
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// Basic test for Federated Informer. Checks whether the subinformer are added and deleted
|
// Basic test for Federated Informer. Checks whether the subinformer are added and deleted
|
||||||
// when the corresponding cluster entries appear and dissapear from etcd.
|
// when the corresponding cluster entries appear and disappear from etcd.
|
||||||
func TestFederatedInformer(t *testing.T) {
|
func TestFederatedInformer(t *testing.T) {
|
||||||
fakeFederationClient := &fake_federation_release_1_4.Clientset{}
|
fakeFederationClient := &fake_federation_release_1_4.Clientset{}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user