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:
name: ironic-vars
env:
- name: WATCH_NAMESPACE
value: default
- name: POD_NAME
valueFrom:
fieldRef:

View File

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

View File

@ -1,3 +1,6 @@
resources:
- namespace.yaml
- cluster.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
kind: Kustomization
resources:
- namespace.yaml
- kubeadmconfigtemplate.yaml
- metal3machinetemplate.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:
clusterNamespacedName:
name: target-cluster
namespace: default
namespace: target-infra
ephemeral-cluster:
kubeconfigSources:
- type: "filesystem"

View File

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

View File

@ -1,9 +1,12 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- namespace.yaml
- ../../../../function/ephemeral
- ../catalogues
namespace: target-infra
generators:
- 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
- nodes
namespace: target-infra
transformers:
- ../../../../function/k8scontrol/replacements

View File

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

View File

@ -1,5 +1,6 @@
resources:
- ../../../../composite/infra/
- namespace.yaml
commonLabels:
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/
- nodes
namespace: target-infra
transformers:
- ../../../../function/workers-capm3/replacements

View File

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

View File

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

View File

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

View File

@ -24,7 +24,7 @@ import (
)
// 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)
type WriteOptions struct {

View File

@ -218,7 +218,7 @@ func TestReadStatus(t *testing.T) {
statusMap, err := cluster.NewStatusMap(c)
require.NoError(t, err)
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"}}
result := statusMap.ReadStatus(ctx, resource)
assert.Equal(t, "Pending", result.Status.String())
@ -231,7 +231,7 @@ func makeResource(name, state string) *unstructured.Unstructured {
"kind": "Resource",
"metadata": map[string]interface{}{
"name": name,
"namespace": "default",
"namespace": "target-infra",
},
"status": map[string]interface{}{
"state": state,

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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