Merge pull request #61 from zhiweiyin318/refactor-deploy

generate csv manifests
This commit is contained in:
OpenShift Merge Robot
2020-08-04 10:28:27 +02:00
committed by GitHub
9 changed files with 826 additions and 10 deletions

View File

@@ -16,6 +16,9 @@ IMAGE_REGISTRY?=quay.io/open-cluster-management
IMAGE_TAG?=latest
IMAGE_NAME?=$(IMAGE_REGISTRY)/registration-operator:$(IMAGE_TAG)
# CSV_VERSION is used to generate new CSV manifests
CSV_VERSION?=0.2.0
# WORK_IMAGE can be set in the env to override calculated value
WORK_TAG?=latest
WORK_IMAGE?=$(IMAGE_REGISTRY)/work:$(WORK_TAG)
@@ -63,9 +66,10 @@ verify-crds:
verify: verify-crds
# should set the correct IMAGE_TAG and IMAGE_NAME for the new csv
update-csv: ensure-operator-sdk
$(OPERATOR_SDK) generate csv --crd-dir=deploy/cluster-manager/crds --deploy-dir=deploy/cluster-manager --output-dir=deploy/cluster-manager/olm-catalog/cluster-manager --operator-name=cluster-manager --csv-version=0.1.0
$(OPERATOR_SDK) generate csv --crd-dir=deploy/klusterlet/crds --deploy-dir=deploy/klusterlet --output-dir=deploy/klusterlet/olm-catalog/klusterlet --operator-name=klusterlet --csv-version=0.1.0
$(OPERATOR_SDK) generate csv --crd-dir=deploy/cluster-manager/crds --deploy-dir=deploy/cluster-manager --output-dir=deploy/cluster-manager/olm-catalog/cluster-manager --operator-name=cluster-manager --csv-version=$(CSV_VERSION)
$(OPERATOR_SDK) generate csv --crd-dir=deploy/klusterlet/crds --deploy-dir=deploy/klusterlet --output-dir=deploy/klusterlet/olm-catalog/klusterlet --operator-name=klusterlet --csv-version=$(CSV_VERSION)
munge-hub-csv:
mkdir -p munge-csv
@@ -92,14 +96,14 @@ install-olm: ensure-operator-sdk
deploy-hub: deploy-hub-operator apply-hub-cr
deploy-hub-operator: install-olm munge-hub-csv
$(OPERATOR_SDK) run --olm --operator-namespace open-cluster-management --operator-version 0.1.0 --manifests deploy/cluster-manager/olm-catalog/cluster-manager --olm-namespace $(OLM_NAMESPACE) --timeout 10m
$(OPERATOR_SDK) run --olm --operator-namespace open-cluster-management --operator-version $(CSV_VERSION) --manifests deploy/cluster-manager/olm-catalog/cluster-manager --olm-namespace $(OLM_NAMESPACE) --timeout 10m
apply-hub-cr:
$(SED_CMD) -e "s,quay.io/open-cluster-management/registration,$(REGISTRATION_IMAGE)," deploy/cluster-manager/crds/operator_open-cluster-management_clustermanagers.cr.yaml | $(KUBECTL) apply -f -
clean-hub: ensure-operator-sdk
$(KUBECTL) delete -f deploy/cluster-manager/crds/operator_open-cluster-management_clustermanagers.cr.yaml --ignore-not-found
$(OPERATOR_SDK) cleanup --olm --operator-namespace open-cluster-management --operator-version 0.1.0 --manifests deploy/cluster-manager/olm-catalog/cluster-manager --olm-namespace $(OLM_NAMESPACE) --timeout 10m
$(OPERATOR_SDK) cleanup --olm --operator-namespace open-cluster-management --operator-version $(CSV_VERSION) --manifests deploy/cluster-manager/olm-catalog/cluster-manager --olm-namespace $(OLM_NAMESPACE) --timeout 10m
cluster-ip:
CLUSTER_IP?=$(shell $(KUBECTL) get svc kubernetes -n default -o jsonpath="{.spec.clusterIP}")
@@ -123,14 +127,14 @@ e2e-bootstrap-secret: cluster-ip
deploy-spoke: deploy-spoke-operator apply-spoke-cr
deploy-spoke-operator: install-olm munge-spoke-csv bootstrap-secret
$(OPERATOR_SDK) run --olm --operator-namespace open-cluster-management --operator-version 0.1.0 --manifests deploy/klusterlet/olm-catalog/klusterlet --olm-namespace $(OLM_NAMESPACE) --timeout 10m
$(OPERATOR_SDK) run --olm --operator-namespace open-cluster-management --operator-version $(CSV_VERSION) --manifests deploy/klusterlet/olm-catalog/klusterlet --olm-namespace $(OLM_NAMESPACE) --timeout 10m
apply-spoke-cr:
$(SED_CMD) -e "s,quay.io/open-cluster-management/registration,$(REGISTRATION_IMAGE)," -e "s,quay.io/open-cluster-management/work,$(WORK_IMAGE)," deploy/klusterlet/crds/operator_open-cluster-management_klusterlets.cr.yaml | $(KUBECTL) apply -f -
clean-spoke: ensure-operator-sdk
$(KUBECTL) delete -f deploy/klusterlet/crds/operator_open-cluster-management_klusterlets.cr.yaml --ignore-not-found
$(OPERATOR_SDK) cleanup --olm --operator-namespace open-cluster-management --operator-version 0.1.0 --manifests deploy/klusterlet/olm-catalog/klusterlet --olm-namespace $(OLM_NAMESPACE) --timeout 10m
$(OPERATOR_SDK) cleanup --olm --operator-namespace open-cluster-management --operator-version $(CSV_VERSION) --manifests deploy/klusterlet/olm-catalog/klusterlet --olm-namespace $(OLM_NAMESPACE) --timeout 10m
test-e2e: deploy-hub deploy-spoke-operator run-e2e

