Move CAPI resources to target-infra namespace

Moves CAPI resources in ephemeral cluster from the 'default'
namespace to a new 'target-infra' namespace.

Closes: #551
Change-Id: I419a71baa8e05e7b57b38234d15b955b36951b40
This commit is contained in:
Matthew Fuller 2021-05-27 20:40:26 +00:00
parent 92e70c734e
commit 75429db630
27 changed files with 59 additions and 23 deletions

View File

@ -38,8 +38,6 @@ spec:
- configMapRef: - configMapRef:
name: ironic-vars name: ironic-vars
env: env:
- name: WATCH_NAMESPACE
value: default
- name: POD_NAME - name: POD_NAME
valueFrom: valueFrom:
fieldRef: fieldRef:

View File

@ -55,7 +55,7 @@ template: |
bootMode: {{ $host.bootMode }} bootMode: {{ $host.bootMode }}
networkData: networkData:
name: {{ $hostName }}-network-data name: {{ $hostName }}-network-data
namespace: default namespace: target-infra
bmc: bmc:
address: {{ $host.bmcAddress }} address: {{ $host.bmcAddress }}
credentialsName: {{ $hostName }}-bmc-secret credentialsName: {{ $hostName }}-bmc-secret

View File

@ -1,3 +1,6 @@
resources: resources:
- namespace.yaml
- cluster.yaml - cluster.yaml
- controlplane.yaml - controlplane.yaml
namespace: target-infra

View File

@ -0,0 +1,5 @@
---
apiVersion: v1
kind: Namespace
metadata:
name: target-infra

View File

@ -1,6 +1,9 @@
apiVersion: kustomize.config.k8s.io/v1beta1 apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization kind: Kustomization
resources: resources:
- namespace.yaml
- kubeadmconfigtemplate.yaml - kubeadmconfigtemplate.yaml
- metal3machinetemplate.yaml - metal3machinetemplate.yaml
- machinedeployment.yaml - machinedeployment.yaml
namespace: target-infra

View File

@ -0,0 +1,5 @@
---
apiVersion: v1
kind: Namespace
metadata:
name: target-infra

View File

@ -20,7 +20,7 @@ map:
clusterAPI: clusterAPI:
clusterNamespacedName: clusterNamespacedName:
name: target-cluster name: target-cluster
namespace: default namespace: target-infra
ephemeral-cluster: ephemeral-cluster:
kubeconfigSources: kubeconfigSources:
- type: "filesystem" - type: "filesystem"

View File

@ -44,7 +44,8 @@ apiVersion: airshipit.org/v1alpha1
kind: Clusterctl kind: Clusterctl
metadata: metadata:
name: clusterctl_move name: clusterctl_move
move-options: {} move-options:
namespace: target-infra
action: move action: move
--- ---
apiVersion: airshipit.org/v1alpha1 apiVersion: airshipit.org/v1alpha1
@ -223,6 +224,7 @@ config: |
builder: builder:
userDataSelector: userDataSelector:
kind: Secret kind: Secret
namespace: target-infra
labelSelector: airshipit.org/ephemeral-user-data labelSelector: airshipit.org/ephemeral-user-data
userDataKey: userData userDataKey: userData
networkConfigSelector: networkConfigSelector:

View File

@ -1,9 +1,12 @@
apiVersion: kustomize.config.k8s.io/v1beta1 apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization kind: Kustomization
resources: resources:
- namespace.yaml
- ../../../../function/ephemeral - ../../../../function/ephemeral
- ../catalogues - ../catalogues
namespace: target-infra
generators: generators:
- hostgenerator - hostgenerator

View File

@ -0,0 +1,5 @@
---
apiVersion: v1
kind: Namespace
metadata:
name: target-infra

View File

@ -7,5 +7,7 @@ resources:
- ../../target/catalogues # NOTE: use target networking for this phase - ../../target/catalogues # NOTE: use target networking for this phase
- nodes - nodes
namespace: target-infra
transformers: transformers:
- ../../../../function/k8scontrol/replacements - ../../../../function/k8scontrol/replacements

View File

@ -7,6 +7,8 @@ resources:
- ../../../../function/k8scontrol - ../../../../function/k8scontrol
- ../catalogues - ../catalogues
namespace: target-infra
commonLabels: commonLabels:
airshipit.org/stage: initinfra airshipit.org/stage: initinfra

View File

@ -1,5 +1,6 @@
resources: resources:
- ../../../../composite/infra/ - ../../../../composite/infra/
- namespace.yaml
commonLabels: commonLabels:
airshipit.org/stage: initinfra airshipit.org/stage: initinfra

View File

@ -0,0 +1,5 @@
---
apiVersion: v1
kind: Namespace
metadata:
name: target-infra

View File

@ -5,5 +5,7 @@ resources:
- ../../../../function/workers-capm3/ - ../../../../function/workers-capm3/
- nodes - nodes
namespace: target-infra
transformers: transformers:
- ../../../../function/workers-capm3/replacements - ../../../../function/workers-capm3/replacements

View File

@ -45,7 +45,7 @@ const (
"tlsSecrets": [ "tlsSecrets": [
{ {
"name": "test-cluster-etcd", "name": "test-cluster-etcd",
"namespace": "default", "namespace": "target-infra",
"certificate": { "certificate": {
"ca.crt": "2030-08-31 10:12:49 +0000 UTC", "ca.crt": "2030-08-31 10:12:49 +0000 UTC",
"tls.crt": "2030-08-31 10:12:49 +0000 UTC" "tls.crt": "2030-08-31 10:12:49 +0000 UTC"
@ -55,7 +55,7 @@ const (
"kubeconfs": [ "kubeconfs": [
{ {
"secretName": "test-cluster-kubeconfig", "secretName": "test-cluster-kubeconfig",
"secretNamespace": "default", "secretNamespace": "target-infra",
"cluster": [ "cluster": [
{ {
"name": "workload-cluster", "name": "workload-cluster",
@ -102,7 +102,7 @@ kubeconfs:
expirationDate: 2030-08-31 10:12:48 +0000 UTC expirationDate: 2030-08-31 10:12:48 +0000 UTC
name: workload-cluster name: workload-cluster
secretName: test-cluster-kubeconfig secretName: test-cluster-kubeconfig
secretNamespace: default secretNamespace: target-infra
user: user:
- certificateName: ClientCertificateData - certificateName: ClientCertificateData
expirationDate: 2021-09-02 10:12:50 +0000 UTC expirationDate: 2021-09-02 10:12:50 +0000 UTC
@ -112,7 +112,7 @@ tlsSecrets:
ca.crt: 2030-08-31 10:12:49 +0000 UTC ca.crt: 2030-08-31 10:12:49 +0000 UTC
tls.crt: 2030-08-31 10:12:49 +0000 UTC tls.crt: 2030-08-31 10:12:49 +0000 UTC
name: test-cluster-etcd name: test-cluster-etcd
namespace: default namespace: target-infra
nodeCerts: nodeCerts:
- name: test-node - name: test-node
certificate: certificate:

View File

@ -6,7 +6,7 @@ metadata:
labels: labels:
cluster.x-k8s.io/cluster-name: workload-cluster cluster.x-k8s.io/cluster-name: workload-cluster
name: test-cluster-kubeconfig name: test-cluster-kubeconfig
namespace: default namespace: target-infra
ownerReferences: ownerReferences:
- apiVersion: controlplane.cluster.x-k8s.io/v1alpha3 - apiVersion: controlplane.cluster.x-k8s.io/v1alpha3
blockOwnerDeletion: true blockOwnerDeletion: true

View File

@ -8,5 +8,5 @@ metadata:
labels: labels:
cluster.x-k8s.io/cluster-name: test-cluster cluster.x-k8s.io/cluster-name: test-cluster
name: test-cluster-etcd name: test-cluster-etcd
namespace: default namespace: target-infra
type: Opaque type: Opaque

View File

@ -24,7 +24,7 @@ import (
) )
// DefaultClusterAPIObjNamespace is a default namespace used for cluster-api cluster object // DefaultClusterAPIObjNamespace is a default namespace used for cluster-api cluster object
const DefaultClusterAPIObjNamespace = "default" const DefaultClusterAPIObjNamespace = "target-infra"
// WriteOptions has format in which we want to print the output(table/yaml/cluster name) // WriteOptions has format in which we want to print the output(table/yaml/cluster name)
type WriteOptions struct { type WriteOptions struct {

View File

@ -218,7 +218,7 @@ func TestReadStatus(t *testing.T) {
statusMap, err := cluster.NewStatusMap(c) statusMap, err := cluster.NewStatusMap(c)
require.NoError(t, err) require.NoError(t, err)
ctx := context.Background() ctx := context.Background()
resource := object.ObjMetadata{Namespace: "default", resource := object.ObjMetadata{Namespace: "target-infra",
Name: "pending-resource", GroupKind: schema.GroupKind{Group: "example.com", Kind: "Resource"}} Name: "pending-resource", GroupKind: schema.GroupKind{Group: "example.com", Kind: "Resource"}}
result := statusMap.ReadStatus(ctx, resource) result := statusMap.ReadStatus(ctx, resource)
assert.Equal(t, "Pending", result.Status.String()) assert.Equal(t, "Pending", result.Status.String())
@ -231,7 +231,7 @@ func makeResource(name, state string) *unstructured.Unstructured {
"kind": "Resource", "kind": "Resource",
"metadata": map[string]interface{}{ "metadata": map[string]interface{}{
"name": name, "name": name,
"namespace": "default", "namespace": "target-infra",
}, },
"status": map[string]interface{}{ "status": map[string]interface{}{
"state": state, "state": state,

View File

@ -4,4 +4,4 @@ apiVersion: "example.com/v1"
kind: Legacy kind: Legacy
metadata: metadata:
name: stable-legacy name: stable-legacy
namespace: default namespace: target-infra

View File

@ -4,4 +4,4 @@ apiVersion: "example.com/v1"
kind: Missing kind: Missing
metadata: metadata:
name: missing-resource name: missing-resource
namespace: default namespace: target-infra

View File

@ -4,4 +4,4 @@ apiVersion: "example.com/v1"
kind: Resource kind: Resource
metadata: metadata:
name: pending-resource name: pending-resource
namespace: default namespace: target-infra

View File

@ -4,4 +4,4 @@ apiVersion: "example.com/v1"
kind: Resource kind: Resource
metadata: metadata:
name: stable-resource name: stable-resource
namespace: default namespace: target-infra

View File

@ -5,4 +5,4 @@ apiVersion: "example.com/v1"
kind: Resource kind: Resource
metadata: metadata:
name: unknown name: unknown
namespace: default namespace: target-infra

View File

@ -25,7 +25,7 @@ apiVersion: v1
kind: ConfigMap kind: ConfigMap
metadata: metadata:
name: first-map name: first-map
namespace: default namespace: target-infra
labels: labels:
cli-utils.sigs.k8s.io/inventory-id: "some id" cli-utils.sigs.k8s.io/inventory-id: "some id"
--- ---
@ -33,7 +33,7 @@ apiVersion: v1
kind: ConfigMap kind: ConfigMap
metadata: metadata:
name: second-map name: second-map
namespace: default namespace: target-infra
labels: labels:
cli-utils.sigs.k8s.io/inventory-id: "some id" cli-utils.sigs.k8s.io/inventory-id: "some id"

View File

@ -179,7 +179,7 @@ func TestBuilderClusterctl(t *testing.T) {
ClusterAPI: v1alpha1.KubeconfigSourceClusterAPI{ ClusterAPI: v1alpha1.KubeconfigSourceClusterAPI{
NamespacedName: v1alpha1.NamespacedName{ NamespacedName: v1alpha1.NamespacedName{
Name: childClusterID, Name: childClusterID,
Namespace: "default", Namespace: "target-infra",
}, },
}, },
}, },
@ -192,7 +192,7 @@ func TestBuilderClusterctl(t *testing.T) {
ClusterAPI: v1alpha1.KubeconfigSourceClusterAPI{ ClusterAPI: v1alpha1.KubeconfigSourceClusterAPI{
NamespacedName: v1alpha1.NamespacedName{ NamespacedName: v1alpha1.NamespacedName{
Name: parentClusterID, Name: parentClusterID,
Namespace: "default", Namespace: "target-infra",
}, },
}, },
}, },