From c7f8eebd79d32b3443bb3b96ea344b0fbd8c16a0 Mon Sep 17 00:00:00 2001 From: rcmadhankumar Date: Wed, 14 Feb 2024 14:54:41 +0530 Subject: [PATCH 1/3] Dependency resolution added for carvel packages Signed-off-by: rcmadhankumar --- config/config/crds.yml | 24 + .../packaging/v1alpha1/package_install.go | 9 + .../v1alpha1/zz_generated.deepcopy.go | 17 + pkg/apiserver/apis/datapackaging/types.go | 20 + .../datapackaging/v1alpha1/generated.pb.go | 606 +++++++++++++++--- .../datapackaging/v1alpha1/generated.proto | 21 + .../apis/datapackaging/v1alpha1/types.go | 25 +- .../v1alpha1/zz_generated.conversion.go | 64 ++ .../v1alpha1/zz_generated.deepcopy.go | 44 ++ .../datapackaging/zz_generated.deepcopy.go | 44 ++ pkg/apiserver/openapi/zz_generated.openapi.go | 65 +- pkg/packageinstall/packageinstall.go | 16 +- pkg/packageinstall/packageinstall_test.go | 280 ++++++++ 13 files changed, 1145 insertions(+), 90 deletions(-) diff --git a/config/config/crds.yml b/config/config/crds.yml index 38e4f0424..9ac4c7589 100644 --- a/config/config/crds.yml +++ b/config/config/crds.yml @@ -95,6 +95,23 @@ spec: capacityRequirementsDescription: description: 'System requirements needed to install the package. Note: these requirements will not be verified by kapp-controller on installation. (optional; string)' type: string + dependencies: + description: List of dependencies to be resolved + items: + description: DependencyType contains the list of type of depencies + properties: + package: + description: PackageDependency contains package dependency related info + properties: + refName: + description: The name of the PackageMetadata associated with this dependency Must be a valid PackageMetadata name (see PackageMetadata CR for details) Cannot be empty + type: string + version: + description: Package version; Will be Referenced by PackageInstall; Must be valid semver (required) Cannot be empty + type: string + type: object + type: object + type: array includedSoftware: description: IncludedSoftware can be used to show the software contents of a Package. This is especially useful if the underlying versions do not match the Package version items: @@ -1511,6 +1528,13 @@ spec: defaultNamespace: description: Specifies the default namespace to install the Package resources, by default this is same as the PackageInstall namespace (optional; v0.48.0+) type: string + dependencies: + description: Dependencies can be controlled through this section + properties: + install: + description: Indicates whether to install depencies along with or not + type: boolean + type: object noopDelete: description: When NoopDelete set to true, PackageInstall deletion should delete PackageInstall/App CR but preserve App's associated resources. type: boolean diff --git a/pkg/apis/packaging/v1alpha1/package_install.go b/pkg/apis/packaging/v1alpha1/package_install.go index 0195b0840..4da2fb497 100644 --- a/pkg/apis/packaging/v1alpha1/package_install.go +++ b/pkg/apis/packaging/v1alpha1/package_install.go @@ -79,6 +79,9 @@ type PackageInstallSpec struct { // same as the PackageInstall namespace (optional; v0.48.0+) // +optional DefaultNamespace string `json:"defaultNamespace,omitempty"` + // Dependencies can be controlled through this section + // +optional + Dependencies Dependencies `json:"dependencies,omitempty"` } type PackageRef struct { @@ -111,3 +114,9 @@ type PackageInstallStatus struct { // +optional LastAttemptedVersion string `json:"lastAttemptedVersion,omitempty"` } + +type Dependencies struct { + // Indicates whether to install depencies along with or not + // +optional + Install bool `json:"install,omitempty"` +} diff --git a/pkg/apis/packaging/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/packaging/v1alpha1/zz_generated.deepcopy.go index a92b8c534..0344f607e 100644 --- a/pkg/apis/packaging/v1alpha1/zz_generated.deepcopy.go +++ b/pkg/apis/packaging/v1alpha1/zz_generated.deepcopy.go @@ -12,6 +12,22 @@ import ( runtime "k8s.io/apimachinery/pkg/runtime" ) +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Dependencies) DeepCopyInto(out *Dependencies) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Dependencies. +func (in *Dependencies) DeepCopy() *Dependencies { + if in == nil { + return nil + } + out := new(Dependencies) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *PackageInstall) DeepCopyInto(out *PackageInstall) { *out = *in @@ -98,6 +114,7 @@ func (in *PackageInstallSpec) DeepCopyInto(out *PackageInstallSpec) { *out = new(v1.Duration) **out = **in } + out.Dependencies = in.Dependencies return } diff --git a/pkg/apiserver/apis/datapackaging/types.go b/pkg/apiserver/apis/datapackaging/types.go index 821fe4a03..84b2957c3 100644 --- a/pkg/apiserver/apis/datapackaging/types.go +++ b/pkg/apiserver/apis/datapackaging/types.go @@ -70,6 +70,9 @@ type PackageSpec struct { // Must be valid semver (required) // Cannot be empty Version string `json:"version,omitempty"` + // List of dependencies to be resolved + // +optional + Dependencies []DependencyType `json:"dependencies,omitempty"` // Description of the licenses that apply to the package software // (optional; Array of strings) Licenses []string `json:"licenses,omitempty"` @@ -151,3 +154,20 @@ type IncludedSoftware struct { Version string `json:"version,omitempty" protobuf:"bytes,2,opt,name=version"` Description string `json:"description,omitempty" protobuf:"bytes,3,opt,name=description"` } + +// DependencyType contains the list of type of depencies +type DependencyType struct { + Package *PackageDependency `json:"package,omitempty"` +} + +// PackageDependency contains package dependency related info +type PackageDependency struct { + // The name of the PackageMetadata associated with this dependency + // Must be a valid PackageMetadata name (see PackageMetadata CR for details) + // Cannot be empty + RefName string `json:"refName,omitempty"` + // Package version; Will be Referenced by PackageInstall; + // Must be valid semver (required) + // Cannot be empty + Version string `json:"version,omitempty"` +} diff --git a/pkg/apiserver/apis/datapackaging/v1alpha1/generated.pb.go b/pkg/apiserver/apis/datapackaging/v1alpha1/generated.pb.go index 22ed0b388..8c6ca1e40 100644 --- a/pkg/apiserver/apis/datapackaging/v1alpha1/generated.pb.go +++ b/pkg/apiserver/apis/datapackaging/v1alpha1/generated.pb.go @@ -56,10 +56,38 @@ func (m *AppTemplateSpec) XXX_DiscardUnknown() { var xxx_messageInfo_AppTemplateSpec proto.InternalMessageInfo +func (m *DependencyType) Reset() { *m = DependencyType{} } +func (*DependencyType) ProtoMessage() {} +func (*DependencyType) Descriptor() ([]byte, []int) { + return fileDescriptor_ff0bf4d4d6edd19a, []int{1} +} +func (m *DependencyType) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *DependencyType) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *DependencyType) XXX_Merge(src proto.Message) { + xxx_messageInfo_DependencyType.Merge(m, src) +} +func (m *DependencyType) XXX_Size() int { + return m.Size() +} +func (m *DependencyType) XXX_DiscardUnknown() { + xxx_messageInfo_DependencyType.DiscardUnknown(m) +} + +var xxx_messageInfo_DependencyType proto.InternalMessageInfo + func (m *IncludedSoftware) Reset() { *m = IncludedSoftware{} } func (*IncludedSoftware) ProtoMessage() {} func (*IncludedSoftware) Descriptor() ([]byte, []int) { - return fileDescriptor_ff0bf4d4d6edd19a, []int{1} + return fileDescriptor_ff0bf4d4d6edd19a, []int{2} } func (m *IncludedSoftware) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -87,7 +115,7 @@ var xxx_messageInfo_IncludedSoftware proto.InternalMessageInfo func (m *Maintainer) Reset() { *m = Maintainer{} } func (*Maintainer) ProtoMessage() {} func (*Maintainer) Descriptor() ([]byte, []int) { - return fileDescriptor_ff0bf4d4d6edd19a, []int{2} + return fileDescriptor_ff0bf4d4d6edd19a, []int{3} } func (m *Maintainer) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -115,7 +143,7 @@ var xxx_messageInfo_Maintainer proto.InternalMessageInfo func (m *Package) Reset() { *m = Package{} } func (*Package) ProtoMessage() {} func (*Package) Descriptor() ([]byte, []int) { - return fileDescriptor_ff0bf4d4d6edd19a, []int{3} + return fileDescriptor_ff0bf4d4d6edd19a, []int{4} } func (m *Package) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -140,10 +168,38 @@ func (m *Package) XXX_DiscardUnknown() { var xxx_messageInfo_Package proto.InternalMessageInfo +func (m *PackageDependency) Reset() { *m = PackageDependency{} } +func (*PackageDependency) ProtoMessage() {} +func (*PackageDependency) Descriptor() ([]byte, []int) { + return fileDescriptor_ff0bf4d4d6edd19a, []int{5} +} +func (m *PackageDependency) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *PackageDependency) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *PackageDependency) XXX_Merge(src proto.Message) { + xxx_messageInfo_PackageDependency.Merge(m, src) +} +func (m *PackageDependency) XXX_Size() int { + return m.Size() +} +func (m *PackageDependency) XXX_DiscardUnknown() { + xxx_messageInfo_PackageDependency.DiscardUnknown(m) +} + +var xxx_messageInfo_PackageDependency proto.InternalMessageInfo + func (m *PackageList) Reset() { *m = PackageList{} } func (*PackageList) ProtoMessage() {} func (*PackageList) Descriptor() ([]byte, []int) { - return fileDescriptor_ff0bf4d4d6edd19a, []int{4} + return fileDescriptor_ff0bf4d4d6edd19a, []int{6} } func (m *PackageList) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -171,7 +227,7 @@ var xxx_messageInfo_PackageList proto.InternalMessageInfo func (m *PackageMetadata) Reset() { *m = PackageMetadata{} } func (*PackageMetadata) ProtoMessage() {} func (*PackageMetadata) Descriptor() ([]byte, []int) { - return fileDescriptor_ff0bf4d4d6edd19a, []int{5} + return fileDescriptor_ff0bf4d4d6edd19a, []int{7} } func (m *PackageMetadata) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -199,7 +255,7 @@ var xxx_messageInfo_PackageMetadata proto.InternalMessageInfo func (m *PackageMetadataList) Reset() { *m = PackageMetadataList{} } func (*PackageMetadataList) ProtoMessage() {} func (*PackageMetadataList) Descriptor() ([]byte, []int) { - return fileDescriptor_ff0bf4d4d6edd19a, []int{6} + return fileDescriptor_ff0bf4d4d6edd19a, []int{8} } func (m *PackageMetadataList) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -227,7 +283,7 @@ var xxx_messageInfo_PackageMetadataList proto.InternalMessageInfo func (m *PackageMetadataSpec) Reset() { *m = PackageMetadataSpec{} } func (*PackageMetadataSpec) ProtoMessage() {} func (*PackageMetadataSpec) Descriptor() ([]byte, []int) { - return fileDescriptor_ff0bf4d4d6edd19a, []int{7} + return fileDescriptor_ff0bf4d4d6edd19a, []int{9} } func (m *PackageMetadataSpec) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -255,7 +311,7 @@ var xxx_messageInfo_PackageMetadataSpec proto.InternalMessageInfo func (m *PackageSpec) Reset() { *m = PackageSpec{} } func (*PackageSpec) ProtoMessage() {} func (*PackageSpec) Descriptor() ([]byte, []int) { - return fileDescriptor_ff0bf4d4d6edd19a, []int{8} + return fileDescriptor_ff0bf4d4d6edd19a, []int{10} } func (m *PackageSpec) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -283,7 +339,7 @@ var xxx_messageInfo_PackageSpec proto.InternalMessageInfo func (m *ValuesSchema) Reset() { *m = ValuesSchema{} } func (*ValuesSchema) ProtoMessage() {} func (*ValuesSchema) Descriptor() ([]byte, []int) { - return fileDescriptor_ff0bf4d4d6edd19a, []int{9} + return fileDescriptor_ff0bf4d4d6edd19a, []int{11} } func (m *ValuesSchema) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -311,7 +367,7 @@ var xxx_messageInfo_ValuesSchema proto.InternalMessageInfo func (m *VersionSelection) Reset() { *m = VersionSelection{} } func (*VersionSelection) ProtoMessage() {} func (*VersionSelection) Descriptor() ([]byte, []int) { - return fileDescriptor_ff0bf4d4d6edd19a, []int{10} + return fileDescriptor_ff0bf4d4d6edd19a, []int{12} } func (m *VersionSelection) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -338,9 +394,11 @@ var xxx_messageInfo_VersionSelection proto.InternalMessageInfo func init() { proto.RegisterType((*AppTemplateSpec)(nil), "github.com.vmware_tanzu.carvel_kapp_controller.pkg.apiserver.apis.datapackaging.v1alpha1.AppTemplateSpec") + proto.RegisterType((*DependencyType)(nil), "github.com.vmware_tanzu.carvel_kapp_controller.pkg.apiserver.apis.datapackaging.v1alpha1.DependencyType") proto.RegisterType((*IncludedSoftware)(nil), "github.com.vmware_tanzu.carvel_kapp_controller.pkg.apiserver.apis.datapackaging.v1alpha1.IncludedSoftware") proto.RegisterType((*Maintainer)(nil), "github.com.vmware_tanzu.carvel_kapp_controller.pkg.apiserver.apis.datapackaging.v1alpha1.Maintainer") proto.RegisterType((*Package)(nil), "github.com.vmware_tanzu.carvel_kapp_controller.pkg.apiserver.apis.datapackaging.v1alpha1.Package") + proto.RegisterType((*PackageDependency)(nil), "github.com.vmware_tanzu.carvel_kapp_controller.pkg.apiserver.apis.datapackaging.v1alpha1.PackageDependency") proto.RegisterType((*PackageList)(nil), "github.com.vmware_tanzu.carvel_kapp_controller.pkg.apiserver.apis.datapackaging.v1alpha1.PackageList") proto.RegisterType((*PackageMetadata)(nil), "github.com.vmware_tanzu.carvel_kapp_controller.pkg.apiserver.apis.datapackaging.v1alpha1.PackageMetadata") proto.RegisterType((*PackageMetadataList)(nil), "github.com.vmware_tanzu.carvel_kapp_controller.pkg.apiserver.apis.datapackaging.v1alpha1.PackageMetadataList") @@ -355,80 +413,85 @@ func init() { } var fileDescriptor_ff0bf4d4d6edd19a = []byte{ - // 1156 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x57, 0xcd, 0x6f, 0x1b, 0x45, - 0x14, 0xcf, 0x26, 0x2e, 0x76, 0xc6, 0x29, 0x31, 0x53, 0x10, 0x96, 0x0f, 0xeb, 0xc8, 0x17, 0x52, - 0xa4, 0xac, 0x69, 0x68, 0xab, 0x4a, 0x9c, 0xe2, 0x04, 0xa1, 0xd0, 0xa6, 0x8d, 0xc6, 0x55, 0x54, - 0x10, 0x6a, 0x98, 0xac, 0x5f, 0xec, 0xa9, 0xf7, 0x63, 0x3a, 0x33, 0x76, 0x09, 0x07, 0x84, 0xc4, - 0xd7, 0x0d, 0xb8, 0x71, 0xe0, 0xc2, 0x9d, 0x4b, 0xff, 0x8c, 0x88, 0x53,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33, 0xae, 0x26, 0x59, 0x7b, 0xbc, 0x85, 0x4a, 0xb2, 0x13, 0x0a, 0xb5, 0x35, 0xb1, 0xfb, 0xca, - 0x26, 0x46, 0xa9, 0x99, 0xd1, 0x93, 0x09, 0x0f, 0xfc, 0x1e, 0xba, 0xcc, 0xdc, 0x30, 0x68, 0xee, - 0x7d, 0xd0, 0xa0, 0x12, 0x6e, 0x5e, 0x2f, 0xe7, 0x74, 0x88, 0x37, 0x4c, 0x88, 0xcb, 0xdb, 0x69, - 0x25, 0x19, 0xb7, 0xc5, 0xb7, 0xd0, 0x12, 0x17, 0x61, 0x9f, 0xb5, 0x40, 0x68, 0xf6, 0x97, 0xb4, - 0xef, 0xeb, 0xc6, 0x77, 0x69, 0x37, 0xa5, 0x23, 0x63, 0x96, 0xf8, 0x67, 0x0b, 0x15, 0xfd, 0x78, - 0xfb, 0xca, 0xf2, 0x2b, 0xba, 0xcb, 0xad, 0xd9, 0x75, 0x39, 0x59, 0xf5, 0x49, 0x77, 0x12, 0x99, - 0x24, 0xe9, 0x6c, 0xb0, 0x83, 0x90, 0x4b, 0x15, 0xb4, 0x43, 0xc1, 0x40, 0x96, 0xf3, 0x2b, 0x0b, - 0xab, 0x8b, 0x8d, 0x57, 0xa3, 0x3b, 0xbb, 0x19, 0x4b, 0x49, 0xca, 0x02, 0x7f, 0x88, 0xb0, 0xec, - 0x71, 0x9e, 0x69, 0x46, 0x41, 0x57, 0xa3, 0x62, 0xd0, 0x70, 0x73, 0xc2, 0x82, 0xfc, 0x87, 0x57, - 0xed, 0x29, 0x8a, 0xd7, 0xad, 0x1e, 0xb0, 0xab, 0x28, 0x2f, 0xe0, 0x30, 0x35, 0x5c, 0xf1, 0x87, - 0x90, 0x0c, 0xc5, 0x64, 0xa4, 0xff, 0x3f, 0xdf, 0xcc, 0x55, 0x54, 0xf0, 0x98, 0x0b, 0x81, 0x04, - 0x59, 0x5e, 0xd0, 0xfc, 0x96, 0x86, 0x37, 0x71, 0x28, 0x23,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 0xda, 0xe0, 0xa4, 0x6a, 0xdf, 0x7e, 0x61, 0x56, 0xe4, 0x8c, 0xac, 0xf1, 0x6f, 0x16, 0xaa, - 0x74, 0x7b, 0x07, 0x20, 0x02, 0x50, 0x20, 0x27, 0x48, 0x15, 0x2f, 0x9c, 0x94, 0x3d, 0x38, 0xa9, - 0x56, 0x6e, 0x4f, 0xcd, 0x88, 0xbc, 0x20, 0xdb, 0x5a, 0x80, 0xc6, 0xc6, 0x0e, 0x3f, 0x44, 0x8b, - 0x21, 0x87, 0x60, 0x63, 0x77, 0xbb, 0xff, 0xae, 0x79, 0x9b, 0xac, 0x4d, 0xdd, 0x58, 0xe6, 0x9f, - 0x95, 0x43, 0xe8, 0x93, 0xf7, 0x3f, 0x53, 0x10, 0x44, 0xa1, 0x1b, 0xaf, 0x99, 0x19, 0x59, 0xbc, - 0x37, 0x8a, 0x43, 0x92, 0x90, 0xb5, 0x6d, 0x54, 0x9a, 0x28, 0xe8, 0x0d, 0x54, 0x74, 0xc3, 0x40, - 0x2a, 0x11, 0x7d, 0x46, 0x64, 0xf6, 0x1d, 0xb0, 0x99, 0xa8, 0x48, 0xda, 0xae, 0xf1, 0xc5, 0xf1, - 0xa9, 0x3d, 0xf7, 0xec, 0xd4, 0x9e, 0x7b, 0x7e, 0x6a, 0xcf, 0x7d, 0x39, 0xb0, 0xad, 0xe3, 0x81, - 0x6d, 0x3d, 0x1b, 0xd8, 0xd6, 0xf3, 0x81, 0x6d, 0xfd, 0x31, 0xb0, 0xad, 0x1f, 0xff, 0xb4, 0xe7, - 0x3e, 0x7e, 0x30, 0xab, 0xff, 0xf2, 0xff, 0x06, 0x00, 0x00, 0xff, 0xff, 0xe6, 0xaf, 0x1f, 0xcd, - 0x26, 0x10, 0x00, 0x00, + // 1235 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x58, 0xcd, 0x6f, 0x1b, 0x45, + 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0x83, 0x04, 0x49, 0x67, 0xfd, 0xae, 0x1e, 0x23, + 0x89, 0x5f, 0xfa, 0x04, 0x92, 0x1e, 0x21, 0xd5, 0x56, 0x53, 0x35, 0x74, 0xdd, 0xae, 0xdb, 0x14, + 0x80, 0x87, 0x83, 0x23, 0xf1, 0x97, 0xf8, 0x43, 0xfc, 0x0a, 0x89, 0xd4, 0xde, 0x3d, 0x67, 0xc9, + 0xcd, 0xc0, 0x60, 0x70, 0xcf, 0x9a, 0x59, 0x63, 0xed, 0x7a, 0xff, 0x96, 0xaf, 0x9b, 0x6e, 0xe0, + 0x6e, 0x53, 0xa3, 0x67, 0x3a, 0xe0, 0x1d, 0x27, 0xf1, 0x36, 0x70, 0xda, 0x1c, 0x4e, 0x47, 0x35, + 0x67, 0x45, 0x79, 0x03, 0x87, 0x9b, 0x36, 0x4c, 0x05, 0xdc, 0x3c, 0x2b, 0xc0, 0x37, 0x7a, 0x60, + 0xd3, 0x6c, 0x5c, 0xe3, 0x53, 0x05, 0x2d, 0x6d, 0x30, 0xb6, 0x07, 0x36, 0xb3, 0x28, 0x87, 0x36, + 0x03, 0x03, 0x33, 0x54, 0xf0, 0x19, 0x18, 0x55, 0x65, 0x59, 0x59, 0x51, 0xd7, 0x89, 0x7e, 0xce, + 0x29, 0xe9, 0x51, 0x73, 0xe2, 0xb1, 0xe8, 0x1b, 0x8c, 0x05, 0x08, 0xad, 0xd2, 0x78, 0x54, 0x2f, + 0x04, 0xbf, 0x88, 0x40, 0x6a, 0xfc, 0xa4, 0xa0, 0x2b, 0x5b, 0xc0, 0xc0, 0xe9, 0x80, 0x63, 0x1c, + 0xef, 0x1d, 0x33, 0xc0, 0xdf, 0x2a, 0xa8, 0x18, 0x0e, 0x16, 0x24, 0x91, 0xbe, 0x9e, 0x97, 0x5c, + 0xf4, 0xdd, 0x10, 0x28, 0xa1, 0xd0, 0x52, 0xc7, 0xa3, 0x7a, 0x51, 0x1e, 0x93, 0x88, 0x48, 0xe3, + 0x67, 0x05, 0x55, 0xb6, 0x1d, 0xc3, 0x1a, 0x74, 0xa0, 0xd3, 0x76, 0x8f, 0x78, 0xc0, 0x01, 0xdf, + 0x40, 0x6a, 0xc7, 0xf4, 0x99, 0x45, 0x8f, 0xef, 0x52, 0x3b, 0x24, 0xbb, 0xd8, 0xba, 0x76, 0x32, + 0xaa, 0xcf, 0x8d, 0x47, 0x75, 0x75, 0x2b, 0x31, 0x91, 0xb4, 0x1f, 0x7e, 0x15, 0x15, 0x87, 0xe0, + 0xf9, 0xa6, 0xeb, 0x54, 0xe7, 0x45, 0xc8, 0x92, 0x0c, 0x29, 0xee, 0x87, 0xc7, 0x24, 0xb2, 0x0b, + 0x04, 0xf0, 0x0d, 0xcf, 0x64, 0x3c, 0x70, 0x5f, 0xc8, 0x20, 0x24, 0x26, 0x92, 0xf6, 0x6b, 0xe8, + 0x08, 0xed, 0x50, 0xd3, 0xe1, 0x34, 0x50, 0x03, 0x5e, 0x46, 0x05, 0x27, 0xe1, 0x57, 0x96, 0xd1, + 0x05, 0x41, 0x4c, 0x58, 0x1a, 0xff, 0x28, 0x28, 0x2a, 0x19, 0x7f, 0x80, 0x4a, 0x81, 0x36, 0x83, + 0x7e, 0xc9, 0xf6, 0xbf, 0xae, 0x87, 0x12, 0xd3, 0xd3, 0x12, 0x4b, 0x86, 0x1d, 0x78, 0xeb, 0xc3, + 0x35, 0xfd, 0xde, 0xe1, 0x43, 0x30, 0xf8, 0x0e, 0x70, 0xda, 0xc2, 0x12, 0x03, 0x25, 0x67, 0x24, + 0xce, 0x8a, 0xbf, 0x54, 0xa4, 0xcc, 0xe6, 0x45, 0x7a, 0xc8, 0x7d, 0xba, 0x42, 0x79, 0x71, 0xdd, + 0x29, 0xf5, 0x99, 0xe8, 0xea, 0x94, 0x00, 0x82, 0xf1, 0x78, 0x70, 0x94, 0x9a, 0x68, 0x3c, 0x1e, + 0x12, 0x1e, 0x93, 0xc8, 0xfe, 0x3f, 0x26, 0xd9, 0xf8, 0x5b,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3, 0x0f, 0xd0, 0xa2, 0xcb, + 0xc0, 0xd9, 0xd8, 0xdd, 0x1e, 0xbe, 0x21, 0x1f, 0x50, 0xab, 0x33, 0x37, 0x96, 0xfc, 0x17, 0xb1, + 0x4e, 0xe8, 0xe3, 0xb7, 0x3e, 0xe4, 0xe0, 0x04, 0xa9, 0x5b, 0x57, 0xa5, 0x46, 0x16, 0xef, 0x45, + 0x79, 0x48, 0x92, 0xb2, 0xb1, 0x8d, 0x2a, 0x53, 0x0d, 0xbd, 0x81, 0x54, 0xc3, 0x75, 0x7c, 0xee, + 0x05, 0xdf, 0x3a, 0x3f, 0xfb, 0x58, 0xd9, 0x4c, 0x4c, 0x24, 0xed, 0xd7, 0xfa, 0xf8, 0xe4, 0x54, + 0x9b, 0x7b, 0x72, 0xaa, 0xcd, 0x3d, 0x3d, 0xd5, 0xe6, 0x3e, 0x19, 0x6b, 0xca, 0xc9, 0x58, 0x53, + 0x9e, 0x8c, 0x35, 0xe5, 0xe9, 0x58, 0x53, 0xfe, 0x18, 0x6b, 0xca, 0x37, 0x7f, 0x6a, 0x73, 0xef, + 0xdd, 0xcf, 0xeb, 0xff, 0x60, 0xfe, 0x0d, 0x00, 0x00, 0xff, 0xff, 0xdd, 0x8b, 0xb5, 0x95, 0xde, + 0x11, 0x00, 0x00, } func (m *AppTemplateSpec) Marshal() (dAtA []byte, err error) { @@ -466,6 +529,41 @@ func (m *AppTemplateSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *DependencyType) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *DependencyType) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *DependencyType) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Package != nil { + { + size, err := m.Package.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + func (m *IncludedSoftware) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -575,6 +673,39 @@ func (m *Package) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *PackageDependency) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *PackageDependency) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PackageDependency) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + i -= len(m.Version) + copy(dAtA[i:], m.Version) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.Version))) + i-- + dAtA[i] = 0x12 + i -= len(m.RefName) + copy(dAtA[i:], m.RefName) + i = encodeVarintGenerated(dAtA, i, uint64(len(m.RefName))) + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + func (m *PackageList) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -808,6 +939,20 @@ func (m *PackageSpec) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if len(m.Dependencies) > 0 { + for iNdEx := len(m.Dependencies) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Dependencies[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenerated(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x62 + } + } if m.KubernetesVersionSelection != nil { { size, err := m.KubernetesVersionSelection.MarshalToSizedBuffer(dAtA[:i]) @@ -993,6 +1138,19 @@ func (m *AppTemplateSpec) Size() (n int) { return n } +func (m *DependencyType) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Package != nil { + l = m.Package.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + return n +} + func (m *IncludedSoftware) Size() (n int) { if m == nil { return 0 @@ -1032,6 +1190,19 @@ func (m *Package) Size() (n int) { return n } +func (m *PackageDependency) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.RefName) + n += 1 + l + sovGenerated(uint64(l)) + l = len(m.Version) + n += 1 + l + sovGenerated(uint64(l)) + return n +} + func (m *PackageList) Size() (n int) { if m == nil { return 0 @@ -1152,6 +1323,12 @@ func (m *PackageSpec) Size() (n int) { l = m.KubernetesVersionSelection.Size() n += 1 + l + sovGenerated(uint64(l)) } + if len(m.Dependencies) > 0 { + for _, e := range m.Dependencies { + l = e.Size() + n += 1 + l + sovGenerated(uint64(l)) + } + } return n } @@ -1193,6 +1370,16 @@ func (this *AppTemplateSpec) String() string { }, "") return s } +func (this *DependencyType) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&DependencyType{`, + `Package:` + strings.Replace(this.Package.String(), "PackageDependency", "PackageDependency", 1) + `,`, + `}`, + }, "") + return s +} func (this *IncludedSoftware) String() string { if this == nil { return "nil" @@ -1226,6 +1413,17 @@ func (this *Package) String() string { }, "") return s } +func (this *PackageDependency) String() string { + if this == nil { + return "nil" + } + s := strings.Join([]string{`&PackageDependency{`, + `RefName:` + fmt.Sprintf("%v", this.RefName) + `,`, + `Version:` + fmt.Sprintf("%v", this.Version) + `,`, + `}`, + }, "") + return s +} func (this *PackageList) String() string { if this == nil { return "nil" @@ -1300,6 +1498,11 @@ func (this *PackageSpec) String() string { repeatedStringForIncludedSoftware += strings.Replace(strings.Replace(f.String(), "IncludedSoftware", "IncludedSoftware", 1), `&`, ``, 1) + "," } repeatedStringForIncludedSoftware += "}" + repeatedStringForDependencies := "[]DependencyType{" + for _, f := range this.Dependencies { + repeatedStringForDependencies += strings.Replace(strings.Replace(f.String(), "DependencyType", "DependencyType", 1), `&`, ``, 1) + "," + } + repeatedStringForDependencies += "}" s := strings.Join([]string{`&PackageSpec{`, `RefName:` + fmt.Sprintf("%v", this.RefName) + `,`, `Version:` + fmt.Sprintf("%v", this.Version) + `,`, @@ -1312,6 +1515,7 @@ func (this *PackageSpec) String() string { `IncludedSoftware:` + repeatedStringForIncludedSoftware + `,`, `KappControllerVersionSelection:` + strings.Replace(this.KappControllerVersionSelection.String(), "VersionSelection", "VersionSelection", 1) + `,`, `KubernetesVersionSelection:` + strings.Replace(this.KubernetesVersionSelection.String(), "VersionSelection", "VersionSelection", 1) + `,`, + `Dependencies:` + repeatedStringForDependencies + `,`, `}`, }, "") return s @@ -1430,6 +1634,92 @@ func (m *AppTemplateSpec) Unmarshal(dAtA []byte) error { } return nil } +func (m *DependencyType) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DependencyType: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DependencyType: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Package", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Package == nil { + m.Package = &PackageDependency{} + } + if err := m.Package.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *IncludedSoftware) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -1774,6 +2064,120 @@ func (m *Package) Unmarshal(dAtA []byte) error { } return nil } +func (m *PackageDependency) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: PackageDependency: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PackageDependency: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RefName", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.RefName = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Version = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenerated(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenerated + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func (m *PackageList) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 @@ -2826,6 +3230,40 @@ func (m *PackageSpec) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 12: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Dependencies", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenerated + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenerated + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenerated + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Dependencies = append(m.Dependencies, DependencyType{}) + if err := m.Dependencies[len(m.Dependencies)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenerated(dAtA[iNdEx:]) diff --git a/pkg/apiserver/apis/datapackaging/v1alpha1/generated.proto b/pkg/apiserver/apis/datapackaging/v1alpha1/generated.proto index 642485bf1..b06195216 100644 --- a/pkg/apiserver/apis/datapackaging/v1alpha1/generated.proto +++ b/pkg/apiserver/apis/datapackaging/v1alpha1/generated.proto @@ -17,6 +17,11 @@ message AppTemplateSpec { optional github.com.vmware_tanzu.carvel_kapp_controller.pkg.apis.kappctrl.v1alpha1.AppSpec spec = 1; } +// DependencyType contains the list of type of depencies +message DependencyType { + optional PackageDependency package = 1; +} + // IncludedSoftware contains the underlying Software Contents of a Package message IncludedSoftware { optional string displayName = 1; @@ -40,6 +45,19 @@ message Package { optional PackageSpec spec = 2; } +// PackageDependency contains package dependency related info +message PackageDependency { + // The name of the PackageMetadata associated with this dependency + // Must be a valid PackageMetadata name (see PackageMetadata CR for details) + // Cannot be empty + optional string refName = 1; + + // Package version; Will be Referenced by PackageInstall; + // Must be valid semver (required) + // Cannot be empty + optional string version = 2; +} + // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object message PackageList { // Standard list metadata. @@ -93,6 +111,9 @@ message PackageSpec { optional string version = 2; + // List of dependencies to be resolved + repeated DependencyType dependencies = 12; + repeated string licenses = 3; // +optional diff --git a/pkg/apiserver/apis/datapackaging/v1alpha1/types.go b/pkg/apiserver/apis/datapackaging/v1alpha1/types.go index 7df844104..b7216c4cb 100644 --- a/pkg/apiserver/apis/datapackaging/v1alpha1/types.go +++ b/pkg/apiserver/apis/datapackaging/v1alpha1/types.go @@ -58,9 +58,11 @@ type PackageMetadataList struct { } type PackageSpec struct { - RefName string `json:"refName,omitempty" protobuf:"bytes,1,opt,name=refName"` - Version string `json:"version,omitempty" protobuf:"bytes,2,opt,name=version"` - Licenses []string `json:"licenses,omitempty" protobuf:"bytes,3,rep,name=licenses"` + RefName string `json:"refName,omitempty" protobuf:"bytes,1,opt,name=refName"` + Version string `json:"version,omitempty" protobuf:"bytes,2,opt,name=version"` + // List of dependencies to be resolved + Dependencies []DependencyType `json:"dependencies,omitempty" protobuf:"bytes,12,rep,name=dependencies"` + Licenses []string `json:"licenses,omitempty" protobuf:"bytes,3,rep,name=licenses"` // +optional // +nullable ReleasedAt metav1.Time `json:"releasedAt,omitempty" protobuf:"bytes,4,opt,name=releasedAt"` @@ -125,3 +127,20 @@ type IncludedSoftware struct { Version string `json:"version,omitempty" protobuf:"bytes,2,opt,name=version"` Description string `json:"description,omitempty" protobuf:"bytes,3,opt,name=description"` } + +// DependencyType contains the list of type of depencies +type DependencyType struct { + Package *PackageDependency `json:"package,omitempty" protobuf:"bytes,1,opt,name=package"` +} + +// PackageDependency contains package dependency related info +type PackageDependency struct { + // The name of the PackageMetadata associated with this dependency + // Must be a valid PackageMetadata name (see PackageMetadata CR for details) + // Cannot be empty + RefName string `json:"refName,omitempty" protobuf:"bytes,1,opt,name=refName"` + // Package version; Will be Referenced by PackageInstall; + // Must be valid semver (required) + // Cannot be empty + Version string `json:"version,omitempty" protobuf:"bytes,2,opt,name=version"` +} diff --git a/pkg/apiserver/apis/datapackaging/v1alpha1/zz_generated.conversion.go b/pkg/apiserver/apis/datapackaging/v1alpha1/zz_generated.conversion.go index e7e38a148..560d3fda5 100644 --- a/pkg/apiserver/apis/datapackaging/v1alpha1/zz_generated.conversion.go +++ b/pkg/apiserver/apis/datapackaging/v1alpha1/zz_generated.conversion.go @@ -31,6 +31,16 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } + if err := s.AddGeneratedConversionFunc((*DependencyType)(nil), (*datapackaging.DependencyType)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_DependencyType_To_datapackaging_DependencyType(a.(*DependencyType), b.(*datapackaging.DependencyType), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*datapackaging.DependencyType)(nil), (*DependencyType)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_datapackaging_DependencyType_To_v1alpha1_DependencyType(a.(*datapackaging.DependencyType), b.(*DependencyType), scope) + }); err != nil { + return err + } if err := s.AddGeneratedConversionFunc((*IncludedSoftware)(nil), (*datapackaging.IncludedSoftware)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1alpha1_IncludedSoftware_To_datapackaging_IncludedSoftware(a.(*IncludedSoftware), b.(*datapackaging.IncludedSoftware), scope) }); err != nil { @@ -61,6 +71,16 @@ func RegisterConversions(s *runtime.Scheme) error { }); err != nil { return err } + if err := s.AddGeneratedConversionFunc((*PackageDependency)(nil), (*datapackaging.PackageDependency)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_v1alpha1_PackageDependency_To_datapackaging_PackageDependency(a.(*PackageDependency), b.(*datapackaging.PackageDependency), scope) + }); err != nil { + return err + } + if err := s.AddGeneratedConversionFunc((*datapackaging.PackageDependency)(nil), (*PackageDependency)(nil), func(a, b interface{}, scope conversion.Scope) error { + return Convert_datapackaging_PackageDependency_To_v1alpha1_PackageDependency(a.(*datapackaging.PackageDependency), b.(*PackageDependency), scope) + }); err != nil { + return err + } if err := s.AddGeneratedConversionFunc((*PackageList)(nil), (*datapackaging.PackageList)(nil), func(a, b interface{}, scope conversion.Scope) error { return Convert_v1alpha1_PackageList_To_datapackaging_PackageList(a.(*PackageList), b.(*datapackaging.PackageList), scope) }); err != nil { @@ -154,6 +174,26 @@ func Convert_datapackaging_AppTemplateSpec_To_v1alpha1_AppTemplateSpec(in *datap return autoConvert_datapackaging_AppTemplateSpec_To_v1alpha1_AppTemplateSpec(in, out, s) } +func autoConvert_v1alpha1_DependencyType_To_datapackaging_DependencyType(in *DependencyType, out *datapackaging.DependencyType, s conversion.Scope) error { + out.Package = (*datapackaging.PackageDependency)(unsafe.Pointer(in.Package)) + return nil +} + +// Convert_v1alpha1_DependencyType_To_datapackaging_DependencyType is an autogenerated conversion function. +func Convert_v1alpha1_DependencyType_To_datapackaging_DependencyType(in *DependencyType, out *datapackaging.DependencyType, s conversion.Scope) error { + return autoConvert_v1alpha1_DependencyType_To_datapackaging_DependencyType(in, out, s) +} + +func autoConvert_datapackaging_DependencyType_To_v1alpha1_DependencyType(in *datapackaging.DependencyType, out *DependencyType, s conversion.Scope) error { + out.Package = (*PackageDependency)(unsafe.Pointer(in.Package)) + return nil +} + +// Convert_datapackaging_DependencyType_To_v1alpha1_DependencyType is an autogenerated conversion function. +func Convert_datapackaging_DependencyType_To_v1alpha1_DependencyType(in *datapackaging.DependencyType, out *DependencyType, s conversion.Scope) error { + return autoConvert_datapackaging_DependencyType_To_v1alpha1_DependencyType(in, out, s) +} + func autoConvert_v1alpha1_IncludedSoftware_To_datapackaging_IncludedSoftware(in *IncludedSoftware, out *datapackaging.IncludedSoftware, s conversion.Scope) error { out.DisplayName = in.DisplayName out.Version = in.Version @@ -224,6 +264,28 @@ func Convert_datapackaging_Package_To_v1alpha1_Package(in *datapackaging.Package return autoConvert_datapackaging_Package_To_v1alpha1_Package(in, out, s) } +func autoConvert_v1alpha1_PackageDependency_To_datapackaging_PackageDependency(in *PackageDependency, out *datapackaging.PackageDependency, s conversion.Scope) error { + out.RefName = in.RefName + out.Version = in.Version + return nil +} + +// Convert_v1alpha1_PackageDependency_To_datapackaging_PackageDependency is an autogenerated conversion function. +func Convert_v1alpha1_PackageDependency_To_datapackaging_PackageDependency(in *PackageDependency, out *datapackaging.PackageDependency, s conversion.Scope) error { + return autoConvert_v1alpha1_PackageDependency_To_datapackaging_PackageDependency(in, out, s) +} + +func autoConvert_datapackaging_PackageDependency_To_v1alpha1_PackageDependency(in *datapackaging.PackageDependency, out *PackageDependency, s conversion.Scope) error { + out.RefName = in.RefName + out.Version = in.Version + return nil +} + +// Convert_datapackaging_PackageDependency_To_v1alpha1_PackageDependency is an autogenerated conversion function. +func Convert_datapackaging_PackageDependency_To_v1alpha1_PackageDependency(in *datapackaging.PackageDependency, out *PackageDependency, s conversion.Scope) error { + return autoConvert_datapackaging_PackageDependency_To_v1alpha1_PackageDependency(in, out, s) +} + func autoConvert_v1alpha1_PackageList_To_datapackaging_PackageList(in *PackageList, out *datapackaging.PackageList, s conversion.Scope) error { out.ListMeta = in.ListMeta out.Items = *(*[]datapackaging.Package)(unsafe.Pointer(&in.Items)) @@ -331,6 +393,7 @@ func Convert_datapackaging_PackageMetadataSpec_To_v1alpha1_PackageMetadataSpec(i func autoConvert_v1alpha1_PackageSpec_To_datapackaging_PackageSpec(in *PackageSpec, out *datapackaging.PackageSpec, s conversion.Scope) error { out.RefName = in.RefName out.Version = in.Version + out.Dependencies = *(*[]datapackaging.DependencyType)(unsafe.Pointer(&in.Dependencies)) out.Licenses = *(*[]string)(unsafe.Pointer(&in.Licenses)) out.ReleasedAt = in.ReleasedAt out.CapactiyRequirementsDescription = in.CapactiyRequirementsDescription @@ -355,6 +418,7 @@ func Convert_v1alpha1_PackageSpec_To_datapackaging_PackageSpec(in *PackageSpec, func autoConvert_datapackaging_PackageSpec_To_v1alpha1_PackageSpec(in *datapackaging.PackageSpec, out *PackageSpec, s conversion.Scope) error { out.RefName = in.RefName out.Version = in.Version + out.Dependencies = *(*[]DependencyType)(unsafe.Pointer(&in.Dependencies)) out.Licenses = *(*[]string)(unsafe.Pointer(&in.Licenses)) out.ReleasedAt = in.ReleasedAt out.CapactiyRequirementsDescription = in.CapactiyRequirementsDescription diff --git a/pkg/apiserver/apis/datapackaging/v1alpha1/zz_generated.deepcopy.go b/pkg/apiserver/apis/datapackaging/v1alpha1/zz_generated.deepcopy.go index f42edfdf5..e6d88a85d 100644 --- a/pkg/apiserver/apis/datapackaging/v1alpha1/zz_generated.deepcopy.go +++ b/pkg/apiserver/apis/datapackaging/v1alpha1/zz_generated.deepcopy.go @@ -31,6 +31,27 @@ func (in *AppTemplateSpec) DeepCopy() *AppTemplateSpec { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DependencyType) DeepCopyInto(out *DependencyType) { + *out = *in + if in.Package != nil { + in, out := &in.Package, &out.Package + *out = new(PackageDependency) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DependencyType. +func (in *DependencyType) DeepCopy() *DependencyType { + if in == nil { + return nil + } + out := new(DependencyType) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *IncludedSoftware) DeepCopyInto(out *IncludedSoftware) { *out = *in @@ -90,6 +111,22 @@ func (in *Package) DeepCopyObject() runtime.Object { return nil } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PackageDependency) DeepCopyInto(out *PackageDependency) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PackageDependency. +func (in *PackageDependency) DeepCopy() *PackageDependency { + if in == nil { + return nil + } + out := new(PackageDependency) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *PackageList) DeepCopyInto(out *PackageList) { *out = *in @@ -212,6 +249,13 @@ func (in *PackageMetadataSpec) DeepCopy() *PackageMetadataSpec { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *PackageSpec) DeepCopyInto(out *PackageSpec) { *out = *in + if in.Dependencies != nil { + in, out := &in.Dependencies, &out.Dependencies + *out = make([]DependencyType, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } if in.Licenses != nil { in, out := &in.Licenses, &out.Licenses *out = make([]string, len(*in)) diff --git a/pkg/apiserver/apis/datapackaging/zz_generated.deepcopy.go b/pkg/apiserver/apis/datapackaging/zz_generated.deepcopy.go index 64f5f0100..7c711cedc 100644 --- a/pkg/apiserver/apis/datapackaging/zz_generated.deepcopy.go +++ b/pkg/apiserver/apis/datapackaging/zz_generated.deepcopy.go @@ -31,6 +31,27 @@ func (in *AppTemplateSpec) DeepCopy() *AppTemplateSpec { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *DependencyType) DeepCopyInto(out *DependencyType) { + *out = *in + if in.Package != nil { + in, out := &in.Package, &out.Package + *out = new(PackageDependency) + **out = **in + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DependencyType. +func (in *DependencyType) DeepCopy() *DependencyType { + if in == nil { + return nil + } + out := new(DependencyType) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *IncludedSoftware) DeepCopyInto(out *IncludedSoftware) { *out = *in @@ -90,6 +111,22 @@ func (in *Package) DeepCopyObject() runtime.Object { return nil } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *PackageDependency) DeepCopyInto(out *PackageDependency) { + *out = *in + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PackageDependency. +func (in *PackageDependency) DeepCopy() *PackageDependency { + if in == nil { + return nil + } + out := new(PackageDependency) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *PackageList) DeepCopyInto(out *PackageList) { *out = *in @@ -212,6 +249,13 @@ func (in *PackageMetadataSpec) DeepCopy() *PackageMetadataSpec { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *PackageSpec) DeepCopyInto(out *PackageSpec) { *out = *in + if in.Dependencies != nil { + in, out := &in.Dependencies, &out.Dependencies + *out = make([]DependencyType, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } if in.Licenses != nil { in, out := &in.Licenses, &out.Licenses *out = make([]string, len(*in)) diff --git a/pkg/apiserver/openapi/zz_generated.openapi.go b/pkg/apiserver/openapi/zz_generated.openapi.go index 78c4d08d1..9c38cdbcf 100644 --- a/pkg/apiserver/openapi/zz_generated.openapi.go +++ b/pkg/apiserver/openapi/zz_generated.openapi.go @@ -53,9 +53,11 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA "github.com/vmware-tanzu/carvel-kapp-controller/pkg/apis/kappctrl/v1alpha1.KubernetesAPIs": schema_pkg_apis_kappctrl_v1alpha1_KubernetesAPIs(ref), "github.com/vmware-tanzu/carvel-kapp-controller/pkg/apis/kappctrl/v1alpha1.Version": schema_pkg_apis_kappctrl_v1alpha1_Version(ref), "github.com/vmware-tanzu/carvel-kapp-controller/pkg/apiserver/apis/datapackaging/v1alpha1.AppTemplateSpec": schema_apiserver_apis_datapackaging_v1alpha1_AppTemplateSpec(ref), + "github.com/vmware-tanzu/carvel-kapp-controller/pkg/apiserver/apis/datapackaging/v1alpha1.DependencyType": schema_apiserver_apis_datapackaging_v1alpha1_DependencyType(ref), "github.com/vmware-tanzu/carvel-kapp-controller/pkg/apiserver/apis/datapackaging/v1alpha1.IncludedSoftware": schema_apiserver_apis_datapackaging_v1alpha1_IncludedSoftware(ref), "github.com/vmware-tanzu/carvel-kapp-controller/pkg/apiserver/apis/datapackaging/v1alpha1.Maintainer": schema_apiserver_apis_datapackaging_v1alpha1_Maintainer(ref), "github.com/vmware-tanzu/carvel-kapp-controller/pkg/apiserver/apis/datapackaging/v1alpha1.Package": schema_apiserver_apis_datapackaging_v1alpha1_Package(ref), + "github.com/vmware-tanzu/carvel-kapp-controller/pkg/apiserver/apis/datapackaging/v1alpha1.PackageDependency": schema_apiserver_apis_datapackaging_v1alpha1_PackageDependency(ref), "github.com/vmware-tanzu/carvel-kapp-controller/pkg/apiserver/apis/datapackaging/v1alpha1.PackageList": schema_apiserver_apis_datapackaging_v1alpha1_PackageList(ref), "github.com/vmware-tanzu/carvel-kapp-controller/pkg/apiserver/apis/datapackaging/v1alpha1.PackageMetadata": schema_apiserver_apis_datapackaging_v1alpha1_PackageMetadata(ref), "github.com/vmware-tanzu/carvel-kapp-controller/pkg/apiserver/apis/datapackaging/v1alpha1.PackageMetadataList": schema_apiserver_apis_datapackaging_v1alpha1_PackageMetadataList(ref), @@ -1644,6 +1646,26 @@ func schema_apiserver_apis_datapackaging_v1alpha1_AppTemplateSpec(ref common.Ref } } +func schema_apiserver_apis_datapackaging_v1alpha1_DependencyType(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "DependencyType contains the list of type of depencies", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "package": { + SchemaProps: spec.SchemaProps{ + Ref: ref("github.com/vmware-tanzu/carvel-kapp-controller/pkg/apiserver/apis/datapackaging/v1alpha1.PackageDependency"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "github.com/vmware-tanzu/carvel-kapp-controller/pkg/apiserver/apis/datapackaging/v1alpha1.PackageDependency"}, + } +} + func schema_apiserver_apis_datapackaging_v1alpha1_IncludedSoftware(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ @@ -1735,6 +1757,33 @@ func schema_apiserver_apis_datapackaging_v1alpha1_Package(ref common.ReferenceCa } } +func schema_apiserver_apis_datapackaging_v1alpha1_PackageDependency(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "PackageDependency contains package dependency related info", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "refName": { + SchemaProps: spec.SchemaProps{ + Description: "The name of the PackageMetadata associated with this dependency Must be a valid PackageMetadata name (see PackageMetadata CR for details) Cannot be empty", + Type: []string{"string"}, + Format: "", + }, + }, + "version": { + SchemaProps: spec.SchemaProps{ + Description: "Package version; Will be Referenced by PackageInstall; Must be valid semver (required) Cannot be empty", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + } +} + func schema_apiserver_apis_datapackaging_v1alpha1_PackageList(ref common.ReferenceCallback) common.OpenAPIDefinition { return common.OpenAPIDefinition{ Schema: spec.Schema{ @@ -1970,6 +2019,20 @@ func schema_apiserver_apis_datapackaging_v1alpha1_PackageSpec(ref common.Referen Format: "", }, }, + "dependencies": { + SchemaProps: spec.SchemaProps{ + Description: "List of dependencies to be resolved", + Type: []string{"array"}, + Items: &spec.SchemaOrArray{ + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: map[string]interface{}{}, + Ref: ref("github.com/vmware-tanzu/carvel-kapp-controller/pkg/apiserver/apis/datapackaging/v1alpha1.DependencyType"), + }, + }, + }, + }, + }, "licenses": { SchemaProps: spec.SchemaProps{ Type: []string{"array"}, @@ -2045,7 +2108,7 @@ func schema_apiserver_apis_datapackaging_v1alpha1_PackageSpec(ref common.Referen }, }, Dependencies: []string{ - "github.com/vmware-tanzu/carvel-kapp-controller/pkg/apiserver/apis/datapackaging/v1alpha1.AppTemplateSpec", "github.com/vmware-tanzu/carvel-kapp-controller/pkg/apiserver/apis/datapackaging/v1alpha1.IncludedSoftware", "github.com/vmware-tanzu/carvel-kapp-controller/pkg/apiserver/apis/datapackaging/v1alpha1.ValuesSchema", "github.com/vmware-tanzu/carvel-kapp-controller/pkg/apiserver/apis/datapackaging/v1alpha1.VersionSelection", "k8s.io/apimachinery/pkg/apis/meta/v1.Time"}, + "github.com/vmware-tanzu/carvel-kapp-controller/pkg/apiserver/apis/datapackaging/v1alpha1.AppTemplateSpec", "github.com/vmware-tanzu/carvel-kapp-controller/pkg/apiserver/apis/datapackaging/v1alpha1.DependencyType", "github.com/vmware-tanzu/carvel-kapp-controller/pkg/apiserver/apis/datapackaging/v1alpha1.IncludedSoftware", "github.com/vmware-tanzu/carvel-kapp-controller/pkg/apiserver/apis/datapackaging/v1alpha1.ValuesSchema", "github.com/vmware-tanzu/carvel-kapp-controller/pkg/apiserver/apis/datapackaging/v1alpha1.VersionSelection", "k8s.io/apimachinery/pkg/apis/meta/v1.Time"}, } } diff --git a/pkg/packageinstall/packageinstall.go b/pkg/packageinstall/packageinstall.go index b5aba623d..7bd02eb45 100644 --- a/pkg/packageinstall/packageinstall.go +++ b/pkg/packageinstall/packageinstall.go @@ -168,6 +168,14 @@ func (pi *PackageInstallCR) reconcile(modelStatus *reconciler.Status) (reconcile pi.model.Status.LastAttemptedVersion = pkg.Spec.Version + // Dependency resolution + if pi.model.Spec.Dependencies.Install { + err := pi.reconcileDependencies(pkg) + if err != nil { + return reconcile.Result{Requeue: true}, err + } + } + existingApp, err := pi.kcclient.KappctrlV1alpha1().Apps(pi.model.Namespace).Get( context.Background(), pi.model.Name, metav1.GetOptions{}) if err != nil { @@ -289,6 +297,10 @@ func (pi *PackageInstallCR) referencedPkgVersion() (datapkgingv1alpha1.Package, return datapkgingv1alpha1.Package{}, fmt.Errorf("Expected non-empty version selection") } + return pi.getPkgVersion(pi.model.Spec.PackageRef.RefName, semverConfig) +} + +func (pi PackageInstallCR) getPkgVersion(packageRef string, semverConfig *verv1alpha1.VersionSelectionSemver) (datapkgingv1alpha1.Package, error) { pkgList, err := pi.pkgclient.DataV1alpha1().Packages(pi.model.Namespace).List( context.Background(), metav1.ListOptions{}) if err != nil { @@ -303,7 +315,7 @@ func (pi *PackageInstallCR) referencedPkgVersion() (datapkgingv1alpha1.Package, requiresClusterVersion := false for _, pkg := range pkgList.Items { - if pkg.Spec.RefName == pi.model.Spec.PackageRef.RefName { + if pkg.Spec.RefName == packageRef { versionStrs = append(versionStrs, pkg.Spec.Version) versionToPkg[pkg.Spec.Version] = pkg @@ -358,7 +370,7 @@ func (pi *PackageInstallCR) referencedPkgVersion() (datapkgingv1alpha1.Package, } return datapkgingv1alpha1.Package{}, fmt.Errorf("Could not find package with name '%s' and version '%s'", - pi.model.Spec.PackageRef.RefName, selectedVersion) + packageRef, selectedVersion) } func (pi *PackageInstallCR) reconcileDelete(modelStatus *reconciler.Status) (reconcile.Result, error) { diff --git a/pkg/packageinstall/packageinstall_test.go b/pkg/packageinstall/packageinstall_test.go index 7a5c576e9..5480d0a46 100644 --- a/pkg/packageinstall/packageinstall_test.go +++ b/pkg/packageinstall/packageinstall_test.go @@ -705,3 +705,283 @@ func generatePackageWithConstraints(name, version, kcConstraint string, k8sConst }, } } + +func Test_Dependency_PackageInstallCreated(t *testing.T) { + pkg := datapkgingv1alpha1.Package{ + ObjectMeta: metav1.ObjectMeta{ + Name: "parent-pkg", + }, + Spec: datapkgingv1alpha1.PackageSpec{ + RefName: "parent-pkg", + Version: "1.0.0", + Template: datapkgingv1alpha1.AppTemplateSpec{ + Spec: &v1alpha1.AppSpec{ + Fetch: []v1alpha1.AppFetch{ + { + ImgpkgBundle: &v1alpha1.AppFetchImgpkgBundle{ + // Since no secretRef, we expect a placeholder secret + // to be created by kapp-controller. + Image: "foo/bar", + }, + }, + }, + }, + }, + Dependencies: []datapkgingv1alpha1.DependencyType{ + { + Package: &datapkgingv1alpha1.PackageDependency{ + RefName: "dependency-pkg", + Version: "1.0.0", + }, + }, + }, + }, + } + + dependencyPkg := datapkgingv1alpha1.Package{ + ObjectMeta: metav1.ObjectMeta{ + Name: "dependency-pkg", + }, + Spec: datapkgingv1alpha1.PackageSpec{ + RefName: "dependency-pkg", + Version: "1.0.0", + }, + } + + fakePkgClient := fakeapiserver.NewSimpleClientset(&pkg, &dependencyPkg) + + model := &pkgingv1alpha1.PackageInstall{ + ObjectMeta: metav1.ObjectMeta{ + Name: "parent-pkgi", + }, + Spec: pkgingv1alpha1.PackageInstallSpec{ + PackageRef: &pkgingv1alpha1.PackageRef{ + RefName: "parent-pkg", + VersionSelection: &versions.VersionSelectionSemver{ + Constraints: "1.0.0", + }, + }, + ServiceAccountName: "use-local-cluster-sa", // saname being present indicates use local cluster version + Dependencies: pkgingv1alpha1.Dependencies{ + // Expecting kapp controller to create pkgis for dependency package + Install: true, + }, + }, + } + + log := logf.Log.WithName("kc") + fakekctrl := fakekappctrl.NewSimpleClientset(model) + fakek8s := fake.NewSimpleClientset() + + // mock the kubernetes server version + fakeDiscovery, _ := fakek8s.Discovery().(*fakediscovery.FakeDiscovery) + fakeDiscovery.FakedServerVersion = &version.Info{ + GitVersion: "v0.20.0", + } + + ip := NewPackageInstallCR(model, log, fakekctrl, fakePkgClient, fakek8s, + FakeComponentInfo{KCVersion: semver.MustParse("0.42.31337")}, Opts{}, + metrics.NewMetrics()) + + _, err := ip.Reconcile() + assert.Nil(t, err) + + gvr := schema.GroupVersionResource{"", "v1", "secrets"} + obj, err := fakek8s.Tracker().Get(gvr, "", "parent-pkgi-fetch-0") + assert.Nil(t, err) + require.NotNil(t, obj) + secret := obj.(*corev1.Secret) + _, ok := secret.Annotations["secretgen.carvel.dev/image-pull-secret"] + assert.True(t, ok) + + gvr = schema.GroupVersionResource{"packaging.carvel.dev", "v1alpha1", "packageinstalls"} + obj, err = fakekctrl.Tracker().Get(gvr, "", "dependency-pkg.1.0.0") + require.NotNil(t, obj) + assert.Nil(t, err) + pkgi := obj.(*pkgingv1alpha1.PackageInstall) + require.Equal(t, pkgi.ObjectMeta.Annotations["kapp-controller.carvel.dev/owner"], "PackageInstall/parent-pkgi") +} + +func Test_Dependency_PackageInstall_NotCreated_On_Install_False(t *testing.T) { + pkg := datapkgingv1alpha1.Package{ + ObjectMeta: metav1.ObjectMeta{ + Name: "parent-pkg", + }, + Spec: datapkgingv1alpha1.PackageSpec{ + RefName: "parent-pkg", + Version: "1.0.0", + Template: datapkgingv1alpha1.AppTemplateSpec{ + Spec: &v1alpha1.AppSpec{ + Fetch: []v1alpha1.AppFetch{ + { + ImgpkgBundle: &v1alpha1.AppFetchImgpkgBundle{ + // Since no secretRef, we expect a placeholder secret + // to be created by kapp-controller. + Image: "foo/bar", + }, + }, + }, + }, + }, + Dependencies: []datapkgingv1alpha1.DependencyType{ + { + Package: &datapkgingv1alpha1.PackageDependency{ + RefName: "dependency-pkg", + Version: "1.0.0", + }, + }, + }, + }, + } + + dependencyPkg := datapkgingv1alpha1.Package{ + ObjectMeta: metav1.ObjectMeta{ + Name: "dependency-pkg", + }, + Spec: datapkgingv1alpha1.PackageSpec{ + RefName: "dependency-pkg", + Version: "1.0.0", + }, + } + + fakePkgClient := fakeapiserver.NewSimpleClientset(&pkg, &dependencyPkg) + + model := &pkgingv1alpha1.PackageInstall{ + ObjectMeta: metav1.ObjectMeta{ + Name: "parent-pkgi", + }, + Spec: pkgingv1alpha1.PackageInstallSpec{ + PackageRef: &pkgingv1alpha1.PackageRef{ + RefName: "parent-pkg", + VersionSelection: &versions.VersionSelectionSemver{ + Constraints: "1.0.0", + }, + }, + ServiceAccountName: "use-local-cluster-sa", // saname being present indicates use local cluster version + Dependencies: pkgingv1alpha1.Dependencies{ + // Expecting kapp controller to ignore creating dependency packages + Install: false, + }, + }, + } + + log := logf.Log.WithName("kc") + fakekctrl := fakekappctrl.NewSimpleClientset(model) + fakek8s := fake.NewSimpleClientset() + + // mock the kubernetes server version + fakeDiscovery, _ := fakek8s.Discovery().(*fakediscovery.FakeDiscovery) + fakeDiscovery.FakedServerVersion = &version.Info{ + GitVersion: "v0.20.0", + } + + ip := NewPackageInstallCR(model, log, fakekctrl, fakePkgClient, fakek8s, + FakeComponentInfo{KCVersion: semver.MustParse("0.42.31337")}, Opts{}, + metrics.NewMetrics()) + + _, err := ip.Reconcile() + assert.Nil(t, err) + + gvr := schema.GroupVersionResource{"", "v1", "secrets"} + obj, err := fakek8s.Tracker().Get(gvr, "", "parent-pkgi-fetch-0") + assert.Nil(t, err) + require.NotNil(t, obj) + secret := obj.(*corev1.Secret) + _, ok := secret.Annotations["secretgen.carvel.dev/image-pull-secret"] + assert.True(t, ok) + + gvr = schema.GroupVersionResource{"packaging.carvel.dev", "v1alpha1", "packageinstalls"} + obj, err = fakekctrl.Tracker().Get(gvr, "", "dependency-pkg.1.0.0") + require.Nil(t, obj) + require.Error(t, err, "packageinstalls.packaging.carvel.dev \"dependency-pkg.1.0.0\" not found") +} + +func Test_Dependency_PackageInstall_NotCreated_By_Default(t *testing.T) { + pkg := datapkgingv1alpha1.Package{ + ObjectMeta: metav1.ObjectMeta{ + Name: "parent-pkg", + }, + Spec: datapkgingv1alpha1.PackageSpec{ + RefName: "parent-pkg", + Version: "1.0.0", + Template: datapkgingv1alpha1.AppTemplateSpec{ + Spec: &v1alpha1.AppSpec{ + Fetch: []v1alpha1.AppFetch{ + { + ImgpkgBundle: &v1alpha1.AppFetchImgpkgBundle{ + // Since no secretRef, we expect a placeholder secret + // to be created by kapp-controller. + Image: "foo/bar", + }, + }, + }, + }, + }, + Dependencies: []datapkgingv1alpha1.DependencyType{ + { + Package: &datapkgingv1alpha1.PackageDependency{ + RefName: "dependency-pkg", + Version: "1.0.0", + }, + }, + }, + }, + } + + dependencyPkg := datapkgingv1alpha1.Package{ + ObjectMeta: metav1.ObjectMeta{ + Name: "dependency-pkg", + }, + Spec: datapkgingv1alpha1.PackageSpec{ + RefName: "dependency-pkg", + Version: "1.0.0", + }, + } + + fakePkgClient := fakeapiserver.NewSimpleClientset(&pkg, &dependencyPkg) + + model := &pkgingv1alpha1.PackageInstall{ + ObjectMeta: metav1.ObjectMeta{ + Name: "parent-pkgi", + }, + Spec: pkgingv1alpha1.PackageInstallSpec{ + PackageRef: &pkgingv1alpha1.PackageRef{ + RefName: "parent-pkg", + VersionSelection: &versions.VersionSelectionSemver{ + Constraints: "1.0.0", + }, + }, + ServiceAccountName: "use-local-cluster-sa", // saname being present indicates use local cluster version + }, + } + + log := logf.Log.WithName("kc") + fakekctrl := fakekappctrl.NewSimpleClientset(model) + fakek8s := fake.NewSimpleClientset() + + // mock the kubernetes server version + fakeDiscovery, _ := fakek8s.Discovery().(*fakediscovery.FakeDiscovery) + fakeDiscovery.FakedServerVersion = &version.Info{ + GitVersion: "v0.20.0", + } + + ip := NewPackageInstallCR(model, log, fakekctrl, fakePkgClient, fakek8s, + FakeComponentInfo{KCVersion: semver.MustParse("0.42.31337")}, Opts{}, + metrics.NewMetrics()) + + _, err := ip.Reconcile() + assert.Nil(t, err) + + gvr := schema.GroupVersionResource{"", "v1", "secrets"} + obj, err := fakek8s.Tracker().Get(gvr, "", "parent-pkgi-fetch-0") + assert.Nil(t, err) + require.NotNil(t, obj) + secret := obj.(*corev1.Secret) + _, ok := secret.Annotations["secretgen.carvel.dev/image-pull-secret"] + assert.True(t, ok) + + gvr = schema.GroupVersionResource{"packaging.carvel.dev", "v1alpha1", "packageinstalls"} + obj, err = fakekctrl.Tracker().Get(gvr, "", "dependency-pkg.1.0.0") + require.Nil(t, obj) + require.Error(t, err, "packageinstalls.packaging.carvel.dev \"dependency-pkg.1.0.0\" not found") +} From 6a84407e75e2843296b478a78b7d81305f482e9d Mon Sep 17 00:00:00 2001 From: rcmadhankumar Date: Wed, 14 Feb 2024 15:11:09 +0530 Subject: [PATCH 2/3] Dependencies added Signed-off-by: rcmadhankumar --- pkg/packageinstall/dependencies.go | 78 ++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 pkg/packageinstall/dependencies.go diff --git a/pkg/packageinstall/dependencies.go b/pkg/packageinstall/dependencies.go new file mode 100644 index 000000000..504f190d6 --- /dev/null +++ b/pkg/packageinstall/dependencies.go @@ -0,0 +1,78 @@ +// Copyright 2023 VMware, Inc. +// SPDX-License-Identifier: Apache-2.0 + +package packageinstall + +import ( + "context" + "fmt" + + packagingv1alpha1 "github.com/vmware-tanzu/carvel-kapp-controller/pkg/apis/packaging/v1alpha1" + "github.com/vmware-tanzu/carvel-kapp-controller/pkg/apiserver/apis/datapackaging/v1alpha1" + versionsv1alpha1 "github.com/vmware-tanzu/carvel-vendir/pkg/vendir/versions/v1alpha1" + "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +func (pi *PackageInstallCR) reconcileDependencies(pkg v1alpha1.Package) error { + var dependencyList []v1alpha1.Package + // Check if packages exist in the cluster + for _, dep := range pkg.Spec.Dependencies { + + if dep.Package != nil { + pkg, err := pi.getPkgVersion(dep.Package.RefName, &versionsv1alpha1.VersionSelectionSemver{ + Constraints: dep.Package.Version, + }) + if err != nil { + if errors.IsNotFound(err) { + continue + } + return err + } + dependencyList = append(dependencyList, pkg) + } + + } + + // Check if the packages are installed + for _, dep := range dependencyList { + pkgiName := dep.Spec.RefName + "." + dep.Spec.Version + pkgi, err := pi.kcclient.PackagingV1alpha1().PackageInstalls(pi.model.Namespace).Get(context.TODO(), pkgiName, metav1.GetOptions{}) + if err != nil { + if !errors.IsNotFound(err) { + // do we need to ignore this and continue? + return err + } + + pkgi = &packagingv1alpha1.PackageInstall{ + TypeMeta: pi.model.TypeMeta, + ObjectMeta: metav1.ObjectMeta{ + Name: pkgiName, + Namespace: pi.model.Namespace, + Annotations: map[string]string{ + "kapp-controller.carvel.dev/owner": "PackageInstall/" + pi.model.Name, + }, + }, + Spec: packagingv1alpha1.PackageInstallSpec{ + ServiceAccountName: pi.model.Spec.ServiceAccountName, + PackageRef: &packagingv1alpha1.PackageRef{ + RefName: dep.Spec.RefName, + VersionSelection: &versionsv1alpha1.VersionSelectionSemver{ + Constraints: dep.Spec.Version, + }, + }, + DefaultNamespace: pi.model.Spec.DefaultNamespace, + Dependencies: packagingv1alpha1.Dependencies{}, + }, + } + + _, err = pi.kcclient.PackagingV1alpha1().PackageInstalls(pi.model.Namespace).Create(context.TODO(), pkgi, metav1.CreateOptions{}) + if err != nil { + // do we need to ignore this and continue? + return fmt.Errorf("Unable to create the packageinstall for the package %s: %s", dep.Name, err) + } + } + + } + return nil +} From a491dc6abc7ab7cb9f4f43dc9da7d74f3d3fd717 Mon Sep 17 00:00:00 2001 From: rcmadhankumar Date: Wed, 14 Feb 2024 15:29:21 +0530 Subject: [PATCH 3/3] fix - exported type Dependencies should have comment or be unexported Signed-off-by: rcmadhankumar --- config/config/crds.yml | 1 - pkg/apis/packaging/v1alpha1/package_install.go | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/config/config/crds.yml b/config/config/crds.yml index 9ac4c7589..ae7735d70 100644 --- a/config/config/crds.yml +++ b/config/config/crds.yml @@ -1532,7 +1532,6 @@ spec: description: Dependencies can be controlled through this section properties: install: - description: Indicates whether to install depencies along with or not type: boolean type: object noopDelete: diff --git a/pkg/apis/packaging/v1alpha1/package_install.go b/pkg/apis/packaging/v1alpha1/package_install.go index 4da2fb497..d15297f47 100644 --- a/pkg/apis/packaging/v1alpha1/package_install.go +++ b/pkg/apis/packaging/v1alpha1/package_install.go @@ -115,8 +115,8 @@ type PackageInstallStatus struct { LastAttemptedVersion string `json:"lastAttemptedVersion,omitempty"` } +// Dependencies controls whether to install depency packages along with the current package or not type Dependencies struct { - // Indicates whether to install depencies along with or not // +optional Install bool `json:"install,omitempty"` }