id stringlengths 2 7 | text stringlengths 17 51.2k | title stringclasses 1
value |
|---|---|---|
c162000 | = append(mgr.subscribers, subCh)
log.Infof("%v subscribed to settings updates", subCh)
} | |
c162001 | {
if ch == subCh {
mgr.subscribers = append(mgr.subscribers[:i], mgr.subscribers[i+1:]...)
log.Infof("%v unsubscribed from settings updates", subCh)
return
}
}
} | |
c162002 | Hosts: hosts,
Organization: "Argo CD",
IsCA: true,
}
cert, err := tlsutil.GenerateX509KeyPair(certOpts)
if err != nil {
return nil, err
}
cdSettings.Certificate = cert
log.Info("Initialized TLS certificate")
}
if len(cdSettings.Repositories) == 0 {
err = mgr.MigrateLegacyRepo... | |
c162003 | return &Server{enf: enf, appclientset: appclientset, kubeclientset: kubeclientset, ns: ns, projectLock: projectLock, auditLogger: auditLogger, sessionMgr: sessionMgr}
} | |
c162004 | have role '%s'", q.Project, q.Role)
}
tokenName := fmt.Sprintf(JWTTokenSubFormat, q.Project, q.Role)
jwtToken, err := s.sessionMgr.Create(tokenName, q.ExpiresIn)
if err != nil {
return nil, status.Error(codes.InvalidArgument, err.Error())
}
parser := &jwt.Parser{
SkipClaimsValidation: true,
}
claims := jw... | |
c162005 |
return &EmptyResponse{}, nil
}
project.Spec.Roles[roleIndex].JWTTokens[jwtTokenIndex] = project.Spec.Roles[roleIndex].JWTTokens[len(project.Spec.Roles[roleIndex].JWTTokens)-1]
project.Spec.Roles[roleIndex].JWTTokens = project.Spec.Roles[roleIndex].JWTTokens[:len(project.Spec.Roles[roleIndex].JWTTokens)-1]
_, err... | |
c162006 | := list.Items[i]
if s.enf.Enforce(ctx.Value("claims"), rbacpolicy.ResourceProjects, rbacpolicy.ActionGet, project.Name) {
newItems = append(newItems, project)
}
}
list.Items = newItems
}
return list, err
} | |
c162007 | return nil, err
}
return s.appclientset.ArgoprojV1alpha1().AppProjects(s.ns).Get(q.Name, metav1.GetOptions{})
} | |
c162008 |
apps := argo.FilterByProjects(appsList.Items, []string{q.Name})
if len(apps) > 0 {
return nil, status.Errorf(codes.InvalidArgument, "project is referenced by %d applications", len(apps))
}
err = s.appclientset.ArgoprojV1alpha1().AppProjects(s.ns).Delete(q.Name, &metav1.DeleteOptions{})
if err == nil {
s.logEv... | |
c162009 | http.ResponseWriter, r *http.Request) {
_, _ = fmt.Fprint(w, swaggerJSON)
})
mux.Handle(uiPath, middleware.Redoc(middleware.RedocOpts{
BasePath: prefix,
SpecURL: specURL,
Path: path.Base(uiPath),
}, http.NotFoundHandler()))
} | |
c162010 | *appProjects {
return &appProjects{
client: c.RESTClient(),
ns: namespace,
}
} | |
c162011 | },
}
command.AddCommand(NewApplicationResourceActionsListCommand(clientOpts))
command.AddCommand(NewApplicationResourceActionsRunCommand(clientOpts))
return command
} | |
c162012 | obj := filteredObjects[i]
gvk := obj.GroupVersionKind()
availActionsForResource, err := appIf.ListResourceActions(ctx, &application.ApplicationResourceRequest{
Name: &appName,
Namespace: obj.GetNamespace(),
ResourceName: obj.GetName(),
Group: gvk.Group,
Kind: gvk.Kin... | |
c162013 | filteredObjects := filterResources(command, resources.Items, group, kind, namespace, resourceName, all)
for i := range filteredObjects {
obj := filteredObjects[i]
gvk := obj.GroupVersionKind()
objResourceName := obj.GetName()
_, err := appIf.RunResourceAction(context.Background(), &application.ResourceAc... | |
c162014 | == r.Kind && gvk.Group == r.Group {
return true
}
return false
} | |
c162015 | groupName := range role.Groups {
policies = append(policies, fmt.Sprintf("g, %s, proj:%s:%s", groupName, proj.ObjectMeta.Name, role.Name))
}
}
return strings.Join(policies, "\n")
} | |
c162016 | > -1 {
app.Finalizers[index] = app.Finalizers[len(app.Finalizers)-1]
app.Finalizers = app.Finalizers[:len(app.Finalizers)-1]
} else {
app.Finalizers = append(app.Finalizers, common.ResourcesFinalizerName)
}
}
} | |
c162017 |
for i := range status.Conditions {
condition := status.Conditions[i]
if condition.IsError() {
result = append(result, condition)
}
}
return result
} | |
c162018 | reflect.DeepEqual(*source, other)
} | |
c162019 | return reflect.DeepEqual(dest, other)
} | |
c162020 | return common.DefaultAppProjectName
}
return spec.Project
} | |
c162021 | normalized := git.NormalizeGitURL(repoURL)
if globMatch(normalized, srcNormalized) {
return true
}
}
return false
} | |
c162022 | proj.Spec.Destinations {
if globMatch(item.Server, dst.Server) && globMatch(item.Namespace, dst.Namespace) {
return true
}
}
return false
} | |
c162023 | c.Server,
TLSClientConfig: tlsClientConfig,
ExecProvider: &api.ExecConfig{
APIVersion: "client.authentication.k8s.io/v1alpha1",
Command: "aws-iam-authenticator",
Args: args,
},
}
} else {
config = &rest.Config{
Host: c.Server,
Username: c.Confi... | |
c162024 | TLSClientConfig: tlsConfig,
Proxy: http.ProxyFromEnvironment,
Dial: (&net.Dialer{
Timeout: 30 * time.Second,
KeepAlive: 30 * time.Second,
}).Dial,
TLSHandshakeTimeout: 10 * time.Second,
ExpectContinueTimeout: 1 * time.Second,
},
}
if settings.DexConfig != "" {
s.client.Transp... | |
c162025 | what you expect:
if _, ok := token.Method.(*jwt.SigningMethodHMAC); !ok {
return nil, fmt.Errorf("Unexpected signing method: %v", token.Header["alg"])
}
return settings.ServerSignature, nil
})
if err != nil {
return nil, err
}
issuedAt := time.Unix(int64(claims["iat"].(float64)), 0)
if issuedAt.Before... | |
c162026 | {
return nil, err
}
idToken, err := prov.Verify(claims.Audience, tokenString)
if err != nil {
return nil, err
}
var claims jwt.MapClaims
err = idToken.Claims(&claims)
return claims, err
}
} | |
c162027 | case SessionManagerClaimsIssuer:
return jwtutil.GetField(mapClaims, "sub")
default:
return jwtutil.GetField(mapClaims, "email")
}
} | |
c162028 | r != nil {
log.Errorf("Recovered from panic: %+v\n%s", r, debug.Stack())
err = status.Errorf(codes.Internal, "%s", r)
}
}()
return handler(ctx, req)
}
} | |
c162029 | != nil {
log.Errorf("Recovered from panic: %+v\n%s", r, debug.Stack())
err = status.Errorf(codes.Internal, "%s", r)
}
}()
return handler(srv, stream)
}
} | |
c162030 | grpc.UnaryHandler) (interface{}, error) {
if err := userAgentEnforcer(ctx); err != nil {
return nil, err
}
return handler(ctx, req)
}
} | |
c162031 | grpc.StreamHandler) error {
if err := userAgentEnforcer(stream.Context()); err != nil {
return err
}
return handler(srv, stream)
}
} | |
c162032 | hook.GroupVersionKind()
sc.setResourceDetails(&appv1.ResourceResult{
Name: hook.GetName(),
Group: gvk.Group,
Version: gvk.Version,
Kind: hook.GetKind(),
Namespace: hook.GetNamespace(),
Message: fmt.Sprintf("namespace %v is not permitted in project '%s'", hook.GetNamespace()... | |
c162033 | // phase, we want a full health assessment to happen. By returning early, we allow
// the application to get requeued into the controller workqueue, and on the next
// process iteration, a new CompareAppState() will be performed to get the most
// up-to-date live state. This enables us to accurately wait for... | |
c162034 |
// if we get here, this resource does not have any hook annotation so we
// should perform an `kubectl apply`
nonHookTasks = append(nonHookTasks, task)
}
}
return sc.doApplySync(nonHookTasks, false, sc.syncOp.SyncStrategy.Hook.Force, true)
} | |
c162035 | == appv1.HookDeletePolicyHookSucceeded && phase == appv1.OperationSucceeded {
return true
}
if policy == appv1.HookDeletePolicyHookFailed && phase == appv1.OperationFailed {
return true
}
}
return false
} | |
c162036 | return false
}
resHookTypes := strings.Split(annotations[common.AnnotationKeyHook], ",")
for _, ht := range resHookTypes {
if string(hookType) == strings.TrimSpace(ht) {
return true
}
}
return false
} | |
c162037 |
} else if isArgoWorkflow(gvk) {
updateStatusFromArgoWorkflow(hook, &hookStatus)
} else if isPod(gvk) {
updateStatusFromPod(hook, &hookStatus)
} else {
hookStatus.HookPhase = appv1.OperationSucceeded
hookStatus.Message = fmt.Sprintf("%s created", hook.GetName())
}
return hookStatus
} | |
c162038 | res.GroupVersionKind()
return isBatchJob(gvk) || isArgoWorkflow(gvk) || isPod(gvk)
} | |
c162039 |
if prev.Message != hookStatus.Message {
sc.log.Infof("Hook %s %s/%s message: '%s' -> '%s'", hookStatus.HookType, prev.Kind, prev.Name, prev.Message, hookStatus.Message)
}
sc.syncRes.Resources[i] = &hookStatus
return true
}
}
sc.syncRes.Resources = append(sc.syncRes.Resources, &hookStatus)
sc.log.I... | |
c162040 | continue
}
if !hookStatus.HookPhase.Completed() {
return false, false
}
if !hookStatus.HookPhase.Successful() {
isSuccessful = false
}
}
return true, isSuccessful
} | |
c162041 | c.ns, name), &v1alpha1.Application{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.Application), err
} | |
c162042 | label = labels.Everything()
}
list := &v1alpha1.ApplicationList{ListMeta: obj.(*v1alpha1.ApplicationList).ListMeta}
for _, item := range obj.(*v1alpha1.ApplicationList).Items {
if label.Matches(labels.Set(item.Labels)) {
list.Items = append(list.Items, item)
}
}
return list, err
} | |
c162043 | error) {
return c.Fake.
InvokesWatch(testing.NewWatchAction(applicationsResource, c.ns, opts))
} | |
c162044 | Invokes(testing.NewDeleteAction(applicationsResource, c.ns, name), &v1alpha1.Application{})
return err
} | |
c162045 | subresources...), &v1alpha1.Application{})
if obj == nil {
return nil, err
}
return obj.(*v1alpha1.Application), err
} | |
c162046 | {
err = cache.ListAll(s.indexer, selector, func(m interface{}) {
ret = append(ret, m.(*v1alpha1.Application))
})
return ret, err
} | |
c162047 | {
return applicationNamespaceLister{indexer: s.indexer, namespace: namespace}
} | |
c162048 | {
err = cache.ListAllByNamespace(s.indexer, s.namespace, selector, func(m interface{}) {
ret = append(ret, m.(*v1alpha1.Application))
})
return ret, err
} | |
c162049 | func() error {
c.proxyMutex.Lock()
defer c.proxyMutex.Unlock()
c.proxyUsersCount = c.proxyUsersCount - 1
if c.proxyUsersCount == 0 {
c.proxyServer.Stop()
c.proxyListener = nil
c.proxyServer = nil
return nil
}
return nil
}}, nil
} | |
c162050 |
return RegisterSettingsServiceHandlerClient(ctx, mux, NewSettingsServiceClient(conn))
} | |
c162051 | (resp interface{}, err error) {
resp, err = handler(ctx, req)
return resp, kubeErrToGRPC(err)
}
} | |
c162052 | handler grpc.StreamHandler) error {
err := handler(srv, ss)
return kubeErrToGRPC(err)
}
} | |
c162053 | 0 {
parallelismLimitSemaphore = semaphore.NewWeighted(parallelismLimit)
}
return &Service{
parallelismLimitSemaphore: parallelismLimitSemaphore,
repoLock: util.NewKeyLock(),
gitFactory: gitFactory,
cache: cache,
}
} | |
c162054 | err := gitClient.LsFiles(q.Path)
if err != nil {
return nil, err
}
res := FileList{Items: lsFiles}
err = s.cache.SetListDir(commitSHA, q.Path, res.Items)
if err != nil {
log.Warnf("listdir cache set error %s/%s: %v", commitSHA, q.Path, err)
}
return &res, nil
} | |
c162055 | filepath.Join(os.TempDir(), strings.Replace(repo, "/", "_", -1))
} | |
c162056 | nil
}
for _, kustomization := range kustomize.KustomizationNames {
if pathExists(appDirPath, kustomization) {
return v1alpha1.ApplicationSourceTypeKustomize, nil
}
}
return v1alpha1.ApplicationSourceTypeDirectory, nil
} | |
c162057 | to fetch git repo: %v", err)
}
err = gitClient.Checkout(commitSHA)
if err != nil {
return "", status.Errorf(codes.Internal, "Failed to checkout %s: %v", commitSHA, err)
}
return gitClient.CommitSHA()
} | |
c162058 | ksApp.Destination(ksonnetOpts.Environment)
if err != nil {
return nil, nil, status.Errorf(codes.InvalidArgument, err.Error())
}
targetObjs, err := ksApp.Show(ksonnetOpts.Environment)
if err == nil && appLabelKey == common.LabelKeyLegacyApplicationName {
// Address https://github.com/ksonnet/ksonnet/issues/707
... | |
c162059 | })
jsonStr, err := vm.EvaluateSnippet(f.Name(), string(out))
if err != nil {
return status.Errorf(codes.FailedPrecondition, "Failed to evaluate jsonnet %q: %v", f.Name(), err)
}
// attempt to unmarshal either array or single object
var jsonObjs []*unstructured.Unstructured
err = json.Unmarshal(... | |
c162060 | if os.IsNotExist(err) {
return false
}
}
return true
} | |
c162061 | if err != nil {
return nil, "", err
}
commitSHA, err := gitClient.LsRemote(revision)
if err != nil {
return nil, "", err
}
return gitClient, commitSHA, nil
} | |
c162062 | not match", app.Spec.Source.RepoURL)
continue
}
targetRev := app.Spec.Source.TargetRevision
if targetRev == "HEAD" || targetRev == "" {
if !touchedHead {
continue
}
} else if targetRev != revision {
continue
}
_, err = argo.RefreshApp(appIf, app.ObjectMeta.Name, v1alpha1.RefreshTypeNormal)
... | |
c162063 | util.Close(setConn)
ctx := context.Background()
httpClient, err := acdClient.HTTPClient()
errors.CheckError(err)
ctx = oidc.ClientContext(ctx, httpClient)
acdSet, err := setIf.Get(ctx, &settings.SettingsQuery{})
errors.CheckError(err)
oauth2conf, provider, err := acdClient.OIDCConfig(ctx, a... | |
c162064 | v.namespace, tweakListOptions: v.tweakListOptions}
} | |
c162065 | v.namespace, tweakListOptions: v.tweakListOptions}
} | |
c162066 |
return
}
_ = os.Remove(path)
} | |
c162067 | be typed into validation utilities
b = []byte(base64.StdEncoding.EncodeToString(b))
return b, err
} | |
c162068 | desc)
return
}
if ctxCompleted {
log.Debugf("Stop retrying %s", desc)
return
}
log.Debugf("Failed to %s: %+v, retrying in %v", desc, err, timeout)
time.Sleep(timeout)
}
} | |
c162069 |
}
if !isValidHealthStatusCode(healthStatus.Status) {
return &appv1.HealthStatus{
Status: appv1.HealthStatusUnknown,
Message: invalidHealthStatus,
}, nil
}
return healthStatus, nil
}
return nil, fmt.Errorf(incorrectReturnType, "table", returnValue.Type().String())
} | |
c162070 | {
return script.HealthLua, nil
}
return vm.getPredefinedLuaScripts(key, healthScriptFile)
} | |
c162071 | switch oldValue := oldValueInterface.(type) {
case map[string]interface{}:
if len(newValue) == 0 {
mapToReturn[key] = oldValue
}
case []interface{}:
newArray := cleanReturnedArray(newValue, oldValue)
mapToReturn[key] = newArray
}
}
}
}
return mapToReturn
} | |
c162072 | }
case []interface{}:
if oldValue, ok := obj[i].([]interface{}); ok {
convertedMap := cleanReturnedArray(newValue, oldValue)
arrayToReturn[i] = convertedMap
}
}
}
return arrayToReturn
} | |
c162073 | }
actionKey := fmt.Sprintf("%s/actions/%s", key, actionName)
actionScript, err := vm.getPredefinedLuaScripts(actionKey, actionScriptFile)
if err != nil {
return appv1.ResourceActionDefinition{}, err
}
return appv1.ResourceActionDefinition{
Name: actionName,
ActionLua: actionScript,
}, nil
} | |
c162074 | command.AddCommand(NewProjectAddSourceCommand(clientOpts))
command.AddCommand(NewProjectRemoveSourceCommand(clientOpts))
command.AddCommand(NewProjectAllowClusterResourceCommand(clientOpts))
command.AddCommand(NewProjectDenyClusterResourceCommand(clientOpts))
command.AddCommand(NewProjectAllowNamespaceResourceComm... | |
c162075 | opts.sources,
},
}
conn, projIf := argocdclient.NewClientOrDie(clientOpts).NewProjectClientOrDie()
defer util.Close(conn)
_, err := projIf.Create(context.Background(), &project.ProjectCreateRequest{Project: &proj})
errors.CheckError(err)
},
}
addProjFlags(command, &opts)
return command
} | |
c162076 | errors.CheckError(err)
visited := 0
c.Flags().Visit(func(f *pflag.Flag) {
visited++
switch f.Name {
case "description":
proj.Spec.Description = opts.description
case "dest":
proj.Spec.Destinations = opts.GetDestinations()
case "src":
proj.Spec.SourceRepos = opts.sources
}... | |
c162077 | == namespace && dest.Server == server {
log.Fatal("Specified destination is already defined in project")
}
}
proj.Spec.Destinations = append(proj.Spec.Destinations, v1alpha1.ApplicationDestination{Server: server, Namespace: namespace})
_, err = projIf.Update(context.Background(), &project.ProjectUpda... | |
c162078 |
index := -1
for i, item := range proj.Spec.NamespaceResourceBlacklist {
if item.Group == group && item.Kind == kind {
index = i
break
}
}
if index == -1 {
fmt.Printf("Group '%s' and kind '%s' not in blacklisted namespaced resources\n", group, kind)
return false
}
proj.Spec.NamespaceReso... | |
c162079 | already present in blacklisted namespaced resources\n", group, kind)
return false
}
}
proj.Spec.NamespaceResourceBlacklist = append(proj.Spec.NamespaceResourceBlacklist, v1.GroupKind{Group: group, Kind: kind})
return true
})
} | |
c162080 | == -1 {
fmt.Printf("Source repository '%s' does not exist in project\n", url)
} else {
proj.Spec.SourceRepos = append(proj.Spec.SourceRepos[:index], proj.Spec.SourceRepos[index+1:]...)
_, err = projIf.Update(context.Background(), &project.ProjectUpdateRequest{Project: proj})
errors.CheckError(err)
... | |
c162081 | {
c.HelpFunc()(c, args)
os.Exit(1)
}
conn, projIf := argocdclient.NewClientOrDie(clientOpts).NewProjectClientOrDie()
defer util.Close(conn)
for _, name := range args {
_, err := projIf.Delete(context.Background(), &project.ProjectQuery{Name: name})
errors.CheckError(err)
}
},
}
retur... | |
c162082 | defer util.Close(conn)
projects, err := projIf.List(context.Background(), &project.ProjectQuery{})
errors.CheckError(err)
w := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)
fmt.Fprintf(w, "NAME\tDESCRIPTION\tDESTINATIONS\tSOURCES\tCLUSTER-RESOURCE-WHITELIST\tNAMESPACE-RESOURCE-BLACKLIST\n")
for _, p ... | |
c162083 | path}})
if err != nil {
return nil, err
}
patch, err := jsonpatch.DecodePatch(patchData)
if err != nil {
return nil, err
}
patches = append(patches, normalizerPatch{
groupKind: schema.GroupKind{Group: ignore[i].Group, Kind: ignore[i].Kind},
name: ignore[i].Name,
namespace: ig... | |
c162084 | nil {
return err
}
for _, patch := range matched {
patchedData, err := patch.patch.Apply(docData)
if err != nil {
// bug?
if strings.HasPrefix(err.Error(), "Unable to remove nonexistent key") {
continue
}
return err
}
docData = patchedData
}
err = json.Unmarshal(docData, un)
if err != ... | |
c162085 | b {
if as == bs {
continue OUTER
}
}
rv = append(rv, as)
}
return rv
} | |
c162086 | cleanup()
return err
}
err = br.Flush()
if err != nil {
cleanup()
return err
}
err = f.Sync()
if err != nil {
cleanup()
return err
}
err = f.Close()
if err != nil {
cleanup()
return err
}
return nil
} | |
c162087 | {
return NewTermRangeInclusiveQuery(min, max, nil, nil)
} | |
c162088 | Max: max,
InclusiveMin: minInclusive,
InclusiveMax: maxInclusive,
}
} | |
c162089 | _ := LevenshteinDistanceMaxReuseSlice(a, b, max, nil)
return v, wasMax
} | |
c162090 | c
}
// if they are the same at this point, impose order based on index natural sort order
if i.HitNumber == j.HitNumber {
return 0
} else if i.HitNumber > j.HitNumber {
return 1
}
return -1
} | |
c162091 | s.values = append(s.values, term)
}
} | |
c162092 | s.tmp = termsWithShiftZero[:0]
}
} else if stype == SortFieldAsNumber || stype == SortFieldAsDate {
termsWithShiftZero := s.tmp[:0]
for _, term := range terms {
valid, shift := numeric.ValidPrefixCodedTermBytes(term)
if valid && shift == 0 {
termsWithShiftZero = append(termsWithShiftZero, term)
}
... | |
c162093 |
Desc: desc,
Unit: unit,
Lon: lon,
Lat: lat,
}
var err error
rv.unitMult, err = geo.ParseDistanceUnit(unit)
if err != nil {
return nil, err
}
return rv, nil
} | |
c162094 | termsWithShiftZero = append(termsWithShiftZero, term)
}
}
return termsWithShiftZero
} | |
c162095 | >> interleaveShift[3])) & interleaveMagic[4]
b = (b ^ (b >> interleaveShift[4])) & interleaveMagic[5]
return b
} | |
c162096 | {
field := dm.fieldDescribedByPath(path)
if field != nil {
return field.Analyzer
}
return ""
} | |
c162097 | // only if this is the last element check for field name
if i == len(pathElements)-1 {
for _, field := range current.Fields {
if field.Name == pathElement {
break
}
}
}
return nil
}
return current
} | |
c162098 | name == pathElement {
current = subDocMapping
continue OUTER
}
}
break
}
return current
} | |
c162099 | dm.Properties = make(map[string]*DocumentMapping)
}
dm.Properties[property] = sdm
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.