/
listers.go
56 lines (51 loc) · 2.26 KB
/
listers.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
package naiserator_scheme
import (
iam_cnrm_cloud_google_com_v1beta1 "github.com/nais/liberator/pkg/apis/iam.cnrm.cloud.google.com/v1beta1"
nais_io_v1 "github.com/nais/liberator/pkg/apis/nais.io/v1"
sql_cnrm_cloud_google_com_v1beta1 "github.com/nais/liberator/pkg/apis/sql.cnrm.cloud.google.com/v1beta1"
storage_cnrm_cloud_google_com_v1beta1 "github.com/nais/liberator/pkg/apis/storage.cnrm.cloud.google.com/v1beta1"
appsv1 "k8s.io/api/apps/v1"
autoscalev2 "k8s.io/api/autoscaling/v2"
corev1 "k8s.io/api/core/v1"
networkingv1 "k8s.io/api/networking/v1"
rbacv1 "k8s.io/api/rbac/v1"
"sigs.k8s.io/controller-runtime/pkg/client"
)
// Maintain a list of resources that should be cleaned up during Application synchronization.
// Orphaned types with matching label 'app=NAME' but without owner references are automatically removed.
// It is too expensive to list all known Kubernetes types, so we need to have some knowledge of which types to care about.
// These are usually the types we persist to the cluster with names different than the application name.
// Resources that can be queried in all clusters
func GenericListers() []client.ObjectList {
return []client.ObjectList{
// Kubernetes internals
&appsv1.DeploymentList{},
&autoscalev2.HorizontalPodAutoscalerList{},
&corev1.SecretList{},
&corev1.ServiceAccountList{},
&corev1.ServiceList{},
&networkingv1.NetworkPolicyList{},
&networkingv1.IngressList{},
&rbacv1.RoleBindingList{},
&rbacv1.RoleList{},
// Custom resources
&nais_io_v1.AzureAdApplicationList{},
&nais_io_v1.IDPortenClientList{},
&nais_io_v1.JwkerList{},
&nais_io_v1.MaskinportenClientList{},
}
}
// Resources that exist only in GCP clusters
func GCPListers() []client.ObjectList {
return []client.ObjectList{
&iam_cnrm_cloud_google_com_v1beta1.IAMPolicyList{},
&iam_cnrm_cloud_google_com_v1beta1.IAMPolicyMemberList{},
&iam_cnrm_cloud_google_com_v1beta1.IAMServiceAccountList{},
&sql_cnrm_cloud_google_com_v1beta1.SQLDatabaseList{},
&sql_cnrm_cloud_google_com_v1beta1.SQLInstanceList{},
&sql_cnrm_cloud_google_com_v1beta1.SQLUserList{},
&sql_cnrm_cloud_google_com_v1beta1.SQLSSLCertList{},
&storage_cnrm_cloud_google_com_v1beta1.StorageBucketAccessControlList{},
&storage_cnrm_cloud_google_com_v1beta1.StorageBucketList{},
}
}