rename containerized to podspecworkload

This commit is contained in:
Ryan Zhang
2020-10-06 00:25:16 -07:00
parent e422d0ba86
commit 61544a0be6
44 changed files with 241 additions and 16906 deletions

View File

@@ -69,7 +69,7 @@ Succeeded!
$ vela comp status abc
Showing status of Component abc deployed in Environment t2
Component Status:
Name: abc Containerized(type) UNKNOWN APIVersion standard.oam.dev/v1alpha1 Kind Containerized workload is unknown for HealthScope
Name: abc PodSpecWorkload(type) UNKNOWN APIVersion standard.oam.dev/v1alpha1 Kind PodSpecWorkload workload is unknown for HealthScope
Traits
└─Trait/route

View File

@@ -61,9 +61,9 @@ After `vela install` you will see available workloads and traits.
```console
$ vela workloads
NAME DEFINITION
backend containerizeds.standard.oam.dev
backend podspecworkloads.standard.oam.dev
task jobs.batch.k8s.io
webservice containerizeds.standard.oam.dev
webservice podspecworkloads.standard.oam.dev
```
```console
@@ -247,7 +247,7 @@ $ vela comp show mycomp
$ vela comp status mycomp
Showing status of Component mycomp deployed in Environment demo
Component Status:
Name: mycomp Containerized(type) UNKNOWN APIVersion standard.oam.dev/v1alpha1 Kind Containerized workload is unknown for HealthScope
Name: mycomp PodSpecWorkload(type) UNKNOWN APIVersion standard.oam.dev/v1alpha1 Kind PodSpecWorkload workload is unknown for HealthScope
Traits
└─Trait/route

View File

@@ -23,20 +23,20 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
// ContainerizedSpec defines the desired state of Containerized
type ContainerizedSpec struct {
// PodSpecWorkloadSpec defines the desired state of PodSpecWorkload
type PodSpecWorkloadSpec struct {
// Replicas is the desired number of replicas of the given podSpec.
// These are replicas in the sense that they are instantiations of the same podSpec.
// If unspecified, defaults to 1.
Replicas *int32 `json:"replicas"`
// PodSpec describes the pods that will be created,
// we omit the meta part as it will be exactly the same as the containerized
// we omit the meta part as it will be exactly the same as the PodSpecWorkload
PodSpec v1.PodSpec `json:"podSpec"`
}
// ContainerizedStatus defines the observed state of Containerized
type ContainerizedStatus struct {
// PodSpecWorkloadStatus defines the observed state of PodSpecWorkload
type PodSpecWorkloadStatus struct {
cpv1alpha1.ConditionedStatus `json:",inline"`
// Resources managed by this workload.
@@ -45,36 +45,36 @@ type ContainerizedStatus struct {
// +kubebuilder:object:root=true
// Containerized is the Schema for the containerizeds API
// PodSpecWorkload is the Schema for the PodSpec API
// +kubebuilder:resource:categories={oam}
// +kubebuilder:subresource:status
type Containerized struct {
type PodSpecWorkload struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec ContainerizedSpec `json:"spec,omitempty"`
Status ContainerizedStatus `json:"status,omitempty"`
Spec PodSpecWorkloadSpec `json:"spec,omitempty"`
Status PodSpecWorkloadStatus `json:"status,omitempty"`
}
// +kubebuilder:object:root=true
// ContainerizedList contains a list of Containerized
type ContainerizedList struct {
// PodSpecWorkloadList contains a list of PodSpecWorkload
type PodSpecWorkloadList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []Containerized `json:"items"`
Items []PodSpecWorkload `json:"items"`
}
func init() {
SchemeBuilder.Register(&Containerized{}, &ContainerizedList{})
SchemeBuilder.Register(&PodSpecWorkload{}, &PodSpecWorkloadList{})
}
var _ oam.Workload = &Containerized{}
var _ oam.Workload = &PodSpecWorkload{}
func (in *Containerized) SetConditions(c ...cpv1alpha1.Condition) {
func (in *PodSpecWorkload) SetConditions(c ...cpv1alpha1.Condition) {
in.Status.SetConditions(c...)
}
func (in *Containerized) GetCondition(c cpv1alpha1.ConditionType) cpv1alpha1.Condition {
func (in *PodSpecWorkload) GetCondition(c cpv1alpha1.ConditionType) cpv1alpha1.Condition {
return in.Status.GetCondition(c)
}

View File

@@ -49,107 +49,6 @@ func (in *Backend) DeepCopy() *Backend {
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Containerized) DeepCopyInto(out *Containerized) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
in.Spec.DeepCopyInto(&out.Spec)
in.Status.DeepCopyInto(&out.Status)
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Containerized.
func (in *Containerized) DeepCopy() *Containerized {
if in == nil {
return nil
}
out := new(Containerized)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *Containerized) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ContainerizedList) DeepCopyInto(out *ContainerizedList) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ListMeta.DeepCopyInto(&out.ListMeta)
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]Containerized, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ContainerizedList.
func (in *ContainerizedList) DeepCopy() *ContainerizedList {
if in == nil {
return nil
}
out := new(ContainerizedList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *ContainerizedList) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ContainerizedSpec) DeepCopyInto(out *ContainerizedSpec) {
*out = *in
if in.Replicas != nil {
in, out := &in.Replicas, &out.Replicas
*out = new(int32)
**out = **in
}
in.PodSpec.DeepCopyInto(&out.PodSpec)
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ContainerizedSpec.
func (in *ContainerizedSpec) DeepCopy() *ContainerizedSpec {
if in == nil {
return nil
}
out := new(ContainerizedSpec)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *ContainerizedStatus) DeepCopyInto(out *ContainerizedStatus) {
*out = *in
in.ConditionedStatus.DeepCopyInto(&out.ConditionedStatus)
if in.Resources != nil {
in, out := &in.Resources, &out.Resources
*out = make([]corev1alpha1.TypedReference, len(*in))
copy(*out, *in)
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ContainerizedStatus.
func (in *ContainerizedStatus) DeepCopy() *ContainerizedStatus {
if in == nil {
return nil
}
out := new(ContainerizedStatus)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *MetricsTrait) DeepCopyInto(out *MetricsTrait) {
*out = *in
@@ -247,6 +146,107 @@ func (in *MetricsTraitStatus) DeepCopy() *MetricsTraitStatus {
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *PodSpecWorkload) DeepCopyInto(out *PodSpecWorkload) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)
in.Spec.DeepCopyInto(&out.Spec)
in.Status.DeepCopyInto(&out.Status)
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodSpecWorkload.
func (in *PodSpecWorkload) DeepCopy() *PodSpecWorkload {
if in == nil {
return nil
}
out := new(PodSpecWorkload)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *PodSpecWorkload) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *PodSpecWorkloadList) DeepCopyInto(out *PodSpecWorkloadList) {
*out = *in
out.TypeMeta = in.TypeMeta
in.ListMeta.DeepCopyInto(&out.ListMeta)
if in.Items != nil {
in, out := &in.Items, &out.Items
*out = make([]PodSpecWorkload, len(*in))
for i := range *in {
(*in)[i].DeepCopyInto(&(*out)[i])
}
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodSpecWorkloadList.
func (in *PodSpecWorkloadList) DeepCopy() *PodSpecWorkloadList {
if in == nil {
return nil
}
out := new(PodSpecWorkloadList)
in.DeepCopyInto(out)
return out
}
// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.
func (in *PodSpecWorkloadList) DeepCopyObject() runtime.Object {
if c := in.DeepCopy(); c != nil {
return c
}
return nil
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *PodSpecWorkloadSpec) DeepCopyInto(out *PodSpecWorkloadSpec) {
*out = *in
if in.Replicas != nil {
in, out := &in.Replicas, &out.Replicas
*out = new(int32)
**out = **in
}
in.PodSpec.DeepCopyInto(&out.PodSpec)
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodSpecWorkloadSpec.
func (in *PodSpecWorkloadSpec) DeepCopy() *PodSpecWorkloadSpec {
if in == nil {
return nil
}
out := new(PodSpecWorkloadSpec)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *PodSpecWorkloadStatus) DeepCopyInto(out *PodSpecWorkloadStatus) {
*out = *in
in.ConditionedStatus.DeepCopyInto(&out.ConditionedStatus)
if in.Resources != nil {
in, out := &in.Resources, &out.Resources
*out = make([]corev1alpha1.TypedReference, len(*in))
copy(*out, *in)
}
}
// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PodSpecWorkloadStatus.
func (in *PodSpecWorkloadStatus) DeepCopy() *PodSpecWorkloadStatus {
if in == nil {
return nil
}
out := new(PodSpecWorkloadStatus)
in.DeepCopyInto(out)
return out
}
// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (in *Route) DeepCopyInto(out *Route) {
*out = *in

View File

@@ -1,44 +0,0 @@
#!/bin/bash
# Copyright 2019 The Knative Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#!/usr/bin/env bash
# Download and unpack cert-manager
CERT_MANAGER_VERSION=1.0.0
ARCHIVE_DOWNLOAD_URL=https://github.com/jetstack/cert-manager/archive/v${CERT_MANAGER_VERSION}.tar.gz
YAML_URL=https://github.com/jetstack/cert-manager/releases/download/v${CERT_MANAGER_VERSION}/cert-manager.yaml
wget $ARCHIVE_DOWNLOAD_URL
tar xzf v${CERT_MANAGER_VERSION}.tar.gz
(
# subshell in downloaded directory
cd cert-manager-${CERT_MANAGER_VERSION} || exit
# Copy the CRD yaml file
cp deploy/manifests/00-crds.yaml ../cert-manager-crds.yaml
)
# Download the cert-manager yaml file
wget $YAML_URL
# Clean up.
rm -rf cert-manager-${CERT_MANAGER_VERSION}
rm v${CERT_MANAGER_VERSION}.tar.gz
# Add enable-certificate-owner-ref option to cert-manager's controller.
# The option is to cleans up secret(certificate) by adding ownerref.
patch -l cert-manager.yaml owner-ref.patch

View File

@@ -1,4 +0,0 @@
#!/bin/bash
# Download and unpack operator Lifecycle Manager (coreos)
curl -sL https://github.com/operator-framework/operator-lifecycle-manager/releases/download/0.15.1/install.sh | bash -s 0.15.1

View File

@@ -1,24 +0,0 @@
apiVersion: v1
kind: Namespace
metadata:
name: my-grafana-operator
---
apiVersion: operators.coreos.com/v1
kind: OperatorGroup
metadata:
name: operatorgroup
namespace: my-grafana-operator
spec:
targetNamespaces:
- my-grafana-operator
---
apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
name: my-grafana-operator
namespace: my-grafana-operator
spec:
channel: alpha
name: grafana-operator
source: operatorhubio-catalog
sourceNamespace: olm

View File

@@ -1,6 +0,0 @@
apiVersion: v1
kind: Namespace
metadata:
labels:
mornitoring: oam
name: monitoring

View File

@@ -1,265 +0,0 @@
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.2.4
creationTimestamp: null
name: podmonitors.monitoring.coreos.com
spec:
group: monitoring.coreos.com
names:
kind: PodMonitor
listKind: PodMonitorList
plural: podmonitors
singular: podmonitor
scope: Namespaced
versions:
- name: v1
schema:
openAPIV3Schema:
description: PodMonitor defines monitoring for a set of pods.
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: Specification of desired Pod selection for target discovery
by Prometheus.
properties:
jobLabel:
description: The label to use to retrieve the job name from.
type: string
namespaceSelector:
description: Selector to select which namespaces the Endpoints objects
are discovered from.
properties:
any:
description: Boolean describing whether all namespaces are selected
in contrast to a list restricting them.
type: boolean
matchNames:
description: List of namespace names.
items:
type: string
type: array
type: object
podMetricsEndpoints:
description: A list of endpoints allowed as part of this PodMonitor.
items:
description: PodMetricsEndpoint defines a scrapeable endpoint of
a Kubernetes Pod serving Prometheus metrics.
properties:
honorLabels:
description: HonorLabels chooses the metric's labels on collisions
with target labels.
type: boolean
honorTimestamps:
description: HonorTimestamps controls whether Prometheus respects
the timestamps present in scraped data.
type: boolean
interval:
description: Interval at which metrics should be scraped
type: string
metricRelabelings:
description: MetricRelabelConfigs to apply to samples before
ingestion.
items:
description: 'RelabelConfig allows dynamic rewriting of the
label set, being applied to samples before ingestion. It
defines `<metric_relabel_configs>`-section of Prometheus
configuration. More info: https://prometheus.io/docs/prometheus/latest/configuration/configuration/#metric_relabel_configs'
properties:
action:
description: Action to perform based on regex matching.
Default is 'replace'
type: string
modulus:
description: Modulus to take of the hash of the source
label values.
format: int64
type: integer
regex:
description: Regular expression against which the extracted
value is matched. Default is '(.*)'
type: string
replacement:
description: Replacement value against which a regex replace
is performed if the regular expression matches. Regex
capture groups are available. Default is '$1'
type: string
separator:
description: Separator placed between concatenated source
label values. default is ';'.
type: string
sourceLabels:
description: The source labels select values from existing
labels. Their content is concatenated using the configured
separator and matched against the configured regular
expression for the replace, keep, and drop actions.
items:
type: string
type: array
targetLabel:
description: Label to which the resulting value is written
in a replace action. It is mandatory for replace actions.
Regex capture groups are available.
type: string
type: object
type: array
params:
additionalProperties:
items:
type: string
type: array
description: Optional HTTP URL parameters
type: object
path:
description: HTTP path to scrape for metrics.
type: string
port:
description: Name of the pod port this endpoint refers to. Mutually
exclusive with targetPort.
type: string
proxyUrl:
description: ProxyURL eg http://proxyserver:2195 Directs scrapes
to proxy through this endpoint.
type: string
relabelings:
description: 'RelabelConfigs to apply to samples before ingestion.
More info: https://prometheus.io/docs/prometheus/latest/configuration/configuration/#relabel_config'
items:
description: 'RelabelConfig allows dynamic rewriting of the
label set, being applied to samples before ingestion. It
defines `<metric_relabel_configs>`-section of Prometheus
configuration. More info: https://prometheus.io/docs/prometheus/latest/configuration/configuration/#metric_relabel_configs'
properties:
action:
description: Action to perform based on regex matching.
Default is 'replace'
type: string
modulus:
description: Modulus to take of the hash of the source
label values.
format: int64
type: integer
regex:
description: Regular expression against which the extracted
value is matched. Default is '(.*)'
type: string
replacement:
description: Replacement value against which a regex replace
is performed if the regular expression matches. Regex
capture groups are available. Default is '$1'
type: string
separator:
description: Separator placed between concatenated source
label values. default is ';'.
type: string
sourceLabels:
description: The source labels select values from existing
labels. Their content is concatenated using the configured
separator and matched against the configured regular
expression for the replace, keep, and drop actions.
items:
type: string
type: array
targetLabel:
description: Label to which the resulting value is written
in a replace action. It is mandatory for replace actions.
Regex capture groups are available.
type: string
type: object
type: array
scheme:
description: HTTP scheme to use for scraping.
type: string
scrapeTimeout:
description: Timeout after which the scrape is ended
type: string
targetPort:
anyOf:
- type: integer
- type: string
description: 'Deprecated: Use ''port'' instead.'
x-kubernetes-int-or-string: true
type: object
type: array
podTargetLabels:
description: PodTargetLabels transfers labels on the Kubernetes Pod
onto the target.
items:
type: string
type: array
sampleLimit:
description: SampleLimit defines per-scrape limit on number of scraped
samples that will be accepted.
format: int64
type: integer
selector:
description: Selector to select Pod objects.
properties:
matchExpressions:
description: matchExpressions is a list of label selector requirements.
The requirements are ANDed.
items:
description: A label selector requirement is a selector that
contains values, a key, and an operator that relates the key
and values.
properties:
key:
description: key is the label key that the selector applies
to.
type: string
operator:
description: operator represents a key's relationship to
a set of values. Valid operators are In, NotIn, Exists
and DoesNotExist.
type: string
values:
description: values is an array of string values. If the
operator is In or NotIn, the values array must be non-empty.
If the operator is Exists or DoesNotExist, the values
array must be empty. This array is replaced during a strategic
merge patch.
items:
type: string
type: array
required:
- key
- operator
type: object
type: array
matchLabels:
additionalProperties:
type: string
description: matchLabels is a map of {key,value} pairs. A single
{key,value} in the matchLabels map is equivalent to an element
of matchExpressions, whose key field is "key", the operator
is "In", and the values array contains only "value". The requirements
are ANDed.
type: object
type: object
required:
- podMetricsEndpoints
- selector
type: object
required:
- spec
type: object
served: true
storage: true
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []

View File

@@ -1,212 +0,0 @@
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.2.4
creationTimestamp: null
name: probes.monitoring.coreos.com
spec:
group: monitoring.coreos.com
names:
kind: Probe
listKind: ProbeList
plural: probes
singular: probe
scope: Namespaced
versions:
- name: v1
schema:
openAPIV3Schema:
description: Probe defines monitoring for a set of static targets or ingresses.
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: Specification of desired Ingress selection for target discovery
by Prometheus.
properties:
interval:
description: Interval at which targets are probed using the configured
prober. If not specified Prometheus' global scrape interval is used.
type: string
jobName:
description: The job name assigned to scraped metrics by default.
type: string
module:
description: 'The module to use for probing specifying how to probe
the target. Example module configuring in the blackbox exporter:
https://github.com/prometheus/blackbox_exporter/blob/master/example.yml'
type: string
prober:
description: Specification for the prober to use for probing targets.
The prober.URL parameter is required. Targets cannot be probed if
left empty.
properties:
path:
description: Path to collect metrics from. Defaults to `/probe`.
type: string
scheme:
description: HTTP scheme to use for scraping. Defaults to `http`.
type: string
url:
description: Mandatory URL of the prober.
type: string
required:
- url
type: object
scrapeTimeout:
description: Timeout for scraping metrics from the Prometheus exporter.
type: string
targets:
description: Targets defines a set of static and/or dynamically discovered
targets to be probed using the prober.
properties:
ingress:
description: Ingress defines the set of dynamically discovered
ingress objects which hosts are considered for probing.
properties:
namespaceSelector:
description: Select Ingress objects by namespace.
properties:
any:
description: Boolean describing whether all namespaces
are selected in contrast to a list restricting them.
type: boolean
matchNames:
description: List of namespace names.
items:
type: string
type: array
type: object
relabelingConfigs:
description: 'RelabelConfigs to apply to samples before ingestion.
More info: https://prometheus.io/docs/prometheus/latest/configuration/configuration/#relabel_config'
items:
description: 'RelabelConfig allows dynamic rewriting of
the label set, being applied to samples before ingestion.
It defines `<metric_relabel_configs>`-section of Prometheus
configuration. More info: https://prometheus.io/docs/prometheus/latest/configuration/configuration/#metric_relabel_configs'
properties:
action:
description: Action to perform based on regex matching.
Default is 'replace'
type: string
modulus:
description: Modulus to take of the hash of the source
label values.
format: int64
type: integer
regex:
description: Regular expression against which the extracted
value is matched. Default is '(.*)'
type: string
replacement:
description: Replacement value against which a regex
replace is performed if the regular expression matches.
Regex capture groups are available. Default is '$1'
type: string
separator:
description: Separator placed between concatenated source
label values. default is ';'.
type: string
sourceLabels:
description: The source labels select values from existing
labels. Their content is concatenated using the configured
separator and matched against the configured regular
expression for the replace, keep, and drop actions.
items:
type: string
type: array
targetLabel:
description: Label to which the resulting value is written
in a replace action. It is mandatory for replace actions.
Regex capture groups are available.
type: string
type: object
type: array
selector:
description: Select Ingress objects by labels.
properties:
matchExpressions:
description: matchExpressions is a list of label selector
requirements. The requirements are ANDed.
items:
description: A label selector requirement is a selector
that contains values, a key, and an operator that
relates the key and values.
properties:
key:
description: key is the label key that the selector
applies to.
type: string
operator:
description: operator represents a key's relationship
to a set of values. Valid operators are In, NotIn,
Exists and DoesNotExist.
type: string
values:
description: values is an array of string values.
If the operator is In or NotIn, the values array
must be non-empty. If the operator is Exists or
DoesNotExist, the values array must be empty.
This array is replaced during a strategic merge
patch.
items:
type: string
type: array
required:
- key
- operator
type: object
type: array
matchLabels:
additionalProperties:
type: string
description: matchLabels is a map of {key,value} pairs.
A single {key,value} in the matchLabels map is equivalent
to an element of matchExpressions, whose key field is
"key", the operator is "In", and the values array contains
only "value". The requirements are ANDed.
type: object
type: object
type: object
staticConfig:
description: 'StaticConfig defines static targets which are considers
for probing. More info: https://prometheus.io/docs/prometheus/latest/configuration/configuration/#static_config.'
properties:
labels:
additionalProperties:
type: string
description: Labels assigned to all metrics scraped from the
targets.
type: object
static:
description: Targets is a list of URLs to probe using the
configured prober.
items:
type: string
type: array
type: object
type: object
type: object
required:
- spec
type: object
served: true
storage: true
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []

View File

@@ -1,94 +0,0 @@
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.2.4
creationTimestamp: null
name: prometheusrules.monitoring.coreos.com
spec:
group: monitoring.coreos.com
names:
kind: PrometheusRule
listKind: PrometheusRuleList
plural: prometheusrules
singular: prometheusrule
scope: Namespaced
versions:
- name: v1
schema:
openAPIV3Schema:
description: PrometheusRule defines alerting rules for a Prometheus instance
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: Specification of desired alerting rule definitions for Prometheus.
properties:
groups:
description: Content of Prometheus rule file
items:
description: 'RuleGroup is a list of sequentially evaluated recording
and alerting rules. Note: PartialResponseStrategy is only used
by ThanosRuler and will be ignored by Prometheus instances. Valid
values for this field are ''warn'' or ''abort''. More info: https://github.com/thanos-io/thanos/blob/master/docs/components/rule.md#partial-response'
properties:
interval:
type: string
name:
type: string
partial_response_strategy:
type: string
rules:
items:
description: Rule describes an alerting or recording rule.
properties:
alert:
type: string
annotations:
additionalProperties:
type: string
type: object
expr:
anyOf:
- type: integer
- type: string
x-kubernetes-int-or-string: true
for:
type: string
labels:
additionalProperties:
type: string
type: object
record:
type: string
required:
- expr
type: object
type: array
required:
- name
- rules
type: object
type: array
type: object
required:
- spec
type: object
served: true
storage: true
status:
acceptedNames:
kind: ""
plural: ""
conditions: []
storedVersions: []

View File

@@ -1,82 +0,0 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
labels:
app.kubernetes.io/component: controller
app.kubernetes.io/name: prometheus-operator
app.kubernetes.io/version: v0.41.1
name: prometheus-operator
rules:
- apiGroups:
- monitoring.coreos.com
resources:
- alertmanagers
- alertmanagers/finalizers
- prometheuses
- prometheuses/finalizers
- thanosrulers
- thanosrulers/finalizers
- servicemonitors
- podmonitors
- probes
- prometheusrules
verbs:
- '*'
- apiGroups:
- apps
resources:
- statefulsets
verbs:
- '*'
- apiGroups:
- ""
resources:
- configmaps
- secrets
verbs:
- '*'
- apiGroups:
- ""
resources:
- pods
verbs:
- list
- delete
- apiGroups:
- ""
resources:
- services
- services/finalizers
- endpoints
verbs:
- get
- create
- update
- delete
- apiGroups:
- ""
resources:
- nodes
verbs:
- list
- watch
- apiGroups:
- ""
resources:
- namespaces
verbs:
- get
- list
- watch
- apiGroups:
- authentication.k8s.io
resources:
- tokenreviews
verbs:
- create
- apiGroups:
- authorization.k8s.io
resources:
- subjectaccessreviews
verbs:
- create

View File

@@ -1,34 +0,0 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
labels:
app.kubernetes.io/component: controller
app.kubernetes.io/name: prometheus-operator
app.kubernetes.io/version: v0.41.1
name: prometheus-operator
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: prometheus-operator
subjects:
- kind: ServiceAccount
name: prometheus-operator
namespace: monitoring
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
labels:
app.kubernetes.io/component: controller
app.kubernetes.io/name: prometheus-operator
app.kubernetes.io/version: v0.41.1
name: prometheus-operator-admin
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: "cluster-admin"
subjects:
- kind: ServiceAccount
name: prometheus-operator
namespace: monitoring

View File

@@ -1,60 +0,0 @@
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app.kubernetes.io/component: controller
app.kubernetes.io/name: prometheus-operator
app.kubernetes.io/version: v0.41.1
name: prometheus-operator
namespace: monitoring
spec:
replicas: 1
selector:
matchLabels:
app.kubernetes.io/component: controller
app.kubernetes.io/name: prometheus-operator
template:
metadata:
labels:
app.kubernetes.io/component: controller
app.kubernetes.io/name: prometheus-operator
app.kubernetes.io/version: v0.41.1
spec:
containers:
- args:
- --kubelet-service=kube-system/kubelet
- --logtostderr=true
- --config-reloader-image=jimmidyson/configmap-reload:v0.4.0
- --prometheus-config-reloader=quay.io/coreos/prometheus-config-reloader:v0.41.1
image: quay.io/coreos/prometheus-operator:v0.41.1
name: prometheus-operator
ports:
- containerPort: 8080
name: http
resources:
limits:
cpu: 200m
memory: 200Mi
requests:
cpu: 100m
memory: 100Mi
securityContext:
allowPrivilegeEscalation: false
- args:
- --logtostderr
- --secure-listen-address=:8443
- --tls-cipher-suites=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256,TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384,TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305,TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305
- --upstream=http://127.0.0.1:8080/
image: quay.io/coreos/kube-rbac-proxy:v0.4.1
name: kube-rbac-proxy
ports:
- containerPort: 8443
name: https
securityContext:
runAsUser: 65534
nodeSelector:
beta.kubernetes.io/os: linux
securityContext:
runAsNonRoot: true
runAsUser: 65534
serviceAccountName: prometheus-operator

View File

@@ -1,18 +0,0 @@
apiVersion: v1
kind: Service
metadata:
labels:
app.kubernetes.io/component: controller
app.kubernetes.io/name: prometheus-operator
app.kubernetes.io/version: v0.41.1
name: prometheus-operator
namespace: monitoring
spec:
clusterIP: None
ports:
- name: https
port: 8443
targetPort: https
selector:
app.kubernetes.io/component: controller
app.kubernetes.io/name: prometheus-operator

View File

@@ -1,9 +0,0 @@
apiVersion: v1
kind: ServiceAccount
metadata:
labels:
app.kubernetes.io/component: controller
app.kubernetes.io/name: prometheus-operator
app.kubernetes.io/version: v0.41.1
name: prometheus-operator
namespace: monitoring

View File

@@ -6,22 +6,22 @@ metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.2.5
creationTimestamp: null
name: containerizeds.standard.oam.dev
name: podspecworkloads.standard.oam.dev
spec:
group: standard.oam.dev
names:
categories:
- oam
kind: Containerized
listKind: ContainerizedList
plural: containerizeds
singular: containerized
kind: PodSpecWorkload
listKind: PodSpecWorkloadList
plural: podspecworkloads
singular: podspecworkload
scope: Namespaced
versions:
- name: v1alpha1
schema:
openAPIV3Schema:
description: Containerized is the Schema for the containerizeds API
description: PodSpecWorkload is the Schema for the PodSpec API
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
@@ -36,11 +36,11 @@ spec:
metadata:
type: object
spec:
description: ContainerizedSpec defines the desired state of Containerized
description: PodSpecWorkloadSpec defines the desired state of PodSpecWorkload
properties:
podSpec:
description: PodSpec describes the pods that will be created, we omit
the meta part as it will be exactly the same as the containerized
the meta part as it will be exactly the same as the PodSpecWorkload
properties:
activeDeadlineSeconds:
description: Optional duration in seconds the pod may be active
@@ -3503,6 +3503,7 @@ spec:
can be referred to by services.
type: string
protocol:
default: TCP
description: Protocol for port. Must be UDP, TCP,
or SCTP. Defaults to "TCP".
type: string
@@ -5694,7 +5695,7 @@ spec:
- replicas
type: object
status:
description: ContainerizedStatus defines the observed state of Containerized
description: PodSpecWorkloadStatus defines the observed state of PodSpecWorkload
properties:
conditions:
description: Conditions of the resource.

View File

@@ -4,10 +4,10 @@ metadata:
name: backend
annotations:
definition.oam.dev/apiVersion: "standard.oam.dev/v1alpha1"
definition.oam.dev/kind: "Containerized"
definition.oam.dev/kind: "PodSpecWorkload"
spec:
definitionRef:
name: containerizeds.standard.oam.dev
name: podspecworkload.standard.oam.dev
childResourceKinds:
- apiVersion: apps/v1
kind: Deployment
@@ -15,7 +15,7 @@ spec:
template: |
data: {
apiVersion: "standard.oam.dev/v1alpha1"
kind: "Containerized"
kind: "PodSpecWorkload"
metadata:
name: parameter.name
spec: {

View File

@@ -1,13 +1,13 @@
apiVersion: core.oam.dev/v1alpha2
kind: WorkloadDefinition
metadata:
name: containerizeds.standard.oam.dev
name: podspecworkloads.standard.oam.dev
annotations:
definition.oam.dev/apiVersion: "standard.oam.dev/v1alpha1"
definition.oam.dev/kind: "Containerized"
definition.oam.dev/kind: "PodSpecWorkload"
spec:
definitionRef:
name: containerizeds.standard.oam.dev
name: podspecworkloads.standard.oam.dev
childResourceKinds:
- apiVersion: apps/v1
kind: Deployment
@@ -17,7 +17,7 @@ spec:
template: |
data: {
apiVersion: "standard.oam.dev/v1alpha1"
kind: "Containerized"
kind: "PodSpecWorkload"
metadata:
name: parameter.name
spec: {

View File

@@ -8,7 +8,7 @@ metadata:
spec:
appliesToWorkloads:
- core.oam.dev/v1alpha2.ContainerizedWorkload
- standard.oam.dev/v1alpha1.Containerized
- standard.oam.dev/v1alpha1.PodSpecWorkload
- deployments.apps
workloadRefPath: spec.workloadRef
definitionRef:

View File

@@ -31,7 +31,7 @@ webhooks:
service:
name: {{ template "kubevela.name" . }}-webhook
namespace: {{ .Release.Namespace }}
path: /mutate-standard-oam-dev-v1alpha1-containerized
path: /mutate-standard-oam-dev-v1alpha1-podspecworkload
failurePolicy: Fail
name: mcontainerized.kb.io
rules:
@@ -43,7 +43,7 @@ webhooks:
- CREATE
- UPDATE
resources:
- Containerized
- podspecworkloads
---
apiVersion: admissionregistration.k8s.io/v1beta1
@@ -78,7 +78,7 @@ webhooks:
service:
name: {{ template "kubevela.name" . }}-webhook
namespace: {{ .Release.Namespace }}
path: /validate-standard-oam-dev-v1alpha1-containerized
path: /validate-standard-oam-dev-v1alpha1-podspecworkload
failurePolicy: Fail
name: vcontainerized.kb.io
rules:
@@ -91,7 +91,7 @@ webhooks:
- UPDATE
- DELETE
resources:
- Containerized
- podspecworkloads
---
apiVersion: v1

View File

@@ -4,10 +4,10 @@ metadata:
name: webservice
annotations:
definition.oam.dev/apiVersion: "standard.oam.dev/v1alpha1"
definition.oam.dev/kind: "Containerized"
definition.oam.dev/kind: "PodSpecWorkload"
spec:
definitionRef:
name: containerizeds.standard.oam.dev
name: podspecworkloads.standard.oam.dev
childResourceKinds:
- apiVersion: apps/v1
kind: Deployment
@@ -17,7 +17,7 @@ spec:
template: |
data: {
apiVersion: "standard.oam.dev/v1alpha1"
kind: "Containerized"
kind: "PodSpecWorkload"
metadata:
name: parameter.name
spec: {

View File

@@ -29,9 +29,9 @@ webhooks:
service:
name: webhook-service
namespace: system
path: /mutate-standard-oam-dev-v1alpha1-containerized
path: /mutate-standard-oam-dev-v1alpha1-podspecworkload
failurePolicy: Fail
name: mcontainerized.kb.io
name: mpodspecworkload.kb.io
rules:
- apiGroups:
- standard.oam.dev
@@ -41,7 +41,7 @@ webhooks:
- CREATE
- UPDATE
resources:
- Containerized
- PodSpecWorkload
---
apiVersion: admissionregistration.k8s.io/v1beta1
@@ -74,9 +74,9 @@ webhooks:
service:
name: webhook-service
namespace: system
path: /validate-standard-oam-dev-v1alpha1-containerized
path: /validate-standard-oam-dev-v1alpha1-podspecworkload
failurePolicy: Fail
name: vcontainerized.kb.io
name: vpodspecworkload.kb.io
rules:
- apiGroups:
- standard.oam.dev
@@ -87,4 +87,4 @@ webhooks:
- UPDATE
- DELETE
resources:
- Containerized
- PodSpecWorkload

View File

@@ -21,7 +21,7 @@ export default {
'menu.Workload': 'Workloads',
'menu.Workload.WorkloadItem': 'WorkloadItem',
'menu.Workload.Deployment': 'Deployment',
'menu.Workload.Containerized': 'Containerized',
'menu.Workload.PodSpecWorkload': 'PodSpecWorkload',
'menu.Workload.Detail': 'Detail',
'menu.Release': 'Release',
'menu.admin': 'Admin',

View File

@@ -70,11 +70,6 @@ class TableList extends React.Component {
if (workloadType) {
this.getAcceptTrait(workloadType.toLowerCase());
}
// if (workloadType && workloadType === '') {
// this.getAcceptTrait('containerized');
// } else if (workloadType && workloadType === 'Deployment') {
// this.getAcceptTrait('deployment');
// }
}
}
};

View File

@@ -180,7 +180,7 @@ sample response
"Status": "True",
"workload": {
"apiVersion": "standard.oam.dev/v1alpha1",
"kind": "Containerized",
"kind": "PodSpecWorkload",
"metadata": {
"name": "web-comp"
},
@@ -232,7 +232,7 @@ sample response
"Status": "True",
"workload": {
"apiVersion": "standard.oam.dev/v1alpha1",
"kind": "Containerized",
"kind": "PodSpecWorkload",
"metadata": {
"name": "comp1"
},
@@ -282,7 +282,7 @@ sample response
"Status": "True",
"workload": {
"apiVersion": "standard.oam.dev/v1alpha1",
"kind": "Containerized",
"kind": "PodSpecWorkload",
"metadata": {
"name": "web-comp"
},
@@ -377,7 +377,7 @@ sample request
```json
{
"env_name": "default",
"workload_type": "containerized",
"workload_type": "podspecworkload",
"workload_name": "poc2",
"flags": [
{
@@ -403,7 +403,7 @@ Please also specify `traits` values if need to attach a trait to several traits
```json
{
"env_name": "default",
"workload_type": "containerized",
"workload_type": "podspecworkload",
"workload_name": "poc5",
"app_group": "",
"flags": [
@@ -440,9 +440,9 @@ sample response
{
"code": 200,
"data": {
"name": "containerized",
"name": "podspecworkload",
"type": "workload",
"template": "#Template: {\n\tapiVersion: \"core.oam.dev/v1alpha2\"\n\tkind: \"ContainerizedWorkload\"\n\tmetadata: name: containerized.name\n\tspec: {\n\t\tcontainers: [{\n\t\t\timage: containerized.image\n\t\t\tname: containerized.name\n\t\t\tports: [{\n\t\t\t\tcontainerPort: containerized.port\n\t\t\t\tprotocol: \"TCP\"\n\t\t\t\tname: \"default\"\n\t\t\t}]\n\t\t}]\n\t}\n}\ncontainerized: {\n\tname: string\n\t// +usage=specify app image\n\t// +short=i\n\timage: string\n\t// +usage=specify port for container\n\t// +short=p\n\tport: *6379 | int\n}\n",
"template": "#Template: {\n\tapiVersion: \"core.oam.dev/v1alpha2\"\n\tkind: \"PodSpecWorkload\"\n\tmetadata: name: podspecworkload.name\n\tspec: {\n\t\tcontainers: [{\n\t\t\timage: containerized.image\n\t\t\tname: containerized.name\n\t\t\tports: [{\n\t\t\t\tcontainerPort: containerized.port\n\t\t\t\tprotocol: \"TCP\"\n\t\t\t\tname: \"default\"\n\t\t\t}]\n\t\t}]\n\t}\n}\ncontainerized: {\n\tname: string\n\t// +usage=specify app image\n\t// +short=i\n\timage: string\n\t// +usage=specify port for container\n\t// +short=p\n\tport: *6379 | int\n}\n",
"parameters": [{
"name": "name",
"required": true,
@@ -479,7 +479,7 @@ sample response
{
"code": 200,
"data": [{
"name": "containerized",
"name": "podspecworkload",
"parameters": [{
"name": "name",
"required": true,
@@ -563,7 +563,7 @@ sample response
}],
"definition": "/Users/zhouzhengxi/.vela/capabilities/manualscalertraits.core.oam.dev.cue",
"crdName": "manualscalertraits.core.oam.dev",
"appliesTo": ["containerized"],
"appliesTo": ["containerizedworkload"],
"crdInfo": {
"apiVersion": "core.oam.dev/v1alpha2",
"kind": "ManualScalerTrait"
@@ -584,15 +584,15 @@ sample response
"data": [{
"name": "manualscaler",
"definition": "manualscalertraits.core.oam.dev",
"applies_to": ["containerized"]
"applies_to": ["podspecworkload"]
}, {
"name": "rollout",
"definition": "simplerollouttraits.extend.oam.dev",
"applies_to": ["containerized", "deployment"]
"applies_to": ["podspecworkload", "deployment"]
}, {
"name": "scale",
"definition": "manualscalertraits.core.oam.dev",
"applies_to": ["containerized", "deployment"]
"applies_to": ["podspecworkload", "deployment"]
}]
}
```
@@ -661,7 +661,7 @@ sample response
- example
sample response
```json
{"code":200,"data":"containerized removed successfully"}
{"code":200,"data":"podspecworkload removed successfully"}
```
### GET /api/capabilities/ (capability list)
@@ -671,9 +671,9 @@ sample response
{
"code": 200,
"data": [{
"name": "containerized",
"name": "podspecworkload",
"type": "workload",
"template": "#Template: {\n\tapiVersion: \"core.oam.dev/v1alpha2\"\n\tkind: \"ContainerizedWorkload\"\n\tmetadata: name: containerized.name\n\tspec: {\n\t\tcontainers: [{\n\t\t\timage: containerized.image\n\t\t\tname: containerized.name\n\t\t\tports: [{\n\t\t\t\tcontainerPort: containerized.port\n\t\t\t\tprotocol: \"TCP\"\n\t\t\t\tname: \"default\"\n\t\t\t}]\n\t\t}]\n\t}\n}\ncontainerized: {\n\tname: string\n\t// +usage=specify app image\n\t// +short=i\n\timage: string\n\t// +usage=specify port for container\n\t// +short=p\n\tport: *6379 | int\n}\n",
"template": "#Template: {\n\tapiVersion: \"core.oam.dev/v1alpha2\"\n\tkind: \"ContainerizedWorkload\"\n\tmetadata: name: podspecworkload.name\n\tspec: {\n\t\tcontainers: [{\n\t\t\timage: containerized.image\n\t\t\tname: containerized.name\n\t\t\tports: [{\n\t\t\t\tcontainerPort: containerized.port\n\t\t\t\tprotocol: \"TCP\"\n\t\t\t\tname: \"default\"\n\t\t\t}]\n\t\t}]\n\t}\n}\ncontainerized: {\n\tname: string\n\t// +usage=specify app image\n\t// +short=i\n\timage: string\n\t// +usage=specify port for container\n\t// +short=p\n\tport: *6379 | int\n}\n",
"parameters": [{
"name": "name",
"required": true,
@@ -717,7 +717,7 @@ sample response
"definition": "/Users/zhouzhengxi/.vela/centers/poc/.tmp/simplerollouttraits.extend.oam.dev.cue",
"crdName": "simplerollouttraits.extend.oam.dev",
"center": "poc",
"appliesTo": ["containerized", "deployment"],
"appliesTo": ["podspecworkload", "deployment"],
"status": "uninstalled"
}]
}

View File

@@ -3,8 +3,6 @@
This example show case how one can use a metricsTrait to add prometheus monitoring capability to any workload that
emits metrics data.
The containerized CRD does not work with Kubernetes 1.18 yet, the CRD generator is not compatible
## Install Vela core
```shell script
make docker-build
@@ -12,6 +10,13 @@ kubectl create ns vela-system
helm install kube --namespace vela-system charts/vela-core/
```
## Install OAM Prometheus
```shell script
kubectl apply -f documentation/samples/metrics-demo/prometheus
prometheus.monitoring.coreos.com/oam created
service/prometheus-oam created
```
## Run ApplicationConfiguration
```shell script
kubectl apply -f documentation/samples/metrics-demo/
@@ -30,7 +35,7 @@ Then access the prometheus dashboard via http://localhost:4848
## Verify that the metrics showing up on grafana
```shell script
kubectl --namespace oam-monitoring port-forward service/monitoring-grafana 3000:80
kubectl --namespace monitoring port-forward service/kube-prometheus-stack-grafana 3000:80
```
Then access the grafana dashboard via http://localhost:3000. You shall set the data source URL as `http://prometheus-oam:4848`

View File

@@ -5,7 +5,7 @@ metadata:
spec:
workload:
apiVersion: standard.oam.dev/v1alpha1
kind: Containerized
kind: PodSpecWorkload
metadata:
name: metrics-app
labels:

View File

@@ -19,7 +19,7 @@ spec:
fsGroup: 2000
runAsNonRoot: true
runAsUser: 1000
serviceAccountName: prometheus-operator
serviceAccountName: kube-prometheus-stack-prometheus
serviceMonitorNamespaceSelector:
matchLabels:
mornitoring: oam

View File

@@ -1,22 +0,0 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: vela-config
namespace: default
data:
certificates.cert-manager.io: |
{
"repo": "jetstack",
"urL": "https://charts.jetstack.io",
"name": "cert-manager",
"namespace": "cert-manager",
"version": "1.0.0"
}
servicemonitors.monitoring.coreos.com: |
{
"repo": "prometheus-community",
"urL": "https://prometheus-community.github.io/helm-charts",
"name": "kube-prometheus-stack",
"namespace": "monitoring",
"version": "9.4.4"
}

View File

@@ -52,7 +52,7 @@ var notExistedEnvMeta = apis.Environment{
Namespace: "env-e2e-api-NOT-EXISTED-JUST-FOR-TEST",
}
var containerizedWorkloadType = "webservice"
var webserviceWorkloadType = "webservice"
var backendWorkloadType = "backend"
var taskWorkloadType = "task"
@@ -210,7 +210,7 @@ var _ = ginkgo.Describe("API", func() {
for _, i := range data {
var workloadDefinition = i.(map[string]interface{})
gomega.Expect(err).NotTo(gomega.HaveOccurred())
gomega.Expect([]string{containerizedWorkloadType, backendWorkloadType, taskWorkloadType}).To(gomega.Or(gomega.ContainElement(workloadDefinition["name"])))
gomega.Expect([]string{webserviceWorkloadType, backendWorkloadType, taskWorkloadType}).To(gomega.Or(gomega.ContainElement(workloadDefinition["name"])))
}
})

View File

@@ -57,7 +57,7 @@ func fixOpenAPIV3SchemaValidationIssue(chartPath string) (string, error) {
}
defer targetFile.Close()
if strings.Contains(path, filepath.Join(chartPath, "crds")) && info.Name() == "standard.oam.dev_containerizeds.yaml" {
if strings.Contains(path, filepath.Join(chartPath, "crds")) && info.Name() == "standard.oam.dev_podspecworkloads" {
f, err := os.OpenFile(path, os.O_RDONLY, os.ModePerm)
if err != nil {
fmt.Fprintln(os.Stderr, "failed to open file", path)

View File

@@ -19,15 +19,15 @@ package controller
import (
ctrl "sigs.k8s.io/controller-runtime"
"github.com/oam-dev/kubevela/pkg/controller/v1alpha1/containerized"
"github.com/oam-dev/kubevela/pkg/controller/v1alpha1/metrics"
"github.com/oam-dev/kubevela/pkg/controller/v1alpha1/podspecworkload"
"github.com/oam-dev/kubevela/pkg/controller/v1alpha1/routes"
)
// Setup workload controllers.
func Setup(mgr ctrl.Manager) error {
for _, setup := range []func(ctrl.Manager) error{
metrics.Setup, containerized.Setup, routes.Setup,
metrics.Setup, podspecworkload.Setup, routes.Setup,
} {
if err := setup(mgr); err != nil {
return err

View File

@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
package containerized
package podspecworkload
import (
"context"
@@ -57,7 +57,7 @@ const (
labelNameKey = "component.oam.dev/name"
)
// Reconciler reconciles a Containerized object
// Reconciler reconciles a PodSpecWorkload object
type Reconciler struct {
client.Client
log logr.Logger
@@ -65,20 +65,20 @@ type Reconciler struct {
Scheme *runtime.Scheme
}
// +kubebuilder:rbac:groups=standard.oam.dev,resources=containerizeds,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=standard.oam.dev,resources=containerizeds/status,verbs=get;update;patch
// +kubebuilder:rbac:groups=standard.oam.dev,resources=podspecworkloads,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=standard.oam.dev,resources=podspecworkloads/status,verbs=get;update;patch
// +kubebuilder:rbac:groups=apps,resources=deployments,verbs=get;list;watch;create;update;patch;delete
// +kubebuilder:rbac:groups=,resources=services,verbs=get;list;watch;create;update;patch;delete
func (r *Reconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {
_ = context.Background()
ctx := context.Background()
log := r.log.WithValues("containerized", req.NamespacedName)
log.Info("Reconcile containerized workload")
log := r.log.WithValues("podspecworkload", req.NamespacedName)
log.Info("Reconcile podspecworkload workload")
var workload v1alpha1.Containerized
var workload v1alpha1.PodSpecWorkload
if err := r.Get(ctx, req.NamespacedName, &workload); err != nil {
if apierrors.IsNotFound(err) {
log.Info("Containerized workload is deleted")
log.Info("Podspec workload is deleted")
}
return ctrl.Result{}, client.IgnoreNotFound(err)
}
@@ -158,7 +158,7 @@ func (r *Reconciler) Reconcile(req ctrl.Request) (ctrl.Result, error) {
// create a corresponding deployment
func (r *Reconciler) renderDeployment(ctx context.Context,
workload *v1alpha1.Containerized) (*appsv1.Deployment, error) {
workload *v1alpha1.PodSpecWorkload) (*appsv1.Deployment, error) {
// generate the deployment
deploy := &appsv1.Deployment{
TypeMeta: metav1.TypeMeta{
@@ -212,7 +212,7 @@ func (r *Reconciler) renderDeployment(ctx context.Context,
// check whether the container port is specified
func (r *Reconciler) checkContainerPortsSpecified(ctx context.Context,
workload *v1alpha1.Containerized) bool {
workload *v1alpha1.PodSpecWorkload) bool {
if workload == nil {
return false
}
@@ -226,7 +226,7 @@ func (r *Reconciler) checkContainerPortsSpecified(ctx context.Context,
// create a service for the deployment
func (r *Reconciler) renderService(ctx context.Context,
workload *v1alpha1.Containerized) (*corev1.Service, error) {
workload *v1alpha1.PodSpecWorkload) (*corev1.Service, error) {
// create a service for the workload
service := &corev1.Service{
TypeMeta: metav1.TypeMeta{
@@ -271,10 +271,10 @@ func (r *Reconciler) renderService(ctx context.Context,
}
func (r *Reconciler) SetupWithManager(mgr ctrl.Manager) error {
r.record = event.NewAPIRecorder(mgr.GetEventRecorderFor("Containerized")).
WithAnnotations("controller", "Containerized")
r.record = event.NewAPIRecorder(mgr.GetEventRecorderFor("PodSpecWorkload")).
WithAnnotations("controller", "PodSpecWorkload")
return ctrl.NewControllerManagedBy(mgr).
For(&v1alpha1.Containerized{}).
For(&v1alpha1.PodSpecWorkload{}).
Owns(&appsv1.Deployment{}).
Owns(&corev1.Service{}).
Complete(r)
@@ -284,7 +284,7 @@ func (r *Reconciler) SetupWithManager(mgr ctrl.Manager) error {
func Setup(mgr ctrl.Manager) error {
reconciler := Reconciler{
Client: mgr.GetClient(),
log: ctrl.Log.WithName("Containerized"),
log: ctrl.Log.WithName("PodSpecWorkload"),
Scheme: mgr.GetScheme(),
}
return reconciler.SetupWithManager(mgr)

View File

@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
package containerized
package podspecworkload
import (
"path/filepath"
@@ -55,7 +55,9 @@ var _ = BeforeSuite(func(done Done) {
By("bootstrapping test environment")
useExistCluster := true
testEnv = &envtest.Environment{
CRDDirectoryPaths: []string{filepath.Join("..", "config", "crd", "bases")},
CRDDirectoryPaths: []string{
filepath.Join("../../../..", "charts/vela-core/crds"), // this has all the required CRDs,
filepath.Join("..", "config", "crd", "bases")},
UseExistingCluster: &useExistCluster,
}

View File

@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
package containerized
package podspecworkload
import (
"context"
@@ -32,7 +32,7 @@ import (
util "github.com/oam-dev/kubevela/pkg/utils"
)
// MutatingHandler handles Containerized workload
// MutatingHandler handles PodSpec workload
type MutatingHandler struct {
Client client.Client
@@ -41,19 +41,19 @@ type MutatingHandler struct {
}
// log is for logging in this package.
var mutatelog = logf.Log.WithName("Containerized-mutate")
var mutatelog = logf.Log.WithName("PodSpecWorkload-mutate")
var _ admission.Handler = &MutatingHandler{}
// Handle handles admission requests.
func (h *MutatingHandler) Handle(ctx context.Context, req admission.Request) admission.Response {
obj := &v1alpha1.Containerized{}
obj := &v1alpha1.PodSpecWorkload{}
err := h.Decoder.Decode(req, obj)
if err != nil {
return admission.Errored(http.StatusBadRequest, err)
}
DefaultContainerized(obj)
DefaultPodSpecWorkload(obj)
marshalled, err := json.Marshal(obj)
if err != nil {
@@ -61,13 +61,13 @@ func (h *MutatingHandler) Handle(ctx context.Context, req admission.Request) adm
}
resp := admission.PatchResponseFromRaw(req.AdmissionRequest.Object.Raw, marshalled)
if len(resp.Patches) > 0 {
klog.V(5).Infof("Admit Containerized %s/%s patches: %v", obj.Namespace, obj.Name, util.DumpJSON(resp.Patches))
klog.V(5).Infof("Admit PodSpecWorkload %s/%s patches: %v", obj.Namespace, obj.Name, util.DumpJSON(resp.Patches))
}
return resp
}
// Default sets all the default value for the Containerized
func DefaultContainerized(obj *v1alpha1.Containerized) {
// Default sets all the default value for the PodSpecWorkload
func DefaultPodSpecWorkload(obj *v1alpha1.PodSpecWorkload) {
mutatelog.Info("default", "name", obj.Name)
if obj.Spec.Replicas == nil {
mutatelog.Info("default replicas as 1")

View File

@@ -1,4 +1,4 @@
package containerized
package podspecworkload
import (
"testing"
@@ -12,20 +12,20 @@ import (
"github.com/oam-dev/kubevela/api/v1alpha1"
)
func TestContainerized(t *testing.T) {
func TestPodSpecWorkload(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "Containerized Suite")
RunSpecs(t, "PodSpecWorkload Suite")
}
var _ = Describe("Containerized", func() {
var baseCase v1alpha1.Containerized
var _ = Describe("Test PodSpecWorkload", func() {
var baseCase v1alpha1.PodSpecWorkload
BeforeEach(func() {
baseCase = v1alpha1.Containerized{
baseCase = v1alpha1.PodSpecWorkload{
ObjectMeta: metav1.ObjectMeta{
Name: "mutate-hook",
},
Spec: v1alpha1.ContainerizedSpec{},
Spec: v1alpha1.PodSpecWorkloadSpec{},
}
})
@@ -33,7 +33,7 @@ var _ = Describe("Containerized", func() {
cw := baseCase
want := baseCase
want.Spec.Replicas = pointer.Int32Ptr(1)
DefaultContainerized(&cw)
DefaultPodSpecWorkload(&cw)
Expect(cw).Should(BeEquivalentTo(want))
})
@@ -41,7 +41,7 @@ var _ = Describe("Containerized", func() {
cw := baseCase
cw.Spec.Replicas = pointer.Int32Ptr(10)
want := cw
DefaultContainerized(&cw)
DefaultPodSpecWorkload(&cw)
Expect(cw).Should(BeEquivalentTo(want))
})

View File

@@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
package containerized
package podspecworkload
import (
"context"
@@ -31,7 +31,7 @@ import (
"github.com/oam-dev/kubevela/api/v1alpha1"
)
// ValidatingHandler handles Containerized
// ValidatingHandler handles PodSpecWorkload
type ValidatingHandler struct {
Client client.Client
@@ -40,13 +40,13 @@ type ValidatingHandler struct {
}
// log is for logging in this package.
var validatelog = logf.Log.WithName("Containerized-validate")
var validatelog = logf.Log.WithName("PodSpecWorkload-validate")
var _ admission.Handler = &ValidatingHandler{}
// Handle handles admission requests.
func (h *ValidatingHandler) Handle(ctx context.Context, req admission.Request) admission.Response {
obj := &v1alpha1.Containerized{}
obj := &v1alpha1.PodSpecWorkload{}
err := h.Decoder.Decode(req, obj)
if err != nil {
@@ -61,7 +61,7 @@ func (h *ValidatingHandler) Handle(ctx context.Context, req admission.Request) a
return admission.Errored(http.StatusUnprocessableEntity, allErrs.ToAggregate())
}
case admissionv1beta1.Update:
oldObj := &v1alpha1.Containerized{}
oldObj := &v1alpha1.PodSpecWorkload{}
if err := h.Decoder.DecodeRaw(req.AdmissionRequest.OldObject, oldObj); err != nil {
return admission.Errored(http.StatusBadRequest, err)
}
@@ -74,8 +74,8 @@ func (h *ValidatingHandler) Handle(ctx context.Context, req admission.Request) a
return admission.ValidationResponse(true, "")
}
// ValidateCreate validates the Containerized on creation
func ValidateCreate(r *v1alpha1.Containerized) field.ErrorList {
// ValidateCreate validates the PodSpecWorkload on creation
func ValidateCreate(r *v1alpha1.PodSpecWorkload) field.ErrorList {
validatelog.Info("validate create", "name", r.Name)
allErrs := apimachineryvalidation.ValidateObjectMeta(&r.ObjectMeta, true,
apimachineryvalidation.NameIsDNSSubdomain, field.NewPath("metadata"))
@@ -93,14 +93,14 @@ func ValidateCreate(r *v1alpha1.Containerized) field.ErrorList {
return allErrs
}
// ValidateUpdate validates the Containerized on update
func ValidateUpdate(r *v1alpha1.Containerized, _ *v1alpha1.Containerized) field.ErrorList {
// ValidateUpdate validates the PodSpecWorkload on update
func ValidateUpdate(r *v1alpha1.PodSpecWorkload, _ *v1alpha1.PodSpecWorkload) field.ErrorList {
validatelog.Info("validate update", "name", r.Name)
return ValidateCreate(r)
}
// ValidateDelete validates the Containerized on delete
func ValidateDelete(r *v1alpha1.Containerized) field.ErrorList {
// ValidateDelete validates the PodSpecWorkload on delete
func ValidateDelete(r *v1alpha1.PodSpecWorkload) field.ErrorList {
validatelog.Info("validate delete", "name", r.Name)
return nil
}

View File

@@ -4,14 +4,14 @@ import (
"sigs.k8s.io/controller-runtime/pkg/manager"
"sigs.k8s.io/controller-runtime/pkg/webhook"
"github.com/oam-dev/kubevela/pkg/webhook/containerized"
"github.com/oam-dev/kubevela/pkg/webhook/metrics"
"github.com/oam-dev/kubevela/pkg/webhook/podspecworkload"
)
// +kubebuilder:webhook:verbs=create;update;delete,path=/validate-standard-oam-dev-v1alpha1-metricstrait,mutating=false,failurePolicy=fail,groups=standard.oam.dev,resources=metricstraits,versions=v1alpha1,name=vmetricstrait.kb.io
// +kubebuilder:webhook:path=/mutate-standard-oam-dev-v1alpha1-metricstrait,mutating=true,failurePolicy=fail,groups=standard.oam.dev,resources=metricstraits,verbs=create;update,versions=v1alpha1,name=mmetricstrait.kb.io
// +kubebuilder:webhook:verbs=create;update;delete,path=/validate-standard-oam-dev-v1alpha1-containerized,mutating=false,failurePolicy=fail,groups=standard.oam.dev,resources=Containerized,versions=v1alpha1,name=vcontainerized.kb.io
// +kubebuilder:webhook:path=/mutate-standard-oam-dev-v1alpha1-containerized,mutating=true,failurePolicy=fail,groups=standard.oam.dev,resources=Containerized,verbs=create;update,versions=v1alpha1,name=mcontainerized.kb.io
// +kubebuilder:webhook:verbs=create;update;delete,path=/validate-standard-oam-dev-v1alpha1-podspecworkload,mutating=false,failurePolicy=fail,groups=standard.oam.dev,resources=PodSpecWorkload,versions=v1alpha1,name=vpodspecworkload.kb.io
// +kubebuilder:webhook:path=/mutate-standard-oam-dev-v1alpha1-podspecworkload,mutating=true,failurePolicy=fail,groups=standard.oam.dev,resources=PodSpecWorkload,verbs=create;update,versions=v1alpha1,name=mpodspecworkload.kb.io
// Register will register all the services to the webhook server
func Register(mgr manager.Manager) {
@@ -21,9 +21,9 @@ func Register(mgr manager.Manager) {
&webhook.Admission{Handler: &metrics.ValidatingHandler{}})
server.Register("/mutate-standard-oam-dev-v1alpha1-metricstrait",
&webhook.Admission{Handler: &metrics.MutatingHandler{}})
// Containerized
server.Register("/validate-standard-oam-dev-v1alpha1-containerized",
&webhook.Admission{Handler: &containerized.ValidatingHandler{}})
server.Register("/mutate-standard-oam-dev-v1alpha1-containerized",
&webhook.Admission{Handler: &containerized.MutatingHandler{}})
// PodSpecWorkload
server.Register("/validate-standard-oam-dev-v1alpha1-podspecworkload",
&webhook.Admission{Handler: &podspecworkload.ValidatingHandler{}})
server.Register("/mutate-standard-oam-dev-v1alpha1-podspecworkload",
&webhook.Admission{Handler: &podspecworkload.MutatingHandler{}})
}

View File

@@ -1,6 +1,6 @@
data: {
apiVersion: "standard.oam.dev/v1alpha1"
kind: "Containerized"
kind: "PodSpecWorkload"
metadata:
name: parameter.name
spec: {

View File

@@ -1,6 +1,6 @@
data: {
apiVersion: "standard.oam.dev/v1alpha1"
kind: "Containerized"
kind: "PodSpecWorkload"
metadata:
name: parameter.name
spec: {