View File

@@ -0,0 +1,153 @@
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
creationTimestamp: null
name: clustermanagers.operator.open-cluster-management.io
spec:
group: operator.open-cluster-management.io
names:
kind: ClusterManager
listKind: ClusterManagerList
plural: clustermanagers
singular: clustermanager
scope: Cluster
subresources:
status: {}
validation:
openAPIV3Schema:
description: ClusterManager configures the controllers on the hub that govern
registration and work distribution for attached Klusterlets. ClusterManager
will be only deployed in open-cluster-management-hub namespace.
type: object
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
description: Spec represents a desired deployment configuration of controllers
that govern registration and work distribution for attached Klusterlets.
type: object
properties:
registrationImagePullSpec:
description: RegistrationImagePullSpec represents the desired image
of registration controller installed on hub.
type: string
status:
description: Status represents the current status of controllers that govern
the lifecycle of managed clusters.
type: object
properties:
conditions:
description: 'Conditions contain the different condition statuses for
this ClusterManager. Valid condition types are: Applied: components
in hub are applied. Available: components in hub are available and
ready to serve. Progressing: components in hub are in a transitioning
state. Degraded: components in hub do not match the desired configuration
and only provide degraded service.'
type: array
items:
description: StatusCondition contains condition information.
type: object
properties:
lastTransitionTime:
description: LastTransitionTime is the last time the condition
changed from one status to another.
type: string
format: date-time
message:
description: Message is a human-readable message indicating details
about the last status change.
type: string
reason:
description: Reason is a (brief) reason for the condition's last
status change.
type: string
status:
description: Status is the status of the condition. One of True,
False, Unknown.
type: string
type:
description: Type is the type of the cluster condition.
type: string
generations:
description: Generations are used to determine when an item needs to
be reconciled or has changed in a way that needs a reaction.
type: array
items:
description: GenerationStatus keeps track of the generation for a
given resource so that decisions about forced updates can be made.
the definition matches the GenerationStatus defined in github.com/openshift/api/v1
type: object
properties:
group:
description: group is the group of the thing you're tracking
type: string
lastGeneration:
description: lastGeneration is the last generation of the thing
that controller applies
type: integer
format: int64
name:
description: name is the name of the thing you're tracking
type: string
namespace:
description: namespace is where the thing you're tracking is
type: string
resource:
description: resource is the resource type of the thing you're
tracking
type: string
version:
description: version is the version of the thing you're tracking
type: string
observedGeneration:
description: ObservedGeneration is the last generation change you've
dealt with
type: integer
format: int64
relatedResources:
description: RelatedResources are used to track the resources that are
related to this ClusterManager
type: array
items:
description: RelatedResourceMeta represents the resource that is managed
by an operator
type: object
properties:
group:
description: group is the group of the thing you're tracking
type: string
name:
description: name is the name of the thing you're tracking
type: string
namespace:
description: namespace is where the thing you're tracking is
type: string
resource:
description: resource is the resource type of the thing you're
tracking
type: string
version:
description: version is the version of the thing you're tracking
type: string
version: v1
versions:
- name: v1
served: true
storage: true
preserveUnknownFields: false
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []

View File

@@ -0,0 +1,240 @@
apiVersion: operators.coreos.com/v1alpha1
kind: ClusterServiceVersion
metadata:
annotations:
alm-examples: |-
[
{
"apiVersion": "operator.open-cluster-management.io/v1",
"kind": "ClusterManager",
"metadata": {
"name": "cluster-manager"
},
"spec": {
"registrationImagePullSpec": "quay.io/open-cluster-management/registration"
}
}
]
capabilities: Basic Install
name: cluster-manager.v0.1.0
namespace: placeholder
spec:
apiservicedefinitions: {}
customresourcedefinitions:
owned:
- description: ClusterManager defines the configurations of controllers running
hub that govern registration and work distribution for attached Klusterlets
displayName: ClusterManager
kind: ClusterManager
name: clustermanagers.operator.open-cluster-management.io
version: v1
displayName: Cluster Manager
icon:
- base64data: ""
mediatype: ""
install:
spec:
clusterPermissions:
- rules:
- apiGroups:
- ""
resources:
- configmaps
- namespaces
- serviceaccounts
- services
- secrets
verbs:
- create
- get
- list
- update
- watch
- patch
- delete
- apiGroups:
- authorization.k8s.io
resources:
- subjectaccessreviews
verbs:
- create
- apiGroups:
- ""
- events.k8s.io
resources:
- events
verbs:
- create
- patch
- update
- apiGroups:
- apps
resources:
- deployments
verbs:
- create
- get
- list
- update
- watch
- patch
- delete
- apiGroups:
- rbac.authorization.k8s.io
resources:
- clusterrolebindings
- rolebindings
verbs:
- create
- get
- list
- update
- watch
- patch
- delete
- apiGroups:
- rbac.authorization.k8s.io
resources:
- clusterroles
- roles
verbs:
- create
- get
- list
- update
- watch
- patch
- delete
- escalate
- bind
- apiGroups:
- apiextensions.k8s.io
resources:
- customresourcedefinitions
verbs:
- create
- get
- list
- update
- watch
- patch
- delete
- apiGroups:
- apiregistration.k8s.io
resources:
- apiservices
verbs:
- create
- get
- list
- update
- watch
- patch
- delete
- apiGroups:
- admissionregistration.k8s.io
resources:
- validatingwebhookconfigurations
verbs:
- create
- get
- list
- update
- watch
- patch
- delete
- apiGroups:
- operator.open-cluster-management.io
resources:
- clustermanagers
verbs:
- get
- list
- watch
- update
- delete
- apiGroups:
- operator.open-cluster-management.io
resources:
- clustermanagers/status
verbs:
- update
- patch
serviceAccountName: cluster-manager
deployments:
- name: cluster-manager
spec:
replicas: 3
selector:
matchLabels:
app: cluster-manager
strategy: {}
template:
metadata:
labels:
app: cluster-manager
spec:
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- podAffinityTerm:
labelSelector:
matchExpressions:
- key: app
operator: In
values:
- cluster-manager
topologyKey: failure-domain.beta.kubernetes.io/zone
weight: 70
- podAffinityTerm:
labelSelector:
matchExpressions:
- key: app
operator: In
values:
- cluster-manager
topologyKey: kubernetes.io/hostname
weight: 30
containers:
- args:
- /registration-operator
- hub
image: quay.io/open-cluster-management/registration-operator:0.0.1
imagePullPolicy: IfNotPresent
livenessProbe:
httpGet:
path: /healthz
port: 8443
scheme: HTTPS
initialDelaySeconds: 2
periodSeconds: 10
name: registration-operator
readinessProbe:
httpGet:
path: /healthz
port: 8443
scheme: HTTPS
initialDelaySeconds: 2
resources:
requests:
cpu: 100m
memory: 128Mi
serviceAccountName: cluster-manager
strategy: deployment
installModes:
- supported: true
type: OwnNamespace
- supported: true
type: SingleNamespace
- supported: false
type: MultiNamespace
- supported: true
type: AllNamespaces
keywords:
- open-cluster-management
maintainers:
- {}
maturity: alpha
provider:
name: open-cluster-management
version: 0.1.0

View File

@@ -0,0 +1,5 @@
channels:
- name: stable
currentCSV: cluster-manager.v0.2.0
defaultChannel: stable
packageName: cluster-manager

View File

