-
Notifications
You must be signed in to change notification settings - Fork 5.2k
/
types.go
2431 lines (2177 loc) · 100 KB
/
types.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
package v1alpha1
import (
"encoding/json"
"fmt"
math "math"
"net"
"net/http"
"os"
"path/filepath"
"reflect"
"regexp"
"sort"
"strconv"
"strings"
"time"
"github.com/argoproj/gitops-engine/pkg/health"
synccommon "github.com/argoproj/gitops-engine/pkg/sync/common"
"github.com/ghodss/yaml"
"github.com/robfig/cron"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/status"
v1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/runtime/schema"
utilnet "k8s.io/apimachinery/pkg/util/net"
"k8s.io/apimachinery/pkg/watch"
"k8s.io/client-go/rest"
"k8s.io/client-go/tools/clientcmd"
"k8s.io/client-go/tools/clientcmd/api"
"github.com/argoproj/argo-cd/v2/util/helm"
)
// Application is a definition of Application resource.
// +genclient
// +genclient:noStatus
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +kubebuilder:resource:path=applications,shortName=app;apps
// +kubebuilder:printcolumn:name="Sync Status",type=string,JSONPath=`.status.sync.status`
// +kubebuilder:printcolumn:name="Health Status",type=string,JSONPath=`.status.health.status`
// +kubebuilder:printcolumn:name="Revision",type=string,JSONPath=`.status.sync.revision`,priority=10
type Application struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata" protobuf:"bytes,1,opt,name=metadata"`
Spec ApplicationSpec `json:"spec" protobuf:"bytes,2,opt,name=spec"`
Status ApplicationStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"`
Operation *Operation `json:"operation,omitempty" protobuf:"bytes,4,opt,name=operation"`
}
// ApplicationSpec represents desired application state. Contains link to repository with application definition and additional parameters link definition revision.
type ApplicationSpec struct {
// Source is a reference to the location of the application's manifests or chart
Source ApplicationSource `json:"source" protobuf:"bytes,1,opt,name=source"`
// Destination is a reference to the target Kubernetes server and namespace
Destination ApplicationDestination `json:"destination" protobuf:"bytes,2,name=destination"`
// Project is a reference to the project this application belongs to.
// The empty string means that application belongs to the 'default' project.
Project string `json:"project" protobuf:"bytes,3,name=project"`
// SyncPolicy controls when and how a sync will be performed
SyncPolicy *SyncPolicy `json:"syncPolicy,omitempty" protobuf:"bytes,4,name=syncPolicy"`
// IgnoreDifferences is a list of resources and their fields which should be ignored during comparison
IgnoreDifferences []ResourceIgnoreDifferences `json:"ignoreDifferences,omitempty" protobuf:"bytes,5,name=ignoreDifferences"`
// Info contains a list of information (URLs, email addresses, and plain text) that relates to the application
Info []Info `json:"info,omitempty" protobuf:"bytes,6,name=info"`
// RevisionHistoryLimit limits the number of items kept in the application's revision history, which is used for informational purposes as well as for rollbacks to previous versions.
// This should only be changed in exceptional circumstances.
// Setting to zero will store no history. This will reduce storage used.
// Increasing will increase the space used to store the history, so we do not recommend increasing it.
// Default is 10.
RevisionHistoryLimit *int64 `json:"revisionHistoryLimit,omitempty" protobuf:"bytes,7,name=revisionHistoryLimit"`
}
// ResourceIgnoreDifferences contains resource filter and list of json paths which should be ignored during comparison with live state.
type ResourceIgnoreDifferences struct {
Group string `json:"group,omitempty" protobuf:"bytes,1,opt,name=group"`
Kind string `json:"kind" protobuf:"bytes,2,opt,name=kind"`
Name string `json:"name,omitempty" protobuf:"bytes,3,opt,name=name"`
Namespace string `json:"namespace,omitempty" protobuf:"bytes,4,opt,name=namespace"`
JSONPointers []string `json:"jsonPointers,omitempty" protobuf:"bytes,5,opt,name=jsonPointers"`
JQPathExpressions []string `json:"jqPathExpressions,omitempty" protobuf:"bytes,6,opt,name=jqPathExpressions"`
}
// EnvEntry represents an entry in the application's environment
type EnvEntry struct {
// Name is the name of the variable, usually expressed in uppercase
Name string `json:"name" protobuf:"bytes,1,opt,name=name"`
// Value is the value of the variable
Value string `json:"value" protobuf:"bytes,2,opt,name=value"`
}
// IsZero returns true if a variable is considered empty or unset
func (a *EnvEntry) IsZero() bool {
return a == nil || a.Name == "" && a.Value == ""
}
// NewEnvEntry parses a string in format name=value and returns an EnvEntry object
func NewEnvEntry(text string) (*EnvEntry, error) {
parts := strings.SplitN(text, "=", 2)
if len(parts) != 2 {
return nil, fmt.Errorf("Expected env entry of the form: param=value. Received: %s", text)
}
return &EnvEntry{
Name: parts[0],
Value: parts[1],
}, nil
}
// Env is a list of environment variable entries
type Env []*EnvEntry
// IsZero returns true if a list of variables is considered empty
func (e Env) IsZero() bool {
return len(e) == 0
}
// Environ returns a list of environment variables in name=value format from a list of variables
func (e Env) Environ() []string {
var environ []string
for _, item := range e {
if !item.IsZero() {
environ = append(environ, fmt.Sprintf("%s=%s", item.Name, item.Value))
}
}
return environ
}
// Envsubst interpolates variable references in a string from a list of variables
func (e Env) Envsubst(s string) string {
valByEnv := map[string]string{}
for _, item := range e {
valByEnv[item.Name] = item.Value
}
return os.Expand(s, func(s string) string {
return valByEnv[s]
})
}
// ApplicationSource contains all required information about the source of an application
type ApplicationSource struct {
// RepoURL is the URL to the repository (Git or Helm) that contains the application manifests
RepoURL string `json:"repoURL" protobuf:"bytes,1,opt,name=repoURL"`
// Path is a directory path within the Git repository, and is only valid for applications sourced from Git.
Path string `json:"path,omitempty" protobuf:"bytes,2,opt,name=path"`
// TargetRevision defines the revision of the source to sync the application to.
// In case of Git, this can be commit, tag, or branch. If omitted, will equal to HEAD.
// In case of Helm, this is a semver tag for the Chart's version.
TargetRevision string `json:"targetRevision,omitempty" protobuf:"bytes,4,opt,name=targetRevision"`
// Helm holds helm specific options
Helm *ApplicationSourceHelm `json:"helm,omitempty" protobuf:"bytes,7,opt,name=helm"`
// Kustomize holds kustomize specific options
Kustomize *ApplicationSourceKustomize `json:"kustomize,omitempty" protobuf:"bytes,8,opt,name=kustomize"`
// Ksonnet holds ksonnet specific options
Ksonnet *ApplicationSourceKsonnet `json:"ksonnet,omitempty" protobuf:"bytes,9,opt,name=ksonnet"`
// Directory holds path/directory specific options
Directory *ApplicationSourceDirectory `json:"directory,omitempty" protobuf:"bytes,10,opt,name=directory"`
// ConfigManagementPlugin holds config management plugin specific options
Plugin *ApplicationSourcePlugin `json:"plugin,omitempty" protobuf:"bytes,11,opt,name=plugin"`
// Chart is a Helm chart name, and must be specified for applications sourced from a Helm repo.
Chart string `json:"chart,omitempty" protobuf:"bytes,12,opt,name=chart"`
}
// AllowsConcurrentProcessing returns true if given application source can be processed concurrently
func (a *ApplicationSource) AllowsConcurrentProcessing() bool {
switch {
// Kustomize with parameters requires changing kustomization.yaml file
case a.Kustomize != nil:
return a.Kustomize.AllowsConcurrentProcessing()
// Kustomize with parameters requires changing params.libsonnet file
case a.Ksonnet != nil:
return a.Ksonnet.AllowsConcurrentProcessing()
}
return true
}
// IsHelm returns true when the application source is of type Helm
func (a *ApplicationSource) IsHelm() bool {
return a.Chart != ""
}
// IsHelmOci returns true when the application source is of type Helm OCI
func (a *ApplicationSource) IsHelmOci() bool {
if a.Chart == "" {
return false
}
return helm.IsHelmOciRepo(a.RepoURL)
}
// IsZero returns true if the application source is considered empty
func (a *ApplicationSource) IsZero() bool {
return a == nil ||
a.RepoURL == "" &&
a.Path == "" &&
a.TargetRevision == "" &&
a.Helm.IsZero() &&
a.Kustomize.IsZero() &&
a.Ksonnet.IsZero() &&
a.Directory.IsZero() &&
a.Plugin.IsZero()
}
// ApplicationSourceType specifies the type of the application's source
type ApplicationSourceType string
const (
ApplicationSourceTypeHelm ApplicationSourceType = "Helm"
ApplicationSourceTypeKustomize ApplicationSourceType = "Kustomize"
ApplicationSourceTypeKsonnet ApplicationSourceType = "Ksonnet"
ApplicationSourceTypeDirectory ApplicationSourceType = "Directory"
ApplicationSourceTypePlugin ApplicationSourceType = "Plugin"
)
// RefreshType specifies how to refresh the sources of a given application
type RefreshType string
const (
RefreshTypeNormal RefreshType = "normal"
RefreshTypeHard RefreshType = "hard"
)
// ApplicationSourceHelm holds helm specific options
type ApplicationSourceHelm struct {
// ValuesFiles is a list of Helm value files to use when generating a template
ValueFiles []string `json:"valueFiles,omitempty" protobuf:"bytes,1,opt,name=valueFiles"`
// Parameters is a list of Helm parameters which are passed to the helm template command upon manifest generation
Parameters []HelmParameter `json:"parameters,omitempty" protobuf:"bytes,2,opt,name=parameters"`
// ReleaseName is the Helm release name to use. If omitted it will use the application name
ReleaseName string `json:"releaseName,omitempty" protobuf:"bytes,3,opt,name=releaseName"`
// Values specifies Helm values to be passed to helm template, typically defined as a block
Values string `json:"values,omitempty" protobuf:"bytes,4,opt,name=values"`
// FileParameters are file parameters to the helm template
FileParameters []HelmFileParameter `json:"fileParameters,omitempty" protobuf:"bytes,5,opt,name=fileParameters"`
// Version is the Helm version to use for templating (either "2" or "3")
Version string `json:"version,omitempty" protobuf:"bytes,6,opt,name=version"`
}
// HelmParameter is a parameter that's passed to helm template during manifest generation
type HelmParameter struct {
// Name is the name of the Helm parameter
Name string `json:"name,omitempty" protobuf:"bytes,1,opt,name=name"`
// Value is the value for the Helm parameter
Value string `json:"value,omitempty" protobuf:"bytes,2,opt,name=value"`
// ForceString determines whether to tell Helm to interpret booleans and numbers as strings
ForceString bool `json:"forceString,omitempty" protobuf:"bytes,3,opt,name=forceString"`
}
// HelmFileParameter is a file parameter that's passed to helm template during manifest generation
type HelmFileParameter struct {
// Name is the name of the Helm parameter
Name string `json:"name,omitempty" protobuf:"bytes,1,opt,name=name"`
// Path is the path to the file containing the values for the Helm parameter
Path string `json:"path,omitempty" protobuf:"bytes,2,opt,name=path"`
}
var helmParameterRx = regexp.MustCompile(`([^\\]),`)
// NewHelmParameter parses a string in format name=value into a HelmParameter object and returns it
func NewHelmParameter(text string, forceString bool) (*HelmParameter, error) {
parts := strings.SplitN(text, "=", 2)
if len(parts) != 2 {
return nil, fmt.Errorf("Expected helm parameter of the form: param=value. Received: %s", text)
}
return &HelmParameter{
Name: parts[0],
Value: helmParameterRx.ReplaceAllString(parts[1], `$1\,`),
ForceString: forceString,
}, nil
}
// NewHelmFileParameter parses a string in format name=value into a HelmFileParameter object and returns it
func NewHelmFileParameter(text string) (*HelmFileParameter, error) {
parts := strings.SplitN(text, "=", 2)
if len(parts) != 2 {
return nil, fmt.Errorf("Expected helm file parameter of the form: param=path. Received: %s", text)
}
return &HelmFileParameter{
Name: parts[0],
Path: helmParameterRx.ReplaceAllString(parts[1], `$1\,`),
}, nil
}
// AddParameter adds a HelmParameter to the application source. If a parameter with the same name already
// exists, its value will be overwritten. Otherwise, the HelmParameter will be appended as a new entry.
func (in *ApplicationSourceHelm) AddParameter(p HelmParameter) {
found := false
for i, cp := range in.Parameters {
if cp.Name == p.Name {
found = true
in.Parameters[i] = p
break
}
}
if !found {
in.Parameters = append(in.Parameters, p)
}
}
// AddFileParameter adds a HelmFileParameter to the application source. If a file parameter with the same name already
// exists, its value will be overwritten. Otherwise, the HelmFileParameter will be appended as a new entry.
func (in *ApplicationSourceHelm) AddFileParameter(p HelmFileParameter) {
found := false
for i, cp := range in.FileParameters {
if cp.Name == p.Name {
found = true
in.FileParameters[i] = p
break
}
}
if !found {
in.FileParameters = append(in.FileParameters, p)
}
}
// IsZero Returns true if the Helm options in an application source are considered zero
func (h *ApplicationSourceHelm) IsZero() bool {
return h == nil || (h.Version == "") && (h.ReleaseName == "") && len(h.ValueFiles) == 0 && len(h.Parameters) == 0 && len(h.FileParameters) == 0 && h.Values == ""
}
// KustomizeImage represents a Kustomize image definition in the format [old_image_name=]<image_name>:<image_tag>
type KustomizeImage string
func (i KustomizeImage) delim() string {
for _, d := range []string{"=", ":", "@"} {
if strings.Contains(string(i), d) {
return d
}
}
return ":"
}
// Match returns true if the image name matches (i.e. up to the first delimiter)
func (i KustomizeImage) Match(j KustomizeImage) bool {
delim := j.delim()
if !strings.Contains(string(j), delim) {
return false
}
return strings.HasPrefix(string(i), strings.Split(string(j), delim)[0])
}
// KustomizeImages is a list of Kustomize images
type KustomizeImages []KustomizeImage
// Find returns a positive integer representing the index in the list of images
func (images KustomizeImages) Find(image KustomizeImage) int {
for i, a := range images {
if a.Match(image) {
return i
}
}
return -1
}
// ApplicationSourceKustomize holds options specific to an Application source specific to Kustomize
type ApplicationSourceKustomize struct {
// NamePrefix is a prefix appended to resources for Kustomize apps
NamePrefix string `json:"namePrefix,omitempty" protobuf:"bytes,1,opt,name=namePrefix"`
// NameSuffix is a suffix appended to resources for Kustomize apps
NameSuffix string `json:"nameSuffix,omitempty" protobuf:"bytes,2,opt,name=nameSuffix"`
// Images is a list of Kustomize image override specifications
Images KustomizeImages `json:"images,omitempty" protobuf:"bytes,3,opt,name=images"`
// CommonLabels is a list of additional labels to add to rendered manifests
CommonLabels map[string]string `json:"commonLabels,omitempty" protobuf:"bytes,4,opt,name=commonLabels"`
// Version controls which version of Kustomize to use for rendering manifests
Version string `json:"version,omitempty" protobuf:"bytes,5,opt,name=version"`
// CommonAnnotations is a list of additional annotations to add to rendered manifests
CommonAnnotations map[string]string `json:"commonAnnotations,omitempty" protobuf:"bytes,6,opt,name=commonAnnotations"`
// ForceCommonLabels specifies whether to force applying common labels to resources for Kustomize apps
ForceCommonLabels bool `json:"forceCommonLabels,omitempty" protobuf:"bytes,7,opt,name=forceCommonLabels"`
// ForceCommonAnnotations specifies whether to force applying common annotations to resources for Kustomize apps
ForceCommonAnnotations bool `json:"forceCommonAnnotations,omitempty" protobuf:"bytes,8,opt,name=forceCommonAnnotations"`
}
// AllowsConcurrentProcessing returns true if multiple processes can run Kustomize builds on the same source at the same time
func (k *ApplicationSourceKustomize) AllowsConcurrentProcessing() bool {
return len(k.Images) == 0 &&
len(k.CommonLabels) == 0 &&
k.NamePrefix == "" &&
k.NameSuffix == ""
}
// IsZero returns true when the Kustomize options are considered empty
func (k *ApplicationSourceKustomize) IsZero() bool {
return k == nil ||
k.NamePrefix == "" &&
k.NameSuffix == "" &&
k.Version == "" &&
len(k.Images) == 0 &&
len(k.CommonLabels) == 0 &&
len(k.CommonAnnotations) == 0
}
// MergeImage merges a new Kustomize image identifier in to a list of images
func (k *ApplicationSourceKustomize) MergeImage(image KustomizeImage) {
i := k.Images.Find(image)
if i >= 0 {
k.Images[i] = image
} else {
k.Images = append(k.Images, image)
}
}
// JsonnetVar represents a variable to be passed to jsonnet during manifest generation
type JsonnetVar struct {
Name string `json:"name" protobuf:"bytes,1,opt,name=name"`
Value string `json:"value" protobuf:"bytes,2,opt,name=value"`
Code bool `json:"code,omitempty" protobuf:"bytes,3,opt,name=code"`
}
// NewJsonnetVar parses a Jsonnet variable from a string in the format name=value
func NewJsonnetVar(s string, code bool) JsonnetVar {
parts := strings.SplitN(s, "=", 2)
if len(parts) == 2 {
return JsonnetVar{Name: parts[0], Value: parts[1], Code: code}
} else {
return JsonnetVar{Name: s, Code: code}
}
}
// ApplicationSourceJsonnet holds options specific to applications of type Jsonnet
type ApplicationSourceJsonnet struct {
// ExtVars is a list of Jsonnet External Variables
ExtVars []JsonnetVar `json:"extVars,omitempty" protobuf:"bytes,1,opt,name=extVars"`
// TLAS is a list of Jsonnet Top-level Arguments
TLAs []JsonnetVar `json:"tlas,omitempty" protobuf:"bytes,2,opt,name=tlas"`
// Additional library search dirs
Libs []string `json:"libs,omitempty" protobuf:"bytes,3,opt,name=libs"`
}
// IsZero returns true if the JSonnet options of an application are considered to be empty
func (j *ApplicationSourceJsonnet) IsZero() bool {
return j == nil || len(j.ExtVars) == 0 && len(j.TLAs) == 0 && len(j.Libs) == 0
}
// ApplicationSourceKsonnet holds ksonnet specific options
type ApplicationSourceKsonnet struct {
// Environment is a ksonnet application environment name
Environment string `json:"environment,omitempty" protobuf:"bytes,1,opt,name=environment"`
// Parameters are a list of ksonnet component parameter override values
Parameters []KsonnetParameter `json:"parameters,omitempty" protobuf:"bytes,2,opt,name=parameters"`
}
// KsonnetParameter is a ksonnet component parameter
type KsonnetParameter struct {
Component string `json:"component,omitempty" protobuf:"bytes,1,opt,name=component"`
Name string `json:"name" protobuf:"bytes,2,opt,name=name"`
Value string `json:"value" protobuf:"bytes,3,opt,name=value"`
}
// AllowsConcurrentProcessing returns true if multiple processes can run ksonnet builds on the same source at the same time
func (k *ApplicationSourceKsonnet) AllowsConcurrentProcessing() bool {
return len(k.Parameters) == 0
}
// IsZero returns true if the KSonnet options of an application are considered to be empty
func (k *ApplicationSourceKsonnet) IsZero() bool {
return k == nil || k.Environment == "" && len(k.Parameters) == 0
}
// ApplicationSourceDirectory holds options for applications of type plain YAML or Jsonnet
type ApplicationSourceDirectory struct {
// Recurse specifies whether to scan a directory recursively for manifests
Recurse bool `json:"recurse,omitempty" protobuf:"bytes,1,opt,name=recurse"`
// Jsonnet holds options specific to Jsonnet
Jsonnet ApplicationSourceJsonnet `json:"jsonnet,omitempty" protobuf:"bytes,2,opt,name=jsonnet"`
// Exclude contains a glob pattern to match paths against that should be explicitly excluded from being used during manifest generation
Exclude string `json:"exclude,omitempty" protobuf:"bytes,3,opt,name=exclude"`
// Include contains a glob pattern to match paths against that should be explicitly included during manifest generation
Include string `json:"include,omitempty" protobuf:"bytes,4,opt,name=include"`
}
// IsZero returns true if the ApplicationSourceDirectory is considered empty
func (d *ApplicationSourceDirectory) IsZero() bool {
return d == nil || !d.Recurse && d.Jsonnet.IsZero()
}
// ApplicationSourcePlugin holds options specific to config management plugins
type ApplicationSourcePlugin struct {
Name string `json:"name,omitempty" protobuf:"bytes,1,opt,name=name"`
Env `json:"env,omitempty" protobuf:"bytes,2,opt,name=env"`
}
// IsZero returns true if the ApplicationSourcePlugin is considered empty
func (c *ApplicationSourcePlugin) IsZero() bool {
return c == nil || c.Name == "" && c.Env.IsZero()
}
// AddEnvEntry merges an EnvEntry into a list of entries. If an entry with the same name already exists,
// its value will be overwritten. Otherwise, the entry is appended to the list.
func (c *ApplicationSourcePlugin) AddEnvEntry(e *EnvEntry) {
found := false
for i, ce := range c.Env {
if ce.Name == e.Name {
found = true
c.Env[i] = e
break
}
}
if !found {
c.Env = append(c.Env, e)
}
}
// RemoveEnvEntry removes an EnvEntry if present, from a list of entries.
func (c *ApplicationSourcePlugin) RemoveEnvEntry(key string) error {
for i, ce := range c.Env {
if ce.Name == key {
c.Env[i] = c.Env[len(c.Env)-1]
c.Env = c.Env[:len(c.Env)-1]
return nil
}
}
return fmt.Errorf("unable to find env variable with key %q for plugin %q", key, c.Name)
}
// ApplicationDestination holds information about the application's destination
type ApplicationDestination struct {
// Server specifies the URL of the target cluster and must be set to the Kubernetes control plane API
Server string `json:"server,omitempty" protobuf:"bytes,1,opt,name=server"`
// Namespace specifies the target namespace for the application's resources.
// The namespace will only be set for namespace-scoped resources that have not set a value for .metadata.namespace
Namespace string `json:"namespace,omitempty" protobuf:"bytes,2,opt,name=namespace"`
// Name is an alternate way of specifying the target cluster by its symbolic name
Name string `json:"name,omitempty" protobuf:"bytes,3,opt,name=name"`
// nolint:govet
isServerInferred bool `json:"-"`
}
// ApplicationStatus contains status information for the application
type ApplicationStatus struct {
// Resources is a list of Kubernetes resources managed by this application
Resources []ResourceStatus `json:"resources,omitempty" protobuf:"bytes,1,opt,name=resources"`
// Sync contains information about the application's current sync status
Sync SyncStatus `json:"sync,omitempty" protobuf:"bytes,2,opt,name=sync"`
// Health contains information about the application's current health status
Health HealthStatus `json:"health,omitempty" protobuf:"bytes,3,opt,name=health"`
// History contains information about the application's sync history
History RevisionHistories `json:"history,omitempty" protobuf:"bytes,4,opt,name=history"`
// Conditions is a list of currently observed application conditions
Conditions []ApplicationCondition `json:"conditions,omitempty" protobuf:"bytes,5,opt,name=conditions"`
// ReconciledAt indicates when the application state was reconciled using the latest git version
ReconciledAt *metav1.Time `json:"reconciledAt,omitempty" protobuf:"bytes,6,opt,name=reconciledAt"`
// OperationState contains information about any ongoing operations, such as a sync
OperationState *OperationState `json:"operationState,omitempty" protobuf:"bytes,7,opt,name=operationState"`
// ObservedAt indicates when the application state was updated without querying latest git state
// Deprecated: controller no longer updates ObservedAt field
ObservedAt *metav1.Time `json:"observedAt,omitempty" protobuf:"bytes,8,opt,name=observedAt"`
// SourceType specifies the type of this application
SourceType ApplicationSourceType `json:"sourceType,omitempty" protobuf:"bytes,9,opt,name=sourceType"`
// Summary contains a list of URLs and container images used by this application
Summary ApplicationSummary `json:"summary,omitempty" protobuf:"bytes,10,opt,name=summary"`
}
// JWTTokens represents a list of JWT tokens
type JWTTokens struct {
Items []JWTToken `json:"items,omitempty" protobuf:"bytes,1,opt,name=items"`
}
// OperationInitiator contains information about the initiator of an operation
type OperationInitiator struct {
// Username contains the name of a user who started operation
Username string `json:"username,omitempty" protobuf:"bytes,1,opt,name=username"`
// Automated is set to true if operation was initiated automatically by the application controller.
Automated bool `json:"automated,omitempty" protobuf:"bytes,2,opt,name=automated"`
}
// Operation contains information about a requested or running operation
type Operation struct {
// Sync contains parameters for the operation
Sync *SyncOperation `json:"sync,omitempty" protobuf:"bytes,1,opt,name=sync"`
// InitiatedBy contains information about who initiated the operations
InitiatedBy OperationInitiator `json:"initiatedBy,omitempty" protobuf:"bytes,2,opt,name=initiatedBy"`
// Info is a list of informational items for this operation
Info []*Info `json:"info,omitempty" protobuf:"bytes,3,name=info"`
// Retry controls the strategy to apply if a sync fails
Retry RetryStrategy `json:"retry,omitempty" protobuf:"bytes,4,opt,name=retry"`
}
// DryRun returns true if an operation was requested to be performed in dry run mode
func (o *Operation) DryRun() bool {
if o.Sync != nil {
return o.Sync.DryRun
}
return false
}
// SyncOperationResource contains resources to sync.
type SyncOperationResource struct {
Group string `json:"group,omitempty" protobuf:"bytes,1,opt,name=group"`
Kind string `json:"kind" protobuf:"bytes,2,opt,name=kind"`
Name string `json:"name" protobuf:"bytes,3,opt,name=name"`
Namespace string `json:"namespace,omitempty" protobuf:"bytes,4,opt,name=namespace"`
}
// RevisionHistories is a array of history, oldest first and newest last
type RevisionHistories []RevisionHistory
// LastRevisionHistory returns the latest history item from the revision history
func (in RevisionHistories) LastRevisionHistory() RevisionHistory {
return in[len(in)-1]
}
// Trunc truncates the list of history items to size n
func (in RevisionHistories) Trunc(n int) RevisionHistories {
i := len(in) - n
if i > 0 {
in = in[i:]
}
return in
}
// HasIdentity determines whether a sync operation is identified by a manifest
func (r SyncOperationResource) HasIdentity(name string, namespace string, gvk schema.GroupVersionKind) bool {
if name == r.Name && gvk.Kind == r.Kind && gvk.Group == r.Group && (r.Namespace == "" || namespace == r.Namespace) {
return true
}
return false
}
// SyncOperation contains details about a sync operation.
type SyncOperation struct {
// Revision is the revision (Git) or chart version (Helm) which to sync the application to
// If omitted, will use the revision specified in app spec.
Revision string `json:"revision,omitempty" protobuf:"bytes,1,opt,name=revision"`
// Prune specifies to delete resources from the cluster that are no longer tracked in git
Prune bool `json:"prune,omitempty" protobuf:"bytes,2,opt,name=prune"`
// DryRun specifies to perform a `kubectl apply --dry-run` without actually performing the sync
DryRun bool `json:"dryRun,omitempty" protobuf:"bytes,3,opt,name=dryRun"`
// SyncStrategy describes how to perform the sync
SyncStrategy *SyncStrategy `json:"syncStrategy,omitempty" protobuf:"bytes,4,opt,name=syncStrategy"`
// Resources describes which resources shall be part of the sync
Resources []SyncOperationResource `json:"resources,omitempty" protobuf:"bytes,6,opt,name=resources"`
// Source overrides the source definition set in the application.
// This is typically set in a Rollback operation and is nil during a Sync operation
Source *ApplicationSource `json:"source,omitempty" protobuf:"bytes,7,opt,name=source"`
// Manifests is an optional field that overrides sync source with a local directory for development
Manifests []string `json:"manifests,omitempty" protobuf:"bytes,8,opt,name=manifests"`
// SyncOptions provide per-sync sync-options, e.g. Validate=false
SyncOptions SyncOptions `json:"syncOptions,omitempty" protobuf:"bytes,9,opt,name=syncOptions"`
}
// IsApplyStrategy returns true if the sync strategy is "apply"
func (o *SyncOperation) IsApplyStrategy() bool {
return o.SyncStrategy != nil && o.SyncStrategy.Apply != nil
}
// OperationState contains information about state of a running operation
type OperationState struct {
// Operation is the original requested operation
Operation Operation `json:"operation" protobuf:"bytes,1,opt,name=operation"`
// Phase is the current phase of the operation
Phase synccommon.OperationPhase `json:"phase" protobuf:"bytes,2,opt,name=phase"`
// Message holds any pertinent messages when attempting to perform operation (typically errors).
Message string `json:"message,omitempty" protobuf:"bytes,3,opt,name=message"`
// SyncResult is the result of a Sync operation
SyncResult *SyncOperationResult `json:"syncResult,omitempty" protobuf:"bytes,4,opt,name=syncResult"`
// StartedAt contains time of operation start
StartedAt metav1.Time `json:"startedAt" protobuf:"bytes,6,opt,name=startedAt"`
// FinishedAt contains time of operation completion
FinishedAt *metav1.Time `json:"finishedAt,omitempty" protobuf:"bytes,7,opt,name=finishedAt"`
// RetryCount contains time of operation retries
RetryCount int64 `json:"retryCount,omitempty" protobuf:"bytes,8,opt,name=retryCount"`
}
type Info struct {
Name string `json:"name" protobuf:"bytes,1,name=name"`
Value string `json:"value" protobuf:"bytes,2,name=value"`
}
type SyncOptions []string
// AddOption adds a sync option to the list of sync options and returns the modified list.
// If option was already set, returns the unmodified list of sync options.
func (o SyncOptions) AddOption(option string) SyncOptions {
for _, j := range o {
if j == option {
return o
}
}
return append(o, option)
}
// RemoveOption removes a sync option from the list of sync options and returns the modified list.
// If option has not been already set, returns the unmodified list of sync options.
func (o SyncOptions) RemoveOption(option string) SyncOptions {
for i, j := range o {
if j == option {
return append(o[:i], o[i+1:]...)
}
}
return o
}
// HasOption returns true if the list of sync options contains given option
func (o SyncOptions) HasOption(option string) bool {
for _, i := range o {
if option == i {
return true
}
}
return false
}
// SyncPolicy controls when a sync will be performed in response to updates in git
type SyncPolicy struct {
// Automated will keep an application synced to the target revision
Automated *SyncPolicyAutomated `json:"automated,omitempty" protobuf:"bytes,1,opt,name=automated"`
// Options allow you to specify whole app sync-options
SyncOptions SyncOptions `json:"syncOptions,omitempty" protobuf:"bytes,2,opt,name=syncOptions"`
// Retry controls failed sync retry behavior
Retry *RetryStrategy `json:"retry,omitempty" protobuf:"bytes,3,opt,name=retry"`
}
// IsZero returns true if the sync policy is empty
func (p *SyncPolicy) IsZero() bool {
return p == nil || (p.Automated == nil && len(p.SyncOptions) == 0 && p.Retry == nil)
}
// RetryStrategy contains information about the strategy to apply when a sync failed
type RetryStrategy struct {
// Limit is the maximum number of attempts for retrying a failed sync. If set to 0, no retries will be performed.
Limit int64 `json:"limit,omitempty" protobuf:"bytes,1,opt,name=limit"`
// Backoff controls how to backoff on subsequent retries of failed syncs
Backoff *Backoff `json:"backoff,omitempty" protobuf:"bytes,2,opt,name=backoff,casttype=Backoff"`
}
func parseStringToDuration(durationString string) (time.Duration, error) {
var suspendDuration time.Duration
// If no units are attached, treat as seconds
if val, err := strconv.Atoi(durationString); err == nil {
suspendDuration = time.Duration(val) * time.Second
} else if duration, err := time.ParseDuration(durationString); err == nil {
suspendDuration = duration
} else {
return 0, fmt.Errorf("unable to parse %s as a duration", durationString)
}
return suspendDuration, nil
}
// NextRetryAt calculates the earliest time the next retry should be performed on a failing sync
func (r *RetryStrategy) NextRetryAt(lastAttempt time.Time, retryCounts int64) (time.Time, error) {
maxDuration := DefaultSyncRetryMaxDuration
duration := DefaultSyncRetryDuration
factor := DefaultSyncRetryFactor
var err error
if r.Backoff != nil {
if r.Backoff.Duration != "" {
if duration, err = parseStringToDuration(r.Backoff.Duration); err != nil {
return time.Time{}, err
}
}
if r.Backoff.MaxDuration != "" {
if maxDuration, err = parseStringToDuration(r.Backoff.MaxDuration); err != nil {
return time.Time{}, err
}
}
if r.Backoff.Factor != nil {
factor = *r.Backoff.Factor
}
}
// Formula: timeToWait = duration * factor^retry_number
// Note that timeToWait should equal to duration for the first retry attempt.
timeToWait := duration * time.Duration(math.Pow(float64(factor), float64(retryCounts)))
if maxDuration > 0 {
timeToWait = time.Duration(math.Min(float64(maxDuration), float64(timeToWait)))
}
return lastAttempt.Add(timeToWait), nil
}
// Backoff is the backoff strategy to use on subsequent retries for failing syncs
type Backoff struct {
// Duration is the amount to back off. Default unit is seconds, but could also be a duration (e.g. "2m", "1h")
Duration string `json:"duration,omitempty" protobuf:"bytes,1,opt,name=duration"`
// Factor is a factor to multiply the base duration after each failed retry
Factor *int64 `json:"factor,omitempty" protobuf:"bytes,2,name=factor"`
// MaxDuration is the maximum amount of time allowed for the backoff strategy
MaxDuration string `json:"maxDuration,omitempty" protobuf:"bytes,3,opt,name=maxDuration"`
}
// SyncPolicyAutomated controls the behavior of an automated sync
type SyncPolicyAutomated struct {
// Prune specifies whether to delete resources from the cluster that are not found in the sources anymore as part of automated sync (default: false)
Prune bool `json:"prune,omitempty" protobuf:"bytes,1,opt,name=prune"`
// SelfHeal specifes whether to revert resources back to their desired state upon modification in the cluster (default: false)
SelfHeal bool `json:"selfHeal,omitempty" protobuf:"bytes,2,opt,name=selfHeal"`
// AllowEmpty allows apps have zero live resources (default: false)
AllowEmpty bool `json:"allowEmpty,omitempty" protobuf:"bytes,3,opt,name=allowEmpty"`
}
// SyncStrategy controls the manner in which a sync is performed
type SyncStrategy struct {
// Apply will perform a `kubectl apply` to perform the sync.
Apply *SyncStrategyApply `json:"apply,omitempty" protobuf:"bytes,1,opt,name=apply"`
// Hook will submit any referenced resources to perform the sync. This is the default strategy
Hook *SyncStrategyHook `json:"hook,omitempty" protobuf:"bytes,2,opt,name=hook"`
}
// Force returns true if the sync strategy specifies to perform a forced sync
func (m *SyncStrategy) Force() bool {
if m == nil {
return false
} else if m.Apply != nil {
return m.Apply.Force
} else if m.Hook != nil {
return m.Hook.Force
} else {
return false
}
}
// SyncStrategyApply uses `kubectl apply` to perform the apply
type SyncStrategyApply struct {
// Force indicates whether or not to supply the --force flag to `kubectl apply`.
// The --force flag deletes and re-create the resource, when PATCH encounters conflict and has
// retried for 5 times.
Force bool `json:"force,omitempty" protobuf:"bytes,1,opt,name=force"`
}
// SyncStrategyHook will perform a sync using hooks annotations.
// If no hook annotation is specified falls back to `kubectl apply`.
type SyncStrategyHook struct {
// Embed SyncStrategyApply type to inherit any `apply` options
// +optional
SyncStrategyApply `json:",inline" protobuf:"bytes,1,opt,name=syncStrategyApply"`
}
// RevisionMetadata contains metadata for a specific revision in a Git repository
type RevisionMetadata struct {
// who authored this revision,
// typically their name and email, e.g. "John Doe <john_doe@my-company.com>",
// but might not match this example
Author string `json:"author,omitempty" protobuf:"bytes,1,opt,name=author"`
// Date specifies when the revision was authored
Date metav1.Time `json:"date" protobuf:"bytes,2,opt,name=date"`
// Tags specifies any tags currently attached to the revision
// Floating tags can move from one revision to another
Tags []string `json:"tags,omitempty" protobuf:"bytes,3,opt,name=tags"`
// Message contains the message associated with the revision, most likely the commit message.
// The message is truncated to the first newline or 64 characters (which ever comes first)
Message string `json:"message,omitempty" protobuf:"bytes,4,opt,name=message"`
// SignatureInfo contains a hint on the signer if the revision was signed with GPG, and signature verification is enabled.
SignatureInfo string `json:"signatureInfo,omitempty" protobuf:"bytes,5,opt,name=signatureInfo"`
}
// SyncOperationResult represent result of sync operation
type SyncOperationResult struct {
// Resources contains a list of sync result items for each individual resource in a sync operation
Resources ResourceResults `json:"resources,omitempty" protobuf:"bytes,1,opt,name=resources"`
// Revision holds the revision this sync operation was performed to
Revision string `json:"revision" protobuf:"bytes,2,opt,name=revision"`
// Source records the application source information of the sync, used for comparing auto-sync
Source ApplicationSource `json:"source,omitempty" protobuf:"bytes,3,opt,name=source"`
}
// ResourceResult holds the operation result details of a specific resource
type ResourceResult struct {
// Group specifies the API group of the resource
Group string `json:"group" protobuf:"bytes,1,opt,name=group"`
// Version specifies the API version of the resource
Version string `json:"version" protobuf:"bytes,2,opt,name=version"`
// Kind specifies the API kind of the resource
Kind string `json:"kind" protobuf:"bytes,3,opt,name=kind"`
// Namespace specifies the target namespace of the resource
Namespace string `json:"namespace" protobuf:"bytes,4,opt,name=namespace"`
// Name specifies the name of the resource
Name string `json:"name" protobuf:"bytes,5,opt,name=name"`
// Status holds the final result of the sync. Will be empty if the resources is yet to be applied/pruned and is always zero-value for hooks
Status synccommon.ResultCode `json:"status,omitempty" protobuf:"bytes,6,opt,name=status"`
// Message contains an informational or error message for the last sync OR operation
Message string `json:"message,omitempty" protobuf:"bytes,7,opt,name=message"`
// HookType specifies the type of the hook. Empty for non-hook resources
HookType synccommon.HookType `json:"hookType,omitempty" protobuf:"bytes,8,opt,name=hookType"`
// HookPhase contains the state of any operation associated with this resource OR hook
// This can also contain values for non-hook resources.
HookPhase synccommon.OperationPhase `json:"hookPhase,omitempty" protobuf:"bytes,9,opt,name=hookPhase"`
// SyncPhase indicates the particular phase of the sync that this result was acquired in
SyncPhase synccommon.SyncPhase `json:"syncPhase,omitempty" protobuf:"bytes,10,opt,name=syncPhase"`
}
// GroupVersionKind returns the GVK schema information for a given resource within a sync result
func (r *ResourceResult) GroupVersionKind() schema.GroupVersionKind {
return schema.GroupVersionKind{
Group: r.Group,
Version: r.Version,
Kind: r.Kind,
}
}
// ResourceResults defines a list of resource results for a given operation
type ResourceResults []*ResourceResult
// Find returns the operation result for a specified resource and the index in the list where it was found
func (r ResourceResults) Find(group string, kind string, namespace string, name string, phase synccommon.SyncPhase) (int, *ResourceResult) {
for i, res := range r {
if res.Group == group && res.Kind == kind && res.Namespace == namespace && res.Name == name && res.SyncPhase == phase {
return i, res
}
}
return 0, nil
}
// PruningRequired returns a positive integer containing the number of resources that require pruning after an operation has been completed
func (r ResourceResults) PruningRequired() (num int) {
for _, res := range r {
if res.Status == synccommon.ResultCodePruneSkipped {
num++
}
}
return num
}
// RevisionHistory contains history information about a previous sync
type RevisionHistory struct {
// Revision holds the revision the sync was performed against
Revision string `json:"revision" protobuf:"bytes,2,opt,name=revision"`
// DeployedAt holds the time the sync operation completed
DeployedAt metav1.Time `json:"deployedAt" protobuf:"bytes,4,opt,name=deployedAt"`
// ID is an auto incrementing identifier of the RevisionHistory
ID int64 `json:"id" protobuf:"bytes,5,opt,name=id"`
// Source is a reference to the application source used for the sync operation
Source ApplicationSource `json:"source,omitempty" protobuf:"bytes,6,opt,name=source"`
// DeployStartedAt holds the time the sync operation started
DeployStartedAt *metav1.Time `json:"deployStartedAt,omitempty" protobuf:"bytes,7,opt,name=deployStartedAt"`
}
// ApplicationWatchEvent contains information about application change.
type ApplicationWatchEvent struct {
Type watch.EventType `json:"type" protobuf:"bytes,1,opt,name=type,casttype=k8s.io/apimachinery/pkg/watch.EventType"`
// Application is:
// * If Type is Added or Modified: the new state of the object.
// * If Type is Deleted: the state of the object immediately before deletion.
// * If Type is Error: *api.Status is recommended; other types may make sense
// depending on context.
Application Application `json:"application" protobuf:"bytes,2,opt,name=application"`
}
// ApplicationList is list of Application resources
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
type ApplicationList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata" protobuf:"bytes,1,opt,name=metadata"`
Items []Application `json:"items" protobuf:"bytes,2,rep,name=items"`
}
// ComponentParameter contains information about component parameter value
type ComponentParameter struct {
Component string `json:"component,omitempty" protobuf:"bytes,1,opt,name=component"`
Name string `json:"name" protobuf:"bytes,2,opt,name=name"`
Value string `json:"value" protobuf:"bytes,3,opt,name=value"`
}
// SyncStatusCode is a type which represents possible comparison results
type SyncStatusCode string
// Possible comparison results
const (
// SyncStatusCodeUnknown indicates that the status of a sync could not be reliably determined
SyncStatusCodeUnknown SyncStatusCode = "Unknown"
// SyncStatusCodeOutOfSync indicates that desired and live states match
SyncStatusCodeSynced SyncStatusCode = "Synced"
// SyncStatusCodeOutOfSync indicates that there is a drift beween desired and live states
SyncStatusCodeOutOfSync SyncStatusCode = "OutOfSync"
)
// ApplicationConditionType represents type of application condition. Type name has following convention:
// prefix "Error" means error condition
// prefix "Warning" means warning condition
// prefix "Info" means informational condition
type ApplicationConditionType = string
const (
// ApplicationConditionDeletionError indicates that controller failed to delete application
ApplicationConditionDeletionError = "DeletionError"
// ApplicationConditionInvalidSpecError indicates that application source is invalid
ApplicationConditionInvalidSpecError = "InvalidSpecError"
// ApplicationConditionComparisonError indicates controller failed to compare application state
ApplicationConditionComparisonError = "ComparisonError"
// ApplicationConditionSyncError indicates controller failed to automatically sync the application
ApplicationConditionSyncError = "SyncError"
// ApplicationConditionUnknownError indicates an unknown controller error
ApplicationConditionUnknownError = "UnknownError"
// ApplicationConditionSharedResourceWarning indicates that controller detected resources which belongs to more than one application
ApplicationConditionSharedResourceWarning = "SharedResourceWarning"
// ApplicationConditionRepeatedResourceWarning indicates that application source has resource with same Group, Kind, Name, Namespace multiple times
ApplicationConditionRepeatedResourceWarning = "RepeatedResourceWarning"
// ApplicationConditionExcludedResourceWarning indicates that application has resource which is configured to be excluded
ApplicationConditionExcludedResourceWarning = "ExcludedResourceWarning"
// ApplicationConditionOrphanedResourceWarning indicates that application has orphaned resources
ApplicationConditionOrphanedResourceWarning = "OrphanedResourceWarning"
)
// ApplicationCondition contains details about an application condition, which is usally an error or warning
type ApplicationCondition struct {
// Type is an application condition type
Type ApplicationConditionType `json:"type" protobuf:"bytes,1,opt,name=type"`
// Message contains human-readable message indicating details about condition