-
Notifications
You must be signed in to change notification settings - Fork 165
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
move config options into dedicated struct
this makes it easier to move them around as a whole instead of passing a bajillion arguments around. they're also annotated with json tags for the upcoming slsa stuff Signed-off-by: Bohan Chen <[email protected]>
- Loading branch information
Showing
3 changed files
with
73 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package config | ||
|
||
import "github.com/pivotal/kpack/pkg/apis/build/v1alpha2" | ||
|
||
type Config struct { | ||
EnablePriorityClasses bool `json:"enablePriorityClasses"` | ||
MaximumPlatformApiVersion string `json:"maximumPlatformApiVersion"` | ||
SshTrustUnknownHosts bool `json:"sshTrustUnknownHosts"` | ||
} | ||
|
||
type FeatureFlags struct { | ||
InjectedSidecarSupport bool `json:"injectedSidecarSupport"` | ||
} | ||
|
||
type Images struct { | ||
BuildInitImage string `json:"buildInitImage"` | ||
BuildInitWindowsImage string `json:"buildInitWindowsImage"` | ||
BuildWaiterImage string `json:"buildWaiterImage"` | ||
CompletionImage string `json:"completionImage"` | ||
CompletionWindowsImage string `json:"completionWindowsImage"` | ||
RebaseImage string `json:"rebaseImage"` | ||
} | ||
|
||
// TODO: evaluate if we can move the lifecycle_provider stuff out of this config package | ||
// Ideally v1alpha2.BuildPodImages should either just use config.Images directly or be an alias to it. However this | ||
// doesn't work right now because lifecycle_provider.go imports pkg/cnb which imports pkg/apis/build/v1alpha2 and | ||
// thus creating an import cycle. | ||
func (i *Images) ToBuildPodImages() v1alpha2.BuildPodImages { | ||
return v1alpha2.BuildPodImages{ | ||
BuildInitImage: i.BuildInitImage, | ||
BuildInitWindowsImage: i.BuildInitWindowsImage, | ||
BuildWaiterImage: i.BuildWaiterImage, | ||
CompletionImage: i.CompletionImage, | ||
CompletionWindowsImage: i.CompletionWindowsImage, | ||
RebaseImage: i.RebaseImage, | ||
} | ||
} |