@@ -916,91 +916,117 @@ template API is shown below.
916
916
917
917
` ` ` go
918
918
type PackageVariantTemplate struct {
919
- // Downstream allows overriding the default downstream package and repository name
920
- // +optional
921
- Downstream *DownstreamTemplate ` json:"downstream,omitempty"`
922
-
923
- // AdoptionPolicy allows overriding the PackageVariant adoption policy
924
- // +optional
925
- AdoptionPolicy *pkgvarapi.AdoptionPolicy `json:"adoptionPolicy,omitempty"`
926
-
927
- // DeletionPolicy allows overriding the PackageVariant deletion policy
928
- // +optional
929
- DeletionPolicy *pkgvarapi.DeletionPolicy `json:"deletionPolicy,omitempty"`
930
-
931
- // Labels allows specifying the spec.Labels field of the generated PackageVariant
932
- // +optional
933
- Labels map[string]string `json:"labels,omitempty"`
934
-
935
- // LabelsExprs allows specifying the spec.Labels field of the generated PackageVariant
936
- // using CEL to dynamically create the keys and values. Entries in this field take precedent over
937
- // those with the same keys that are present in Labels.
938
- // +optional
939
- LabelExprs []MapExpr `json:"labelExprs,omitemtpy "`
940
-
941
- // Annotations allows specifying the spec.Annotations field of the generated PackageVariant
942
- // +optional
943
- Annotations map[string]string `json:"annotations,omitempty"`
944
-
945
- // AnnotationsExprs allows specifying the spec.Annotations field of the generated PackageVariant
946
- // using CEL to dynamically create the keys and values. Entries in this field take precedent over
947
- // those with the same keys that are present in Annotations.
948
- // +optional
949
- AnnotationExprs []MapExpr `json:"annotationExprs,omitempty"`
950
-
951
- // PackageContext allows specifying the spec.PackageContext field of the generated PackageVariant
952
- // +optional
953
- PackageContext *PackageContextTemplate `json:"packageContext,omitempty"`
954
-
955
- // Pipeline allows specifying the spec.Pipeline field of the generated PackageVariant
956
- // +optional
957
- Pipeline *kptfilev1.Pipeline `json:"pipeline,omitempty"`
958
-
959
- // Injectors allows specifying the spec.Injectors field of the generated PackageVariant
960
- // +optional
961
- Injectors []InjectionSelectorTemplate `json:"injectors,omitempty"`
919
+ // Downstream allows overriding the default downstream package and repository name
920
+ // +optional
921
+ Downstream *DownstreamTemplate ` json:"downstream,omitempty"`
922
+
923
+ // AdoptionPolicy allows overriding the PackageVariant adoption policy
924
+ // +optional
925
+ AdoptionPolicy *pkgvarapi.AdoptionPolicy `json:"adoptionPolicy,omitempty"`
926
+
927
+ // DeletionPolicy allows overriding the PackageVariant deletion policy
928
+ // +optional
929
+ DeletionPolicy *pkgvarapi.DeletionPolicy `json:"deletionPolicy,omitempty"`
930
+
931
+ // Labels allows specifying the spec.Labels field of the generated PackageVariant
932
+ // +optional
933
+ Labels map[string]string `json:"labels,omitempty"`
934
+
935
+ // LabelsExprs allows specifying the spec.Labels field of the generated PackageVariant
936
+ // using CEL to dynamically create the keys and values. Entries in this field take precedent over
937
+ // those with the same keys that are present in Labels.
938
+ // +optional
939
+ LabelExprs []MapExpr `json:"labelExprs,omitempty "`
940
+
941
+ // Annotations allows specifying the spec.Annotations field of the generated PackageVariant
942
+ // +optional
943
+ Annotations map[string]string `json:"annotations,omitempty"`
944
+
945
+ // AnnotationsExprs allows specifying the spec.Annotations field of the generated PackageVariant
946
+ // using CEL to dynamically create the keys and values. Entries in this field take precedent over
947
+ // those with the same keys that are present in Annotations.
948
+ // +optional
949
+ AnnotationExprs []MapExpr `json:"annotationExprs,omitempty"`
950
+
951
+ // PackageContext allows specifying the spec.PackageContext field of the generated PackageVariant
952
+ // +optional
953
+ PackageContext *PackageContextTemplate `json:"packageContext,omitempty"`
954
+
955
+ // Pipeline allows specifying the spec.Pipeline field of the generated PackageVariant
956
+ // +optional
957
+ Pipeline *PipelineTemplate `json:"pipeline,omitempty"`
958
+
959
+ // Injectors allows specifying the spec.Injectors field of the generated PackageVariant
960
+ // +optional
961
+ Injectors []InjectionSelectorTemplate `json:"injectors,omitempty"`
962
962
}
963
963
964
964
// DownstreamTemplate is used to calculate the downstream field of the resulting
965
965
// package variants. Only one of Repo and RepoExpr may be specified;
966
966
// similarly only one of Package and PackageExpr may be specified.
967
967
type DownstreamTemplate struct {
968
- Repo *string `json:"repo,omitempty"`
969
- Package *string `json:"package,omitempty"`
970
- RepoExpr *string `json:"repoExpr,omitempty"`
971
- PackageExpr *string `json:"packageExpr,omitempty"`
968
+ Repo *string `json:"repo,omitempty"`
969
+ Package *string `json:"package,omitempty"`
970
+ RepoExpr *string `json:"repoExpr,omitempty"`
971
+ PackageExpr *string `json:"packageExpr,omitempty"`
972
972
}
973
973
974
974
// PackageContextTemplate is used to calculate the packageContext field of the
975
975
// resulting package variants. The plain fields and Exprs fields will be
976
976
// merged, with the Exprs fields taking precedence.
977
977
type PackageContextTemplate struct {
978
- Data map[string]string `json:"data,omitempty"`
979
- RemoveKeys []string `json:"removeKeys,omitempty"`
980
- DataExprs []MapExpr `json:"dataExprs,omitempty"`
981
- RemoveKeyExprs []string `json:"removeKeyExprs,omitempty"`
978
+ Data map[string]string `json:"data,omitempty"`
979
+ RemoveKeys []string `json:"removeKeys,omitempty"`
980
+ DataExprs []MapExpr `json:"dataExprs,omitempty"`
981
+ RemoveKeyExprs []string `json:"removeKeyExprs,omitempty"`
982
982
}
983
983
984
984
// InjectionSelectorTemplate is used to calculate the injectors field of the
985
- // resulting package variants. Only one of the Name and NameExpr fields may be
986
- // specified.
985
+ // resulting package variants. Exactly one of the Name and NameExpr fields must
986
+ // be specified. The other fields are optional .
987
987
type InjectionSelectorTemplate struct {
988
- Group *string `json:"group,omitempty"`
989
- Version *string `json:"version,omitempty"`
990
- Kind *string `json:"kind,omitempty"`
991
- Name *string `json:"name,omitempty"`
988
+ Group *string `json:"group,omitempty"`
989
+ Version *string `json:"version,omitempty"`
990
+ Kind *string `json:"kind,omitempty"`
991
+ Name *string `json:"name,omitempty"`
992
992
993
- NameExpr *string `json:"nameExpr,omitempty"`
993
+ NameExpr *string `json:"nameExpr,omitempty"`
994
994
}
995
995
996
996
// MapExpr is used for various fields to calculate map entries. Only one of
997
997
// Key and KeyExpr may be specified; similarly only on of Value and ValueExpr
998
998
// may be specified.
999
999
type MapExpr struct {
1000
- Key *string `json:"key,omitempty"`
1001
- Value *string `json:"value,omitempty"`
1002
- KeyExpr *string `json:"keyExpr,omitempty"`
1003
- ValueExpr *string `json:"valueExpr,omitempty"`
1000
+ Key *string `json:"key,omitempty"`
1001
+ Value *string `json:"value,omitempty"`
1002
+ KeyExpr *string `json:"keyExpr,omitempty"`
1003
+ ValueExpr *string `json:"valueExpr,omitempty"`
1004
+ }
1005
+
1006
+ // PipelineTemplate is used to calculate the pipeline field of the resulting
1007
+ // package variants.
1008
+ type PipelineTemplate struct {
1009
+ // Validators is used to caculate the pipeline.validators field of the
1010
+ // resulting package variants.
1011
+ // +optional
1012
+ Validators []FunctionTemplate `json:"validators,omitempty"`
1013
+
1014
+ // Mutators is used to caculate the pipeline.mutators field of the
1015
+ // resulting package variants.
1016
+ // +optional
1017
+ Mutators []FunctionTemplate `json:"mutators,omitempty"`
1018
+ }
1019
+
1020
+ // FunctionTemplate is used in generating KRM function pipeline entries; that
1021
+ // is, it is used to generate Kptfile Function objects.
1022
+ type FunctionTemplate struct {
1023
+ kptfilev1.Function `json:",inline"`
1024
+
1025
+ // ConfigMapExprs allows use of CEL to dynamically create the keys and values in the
1026
+ // function config ConfigMap. Entries in this field take precedent over those with
1027
+ // the same keys that are present in ConfigMap.
1028
+ // +optional
1029
+ ConfigMapExprs []MapExpr `json:"configMapExprs,omitempty"`
1004
1030
}
1005
1031
```
1006
1032
0 commit comments