Skip to content

Commit

Permalink
chore: renames manifests source to location (#1050)
Browse files Browse the repository at this point in the history
- Source is already used elsewhere in Feature DSL, so we might want to
  avoid confusion
- Location fits the purpose of this field better
  • Loading branch information
bartoszmajsak authored Jun 11, 2024
1 parent 244ca13 commit 8921839
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 22 deletions.
6 changes: 3 additions & 3 deletions components/kserve/feature_resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ var Resources = struct {
InstallDir string
// GatewaysDir is the path to the Serving Istio gateways templates.
GatewaysDir string
// Source the templates to be used
Source fs.FS
// Location specifies the file system that contains the templates to be used.
Location fs.FS
// BaseDir is the path to the base of the embedded FS
BaseDir string
}{
ServiceMeshDir: path.Join(baseDir, "servicemesh"),
InstallDir: path.Join(baseDir, "serving-install"),
GatewaysDir: path.Join(baseDir, "servicemesh", "routing"),
Source: kserveEmbeddedFS,
Location: kserveEmbeddedFS,
BaseDir: baseDir,
}
6 changes: 3 additions & 3 deletions components/kserve/serverless_setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ func (k *Kserve) configureServerlessFeatures() feature.FeaturesProvider {
return func(handler *feature.FeaturesHandler) error {
servingDeploymentErr := feature.CreateFeature("serverless-serving-deployment").
For(handler).
ManifestSource(Resources.Source).
ManifestsLocation(Resources.Location).
Manifests(
path.Join(Resources.InstallDir),
).
Expand All @@ -33,7 +33,7 @@ func (k *Kserve) configureServerlessFeatures() feature.FeaturesProvider {

servingNetIstioSecretFilteringErr := feature.CreateFeature("serverless-net-istio-secret-filtering").
For(handler).
ManifestSource(Resources.Source).
ManifestsLocation(Resources.Location).
Manifests(
path.Join(Resources.BaseDir, "serving-net-istio-secret-filtering.patch.tmpl.yaml"),
).
Expand All @@ -56,7 +56,7 @@ func (k *Kserve) configureServerlessFeatures() feature.FeaturesProvider {
serverless.ServingIngressDomain,
).
WithResources(serverless.ServingCertificateResource).
ManifestSource(Resources.Source).
ManifestsLocation(Resources.Location).
Manifests(
path.Join(Resources.GatewaysDir),
).
Expand Down
4 changes: 2 additions & 2 deletions components/kserve/servicemesh_setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func (k *Kserve) defineServiceMeshFeatures(cli client.Client) feature.FeaturesPr
if authorinoInstalled {
kserveExtAuthzErr := feature.CreateFeature("kserve-external-authz").
For(handler).
ManifestSource(Resources.Source).
ManifestsLocation(Resources.Location).
Manifests(
path.Join(Resources.ServiceMeshDir, "activator-envoyfilter.tmpl.yaml"),
path.Join(Resources.ServiceMeshDir, "envoy-oauth-temp-fix.tmpl.yaml"),
Expand All @@ -59,7 +59,7 @@ func (k *Kserve) defineServiceMeshFeatures(cli client.Client) feature.FeaturesPr

temporaryFixesErr := feature.CreateFeature("kserve-temporary-fixes").
For(handler).
ManifestSource(Resources.Source).
ManifestsLocation(Resources.Location).
Manifests(
path.Join(Resources.ServiceMeshDir, "grpc-envoyfilter-temp-fix.tmpl.yaml"),
).
Expand Down
6 changes: 3 additions & 3 deletions controllers/dscinitialization/feature_resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@ var Templates = struct {
AuthorinoDir string
// MetricsDir is the path to the Metrics Collection templates.
MetricsDir string
// Source the templates to be used
Source fs.FS
// Location specifies the file system that contains the templates to be used.
Location fs.FS
// BaseDir is the path to the base of the embedded FS
BaseDir string
}{
ServiceMeshDir: path.Join(baseDir, "servicemesh"),
AuthorinoDir: path.Join(baseDir, "authorino"),
MetricsDir: path.Join(baseDir, "metrics-collection"),
Source: dsciEmbeddedFS,
Location: dsciEmbeddedFS,
BaseDir: baseDir,
}
6 changes: 3 additions & 3 deletions controllers/dscinitialization/servicemesh_setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ func (r *DSCInitializationReconciler) serviceMeshCapabilityFeatures(instance *ds
serviceMeshSpec := instance.Spec.ServiceMesh
smcpCreationErr := feature.CreateFeature("mesh-control-plane-creation").
For(handler).
ManifestSource(Templates.Source).
ManifestsLocation(Templates.Location).
Manifests(
path.Join(Templates.ServiceMeshDir),
).
Expand All @@ -141,7 +141,7 @@ func (r *DSCInitializationReconciler) serviceMeshCapabilityFeatures(instance *ds
PreConditions(
servicemesh.EnsureServiceMeshInstalled,
).
ManifestSource(Templates.Source).
ManifestsLocation(Templates.Location).
Manifests(
path.Join(Templates.MetricsDir),
).
Expand Down Expand Up @@ -169,7 +169,7 @@ func (r *DSCInitializationReconciler) authorizationFeatures(instance *dsciv1.DSC

extAuthzErr := feature.CreateFeature("mesh-control-plane-external-authz").
For(handler).
ManifestSource(Templates.Source).
ManifestsLocation(Templates.Location).
Manifests(
path.Join(Templates.AuthorinoDir, "auth-smm.tmpl.yaml"),
path.Join(Templates.AuthorinoDir, "base"),
Expand Down
6 changes: 3 additions & 3 deletions pkg/feature/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,13 @@ func (u *usingFeaturesHandler) For(featuresHandler *FeaturesHandler) *featureBui
return fb
}

// Used to enforce that Manifests() is called after ManifestSource() in the chain.
// Used to enforce that Manifests() is called after ManifestsLocation() in the chain.
type featureBuilderWithManifestSource struct {
*featureBuilder
}

// ManifestSource sets the root file system (fsys) from which manifest paths are loaded.
func (fb *featureBuilder) ManifestSource(fsys fs.FS) *featureBuilderWithManifestSource {
// ManifestsLocation sets the root file system (fsys) from which manifest paths are loaded.
func (fb *featureBuilder) ManifestsLocation(fsys fs.FS) *featureBuilderWithManifestSource {
fb.fsys = fsys
return &featureBuilderWithManifestSource{featureBuilder: fb}
}
Expand Down
6 changes: 3 additions & 3 deletions tests/integration/features/manifests_int_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ var _ = Describe("Manifest sources", func() {
createNamespaceErr := feature.CreateFeature("create-namespace").
For(handler).
UsingConfig(envTest.Config).
ManifestSource(fixtures.TestEmbeddedFiles).
ManifestsLocation(fixtures.TestEmbeddedFiles).
Manifests(path.Join(fixtures.BaseDir, "namespace.yaml")).
Load()

Expand All @@ -72,7 +72,7 @@ var _ = Describe("Manifest sources", func() {
createServiceErr := feature.CreateFeature("create-local-gw-svc").
For(handler).
UsingConfig(envTest.Config).
ManifestSource(fixtures.TestEmbeddedFiles).
ManifestsLocation(fixtures.TestEmbeddedFiles).
Manifests(path.Join(fixtures.BaseDir, "local-gateway-svc.tmpl.yaml")).
Load()

Expand Down Expand Up @@ -105,7 +105,7 @@ metadata:
createServiceErr := feature.CreateFeature("create-namespace").
For(handler).
UsingConfig(envTest.Config).
ManifestSource(os.DirFS(tempDir)).
ManifestsLocation(os.DirFS(tempDir)).
Manifests(path.Join("namespace.yaml")). // must be relative to root DirFS defined above
Load()

Expand Down
2 changes: 1 addition & 1 deletion tests/integration/features/resources_int_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ func createAndApplyFeature(dsci *dsciv1.DSCInitialization, managed bool, feature
creator := feature.CreateFeature(featureName).
For(handler).
UsingConfig(envTest.Config).
ManifestSource(fixtures.TestEmbeddedFiles).
ManifestsLocation(fixtures.TestEmbeddedFiles).
Manifests(path.Join(fixtures.BaseDir, yamlFile))
if managed {
creator.Managed()
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/features/servicemesh_feature_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ var _ = Describe("Service Mesh setup", func() {
handler := feature.ClusterFeaturesHandler(dsci, func(handler *feature.FeaturesHandler) error {
return feature.CreateFeature("control-plane-with-external-authz-provider").
For(handler).
ManifestSource(fixtures.TestEmbeddedFiles).
ManifestsLocation(fixtures.TestEmbeddedFiles).
Manifests(path.Join("templates", "mesh-authz-ext-provider.patch.tmpl.yaml")).
OnDelete(
servicemesh.RemoveExtensionProvider,
Expand Down

0 comments on commit 8921839

Please sign in to comment.