From 63ea966368c7f15b0242a6d8a57523b711e97f0c Mon Sep 17 00:00:00 2001 From: Robert Van Voorhees Date: Thu, 14 May 2020 20:37:39 -0400 Subject: [PATCH] Clean up templates. --- .../template-assist/template-overlay.yaml | 18 +- .../workload/manifests/kapp-config.yaml | 170 ++++++++---------- .../workload/manifests/knative-worker.yaml | 4 - 3 files changed, 90 insertions(+), 102 deletions(-) diff --git a/management-cluster/template-assist/template-overlay.yaml b/management-cluster/template-assist/template-overlay.yaml index 82208a1..9557c65 100644 --- a/management-cluster/template-assist/template-overlay.yaml +++ b/management-cluster/template-assist/template-overlay.yaml @@ -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 diff --git a/management-cluster/workload/manifests/kapp-config.yaml b/management-cluster/workload/manifests/kapp-config.yaml index e9bfde9..b198ef5 100644 --- a/management-cluster/workload/manifests/kapp-config.yaml +++ b/management-cluster/workload/manifests/kapp-config.yaml @@ -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} \ No newline at end of file diff --git a/management-cluster/workload/manifests/knative-worker.yaml b/management-cluster/workload/manifests/knative-worker.yaml index c23daf7..97be7cf 100644 --- a/management-cluster/workload/manifests/knative-worker.yaml +++ b/management-cluster/workload/manifests/knative-worker.yaml @@ -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: "" @@ -149,8 +147,6 @@ metadata: spec: clusterName: knative-worker replicas: 4 - selector: - matchLabels: null template: metadata: labels: