diff --git a/crds/meta.k8s.appscode.com_resourceblockdefinitions.yaml b/crds/meta.k8s.appscode.com_resourceblockdefinitions.yaml index d72ba0104..9205bca18 100644 --- a/crds/meta.k8s.appscode.com_resourceblockdefinitions.yaml +++ b/crds/meta.k8s.appscode.com_resourceblockdefinitions.yaml @@ -84,7 +84,7 @@ spec: query: properties: byLabel: - description: ENUM(authn,authz,auth_secret,backup_via,catalog,cert_issuer,config,connect_via,exposed_by,event,located_on,monitored_by,ocm_bind,offshoot,ops,placed_into,policy,recommended_for,restore_into,scaled_by,storage,view) + description: ENUM(authn,authz,auth_secret,backup_via,catalog,cert_issuer,config,connect_via,exposed_by,event,located_on,monitored_by,ocm_bind,offshoot,ops,placed_into,policy,recommended_for,restore_into,scaled_by,source,storage,view) enum: - authn - authz @@ -106,6 +106,7 @@ spec: - recommended_for - restore_into - scaled_by + - source - storage - view type: string diff --git a/crds/meta.k8s.appscode.com_resourcedescriptors.yaml b/crds/meta.k8s.appscode.com_resourcedescriptors.yaml index b606bd118..19d0917b8 100644 --- a/crds/meta.k8s.appscode.com_resourcedescriptors.yaml +++ b/crds/meta.k8s.appscode.com_resourcedescriptors.yaml @@ -46,7 +46,7 @@ spec: properties: labels: items: - description: ENUM(authn,authz,auth_secret,backup_via,catalog,cert_issuer,config,connect_via,exposed_by,event,located_on,monitored_by,ocm_bind,offshoot,ops,placed_into,policy,recommended_for,restore_into,scaled_by,storage,view) + description: ENUM(authn,authz,auth_secret,backup_via,catalog,cert_issuer,config,connect_via,exposed_by,event,located_on,monitored_by,ocm_bind,offshoot,ops,placed_into,policy,recommended_for,restore_into,scaled_by,source,storage,view) enum: - authn - authz @@ -68,6 +68,7 @@ spec: - recommended_for - restore_into - scaled_by + - source - storage - view type: string @@ -205,7 +206,7 @@ spec: query: properties: byLabel: - description: ENUM(authn,authz,auth_secret,backup_via,catalog,cert_issuer,config,connect_via,exposed_by,event,located_on,monitored_by,ocm_bind,offshoot,ops,placed_into,policy,recommended_for,restore_into,scaled_by,storage,view) + description: ENUM(authn,authz,auth_secret,backup_via,catalog,cert_issuer,config,connect_via,exposed_by,event,located_on,monitored_by,ocm_bind,offshoot,ops,placed_into,policy,recommended_for,restore_into,scaled_by,source,storage,view) enum: - authn - authz @@ -227,6 +228,7 @@ spec: - recommended_for - restore_into - scaled_by + - source - storage - view type: string diff --git a/crds/meta.k8s.appscode.com_resourcelayouts.yaml b/crds/meta.k8s.appscode.com_resourcelayouts.yaml index f9be1fb58..d172c2e83 100644 --- a/crds/meta.k8s.appscode.com_resourcelayouts.yaml +++ b/crds/meta.k8s.appscode.com_resourcelayouts.yaml @@ -85,7 +85,7 @@ spec: query: properties: byLabel: - description: ENUM(authn,authz,auth_secret,backup_via,catalog,cert_issuer,config,connect_via,exposed_by,event,located_on,monitored_by,ocm_bind,offshoot,ops,placed_into,policy,recommended_for,restore_into,scaled_by,storage,view) + description: ENUM(authn,authz,auth_secret,backup_via,catalog,cert_issuer,config,connect_via,exposed_by,event,located_on,monitored_by,ocm_bind,offshoot,ops,placed_into,policy,recommended_for,restore_into,scaled_by,source,storage,view) enum: - authn - authz @@ -107,6 +107,7 @@ spec: - recommended_for - restore_into - scaled_by + - source - storage - view type: string @@ -322,7 +323,7 @@ spec: query: properties: byLabel: - description: ENUM(authn,authz,auth_secret,backup_via,catalog,cert_issuer,config,connect_via,exposed_by,event,located_on,monitored_by,ocm_bind,offshoot,ops,placed_into,policy,recommended_for,restore_into,scaled_by,storage,view) + description: ENUM(authn,authz,auth_secret,backup_via,catalog,cert_issuer,config,connect_via,exposed_by,event,located_on,monitored_by,ocm_bind,offshoot,ops,placed_into,policy,recommended_for,restore_into,scaled_by,source,storage,view) enum: - authn - authz @@ -344,6 +345,7 @@ spec: - recommended_for - restore_into - scaled_by + - source - storage - view type: string @@ -585,7 +587,7 @@ spec: query: properties: byLabel: - description: ENUM(authn,authz,auth_secret,backup_via,catalog,cert_issuer,config,connect_via,exposed_by,event,located_on,monitored_by,ocm_bind,offshoot,ops,placed_into,policy,recommended_for,restore_into,scaled_by,storage,view) + description: ENUM(authn,authz,auth_secret,backup_via,catalog,cert_issuer,config,connect_via,exposed_by,event,located_on,monitored_by,ocm_bind,offshoot,ops,placed_into,policy,recommended_for,restore_into,scaled_by,source,storage,view) enum: - authn - authz @@ -607,6 +609,7 @@ spec: - recommended_for - restore_into - scaled_by + - source - storage - view type: string @@ -821,7 +824,7 @@ spec: query: properties: byLabel: - description: ENUM(authn,authz,auth_secret,backup_via,catalog,cert_issuer,config,connect_via,exposed_by,event,located_on,monitored_by,ocm_bind,offshoot,ops,placed_into,policy,recommended_for,restore_into,scaled_by,storage,view) + description: ENUM(authn,authz,auth_secret,backup_via,catalog,cert_issuer,config,connect_via,exposed_by,event,located_on,monitored_by,ocm_bind,offshoot,ops,placed_into,policy,recommended_for,restore_into,scaled_by,source,storage,view) enum: - authn - authz @@ -843,6 +846,7 @@ spec: - recommended_for - restore_into - scaled_by + - source - storage - view type: string @@ -1087,7 +1091,7 @@ spec: query: properties: byLabel: - description: ENUM(authn,authz,auth_secret,backup_via,catalog,cert_issuer,config,connect_via,exposed_by,event,located_on,monitored_by,ocm_bind,offshoot,ops,placed_into,policy,recommended_for,restore_into,scaled_by,storage,view) + description: ENUM(authn,authz,auth_secret,backup_via,catalog,cert_issuer,config,connect_via,exposed_by,event,located_on,monitored_by,ocm_bind,offshoot,ops,placed_into,policy,recommended_for,restore_into,scaled_by,source,storage,view) enum: - authn - authz @@ -1109,6 +1113,7 @@ spec: - recommended_for - restore_into - scaled_by + - source - storage - view type: string diff --git a/crds/meta.k8s.appscode.com_resourceoutlines.yaml b/crds/meta.k8s.appscode.com_resourceoutlines.yaml index 899013797..1ac4810d2 100644 --- a/crds/meta.k8s.appscode.com_resourceoutlines.yaml +++ b/crds/meta.k8s.appscode.com_resourceoutlines.yaml @@ -172,7 +172,7 @@ spec: query: properties: byLabel: - description: ENUM(authn,authz,auth_secret,backup_via,catalog,cert_issuer,config,connect_via,exposed_by,event,located_on,monitored_by,ocm_bind,offshoot,ops,placed_into,policy,recommended_for,restore_into,scaled_by,storage,view) + description: ENUM(authn,authz,auth_secret,backup_via,catalog,cert_issuer,config,connect_via,exposed_by,event,located_on,monitored_by,ocm_bind,offshoot,ops,placed_into,policy,recommended_for,restore_into,scaled_by,source,storage,view) enum: - authn - authz @@ -194,6 +194,7 @@ spec: - recommended_for - restore_into - scaled_by + - source - storage - view type: string @@ -411,7 +412,7 @@ spec: query: properties: byLabel: - description: ENUM(authn,authz,auth_secret,backup_via,catalog,cert_issuer,config,connect_via,exposed_by,event,located_on,monitored_by,ocm_bind,offshoot,ops,placed_into,policy,recommended_for,restore_into,scaled_by,storage,view) + description: ENUM(authn,authz,auth_secret,backup_via,catalog,cert_issuer,config,connect_via,exposed_by,event,located_on,monitored_by,ocm_bind,offshoot,ops,placed_into,policy,recommended_for,restore_into,scaled_by,source,storage,view) enum: - authn - authz @@ -433,6 +434,7 @@ spec: - recommended_for - restore_into - scaled_by + - source - storage - view type: string @@ -676,7 +678,7 @@ spec: query: properties: byLabel: - description: ENUM(authn,authz,auth_secret,backup_via,catalog,cert_issuer,config,connect_via,exposed_by,event,located_on,monitored_by,ocm_bind,offshoot,ops,placed_into,policy,recommended_for,restore_into,scaled_by,storage,view) + description: ENUM(authn,authz,auth_secret,backup_via,catalog,cert_issuer,config,connect_via,exposed_by,event,located_on,monitored_by,ocm_bind,offshoot,ops,placed_into,policy,recommended_for,restore_into,scaled_by,source,storage,view) enum: - authn - authz @@ -698,6 +700,7 @@ spec: - recommended_for - restore_into - scaled_by + - source - storage - view type: string @@ -914,7 +917,7 @@ spec: query: properties: byLabel: - description: ENUM(authn,authz,auth_secret,backup_via,catalog,cert_issuer,config,connect_via,exposed_by,event,located_on,monitored_by,ocm_bind,offshoot,ops,placed_into,policy,recommended_for,restore_into,scaled_by,storage,view) + description: ENUM(authn,authz,auth_secret,backup_via,catalog,cert_issuer,config,connect_via,exposed_by,event,located_on,monitored_by,ocm_bind,offshoot,ops,placed_into,policy,recommended_for,restore_into,scaled_by,source,storage,view) enum: - authn - authz @@ -936,6 +939,7 @@ spec: - recommended_for - restore_into - scaled_by + - source - storage - view type: string @@ -1182,7 +1186,7 @@ spec: query: properties: byLabel: - description: ENUM(authn,authz,auth_secret,backup_via,catalog,cert_issuer,config,connect_via,exposed_by,event,located_on,monitored_by,ocm_bind,offshoot,ops,placed_into,policy,recommended_for,restore_into,scaled_by,storage,view) + description: ENUM(authn,authz,auth_secret,backup_via,catalog,cert_issuer,config,connect_via,exposed_by,event,located_on,monitored_by,ocm_bind,offshoot,ops,placed_into,policy,recommended_for,restore_into,scaled_by,source,storage,view) enum: - authn - authz @@ -1204,6 +1208,7 @@ spec: - recommended_for - restore_into - scaled_by + - source - storage - view type: string diff --git a/crds/ui.k8s.appscode.com_resourcedashboards.yaml b/crds/ui.k8s.appscode.com_resourcedashboards.yaml index 724bc2219..745fde731 100644 --- a/crds/ui.k8s.appscode.com_resourcedashboards.yaml +++ b/crds/ui.k8s.appscode.com_resourcedashboards.yaml @@ -51,7 +51,7 @@ spec: query: properties: byLabel: - description: ENUM(authn,authz,auth_secret,backup_via,catalog,cert_issuer,config,connect_via,exposed_by,event,located_on,monitored_by,ocm_bind,offshoot,ops,placed_into,policy,recommended_for,restore_into,scaled_by,storage,view) + description: ENUM(authn,authz,auth_secret,backup_via,catalog,cert_issuer,config,connect_via,exposed_by,event,located_on,monitored_by,ocm_bind,offshoot,ops,placed_into,policy,recommended_for,restore_into,scaled_by,source,storage,view) enum: - authn - authz @@ -73,6 +73,7 @@ spec: - recommended_for - restore_into - scaled_by + - source - storage - view type: string diff --git a/go.mod b/go.mod index 99306222f..8d5152ea5 100644 --- a/go.mod +++ b/go.mod @@ -26,7 +26,7 @@ require ( k8s.io/klog/v2 v2.80.1 k8s.io/kube-openapi v0.0.0-20221012153701-172d655c2280 kmodules.xyz/apiversion v0.2.0 - kmodules.xyz/client-go v0.25.39 + kmodules.xyz/client-go v0.25.40 kmodules.xyz/crd-schema-fuzz v0.25.0 kmodules.xyz/go-containerregistry v0.0.11 kmodules.xyz/resource-metrics v0.25.7 diff --git a/go.sum b/go.sum index d37e4eb60..d0534120d 100644 --- a/go.sum +++ b/go.sum @@ -731,8 +731,8 @@ k8s.io/utils v0.0.0-20221108210102-8e77b1f39fe2 h1:GfD9OzL11kvZN5iArC6oTS7RTj7oJ k8s.io/utils v0.0.0-20221108210102-8e77b1f39fe2/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= kmodules.xyz/apiversion v0.2.0 h1:vAQYqZFm4xu4pbB1cAdHbFEPES6EQkcR4wc06xdTOWk= kmodules.xyz/apiversion v0.2.0/go.mod h1:oPX8g8LvlPdPX3Yc5YvCzJHQnw3YF/X4/jdW0b1am80= -kmodules.xyz/client-go v0.25.39 h1:5n0fXviJXd/Sioo8v2/f+Ria026oxTjpF9wBte9sBh8= -kmodules.xyz/client-go v0.25.39/go.mod h1:ijkpW+0nkrKf8zpK7V/UQQzjWMZpnMX887jfYLHBMIM= +kmodules.xyz/client-go v0.25.40 h1:za/YLZRUFWHWfF/EYo3Hz9QFED5Mr/ptRumHb/bqxEI= +kmodules.xyz/client-go v0.25.40/go.mod h1:ijkpW+0nkrKf8zpK7V/UQQzjWMZpnMX887jfYLHBMIM= kmodules.xyz/crd-schema-fuzz v0.25.0 h1:c5ZxNRqJak1bkGhECmyrKpzKGThFMB4088Kynyvngbc= kmodules.xyz/crd-schema-fuzz v0.25.0/go.mod h1:VigFz19GwCxMGhb3YjCtlSXmfXb0J/g9du1So6rvqsk= kmodules.xyz/go-containerregistry v0.0.11 h1:eZ7dz5QvszqoedOQLyqf5lkDa+S3Bds4EHHhb6jrLMc= diff --git a/hub/resourceblockdefinitions/helm.toolkit.fluxcd.io/v2beta1/helmreleases.yaml b/hub/resourceblockdefinitions/helm.toolkit.fluxcd.io/v2beta1/helmreleases.yaml index 577211189..1ff2d5999 100644 --- a/hub/resourceblockdefinitions/helm.toolkit.fluxcd.io/v2beta1/helmreleases.yaml +++ b/hub/resourceblockdefinitions/helm.toolkit.fluxcd.io/v2beta1/helmreleases.yaml @@ -11,11 +11,32 @@ spec: kind: Connection name: HelmRepository query: - byLabel: offshoot + raw: |- + query Find($src: String!, $targetGroup: String!, $targetKind: String!) { + find(oid: $src) { + offshoot(group: "source.toolkit.fluxcd.io", kind: "HelmChart") { + refs: source(group: $targetGroup, kind: $targetKind) { + namespace + name + } + } + } + } type: GraphQL ref: group: source.toolkit.fluxcd.io kind: HelmRepository + - actions: + create: Never + displayMode: List + kind: Connection + name: HelmChart + query: + byLabel: offshoot + type: GraphQL + ref: + group: source.toolkit.fluxcd.io + kind: HelmChart resource: group: helm.toolkit.fluxcd.io kind: HelmRelease diff --git a/hub/resourceblockdefinitions/source.toolkit.fluxcd.io/v1beta2/helmcharts.yaml b/hub/resourceblockdefinitions/source.toolkit.fluxcd.io/v1beta2/helmcharts.yaml index 0466ff70f..7ef0c3478 100644 --- a/hub/resourceblockdefinitions/source.toolkit.fluxcd.io/v1beta2/helmcharts.yaml +++ b/hub/resourceblockdefinitions/source.toolkit.fluxcd.io/v1beta2/helmcharts.yaml @@ -11,11 +11,22 @@ spec: kind: Connection name: HelmRepository query: - byLabel: offshoot + byLabel: source type: GraphQL ref: group: source.toolkit.fluxcd.io kind: HelmRepository + - actions: + create: Never + displayMode: List + kind: Connection + name: HelmRelease + query: + byLabel: offshoot + type: GraphQL + ref: + group: helm.toolkit.fluxcd.io + kind: HelmRelease resource: group: source.toolkit.fluxcd.io kind: HelmChart diff --git a/hub/resourceblockdefinitions/source.toolkit.fluxcd.io/v1beta2/helmrepositories.yaml b/hub/resourceblockdefinitions/source.toolkit.fluxcd.io/v1beta2/helmrepositories.yaml index 733d0222b..ad86b934d 100644 --- a/hub/resourceblockdefinitions/source.toolkit.fluxcd.io/v1beta2/helmrepositories.yaml +++ b/hub/resourceblockdefinitions/source.toolkit.fluxcd.io/v1beta2/helmrepositories.yaml @@ -11,7 +11,7 @@ spec: kind: Connection name: HelmCharts query: - byLabel: offshoot + byLabel: source type: GraphQL ref: group: source.toolkit.fluxcd.io @@ -22,7 +22,17 @@ spec: kind: Connection name: HelmReleases query: - byLabel: offshoot + raw: |- + query Find($src: String!, $targetGroup: String!, $targetKind: String!) { + find(oid: $src) { + source(group: "source.toolkit.fluxcd.io", kind: "HelmChart") { + refs: offshoot(group: $targetGroup, kind: $targetKind) { + namespace + name + } + } + } + } type: GraphQL ref: group: helm.toolkit.fluxcd.io diff --git a/hub/resourcedescriptors/helm.toolkit.fluxcd.io/v2beta1/helmreleases.yaml b/hub/resourcedescriptors/helm.toolkit.fluxcd.io/v2beta1/helmreleases.yaml index 9f4b4bf01..d7dddbf8a 100644 --- a/hub/resourcedescriptors/helm.toolkit.fluxcd.io/v2beta1/helmreleases.yaml +++ b/hub/resourcedescriptors/helm.toolkit.fluxcd.io/v2beta1/helmreleases.yaml @@ -13,10 +13,10 @@ spec: - labels: - offshoot references: - - '{.spec.chart.spec.sourceRef.name}' + - '{.metadata.namespace}-{.spec.chart.spec.chart}' target: apiVersion: source.toolkit.fluxcd.io/v1beta2 - kind: HelmRepository + kind: HelmChart type: MatchRef resource: group: helm.toolkit.fluxcd.io diff --git a/hub/resourcedescriptors/source.toolkit.fluxcd.io/v1beta2/helmcharts.yaml b/hub/resourcedescriptors/source.toolkit.fluxcd.io/v1beta2/helmcharts.yaml index 60aef085d..8f305a49b 100644 --- a/hub/resourcedescriptors/source.toolkit.fluxcd.io/v1beta2/helmcharts.yaml +++ b/hub/resourcedescriptors/source.toolkit.fluxcd.io/v1beta2/helmcharts.yaml @@ -11,7 +11,7 @@ metadata: spec: connections: - labels: - - offshoot + - source references: - '{.spec.sourceRef.name}' target: diff --git a/vendor/kmodules.xyz/client-go/api/v1/object.go b/vendor/kmodules.xyz/client-go/api/v1/object.go index 4e16224ed..419d3cab3 100644 --- a/vendor/kmodules.xyz/client-go/api/v1/object.go +++ b/vendor/kmodules.xyz/client-go/api/v1/object.go @@ -216,8 +216,8 @@ type ObjectInfo struct { Ref ObjectReference `json:"ref" protobuf:"bytes,2,opt,name=ref"` } -// +kubebuilder:validation:Enum=authn;authz;auth_secret;backup_via;catalog;cert_issuer;config;connect_via;exposed_by;event;located_on;monitored_by;ocm_bind;offshoot;ops;placed_into;policy;recommended_for;restore_into;scaled_by;storage;view -// ENUM(authn,authz,auth_secret,backup_via,catalog,cert_issuer,config,connect_via,exposed_by,event,located_on,monitored_by,ocm_bind,offshoot,ops,placed_into,policy,recommended_for,restore_into,scaled_by,storage,view) +// +kubebuilder:validation:Enum=authn;authz;auth_secret;backup_via;catalog;cert_issuer;config;connect_via;exposed_by;event;located_on;monitored_by;ocm_bind;offshoot;ops;placed_into;policy;recommended_for;restore_into;scaled_by;source;storage;view +// ENUM(authn,authz,auth_secret,backup_via,catalog,cert_issuer,config,connect_via,exposed_by,event,located_on,monitored_by,ocm_bind,offshoot,ops,placed_into,policy,recommended_for,restore_into,scaled_by,source,storage,view) type EdgeLabel string func (e EdgeLabel) Direct() bool { diff --git a/vendor/kmodules.xyz/client-go/api/v1/object_enum.go b/vendor/kmodules.xyz/client-go/api/v1/object_enum.go index 403d3aed1..65792ec2b 100644 --- a/vendor/kmodules.xyz/client-go/api/v1/object_enum.go +++ b/vendor/kmodules.xyz/client-go/api/v1/object_enum.go @@ -52,6 +52,8 @@ const ( EdgeLabelRestoreInto EdgeLabel = "restore_into" // EdgeLabelScaledBy is a EdgeLabel of type scaled_by. EdgeLabelScaledBy EdgeLabel = "scaled_by" + // EdgeLabelSource is a EdgeLabel of type source. + EdgeLabelSource EdgeLabel = "source" // EdgeLabelStorage is a EdgeLabel of type storage. EdgeLabelStorage EdgeLabel = "storage" // EdgeLabelView is a EdgeLabel of type view. @@ -81,6 +83,7 @@ var _EdgeLabelNames = []string{ string(EdgeLabelRecommendedFor), string(EdgeLabelRestoreInto), string(EdgeLabelScaledBy), + string(EdgeLabelSource), string(EdgeLabelStorage), string(EdgeLabelView), } @@ -115,6 +118,7 @@ func EdgeLabelValues() []EdgeLabel { EdgeLabelRecommendedFor, EdgeLabelRestoreInto, EdgeLabelScaledBy, + EdgeLabelSource, EdgeLabelStorage, EdgeLabelView, } @@ -153,6 +157,7 @@ var _EdgeLabelValue = map[string]EdgeLabel{ "recommended_for": EdgeLabelRecommendedFor, "restore_into": EdgeLabelRestoreInto, "scaled_by": EdgeLabelScaledBy, + "source": EdgeLabelSource, "storage": EdgeLabelStorage, "view": EdgeLabelView, } diff --git a/vendor/modules.txt b/vendor/modules.txt index 75f94153e..759764952 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -680,7 +680,7 @@ k8s.io/utils/trace # kmodules.xyz/apiversion v0.2.0 ## explicit; go 1.14 kmodules.xyz/apiversion -# kmodules.xyz/client-go v0.25.39 +# kmodules.xyz/client-go v0.25.40 ## explicit; go 1.18 kmodules.xyz/client-go kmodules.xyz/client-go/api/v1