Skip to content

Commit 55f3aee

Browse files
committed
fix backporting features
Signed-off-by: Chanwit Kaewkasi <chanwit@gmail.com>
1 parent f12cc6c commit 55f3aee

File tree

6 files changed

+357
-280
lines changed

6 files changed

+357
-280
lines changed

api/v1alpha1/reference_types.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,10 @@ type RunnerPodSpec struct {
202202
// Set up Init Containers for the Runner
203203
// +optional
204204
InitContainers []corev1.Container `json:"initContainers,omitempty"`
205+
206+
// Set host aliases for the Runner Pod
207+
// +optional
208+
HostAliases []corev1.HostAlias `json:"hostAliases,omitempty"`
205209
}
206210

207211
func (in HealthCheck) GetTimeout() time.Duration {

api/v1alpha1/zz_generated.deepcopy.go

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

api/v1alpha2/zz_generated.deepcopy.go

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

controllers/tf_controller_outputs.go

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -174,12 +174,15 @@ func (r *TerraformReconciler) writeOutput(ctx context.Context, terraform infrav1
174174
}
175175

176176
writeOutputsReply, err := runnerClient.WriteOutputs(ctx, &runner.WriteOutputsRequest{
177-
Namespace: terraform.Namespace,
178-
Name: terraform.Name,
179-
SecretName: terraform.Spec.WriteOutputsToSecret.Name,
180-
Uuid: string(terraform.UID),
181-
Data: data,
177+
Namespace: terraform.Namespace,
178+
Name: terraform.Name,
179+
SecretName: terraform.Spec.WriteOutputsToSecret.Name,
180+
Uuid: string(terraform.UID),
181+
Data: data,
182+
Labels: terraform.Spec.WriteOutputsToSecret.Labels,
183+
Annotations: terraform.Spec.WriteOutputsToSecret.Annotations,
182184
})
185+
183186
if err != nil {
184187
return infrav1.TerraformNotReady(
185188
terraform,

controllers/tf_controller_runner.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99

1010
"github.com/fluxcd/pkg/runtime/logger"
1111
errors2 "github.com/pkg/errors"
12-
"github.com/weaveworks/tf-controller/api/v1alpha1"
12+
infrav1 "github.com/weaveworks/tf-controller/api/v1alpha1"
1313
"github.com/weaveworks/tf-controller/mtls"
1414
"github.com/weaveworks/tf-controller/runner"
1515
"google.golang.org/grpc"
@@ -23,7 +23,7 @@ import (
2323
"sigs.k8s.io/controller-runtime/pkg/client"
2424
)
2525

26-
func getRunnerPodObjectKey(terraform v1alpha1.Terraform) types.NamespacedName {
26+
func getRunnerPodObjectKey(terraform infrav1.Terraform) types.NamespacedName {
2727
return types.NamespacedName{Namespace: terraform.Namespace, Name: fmt.Sprintf("%s-tf-runner", terraform.Name)}
2828
}
2929

@@ -154,7 +154,7 @@ func (r *TerraformReconciler) getRunnerConnection(ctx context.Context, tlsSecret
154154
)
155155
}
156156

157-
func (r *TerraformReconciler) runnerPodSpec(terraform v1alpha1.Terraform, tlsSecretName string) v1.PodSpec {
157+
func (r *TerraformReconciler) runnerPodSpec(terraform infrav1.Terraform, tlsSecretName string) v1.PodSpec {
158158
serviceAccountName := terraform.Spec.ServiceAccountName
159159
if serviceAccountName == "" {
160160
serviceAccountName = "tf-runner"
@@ -463,7 +463,7 @@ func (r *TerraformReconciler) reconcileRunnerPod(ctx context.Context, terraform
463463
// if the cert is not present in the secret or is invalid, it will generate a new cert and
464464
// write it to the secret. One secret per namespace is created in order to sidestep the need
465465
// for specifying a pod ip in the certificate SAN field.
466-
func (r *TerraformReconciler) reconcileRunnerSecret(ctx context.Context, terraform *v1alpha1.Terraform) (*v1.Secret, error) {
466+
func (r *TerraformReconciler) reconcileRunnerSecret(ctx context.Context, terraform *infrav1.Terraform) (*v1.Secret, error) {
467467
log := controllerruntime.LoggerFrom(ctx)
468468

469469
log.Info("trigger namespace tls secret generation")

0 commit comments

Comments
 (0)