@@ -16,7 +16,7 @@ metadata:
}
]
capabilities: Basic Install
name: cluster-manager.v0.1.0
name: cluster-manager.v0.2.0
namespace: placeholder
spec:
apiservicedefinitions: {}
@@ -238,4 +238,5 @@ spec:
maturity: alpha
provider:
name: open-cluster-management
version: 0.1.0
replaces: cluster-manager.v0.1.0
version: 0.2.0

View File

@@ -0,0 +1,188 @@
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
creationTimestamp: null
name: klusterlets.operator.open-cluster-management.io
spec:
group: operator.open-cluster-management.io
names:
kind: Klusterlet
listKind: KlusterletList
plural: klusterlets
singular: klusterlet
scope: Cluster
subresources:
status: {}
validation:
openAPIV3Schema:
description: Klusterlet represents controllers on the managed cluster. When
configured, the Klusterlet requires a secret named of bootstrap-hub-kubeconfig
in the same namespace to allow API requests to the hub for the registration
protocol.
type: object
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
description: Spec represents the desired deployment configuration of Klusterlet
agent.
type: object
properties:
clusterName:
description: ClusterName is the name of the managed cluster to be created
on hub. The Klusterlet agent generates a random name if it is not
set, or discovers the appropriate cluster name on openshift.
type: string
externalServerURLs:
description: ExternalServerURLs represents the a list of apiserver urls
and ca bundles that is accessible externally If it is set empty, managed
cluster has no externally accessible url that hub cluster can visit.
type: array
items:
description: ServerURL represents the apiserver url and ca bundle
that is accessible externally
type: object
properties:
caBundle:
description: CABundle is the ca bundle to connect to apiserver
of the managed cluster. System certs are used if it is not set.
type: string
format: byte
url:
description: URL is the url of apiserver endpoint of the managed
cluster.
type: string
namespace:
description: Namespace is the namespace to deploy the agent. The namespace
must have a prefix of "open-cluster-management-", and if it is not
set, the namespace of "open-cluster-management-agent" is used to deploy
agent.
type: string
registrationImagePullSpec:
description: RegistrationImagePullSpec represents the desired image
configuration of registration agent.
type: string
workImagePullSpec:
description: WorkImagePullSpec represents the desired image configuration
of work agent.
type: string
status:
description: Status represents the current status of Klusterlet agent.
type: object
properties:
conditions:
description: 'Conditions contain the different condition statuses for
this Klusterlet. Valid condition types are: Applied: components have
been applied in the managed cluster. Available: components in the
managed cluster are available and ready to serve. Progressing: components
in the managed cluster are in a transitioning state. Degraded: components
in the managed cluster do not match the desired configuration and
only provide degraded service.'
type: array
items:
description: StatusCondition contains condition information.
type: object
properties:
lastTransitionTime:
description: LastTransitionTime is the last time the condition
changed from one status to another.
type: string
format: date-time
message:
description: Message is a human-readable message indicating details
about the last status change.
type: string
reason:
description: Reason is a (brief) reason for the condition's last
status change.
type: string
status:
description: Status is the status of the condition. One of True,
False, Unknown.
type: string
type:
description: Type is the type of the cluster condition.
type: string
generations:
description: Generations are used to determine when an item needs to
be reconciled or has changed in a way that needs a reaction.
type: array
items:
description: GenerationStatus keeps track of the generation for a
given resource so that decisions about forced updates can be made.
the definition matches the GenerationStatus defined in github.com/openshift/api/v1
type: object
properties:
group:
description: group is the group of the thing you're tracking
type: string
lastGeneration:
description: lastGeneration is the last generation of the thing
that controller applies
type: integer
format: int64
name:
description: name is the name of the thing you're tracking
type: string
namespace:
description: namespace is where the thing you're tracking is
type: string
resource:
description: resource is the resource type of the thing you're
tracking
type: string
version:
description: version is the version of the thing you're tracking
type: string
observedGeneration:
description: ObservedGeneration is the last generation change you've
dealt with
type: integer
format: int64
relatedResources:
description: RelatedResources are used to track the resources that are
related to this Klusterlet
type: array
items:
description: RelatedResourceMeta represents the resource that is managed
by an operator
type: object
properties:
group:
description: group is the group of the thing you're tracking
type: string
name:
description: name is the name of the thing you're tracking
type: string
namespace:
description: namespace is where the thing you're tracking is
type: string
resource:
description: resource is the resource type of the thing you're
tracking
type: string
version:
description: version is the version of the thing you're tracking
type: string
version: v1
versions:
- name: v1
served: true
storage: true
preserveUnknownFields: false
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []

