Fix manifests generation
Also: * controller-gen bumped to 0.6.2 * resolved cycle dependencies error in API * added clean-up step Change-Id: I08340bc4f44505272d5b2dfaab7ae075aa994cca Signed-off-by: Ruslan Aliev <raliev@mirantis.com> Closes: #664
This commit is contained in:
parent
e8992a6bed
commit
ddf7b36259
4
Makefile
4
Makefile
@ -386,7 +386,7 @@ ifeq (, $(shell which controller-gen))
|
|||||||
CONTROLLER_GEN_TMP_DIR=$$(mktemp -d) ;\
|
CONTROLLER_GEN_TMP_DIR=$$(mktemp -d) ;\
|
||||||
cd $$CONTROLLER_GEN_TMP_DIR ;\
|
cd $$CONTROLLER_GEN_TMP_DIR ;\
|
||||||
go mod init tmp ;\
|
go mod init tmp ;\
|
||||||
go get sigs.k8s.io/controller-tools/cmd/controller-gen@v0.6.1 ;\
|
go get sigs.k8s.io/controller-tools/cmd/controller-gen@v0.6.2 ;\
|
||||||
rm -rf $$CONTROLLER_GEN_TMP_DIR ;\
|
rm -rf $$CONTROLLER_GEN_TMP_DIR ;\
|
||||||
}
|
}
|
||||||
CONTROLLER_GEN=$(GOBIN)/controller-gen
|
CONTROLLER_GEN=$(GOBIN)/controller-gen
|
||||||
@ -396,4 +396,4 @@ endif
|
|||||||
|
|
||||||
# Generate manifests e.g. CRD, RBAC etc.
|
# Generate manifests e.g. CRD, RBAC etc.
|
||||||
manifests: controller-gen
|
manifests: controller-gen
|
||||||
$(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=manifests/function/airshipctl-schemas
|
find manifests/function/airshipctl-schemas/ -type f -not -name 'kustomization.yaml' -delete && $(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=manager-role webhook paths="./..." output:crd:artifacts:config=manifests/function/airshipctl-schemas
|
||||||
|
@ -4,7 +4,7 @@ apiVersion: apiextensions.k8s.io/v1
|
|||||||
kind: CustomResourceDefinition
|
kind: CustomResourceDefinition
|
||||||
metadata:
|
metadata:
|
||||||
annotations:
|
annotations:
|
||||||
controller-gen.kubebuilder.io/version: v0.6.1
|
controller-gen.kubebuilder.io/version: v0.6.2
|
||||||
creationTimestamp: null
|
creationTimestamp: null
|
||||||
name: baremetalmanagers.airshipit.org
|
name: baremetalmanagers.airshipit.org
|
||||||
spec:
|
spec:
|
||||||
|
@ -4,7 +4,7 @@ apiVersion: apiextensions.k8s.io/v1
|
|||||||
kind: CustomResourceDefinition
|
kind: CustomResourceDefinition
|
||||||
metadata:
|
metadata:
|
||||||
annotations:
|
annotations:
|
||||||
controller-gen.kubebuilder.io/version: v0.6.1
|
controller-gen.kubebuilder.io/version: v0.6.2
|
||||||
creationTimestamp: null
|
creationTimestamp: null
|
||||||
name: bootconfigurations.airshipit.org
|
name: bootconfigurations.airshipit.org
|
||||||
spec:
|
spec:
|
||||||
|
@ -4,7 +4,7 @@ apiVersion: apiextensions.k8s.io/v1
|
|||||||
kind: CustomResourceDefinition
|
kind: CustomResourceDefinition
|
||||||
metadata:
|
metadata:
|
||||||
annotations:
|
annotations:
|
||||||
controller-gen.kubebuilder.io/version: v0.6.1
|
controller-gen.kubebuilder.io/version: v0.6.2
|
||||||
creationTimestamp: null
|
creationTimestamp: null
|
||||||
name: clusterctls.airshipit.org
|
name: clusterctls.airshipit.org
|
||||||
spec:
|
spec:
|
||||||
|
@ -4,7 +4,7 @@ apiVersion: apiextensions.k8s.io/v1
|
|||||||
kind: CustomResourceDefinition
|
kind: CustomResourceDefinition
|
||||||
metadata:
|
metadata:
|
||||||
annotations:
|
annotations:
|
||||||
controller-gen.kubebuilder.io/version: v0.6.1
|
controller-gen.kubebuilder.io/version: v0.6.2
|
||||||
creationTimestamp: null
|
creationTimestamp: null
|
||||||
name: clustermaps.airshipit.org
|
name: clustermaps.airshipit.org
|
||||||
spec:
|
spec:
|
||||||
|
@ -4,7 +4,7 @@ apiVersion: apiextensions.k8s.io/v1
|
|||||||
kind: CustomResourceDefinition
|
kind: CustomResourceDefinition
|
||||||
metadata:
|
metadata:
|
||||||
annotations:
|
annotations:
|
||||||
controller-gen.kubebuilder.io/version: v0.6.1
|
controller-gen.kubebuilder.io/version: v0.6.2
|
||||||
creationTimestamp: null
|
creationTimestamp: null
|
||||||
name: genericcontainers.airshipit.org
|
name: genericcontainers.airshipit.org
|
||||||
spec:
|
spec:
|
||||||
|
@ -4,7 +4,7 @@ apiVersion: apiextensions.k8s.io/v1
|
|||||||
kind: CustomResourceDefinition
|
kind: CustomResourceDefinition
|
||||||
metadata:
|
metadata:
|
||||||
annotations:
|
annotations:
|
||||||
controller-gen.kubebuilder.io/version: v0.6.1
|
controller-gen.kubebuilder.io/version: v0.6.2
|
||||||
creationTimestamp: null
|
creationTimestamp: null
|
||||||
name: hosts.airshipit.org
|
name: hosts.airshipit.org
|
||||||
spec:
|
spec:
|
||||||
|
@ -4,7 +4,7 @@ apiVersion: apiextensions.k8s.io/v1
|
|||||||
kind: CustomResourceDefinition
|
kind: CustomResourceDefinition
|
||||||
metadata:
|
metadata:
|
||||||
annotations:
|
annotations:
|
||||||
controller-gen.kubebuilder.io/version: v0.6.1
|
controller-gen.kubebuilder.io/version: v0.6.2
|
||||||
creationTimestamp: null
|
creationTimestamp: null
|
||||||
name: isoconfigurations.airshipit.org
|
name: isoconfigurations.airshipit.org
|
||||||
spec:
|
spec:
|
||||||
@ -39,40 +39,29 @@ spec:
|
|||||||
description: Cloud Init network config will be retrieved from the
|
description: Cloud Init network config will be retrieved from the
|
||||||
doc matching this object
|
doc matching this object
|
||||||
properties:
|
properties:
|
||||||
selector:
|
annotationSelector:
|
||||||
description: Selector specifies a set of resources. Any resource
|
description: AnnotationSelector is a string that follows the label
|
||||||
that matches intersection of all conditions is included in this
|
selection expression https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#api
|
||||||
set.
|
It matches with the resource annotations.
|
||||||
properties:
|
type: string
|
||||||
annotationSelector:
|
group:
|
||||||
description: AnnotationSelector is a string that follows the
|
type: string
|
||||||
label selection expression https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#api
|
kind:
|
||||||
It matches with the resource annotations.
|
type: string
|
||||||
type: string
|
labelSelector:
|
||||||
group:
|
description: LabelSelector is a string that follows the label
|
||||||
type: string
|
selection expression https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#api
|
||||||
isClusterScoped:
|
It matches with the resource labels.
|
||||||
description: isClusterScoped is true if the object is known,
|
type: string
|
||||||
per the openapi data in use, to be cluster scoped, and false
|
name:
|
||||||
otherwise.
|
description: Name of the resource.
|
||||||
type: boolean
|
type: string
|
||||||
kind:
|
namespace:
|
||||||
type: string
|
description: Namespace the resource belongs to, if it can belong
|
||||||
labelSelector:
|
to a namespace.
|
||||||
description: LabelSelector is a string that follows the label
|
type: string
|
||||||
selection expression https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#api
|
version:
|
||||||
It matches with the resource labels.
|
type: string
|
||||||
type: string
|
|
||||||
name:
|
|
||||||
description: Name of the resource.
|
|
||||||
type: string
|
|
||||||
namespace:
|
|
||||||
description: Namespace the resource belongs to, if it can
|
|
||||||
belong to a namespace.
|
|
||||||
type: string
|
|
||||||
version:
|
|
||||||
type: string
|
|
||||||
type: object
|
|
||||||
type: object
|
type: object
|
||||||
outputFileName:
|
outputFileName:
|
||||||
description: File name to use for the output image that will be written
|
description: File name to use for the output image that will be written
|
||||||
@ -86,40 +75,29 @@ spec:
|
|||||||
description: Cloud Init user data will be retrieved from the doc matching
|
description: Cloud Init user data will be retrieved from the doc matching
|
||||||
this object
|
this object
|
||||||
properties:
|
properties:
|
||||||
selector:
|
annotationSelector:
|
||||||
description: Selector specifies a set of resources. Any resource
|
description: AnnotationSelector is a string that follows the label
|
||||||
that matches intersection of all conditions is included in this
|
selection expression https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#api
|
||||||
set.
|
It matches with the resource annotations.
|
||||||
properties:
|
type: string
|
||||||
annotationSelector:
|
group:
|
||||||
description: AnnotationSelector is a string that follows the
|
type: string
|
||||||
label selection expression https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#api
|
kind:
|
||||||
It matches with the resource annotations.
|
type: string
|
||||||
type: string
|
labelSelector:
|
||||||
group:
|
description: LabelSelector is a string that follows the label
|
||||||
type: string
|
selection expression https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#api
|
||||||
isClusterScoped:
|
It matches with the resource labels.
|
||||||
description: isClusterScoped is true if the object is known,
|
type: string
|
||||||
per the openapi data in use, to be cluster scoped, and false
|
name:
|
||||||
otherwise.
|
description: Name of the resource.
|
||||||
type: boolean
|
type: string
|
||||||
kind:
|
namespace:
|
||||||
type: string
|
description: Namespace the resource belongs to, if it can belong
|
||||||
labelSelector:
|
to a namespace.
|
||||||
description: LabelSelector is a string that follows the label
|
type: string
|
||||||
selection expression https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#api
|
version:
|
||||||
It matches with the resource labels.
|
type: string
|
||||||
type: string
|
|
||||||
name:
|
|
||||||
description: Name of the resource.
|
|
||||||
type: string
|
|
||||||
namespace:
|
|
||||||
description: Namespace the resource belongs to, if it can
|
|
||||||
belong to a namespace.
|
|
||||||
type: string
|
|
||||||
version:
|
|
||||||
type: string
|
|
||||||
type: object
|
|
||||||
type: object
|
type: object
|
||||||
type: object
|
type: object
|
||||||
container:
|
container:
|
||||||
|
@ -4,7 +4,7 @@ apiVersion: apiextensions.k8s.io/v1
|
|||||||
kind: CustomResourceDefinition
|
kind: CustomResourceDefinition
|
||||||
metadata:
|
metadata:
|
||||||
annotations:
|
annotations:
|
||||||
controller-gen.kubebuilder.io/version: v0.6.1
|
controller-gen.kubebuilder.io/version: v0.6.2
|
||||||
creationTimestamp: null
|
creationTimestamp: null
|
||||||
name: kubeconfigs.airshipit.org
|
name: kubeconfigs.airshipit.org
|
||||||
spec:
|
spec:
|
||||||
|
@ -4,7 +4,7 @@ apiVersion: apiextensions.k8s.io/v1
|
|||||||
kind: CustomResourceDefinition
|
kind: CustomResourceDefinition
|
||||||
metadata:
|
metadata:
|
||||||
annotations:
|
annotations:
|
||||||
controller-gen.kubebuilder.io/version: v0.6.1
|
controller-gen.kubebuilder.io/version: v0.6.2
|
||||||
creationTimestamp: null
|
creationTimestamp: null
|
||||||
name: kubernetesapplies.airshipit.org
|
name: kubernetesapplies.airshipit.org
|
||||||
spec:
|
spec:
|
||||||
|
@ -4,7 +4,7 @@ apiVersion: apiextensions.k8s.io/v1
|
|||||||
kind: CustomResourceDefinition
|
kind: CustomResourceDefinition
|
||||||
metadata:
|
metadata:
|
||||||
annotations:
|
annotations:
|
||||||
controller-gen.kubebuilder.io/version: v0.6.1
|
controller-gen.kubebuilder.io/version: v0.6.2
|
||||||
creationTimestamp: null
|
creationTimestamp: null
|
||||||
name: manifestmetadata.airshipit.org
|
name: manifestmetadata.airshipit.org
|
||||||
spec:
|
spec:
|
||||||
|
@ -4,7 +4,7 @@ apiVersion: apiextensions.k8s.io/v1
|
|||||||
kind: CustomResourceDefinition
|
kind: CustomResourceDefinition
|
||||||
metadata:
|
metadata:
|
||||||
annotations:
|
annotations:
|
||||||
controller-gen.kubebuilder.io/version: v0.6.1
|
controller-gen.kubebuilder.io/version: v0.6.2
|
||||||
creationTimestamp: null
|
creationTimestamp: null
|
||||||
name: networkcatalogues.airshipit.org
|
name: networkcatalogues.airshipit.org
|
||||||
spec:
|
spec:
|
||||||
|
@ -4,7 +4,7 @@ apiVersion: apiextensions.k8s.io/v1
|
|||||||
kind: CustomResourceDefinition
|
kind: CustomResourceDefinition
|
||||||
metadata:
|
metadata:
|
||||||
annotations:
|
annotations:
|
||||||
controller-gen.kubebuilder.io/version: v0.6.1
|
controller-gen.kubebuilder.io/version: v0.6.2
|
||||||
creationTimestamp: null
|
creationTimestamp: null
|
||||||
name: phaseplans.airshipit.org
|
name: phaseplans.airshipit.org
|
||||||
spec:
|
spec:
|
||||||
@ -67,7 +67,7 @@ spec:
|
|||||||
type: array
|
type: array
|
||||||
kubernetesVersion:
|
kubernetesVersion:
|
||||||
description: KubernetesVersion is the version of Kubernetes to validate
|
description: KubernetesVersion is the version of Kubernetes to validate
|
||||||
against (default "1.21.2").
|
against (default "1.18.6").
|
||||||
type: string
|
type: string
|
||||||
schemaLocation:
|
schemaLocation:
|
||||||
description: SchemaLocation is the base URL from which to search for
|
description: SchemaLocation is the base URL from which to search for
|
||||||
|
@ -4,7 +4,7 @@ apiVersion: apiextensions.k8s.io/v1
|
|||||||
kind: CustomResourceDefinition
|
kind: CustomResourceDefinition
|
||||||
metadata:
|
metadata:
|
||||||
annotations:
|
annotations:
|
||||||
controller-gen.kubebuilder.io/version: v0.6.1
|
controller-gen.kubebuilder.io/version: v0.6.2
|
||||||
creationTimestamp: null
|
creationTimestamp: null
|
||||||
name: phases.airshipit.org
|
name: phases.airshipit.org
|
||||||
spec:
|
spec:
|
||||||
@ -116,7 +116,7 @@ spec:
|
|||||||
type: array
|
type: array
|
||||||
kubernetesVersion:
|
kubernetesVersion:
|
||||||
description: KubernetesVersion is the version of Kubernetes to
|
description: KubernetesVersion is the version of Kubernetes to
|
||||||
validate against (default "1.21.2").
|
validate against (default "1.18.6").
|
||||||
type: string
|
type: string
|
||||||
schemaLocation:
|
schemaLocation:
|
||||||
description: SchemaLocation is the base URL from which to search
|
description: SchemaLocation is the base URL from which to search
|
||||||
|
@ -4,7 +4,7 @@ apiVersion: apiextensions.k8s.io/v1
|
|||||||
kind: CustomResourceDefinition
|
kind: CustomResourceDefinition
|
||||||
metadata:
|
metadata:
|
||||||
annotations:
|
annotations:
|
||||||
controller-gen.kubebuilder.io/version: v0.6.1
|
controller-gen.kubebuilder.io/version: v0.6.2
|
||||||
creationTimestamp: null
|
creationTimestamp: null
|
||||||
name: replacementtransformers.airshipit.org
|
name: replacementtransformers.airshipit.org
|
||||||
spec:
|
spec:
|
||||||
|
@ -4,7 +4,7 @@ apiVersion: apiextensions.k8s.io/v1
|
|||||||
kind: CustomResourceDefinition
|
kind: CustomResourceDefinition
|
||||||
metadata:
|
metadata:
|
||||||
annotations:
|
annotations:
|
||||||
controller-gen.kubebuilder.io/version: v0.6.1
|
controller-gen.kubebuilder.io/version: v0.6.2
|
||||||
creationTimestamp: null
|
creationTimestamp: null
|
||||||
name: templaters.airshipit.org
|
name: templaters.airshipit.org
|
||||||
spec:
|
spec:
|
||||||
|
@ -4,7 +4,7 @@ apiVersion: apiextensions.k8s.io/v1
|
|||||||
kind: CustomResourceDefinition
|
kind: CustomResourceDefinition
|
||||||
metadata:
|
metadata:
|
||||||
annotations:
|
annotations:
|
||||||
controller-gen.kubebuilder.io/version: v0.6.1
|
controller-gen.kubebuilder.io/version: v0.6.2
|
||||||
creationTimestamp: null
|
creationTimestamp: null
|
||||||
name: versionscatalogues.airshipit.org
|
name: versionscatalogues.airshipit.org
|
||||||
spec:
|
spec:
|
||||||
|
@ -16,8 +16,6 @@ package v1alpha1
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
|
|
||||||
"opendev.org/airship/airshipctl/pkg/document"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// IsoContainer structure contains parameters related to Docker runtime, used for building image
|
// IsoContainer structure contains parameters related to Docker runtime, used for building image
|
||||||
@ -33,11 +31,11 @@ type IsoContainer struct {
|
|||||||
// Isogen structure defines document selection criteria for cloud-init metadata
|
// Isogen structure defines document selection criteria for cloud-init metadata
|
||||||
type Isogen struct {
|
type Isogen struct {
|
||||||
// Cloud Init user data will be retrieved from the doc matching this object
|
// Cloud Init user data will be retrieved from the doc matching this object
|
||||||
UserDataSelector document.Selector `json:"userDataSelector,omitempty"`
|
UserDataSelector Selector `json:"userDataSelector,omitempty"`
|
||||||
// Cloud init user data will be retrieved from this document key
|
// Cloud init user data will be retrieved from this document key
|
||||||
UserDataKey string `json:"userDataKey,omitempty"`
|
UserDataKey string `json:"userDataKey,omitempty"`
|
||||||
// Cloud Init network config will be retrieved from the doc matching this object
|
// Cloud Init network config will be retrieved from the doc matching this object
|
||||||
NetworkConfigSelector document.Selector `json:"networkConfigSelector,omitempty"`
|
NetworkConfigSelector Selector `json:"networkConfigSelector,omitempty"`
|
||||||
// Cloud init network config will be retrieved from this document key
|
// Cloud init network config will be retrieved from this document key
|
||||||
NetworkConfigKey string `json:"networkConfigKey,omitempty"`
|
NetworkConfigKey string `json:"networkConfigKey,omitempty"`
|
||||||
// File name to use for the output image that will be written to the container volume root
|
// File name to use for the output image that will be written to the container volume root
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
//go:build !ignore_autogenerated
|
|
||||||
// +build !ignore_autogenerated
|
// +build !ignore_autogenerated
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -15,6 +15,7 @@
|
|||||||
package cloudinit
|
package cloudinit
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"opendev.org/airship/airshipctl/pkg/api/v1alpha1"
|
||||||
"opendev.org/airship/airshipctl/pkg/document"
|
"opendev.org/airship/airshipctl/pkg/document"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -27,13 +28,15 @@ const (
|
|||||||
// ephemeral node.
|
// ephemeral node.
|
||||||
func GetCloudData(
|
func GetCloudData(
|
||||||
docBundle document.Bundle,
|
docBundle document.Bundle,
|
||||||
userDataSelector document.Selector,
|
userDataSelector v1alpha1.Selector,
|
||||||
userDataKey string,
|
userDataKey string,
|
||||||
networkConfigSelector document.Selector,
|
networkConfigSelector v1alpha1.Selector,
|
||||||
networkConfigKey string,
|
networkConfigKey string,
|
||||||
) (userData []byte, netConf []byte, err error) {
|
) (userData []byte, netConf []byte, err error) {
|
||||||
|
uDataSel := document.NewSelectorFromV1Alpha1(userDataSelector)
|
||||||
|
nwDataSel := document.NewSelectorFromV1Alpha1(networkConfigSelector)
|
||||||
userDataSelectorFinal, userDataKeyFinal := applyDefaultsAndGetData(
|
userDataSelectorFinal, userDataKeyFinal := applyDefaultsAndGetData(
|
||||||
userDataSelector,
|
uDataSel,
|
||||||
document.SecretKind,
|
document.SecretKind,
|
||||||
document.EphemeralUserDataSelector,
|
document.EphemeralUserDataSelector,
|
||||||
userDataKey,
|
userDataKey,
|
||||||
@ -45,7 +48,7 @@ func GetCloudData(
|
|||||||
}
|
}
|
||||||
|
|
||||||
netConfSelectorFinal, netConfKeyFinal := applyDefaultsAndGetData(
|
netConfSelectorFinal, netConfKeyFinal := applyDefaultsAndGetData(
|
||||||
networkConfigSelector,
|
nwDataSel,
|
||||||
document.BareMetalHostKind,
|
document.BareMetalHostKind,
|
||||||
document.EphemeralHostSelector,
|
document.EphemeralHostSelector,
|
||||||
networkConfigKey,
|
networkConfigKey,
|
||||||
|
@ -18,29 +18,40 @@ import (
|
|||||||
"github.com/stretchr/testify/assert"
|
"github.com/stretchr/testify/assert"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
|
"opendev.org/airship/airshipctl/pkg/api/v1alpha1"
|
||||||
"opendev.org/airship/airshipctl/pkg/document"
|
"opendev.org/airship/airshipctl/pkg/document"
|
||||||
)
|
)
|
||||||
|
|
||||||
type selectors struct {
|
type selectors struct {
|
||||||
userDataSelector document.Selector
|
userDataSelector v1alpha1.Selector
|
||||||
userDataKey string
|
userDataKey string
|
||||||
networkConfigSelector document.Selector
|
networkConfigSelector v1alpha1.Selector
|
||||||
networkConfigKey string
|
networkConfigKey string
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
emptySelectors = selectors{
|
emptySelectors = selectors{
|
||||||
userDataSelector: document.NewSelector(),
|
userDataSelector: v1alpha1.Selector{},
|
||||||
networkConfigSelector: document.NewSelector(),
|
networkConfigSelector: v1alpha1.Selector{},
|
||||||
}
|
}
|
||||||
validSelectors = selectors{
|
validSelectors = selectors{
|
||||||
userDataSelector: document.NewSelector().
|
userDataSelector: v1alpha1.Selector{
|
||||||
ByKind(secret).
|
ResID: v1alpha1.ResID{
|
||||||
ByLabel(ephUser),
|
Gvk: v1alpha1.Gvk{
|
||||||
|
Kind: secret,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
LabelSelector: ephUser,
|
||||||
|
},
|
||||||
userDataKey: defaultUserDataKey,
|
userDataKey: defaultUserDataKey,
|
||||||
networkConfigSelector: document.NewSelector().
|
networkConfigSelector: v1alpha1.Selector{
|
||||||
ByKind(bmh).
|
ResID: v1alpha1.ResID{
|
||||||
ByLabel(ephNode),
|
Gvk: v1alpha1.Gvk{
|
||||||
|
Kind: bmh,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
LabelSelector: ephNode,
|
||||||
|
},
|
||||||
networkConfigKey: defaultNetworkConfigKey,
|
networkConfigKey: defaultNetworkConfigKey,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
@ -23,6 +23,8 @@ import (
|
|||||||
"k8s.io/apimachinery/pkg/runtime"
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
"sigs.k8s.io/kustomize/api/types"
|
"sigs.k8s.io/kustomize/api/types"
|
||||||
"sigs.k8s.io/kustomize/kyaml/resid"
|
"sigs.k8s.io/kustomize/kyaml/resid"
|
||||||
|
|
||||||
|
"opendev.org/airship/airshipctl/pkg/api/v1alpha1"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Selector provides abstraction layer in front of kustomize selector
|
// Selector provides abstraction layer in front of kustomize selector
|
||||||
@ -35,6 +37,23 @@ func NewSelector() Selector {
|
|||||||
return Selector{}
|
return Selector{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// NewSelectorFromV1Alpha1 generates selector object from v1alpha1 analog
|
||||||
|
func NewSelectorFromV1Alpha1(selector v1alpha1.Selector) Selector {
|
||||||
|
return Selector{types.Selector{
|
||||||
|
ResId: resid.ResId{
|
||||||
|
Gvk: resid.Gvk{
|
||||||
|
Group: selector.Gvk.Group,
|
||||||
|
Version: selector.Gvk.Version,
|
||||||
|
Kind: selector.Gvk.Kind,
|
||||||
|
},
|
||||||
|
Name: selector.Name,
|
||||||
|
Namespace: selector.Namespace,
|
||||||
|
},
|
||||||
|
AnnotationSelector: selector.AnnotationSelector,
|
||||||
|
LabelSelector: selector.LabelSelector,
|
||||||
|
}}
|
||||||
|
}
|
||||||
|
|
||||||
// Following set of functions allows to build selector object
|
// Following set of functions allows to build selector object
|
||||||
// by name, gvk, label selector and annotation selector
|
// by name, gvk, label selector and annotation selector
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user