Example #1
0
func (sync *kubeSync) updateFederations(cm *api.ConfigMap, config *Config) (err error) {
	if flagValue, ok := cm.Data["federations"]; ok {
		config.Federations = make(map[string]string)
		if err = fed.ParseFederationsFlag(flagValue, config.Federations); err != nil {
			glog.Errorf("Invalid federations value: %v (value was %q)",
				err, cm.Data["federations"])
			return
		}
		glog.V(2).Infof("Updated federations to %v", config.Federations)
	} else {
		glog.V(2).Infof("No federations present")
	}

	return
}
Example #2
0
func (t *dnsConfigMapTest) validateFederation() {
	federations := make(map[string]string)
	if t.cm != nil {
		err := fed.ParseFederationsFlag(t.cm.Data["federations"], federations)
		Expect(err).NotTo(HaveOccurred())
	}

	if len(federations) == 0 {
		By(fmt.Sprintf("Validating federation labels %v do not exist", t.labels))

		for _, label := range t.labels {
			var federationDNS = fmt.Sprintf("e2e-dns-configmap.%s.%s.svc.cluster.local.",
				t.f.Namespace.Name, label)
			predicate := func(actual []string) bool {
				return len(actual) == 0
			}
			t.checkDNSRecord(federationDNS, predicate, wait.ForeverTestTimeout)
		}
	} else {
		for label := range federations {
			var federationDNS = fmt.Sprintf("%s.%s.%s.svc.cluster.local.",
				t.utilService.ObjectMeta.Name, t.f.Namespace.Name, label)
			var localDNS = fmt.Sprintf("%s.%s.svc.cluster.local.",
				t.utilService.ObjectMeta.Name, t.f.Namespace.Name)
			// Check local mapping. Checking a remote mapping requires
			// creating an arbitrary DNS record which is not possible at the
			// moment.
			By(fmt.Sprintf("Validating federation record %v", label))
			predicate := func(actual []string) bool {
				for _, v := range actual {
					if v == localDNS {
						return true
					}
				}
				return false
			}
			t.checkDNSRecord(federationDNS, predicate, wait.ForeverTestTimeout)
		}
	}
}
Example #3
0
func (fv federationsVar) Set(keyVal string) error {
	return fed.ParseFederationsFlag(keyVal, fv.nameDomainMap)
}