View File

@@ -0,0 +1,219 @@
apiVersion: operators.coreos.com/v1alpha1
kind: ClusterServiceVersion
metadata:
annotations:
alm-examples: |-
[
{
"apiVersion": "operator.open-cluster-management.io/v1",
"kind": "Klusterlet",
"metadata": {
"name": "klusterlet"
},
"spec": {
"clusterName": "cluster1",
"externalServerURLs": [
{
"url": "https://localhost"
}
],
"namespace": "open-cluster-management-agent",
"registrationImagePullSpec": "quay.io/open-cluster-management/registration",
"workImagePullSpec": "quay.io/open-cluster-management/work"
}
}
]
capabilities: Basic Install
name: klusterlet.v0.1.0
namespace: placeholder
spec:
apiservicedefinitions: {}
customresourcedefinitions:
owned:
- description: Klusterlet defines the configurations of agents running on the
managed cluster
displayName: Klusterlet
kind: Klusterlet
name: klusterlets.operator.open-cluster-management.io
version: v1
displayName: Klusterlet
icon:
- base64data: ""
mediatype: ""
install:
spec:
clusterPermissions:
- rules:
- apiGroups:
- ""
resources:
- secrets
- configmaps
- serviceaccounts
verbs:
- create
- get
- list
- update
- watch
- patch
- delete
- apiGroups:
- authorization.k8s.io
resources:
- subjectaccessreviews
verbs:
- create
- apiGroups:
- ""
resources:
- namespaces
verbs:
- create
- get
- list
- watch
- apiGroups:
- ""
- events.k8s.io
resources:
- events
verbs:
- create
- patch
- update
- apiGroups:
- apps
resources:
- deployments
verbs:
- create
- get
- list
- update
- watch
- patch
- delete
- apiGroups:
- rbac.authorization.k8s.io
resources:
- clusterrolebindings
- rolebindings
verbs:
- create
- get
- list
- update
- watch
- patch
- delete
- apiGroups:
- rbac.authorization.k8s.io
resources:
- clusterroles
- roles
verbs:
- create
- get
- list
- update
- watch
- patch
- delete
- escalate
- bind
- apiGroups:
- operator.open-cluster-management.io
resources:
- klusterlets
verbs:
- get
- list
- watch
- update
- patch
- delete
- apiGroups:
- operator.open-cluster-management.io
resources:
- klusterlets/status
verbs:
- update
- patch
serviceAccountName: klusterlet
deployments:
- name: klusterlet
spec:
replicas: 3
selector:
matchLabels:
app: klusterlet
strategy: {}
template:
metadata:
labels:
app: klusterlet
spec:
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- podAffinityTerm:
labelSelector:
matchExpressions:
- key: app
operator: In
values:
- klusterlet
topologyKey: failure-domain.beta.kubernetes.io/zone
weight: 70
- podAffinityTerm:
labelSelector:
matchExpressions:
- key: app
operator: In
values:
- klusterlet
topologyKey: kubernetes.io/hostname
weight: 30
containers:
- args:
- /registration-operator
- klusterlet
image: quay.io/open-cluster-management/registration-operator:0.0.1
imagePullPolicy: IfNotPresent
livenessProbe:
httpGet:
path: /healthz
port: 8443
scheme: HTTPS
initialDelaySeconds: 2
periodSeconds: 10
name: klusterlet
readinessProbe:
httpGet:
path: /healthz
port: 8443
scheme: HTTPS
initialDelaySeconds: 2
resources:
requests:
cpu: 100m
memory: 128Mi
serviceAccountName: klusterlet
strategy: deployment
installModes:
- supported: true
type: OwnNamespace
- supported: true
type: SingleNamespace
- supported: false
type: MultiNamespace
- supported: true
type: AllNamespaces
keywords:
- open-cluster-management
maintainers:
- {}
maturity: alpha
provider: {}
version: 0.1.0

View File

@@ -0,0 +1,5 @@
channels:
- currentCSV: klusterlet.v0.2.0
name: stable
defaultChannel: stable
packageName: klusterlet

View File

@@ -24,7 +24,7 @@ metadata:
}
]
capabilities: Basic Install
name: klusterlet.v0.1.0
name: klusterlet.v0.2.0
namespace: placeholder
spec:
apiservicedefinitions: {}
@@ -228,4 +228,5 @@ spec:
- {}
maturity: alpha
provider: {}
version: 0.1.0
replaces: klusterlet.v0.1.0
version: 0.2.0