Skip to content

Commit

Permalink
Clean up templates.
Browse files Browse the repository at this point in the history
  • Loading branch information
voor committed May 15, 2020
1 parent dad5423 commit 63ea966
Show file tree
Hide file tree
Showing 3 changed files with 90 additions and 102 deletions.
18 changes: 17 additions & 1 deletion management-cluster/template-assist/template-overlay.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,29 @@
#@overlay/match by=overlay.subset({"kind":"AWSCluster"})
---
spec:
networkSpec:
subnets:
#@overlay/match by=overlay.all,expects="1+"
-
#@overlay/remove
id:
#! Set to false to skip creation of bastion host
bastion:
#@overlay/match missing_ok=True
enabled: false

---

#@overlay/match by=overlay.subset({"kind":"MachineDeployment"})
---
spec:
#@overlay/remove missing_ok=True
selector:

#@overlay/match by=overlay.subset({"kind": "Secret"})
#@overlay/remove

---


# TODO stop setting empty spec.networkSpec.subnets.id on AWSCluster
# TODO do not set spec.strategy.matchLabels to nil on MachineDeployment
170 changes: 73 additions & 97 deletions management-cluster/workload/manifests/kapp-config.yaml
Original file line number Diff line number Diff line change
@@ -1,102 +1,78 @@
apiVersion: kapp.k14s.io/v1alpha1
kind: Config

ownershipLabelRules:
- path: [spec, template, metadata, labels]
resourceMatchers:
- apiVersionKindMatcher:
{ apiVersion: cluster.x-k8s.io/v1alpha3, kind: MachineDeployment }


rebaseRules:
- path: [spec, controlPlaneEndpoint, host]
type: copy
sources: [new, existing]
resourceMatchers: &capiCluster
- apiVersionKindMatcher:
apiVersion: cluster.x-k8s.io/v1alpha3
kind: Cluster
- apiVersionKindMatcher:
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha3
kind: AWSCluster

- path: [spec, controlPlaneEndpoint, port]
type: copy
sources: [new, existing]
resourceMatchers: *capiCluster

- path: [metadata, labels, cluster.x-k8s.io/cluster-name]
type: copy
sources: [new, existing]
resourceMatchers: *capiCluster

- path: [spec, networkSpec, subnets]
type: copy
sources: [new, existing]
resourceMatchers: *capiCluster

- path: [metadata, labels, cluster.x-k8s.io/cluster-name]
type: copy
sources: [new, existing]
resourceMatchers: &capiKubeadmControlPlane
- apiVersionKindMatcher:
apiVersion: controlplane.cluster.x-k8s.io/v1alpha3
kind: KubeadmControlPlane

- path: [spec, kubeadmConfigSpec, clusterConfiguration, networking]
type: copy
sources: [new, existing]
resourceMatchers: *capiKubeadmControlPlane

- path: [spec, kubeadmConfigSpec, initConfiguration, localAPIEndpoint]
type: copy
sources: [new, existing]
resourceMatchers: *capiKubeadmControlPlane

- path: [spec, kubeadmConfigSpec, joinConfiguration, discovery]
type: copy
sources: [new, existing]
resourceMatchers: *capiKubeadmControlPlane

- path: [metadata, annotations, cluster.x-k8s.io/cluster-name]
type: copy
sources: [new, existing]
resourceMatchers: &capiMachinedeployment
- apiVersionKindMatcher:
apiVersion: cluster.x-k8s.io/v1alpha3
kind: Machinedeployment

- path: [spec, minReadySeconds]
type: copy
sources: [new, existing]
resourceMatchers: *capiMachinedeployment

- path: [spec, progressDeadlineSeconds]
type: copy
sources: [new, existing]
resourceMatchers: *capiMachinedeployment

- path: [spec, revisionHistoryLimit]
type: copy
sources: [new, existing]
resourceMatchers: *capiMachinedeployment

- path: [spec, selector]
type: copy
sources: [new, existing]
resourceMatchers: *capiMachinedeployment

- path: [spec, strategy]
type: copy
sources: [new, existing]
resourceMatchers: *capiMachinedeployment

- path: [spec, template, metadata, labels, cluster.x-k8s.io/cluster-name]
type: copy
sources: [new, existing]
resourceMatchers: *capiMachinedeployment

- path: [spec, template, metadata, labels, cluster.x-k8s.io/deployment-name]
type: copy
sources: [new, existing]
resourceMatchers: *capiMachinedeployment
# cluster
- path: [spec, controlPlaneEndpoint]
type: copy
sources: [new, existing]
resourceMatchers:
- apiVersionKindMatcher: {apiVersion: cluster.x-k8s.io/v1alpha3, kind: Cluster}

# aws cluster

- path: [spec, controlPlaneEndpoint]
type: copy
sources: [new, existing]
resourceMatchers: &awscluster
- apiVersionKindMatcher: {apiVersion: infrastructure.cluster.x-k8s.io/v1alpha3, kind: AWSCluster}

- path: [metadata, labels, cluster.x-k8s.io/cluster-name]
type: copy
sources: [new, existing]
resourceMatchers: *awscluster

- path: [spec, networkSpec, subnets, {allIndexes: true}, id]
type: copy
sources: [new, existing]
resourceMatchers: *awscluster

- path: [spec, networkSpec, subnets, {allIndexes: true}, natGatewayId]
type: copy
sources: [new, existing]
resourceMatchers: *awscluster

- path: [spec, networkSpec, subnets, {allIndexes: true}, routeTableId]
type: copy
sources: [new, existing]
resourceMatchers: *awscluster

- path: [spec, networkSpec, subnets, {allIndexes: true}, isPublic]
type: copy
sources: [new, existing]
resourceMatchers: *awscluster

- path: [spec, networkSpec, subnets, {allIndexes: true}, tags]
type: copy
sources: [new, existing]
resourceMatchers: *awscluster

- path: [spec, networkSpec, vpc, id]
type: copy
sources: [new, existing]
resourceMatchers: *awscluster

- path: [spec, networkSpec, vpc, internetGatewayId]
type: copy
sources: [new, existing]
resourceMatchers: *awscluster

- path: [spec, networkSpec, vpc, tags]
type: copy
sources: [new, existing]
resourceMatchers: *awscluster

# control plane
- path: [metadata, labels, cluster.x-k8s.io/cluster-name]
type: copy
sources: [new, existing]
resourceMatchers:
- apiVersionKindMatcher: {apiVersion: controlplane.cluster.x-k8s.io/v1alpha3, kind: KubeadmControlPlane}

# machine dep
- path: [metadata, labels, cluster.x-k8s.io/cluster-name]
type: copy
sources: [new, existing]
resourceMatchers:
- apiVersionKindMatcher: {apiVersion: cluster.x-k8s.io/v1alpha3, kind: MachineDeployment}
4 changes: 0 additions & 4 deletions management-cluster/workload/manifests/knative-worker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,9 @@ spec:
subnets:
- availabilityZone: us-east-1a
cidrBlock: 10.0.1.0/24
id: ""
isPublic: true
- availabilityZone: us-east-1a
cidrBlock: 10.0.0.0/24
id: ""
vpc:
cidrBlock: 10.0.0.0/16
id: ""
Expand Down Expand Up @@ -149,8 +147,6 @@ metadata:
spec:
clusterName: knative-worker
replicas: 4
selector:
matchLabels: null
template:
metadata:
labels:
Expand Down

0 comments on commit 63ea966

Please sign in to comment.