Skip to content

Commit 1cb612a

Browse files
authored
Merge pull request #126 from turkenf/remote-pull-pol
Add remotePullPolicy to reduce remote module download costs
2 parents 24d6b81 + ca3eb03 commit 1cb612a

22 files changed

Lines changed: 1696 additions & 32 deletions

apis/cluster/v1beta1/workspace_types.go

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,19 @@ const (
9292
ModuleSourceInline ModuleSource = "Inline"
9393
)
9494

95+
// RemotePullPolicy determines when to pull remote module sources.
96+
// +kubebuilder:validation:Enum=Always;IfNotPresent
97+
type RemotePullPolicy string
98+
99+
// Remote pull policies.
100+
const (
101+
// RemotePullPolicyAlways pulls remote source on every reconciliation (default)
102+
RemotePullPolicyAlways RemotePullPolicy = "Always"
103+
104+
// RemotePullPolicyIfNotPresent pulls remote source only if not already present
105+
RemotePullPolicyIfNotPresent RemotePullPolicy = "IfNotPresent"
106+
)
107+
95108
// WorkspaceParameters are the configurable fields of a Workspace.
96109
type WorkspaceParameters struct {
97110
// The root module of this workspace; i.e. the module containing its main.tf
@@ -145,12 +158,21 @@ type WorkspaceParameters struct {
145158
// Boolean value to indicate CLI logging of tofu execution is enabled or not
146159
// +optional
147160
EnableTofuCLILogging bool `json:"enableTofuCLILogging,omitempty"`
161+
162+
// RemotePullPolicy determines when to download remote module sources.
163+
// +optional
164+
// +kubebuilder:default=Always
165+
RemotePullPolicy *RemotePullPolicy `json:"remotePullPolicy,omitempty"`
148166
}
149167

150168
// WorkspaceObservation are the observable fields of a Workspace.
151169
type WorkspaceObservation struct {
152170
Checksum string `json:"checksum,omitempty"`
153171
Outputs map[string]extensionsV1.JSON `json:"outputs,omitempty"`
172+
173+
// RemoteSource is the remote module URL that was last retrieved
174+
// +optional
175+
RemoteSource string `json:"remoteSource,omitempty"`
154176
}
155177

156178
// A WorkspaceSpec defines the desired state of a Workspace.

apis/cluster/v1beta1/zz_generated.deepcopy.go

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apis/namespaced/v1beta1/workspace_types.go

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,19 @@ const (
9191
ModuleSourceInline ModuleSource = "Inline"
9292
)
9393

94+
// RemotePullPolicy determines when to pull remote module sources.
95+
// +kubebuilder:validation:Enum=Always;IfNotPresent
96+
type RemotePullPolicy string
97+
98+
// Remote pull policies.
99+
const (
100+
// RemotePullPolicyAlways pulls remote source on every reconciliation (default)
101+
RemotePullPolicyAlways RemotePullPolicy = "Always"
102+
103+
// RemotePullPolicyIfNotPresent pulls remote source only if not already present
104+
RemotePullPolicyIfNotPresent RemotePullPolicy = "IfNotPresent"
105+
)
106+
94107
// WorkspaceParameters are the configurable fields of a Workspace.
95108
type WorkspaceParameters struct {
96109
// The root module of this workspace; i.e. the module containing its main.tf
@@ -144,12 +157,21 @@ type WorkspaceParameters struct {
144157
// Boolean value to indicate CLI logging of tofu execution is enabled or not
145158
// +optional
146159
EnableTofuCLILogging bool `json:"enableTofuCLILogging,omitempty"`
160+
161+
// RemotePullPolicy determines when to download remote module sources.
162+
// +optional
163+
// +kubebuilder:default=Always
164+
RemotePullPolicy *RemotePullPolicy `json:"remotePullPolicy,omitempty"`
147165
}
148166

149167
// WorkspaceObservation are the observable fields of a Workspace.
150168
type WorkspaceObservation struct {
151169
Checksum string `json:"checksum,omitempty"`
152170
Outputs map[string]extensionsV1.JSON `json:"outputs,omitempty"`
171+
172+
// RemoteSource is the remote module URL that was last retrieved
173+
// +optional
174+
RemoteSource string `json:"remoteSource,omitempty"`
153175
}
154176

155177
// A WorkspaceSpec defines the desired state of a Workspace.

apis/namespaced/v1beta1/zz_generated.deepcopy.go

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)