Skip to content

Commit

Permalink
provisioner: remove deprecated fields
Browse files Browse the repository at this point in the history
Cluster templates were updated to use proper accessors:
* zalando-incubator/kubernetes-on-aws#6627
* zalando-incubator/kubernetes-on-aws#6808
* zalando-incubator/kubernetes-on-aws#6819

Signed-off-by: Alexander Yastrebov <alexander.yastrebov@zalando.de>
  • Loading branch information
AlexanderYastrebov committed Feb 29, 2024
1 parent 799b0de commit bea6412
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 47 deletions.
4 changes: 2 additions & 2 deletions provisioner/clusterpy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ post_apply:

deletionsContent2 = `
pre_apply:
- name: {{.Alias}}-pre
- name: {{.Cluster.Alias}}-pre
namespace: templated
kind: deployment
post_apply:
- name: {{.Alias}}-post
- name: {{.Cluster.Alias}}-post
namespace: templated
kind: deployment
`
Expand Down
48 changes: 3 additions & 45 deletions provisioner/template.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,21 +51,6 @@ type templateContext struct {
}

type templateData struct {
// From api.Cluster, TODO: drop after we migrate all Kubernetes manifests
Alias string
APIServerURL string
Channel string
ConfigItems map[string]string
CriticalityLevel int32
Environment string
ID string
InfrastructureAccount string
LifecycleStatus string
LocalID string
NodePools []*api.NodePool
Region string
Owner string

// Available everywhere
Cluster *api.Cluster

Expand All @@ -74,12 +59,6 @@ type templateData struct {

// Available in node pool templates
NodePool *api.NodePool

// User data (deprecated, TODO: move to .Values.UserData)
UserData string

// Path to the generated files uploaded to S3 (deprecated, TODO: move to .Values.S3GeneratedFilesPath)
S3GeneratedFilesPath string
}

func newTemplateContext(fileData map[string][]byte, cluster *api.Cluster, nodePool *api.NodePool, values map[string]interface{}, adapter *awsAdapter, instanceTypes *awsUtils.InstanceTypes) *templateContext {
Expand Down Expand Up @@ -168,30 +147,9 @@ func renderTemplate(context *templateContext, file string) (string, error) {
var out bytes.Buffer

data := &templateData{
Alias: context.cluster.Alias,
APIServerURL: context.cluster.APIServerURL,
Channel: context.cluster.Channel,
ConfigItems: context.cluster.ConfigItems,
CriticalityLevel: context.cluster.CriticalityLevel,
Environment: context.cluster.Environment,
ID: context.cluster.ID,
InfrastructureAccount: context.cluster.InfrastructureAccount,
LifecycleStatus: context.cluster.LifecycleStatus,
LocalID: context.cluster.LocalID,
NodePools: context.cluster.NodePools,
Region: context.cluster.Region,
Owner: context.cluster.Owner,
Cluster: context.cluster,
Values: context.values,
NodePool: context.nodePool,
}

if ud, ok := context.values[userDataValuesKey]; ok {
data.UserData = ud.(string)
}

if s3path, ok := context.values[s3GeneratedFilesPathValuesKey]; ok {
data.S3GeneratedFilesPath = s3path.(string)
Cluster: context.cluster,
Values: context.values,
NodePool: context.nodePool,
}

err = t.Execute(&out, data)
Expand Down

0 comments on commit bea6412

Please sign in to comment.