Merge pull request #206 from jim-minter/journal

enablement of RP log and metric forwarding
This commit is contained in:
Angus Salkeld 2020-02-25 14:59:13 +10:00 коммит произвёл GitHub
Родитель 0dcef6fc80 2458c5f427
Коммит 726c1b0784
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
33 изменённых файлов: 742 добавлений и 1235 удалений

Просмотреть файл

@ -12,8 +12,6 @@ jobs:
makefile.target: "image-aro"
Proxy:
makefile.target: "image-proxy"
MDM:
makefile.target: "image-mdm"
steps:
- template: ./templates/template-setup-golang-env.yml

Просмотреть файл

@ -1,14 +0,0 @@
ARG VERSION
FROM ubuntu:bionic
RUN apt-get update && \
apt-get -y dist-upgrade && \
apt-get install -y curl && \
curl -o metricsext2.deb https://packages.microsoft.com/repos/azurecore/pool/main/m/metricsext2/metricsext2_$VERSION.deb && \
apt-get install -y ./metricsext2.deb && \
rm metricsext2.deb && \
apt-get purge -y curl && \
apt-get autoremove -y && \
rm -rf /var/lib/apt/lists/* && \
chown -R 1000:1000 /var/etw
ENTRYPOINT ["MetricsExtension"]
USER 1000

18
Gopkg.lock сгенерированный
Просмотреть файл

@ -257,9 +257,12 @@
version = "v0.3.0"
[[projects]]
digest = "1:027c348e13b5f924c925aebf0d2932545644c78da3f43cc82327220286084539"
digest = "1:9d9407c5f0001ea2252b16edbfb0ceadcaa17d690156146f83c6af7bca3d4f6e"
name = "github.com/coreos/go-systemd"
packages = ["unit"]
packages = [
"journal",
"unit",
]
pruneopts = "UT"
revision = "2d78030078ef61b3cae27f42ad6d0e46db51b339"
version = "v22.0.0"
@ -896,15 +899,13 @@
[[projects]]
branch = "release-4.3"
digest = "1:ff4eea18a972166c1f93b2c1be7d3468f362379b95d516a29b2b8fc08efda207"
digest = "1:b64353f338d565767e216d8ca7b57d86a8b3da9d05b2caa42399d2388d05acd9"
name = "github.com/openshift/cluster-api"
packages = [
"pkg/apis/cluster/common",
"pkg/apis/cluster/v1alpha1",
"pkg/apis/machine/common",
"pkg/apis/machine/v1beta1",
"pkg/client/clientset_generated/clientset/scheme",
"pkg/client/clientset_generated/clientset/typed/machine/v1beta1",
]
pruneopts = "UT"
revision = "9a3a7bbe9258f5c3117cb2aba6a560babe0d59f8"
@ -1815,6 +1816,7 @@
"github.com/containers/image/pkg/blobinfocache/memory",
"github.com/containers/image/signature",
"github.com/containers/image/types",
"github.com/coreos/go-systemd/journal",
"github.com/dgrijalva/jwt-go",
"github.com/golang/mock/gomock",
"github.com/golang/mock/mockgen",
@ -1829,8 +1831,6 @@
"github.com/openshift/api/operator/v1",
"github.com/openshift/client-go/config/clientset/versioned",
"github.com/openshift/client-go/operator/clientset/versioned",
"github.com/openshift/cluster-api/pkg/apis/machine/v1beta1",
"github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/typed/machine/v1beta1",
"github.com/openshift/console-operator/pkg/api",
"github.com/openshift/installer/data",
"github.com/openshift/installer/pkg/asset",
@ -1866,13 +1866,13 @@
"golang.org/x/tools/go/ast/astutil",
"golang.org/x/tools/go/packages",
"k8s.io/api/core/v1",
"k8s.io/apimachinery/pkg/api/errors",
"k8s.io/apimachinery/pkg/apis/meta/v1",
"k8s.io/apimachinery/pkg/util/wait",
"k8s.io/client-go/kubernetes",
"k8s.io/client-go/kubernetes/typed/core/v1",
"k8s.io/client-go/rest",
"k8s.io/client-go/tools/clientcmd",
"k8s.io/client-go/tools/clientcmd/api",
"k8s.io/client-go/tools/clientcmd/api/latest",
"k8s.io/client-go/tools/clientcmd/api/v1",
"k8s.io/client-go/tools/metrics",
"k8s.io/client-go/util/retry",

Просмотреть файл

@ -55,10 +55,6 @@ image-aro: aro
docker pull registry.access.redhat.com/ubi8/ubi-minimal
docker build -f Dockerfile.aro -t arosvc.azurecr.io/aro:$(COMMIT) .
image-mdm:
docker build --build-arg VERSION=2.2019.801.1228-66cac1-~bionic_amd64 \
-f Dockerfile.mdm -t arosvc.azurecr.io/mdm:2019.801.1228-66cac1 .
image-proxy: proxy
docker pull registry.access.redhat.com/ubi8/ubi-minimal
docker build -f Dockerfile.proxy -t arosvc.azurecr.io/proxy:latest .

Просмотреть файл

@ -29,7 +29,6 @@ func monitor(ctx context.Context, log *logrus.Entry) error {
if err != nil {
return err
}
defer m.Close()
cipher, err := encryption.NewXChaCha20Poly1305(ctx, env)
if err != nil {

Просмотреть файл

@ -5,6 +5,7 @@ package main
import (
"context"
"fmt"
"os"
"os/signal"
"syscall"
@ -24,6 +25,14 @@ import (
)
func rp(ctx context.Context, log *logrus.Entry) error {
for _, key := range []string{
"PULL_SECRET",
} {
if _, found := os.LookupEnv(key); !found {
return fmt.Errorf("environment variable %q unset", key)
}
}
uuid := uuid.NewV4().String()
log.Printf("uuid %s", uuid)
@ -36,7 +45,6 @@ func rp(ctx context.Context, log *logrus.Entry) error {
if err != nil {
return err
}
defer m.Close()
cipher, err := encryption.NewXChaCha20Poly1305(ctx, env)
if err != nil {

Просмотреть файл

@ -2,6 +2,12 @@
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"clusterMdmMetricNamespace": {
"value": ""
},
"clusterMdmMonitoringAccount": {
"value": ""
},
"databaseAccountName": {
"value": ""
},
@ -20,21 +26,6 @@
"keyvaultPrefix": {
"value": ""
},
"mdmCertificate": {
"value": ""
},
"mdmFrontendUrl": {
"value": ""
},
"mdmMetricNamespace": {
"value": ""
},
"mdmMonitoringAccount": {
"value": ""
},
"mdmPrivateKey": {
"value": ""
},
"pullSecret": {
"value": ""
},
@ -44,6 +35,33 @@
"rpImageAuth": {
"value": ""
},
"rpMdmCertificateVaultId": {
"value": ""
},
"rpMdmFrontendUrl": {
"value": ""
},
"rpMdmMetricNamespace": {
"value": ""
},
"rpMdmMonitoringAccount": {
"value": ""
},
"rpMdsdAccount": {
"value": ""
},
"rpMdsdCertificateVaultId": {
"value": ""
},
"rpMdsdConfigVersion": {
"value": ""
},
"rpMdsdEnvironment": {
"value": ""
},
"rpMdsdNamespace": {
"value": ""
},
"rpMode": {
"value": ""
},
@ -53,6 +71,9 @@
"sshPublicKey": {
"value": ""
},
"vmssCount": {
"value": 3
},
"vmssDomainNameLabel": {
"value": ""
},

Различия файлов скрыты, потому что одна или несколько строк слишком длинны

Просмотреть файл

@ -9,6 +9,7 @@ import (
"encoding/json"
"fmt"
"io/ioutil"
"strconv"
"strings"
mgmtcompute "github.com/Azure/azure-sdk-for-go/services/compute/mgmt/2019-03-01/compute"
@ -33,8 +34,12 @@ var apiVersions = map[string]string{
"network": "2019-07-01",
}
const (
capacityHack = 12345
tenantIDHack = "13805ec3-a223-47ad-ad65-8b2baf92c0fb"
)
var (
tenantIDHack = "13805ec3-a223-47ad-ad65-8b2baf92c0fb"
tenantUUIDHack = uuid.Must(uuid.FromString(tenantIDHack))
)
@ -317,14 +322,20 @@ func (g *generator) vmss() *arm.Resource {
}
for _, variable := range []string{
"mdmCertificate",
"mdmFrontendUrl",
"mdmMetricNamespace",
"mdmMonitoringAccount",
"mdmPrivateKey",
"clusterMdmMetricNamespace",
"clusterMdmMonitoringAccount",
"pullSecret",
"rpImage",
"rpImageAuth",
"rpMdmCertificateVaultId",
"rpMdmFrontendUrl",
"rpMdmMetricNamespace",
"rpMdmMonitoringAccount",
"rpMdsdAccount",
"rpMdsdCertificateVaultId",
"rpMdsdConfigVersion",
"rpMdsdEnvironment",
"rpMdsdNamespace",
"rpMode",
} {
parts = append(parts,
@ -334,15 +345,30 @@ func (g *generator) vmss() *arm.Resource {
)
}
trailer := base64.StdEncoding.EncodeToString([]byte(`systemctl stop arorp.service || true
parts = append(parts,
fmt.Sprintf("'LOCATION=$(base64 -d <<<'''"),
fmt.Sprintf("base64(resourceGroup().location)"),
"''')\n'",
)
yum -y update -x WALinuxAgent
trailer := base64.StdEncoding.EncodeToString([]byte(`yum -y update -x WALinuxAgent
# avoid "error: db5 error(-30969) from dbenv->open: BDB0091 DB_VERSION_MISMATCH: Database environment version mismatch"
rm -f /var/lib/rpm/__db*
rpm --import https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-8
rpm --import https://packages.microsoft.com/keys/microsoft.asc
rpm --import https://packages.fluentbit.io/fluentbit.key
yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm || true
yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
cat >/etc/yum.repos.d/azure.repo <<'EOF'
[azure-cli]
name=azure-cli
baseurl=https://packages.microsoft.com/yumrepos/azure-cli
enabled=yes
gpgcheck=yes
cat >/etc/yum.repos.d/azure-cli.repo <<'EOF'
[azurecore]
name=azurecore
baseurl=https://packages.microsoft.com/yumrepos/azurecore
@ -350,17 +376,23 @@ enabled=yes
gpgcheck=no
EOF
yum -y install azsec-clamav azsec-monitor azure-mdsd azure-security podman-docker
cat >/etc/yum.repos.d/td-agent-bit.repo <<'EOF'
[td-agent-bit]
name=td-agent-bit
baseurl=https://packages.fluentbit.io/centos/7
enabled=yes
gpgcheck=yes
EOF
yum -y install azsec-clamav azsec-monitor azure-cli azure-mdsd azure-security podman-docker td-agent-bit
firewall-cmd --add-port=443/tcp --permanent
# https://bugzilla.redhat.com/show_bug.cgi?id=1805212
sed -i -e 's/iptables/firewalld/' /etc/cni/net.d/87-podman-bridge.conflist
firewall-cmd --add-port=443/tcp --permanent
if [[ -n "$RPIMAGEAUTH" ]]; then
mkdir -p /root/.docker
cat >/root/.docker/config.json <<EOF
mkdir /root/.docker
cat >/root/.docker/config.json <<EOF
{
"auths": {
"${RPIMAGE%%/*}": {
@ -370,46 +402,79 @@ if [[ -n "$RPIMAGEAUTH" ]]; then
}
EOF
else
rm -rf /root/.docker
fi
cat >/etc/td-agent-bit/td-agent-bit.conf <<'EOF'
[INPUT]
Name systemd
Tag journald
mkdir -p /etc/mdm
echo "$MDMCERTIFICATE" >/etc/mdm/cert.pem
echo "$MDMPRIVATEKEY" >/etc/mdm/key.pem
chown -R 1000:1000 /etc/mdm
chmod 0600 /etc/mdm/key.pem
[OUTPUT]
Name forward
Port 29230
EOF
az login -i --allow-no-subscriptions
az keyvault secret download --file /etc/mdm.pem --id "$RPMDMCERTIFICATEVAULTID"
chmod 0600 /etc/mdm.pem
az keyvault secret download --file /etc/mdsd.pem --id "$RPMDSDCERTIFICATEVAULTID"
chown syslog:syslog /etc/mdsd.pem
chmod 0600 /etc/mdsd.pem
az logout
cat >/etc/default/mdsd <<EOF
MDSD_ROLE_PREFIX=/var/run/mdsd/default
MDSD_OPTIONS="-A -d -r \$MDSD_ROLE_PREFIX"
export SSL_CERT_FILE=/etc/pki/tls/certs/ca-bundle.crt
export MONITORING_GCS_ENVIRONMENT='$RPMDSDENVIRONMENT'
export MONITORING_GCS_ACCOUNT='$RPMDSDACCOUNT'
export MONITORING_GCS_REGION='$LOCATION'
export MONITORING_GCS_CERT_CERTFILE=/etc/mdsd.pem
export MONITORING_GCS_CERT_KEYFILE=/etc/mdsd.pem
export MONITORING_GCS_NAMESPACE='$RPMDSDNAMESPACE'
export MONITORING_CONFIG_VERSION='$RPMDSDCONFIGVERSION'
export MONITORING_USE_GENEVA_CONFIG_SERVICE=true
export MONITORING_TENANT='$LOCATION'
export MONITORING_ROLE=rp
export MONITORING_ROLE_INSTANCE='$(hostname)'
EOF
cat >/etc/sysconfig/mdm <<EOF
MDMIMAGE='arosvc.azurecr.io/mdm:2019.801.1228-66cac1'
RPMDMFRONTENDURL='$RPMDMFRONTENDURL'
RPMDMIMAGE=arosvc.azurecr.io/genevamdm:master_31
RPMDMSOURCEENVIRONMENT='$LOCATION'
RPMDMSOURCEROLE=rp
RPMDMSOURCEROLEINSTANCE='$(hostname)'
EOF
cat >/etc/sysconfig/arorp <<EOF
PULL_SECRET='$PULLSECRET'
RPIMAGE='$RPIMAGE'
RP_MODE='$RPMODE'
EOF
cat >/etc/systemd/system/mdm.service <<EOF
mkdir /var/etw
cat >/etc/systemd/system/mdm.service <<'EOF'
[Unit]
After=network-online.target
[Service]
EnvironmentFile=/etc/sysconfig/mdm
ExecStartPre=-/usr/bin/docker rm -f %N
ExecStartPre=/usr/bin/docker pull \$MDMIMAGE
ExecStartPre=/usr/bin/docker pull $RPMDMIMAGE
ExecStart=/usr/bin/docker run \
--entrypoint /usr/sbin/MetricsExtension \
--hostname %H \
--name %N \
--rm \
-v /etc/mdm:/etc/mdm \
-v /var/etw:/var/etw \
\$MDMIMAGE \
-FrontEndUrl \$MDMFRONTENDURL \
-MonitoringAccount \$MDMMONITORINGACCOUNT \
-MetricNamespace \$MDMMETRICNAMESPACE \
-CertFile /etc/mdm/cert.pem \
-PrivateKeyFile /etc/mdm/key.pem
-v /etc/mdm.pem:/etc/mdm.pem \
-v /var/etw:/var/etw:z \
$RPMDMIMAGE \
-CertFile /etc/mdm.pem \
-FrontEndUrl $RPMDMFRONTENDURL \
-Logger Console \
-PrivateKeyFile /etc/mdm.pem \
-SourceEnvironment $RPMDMSOURCEENVIRONMENT \
-SourceRole $RPMDMSOURCEROLE \
-SourceRoleInstance $RPMDMSOURCEROLEINSTANCE
ExecStop=/usr/bin/docker stop %N
Restart=always
@ -417,22 +482,34 @@ Restart=always
WantedBy=multi-user.target
EOF
cat >/etc/systemd/system/arorp.service <<EOF
cat >/etc/sysconfig/aro-rp <<EOF
MDM_ACCOUNT='$RPMDMMONITORINGACCOUNT'
MDM_NAMESPACE='$RPMDMMETRICNAMESPACE'
PULL_SECRET='$PULLSECRET'
RPIMAGE='$RPIMAGE'
RP_MODE='$RPMODE'
EOF
cat >/etc/systemd/system/aro-rp.service <<'EOF'
[Unit]
After=network-online.target
[Service]
EnvironmentFile=/etc/sysconfig/arorp
EnvironmentFile=/etc/sysconfig/aro-rp
ExecStartPre=-/usr/bin/docker rm -f %N
ExecStartPre=/usr/bin/docker pull \$RPIMAGE
ExecStartPre=/usr/bin/docker pull $RPIMAGE
ExecStart=/usr/bin/docker run \
--hostname %H \
--name %N \
--rm \
-e MDM_ACCOUNT \
-e MDM_NAMESPACE \
-e PULL_SECRET \
-e RP_MODE \
-p 443:8443 \
\$RPIMAGE \
-v /run/systemd/journal:/run/systemd/journal \
-v /var/etw:/var/etw:z \
$RPIMAGE \
rp
ExecStop=/usr/bin/docker stop -t 3600 %N
Restart=always
@ -441,19 +518,44 @@ Restart=always
WantedBy=multi-user.target
EOF
for service in arorp chronyd; do
systemctl enable $service.service
done
cat >/etc/sysconfig/aro-monitor <<EOF
MDM_ACCOUNT='$CLUSTERMDMMONITORINGACCOUNT'
MDM_NAMESPACE='$CLUSTERMDMMETRICNAMESPACE'
RPIMAGE='$RPIMAGE'
RP_MODE='$RPMODE'
EOF
cat >/etc/systemd/system/aro-monitor.service <<'EOF'
[Unit]
After=network-online.target
[Service]
EnvironmentFile=/etc/sysconfig/aro-monitor
ExecStartPre=-/usr/bin/docker rm -f %N
ExecStartPre=/usr/bin/docker pull $RPIMAGE
ExecStart=/usr/bin/docker run \
--hostname %H \
--name %N \
--rm \
-e MDM_ACCOUNT \
-e MDM_NAMESPACE \
-e RP_MODE \
-v /run/systemd/journal:/run/systemd/journal \
-v /var/etw:/var/etw:z \
$RPIMAGE \
monitor
Restart=always
[Install]
WantedBy=multi-user.target
EOF
chcon -R system_u:object_r:var_log_t:s0 /var/opt/microsoft/linuxmonagent
for service in auoms azsecd azsecmond mdsd; do
systemctl disable $service.service
systemctl mask $service.service
for service in aro-monitor aro-rp auoms azsecd azsecmond mdsd mdm chronyd td-agent-bit; do
systemctl enable $service.service
done
rm /etc/rsyslog.d/10-mdsd.conf
rm /etc/motd.d/*
>/etc/containers/nodocker
@ -469,7 +571,7 @@ rm /etc/motd.d/*
Sku: &mgmtcompute.Sku{
Name: to.StringPtr(string(mgmtcompute.VirtualMachineSizeTypesStandardD2sV3)),
Tier: to.StringPtr("Standard"),
Capacity: to.Int64Ptr(3),
Capacity: to.Int64Ptr(capacityHack),
},
VirtualMachineScaleSetProperties: &mgmtcompute.VirtualMachineScaleSetProperties{
UpgradePolicy: &mgmtcompute.UpgradePolicy{
@ -991,14 +1093,24 @@ func (g *generator) template() *arm.Template {
}
if g.production {
params = append(params,
"mdmCertificate",
"mdmFrontendUrl",
"mdmMetricNamespace",
"mdmMonitoringAccount",
"mdmPrivateKey",
"clusterMdmMetricNamespace",
"clusterMdmMonitoringAccount",
"extraCosmosDBIPs",
"extraKeyvaultAccessPolicies",
"pullSecret",
"rpImage",
"rpImageAuth",
"rpMdmCertificateVaultId",
"rpMdmFrontendUrl",
"rpMdmMetricNamespace",
"rpMdmMonitoringAccount",
"rpMdsdAccount",
"rpMdsdCertificateVaultId",
"rpMdsdConfigVersion",
"rpMdsdEnvironment",
"rpMdsdNamespace",
"rpMode",
"vmssCount",
"vmssDomainNameLabel",
"vmssName",
)
@ -1009,33 +1121,22 @@ func (g *generator) template() *arm.Template {
}
for _, param := range params {
typ := "string"
p := &arm.TemplateParameter{Type: "string"}
switch param {
case "mdmPrivateKey", "pullSecret", "rpImageAuth":
typ = "securestring"
}
t.Parameters[param] = &arm.TemplateParameter{Type: typ}
if param == "keyvaultPrefix" {
t.Parameters[param] = &arm.TemplateParameter{
Type: typ,
MaxLength: 24 - max(len(kvClusterSuffix), len(kvServiceSuffix)),
}
}
}
if g.production {
t.Parameters["extraCosmosDBIPs"] = &arm.TemplateParameter{
Type: "string",
DefaultValue: "",
}
t.Parameters["extraKeyvaultAccessPolicies"] = &arm.TemplateParameter{
Type: "array",
DefaultValue: []mgmtkeyvault.AccessPolicyEntry{},
}
t.Parameters["rpMode"] = &arm.TemplateParameter{
Type: "string",
DefaultValue: "",
case "extraCosmosDBIPs", "rpMode":
p.DefaultValue = ""
case "extraKeyvaultAccessPolicies":
p.Type = "array"
p.DefaultValue = []mgmtkeyvault.AccessPolicyEntry{}
case "pullSecret", "rpImageAuth":
p.Type = "securestring"
case "keyvaultPrefix":
p.MaxLength = 24 - max(len(kvClusterSuffix), len(kvServiceSuffix))
case "vmssCount":
p.Type = "int"
p.DefaultValue = 3
}
t.Parameters[param] = p
}
if g.production {
@ -1082,6 +1183,7 @@ func GenerateRPTemplates() error {
if i.g.production {
b = bytes.Replace(b, []byte(`"accessPolicies": []`), []byte(`"accessPolicies": "[concat(variables('clustersKeyvaultAccessPolicies'), parameters('extraKeyvaultAccessPolicies'))]"`), 1)
b = bytes.Replace(b, []byte(`"accessPolicies": []`), []byte(`"accessPolicies": "[concat(variables('serviceKeyvaultAccessPolicies'), parameters('extraKeyvaultAccessPolicies'))]"`), 1)
b = bytes.Replace(b, []byte(`"capacity": `+strconv.Itoa(capacityHack)), []byte(`"capacity": "[parameters('vmssCount')]"`), 1)
}
b = append(b, byte('\n'))

5
pkg/env/dev.go поставляемый
Просмотреть файл

@ -80,7 +80,6 @@ func newDev(ctx context.Context, log *logrus.Entry, instancemetadata instancemet
"DATABASE_NAME",
"LOCATION",
"PROXY_HOSTNAME",
"PULL_SECRET",
"RESOURCEGROUP",
} {
if _, found := os.LookupEnv(key); !found {
@ -234,6 +233,10 @@ func (d *dev) FPAuthorizer(tenantID, resource string) (autorest.Authorizer, erro
return &refreshableAuthorizer{autorest.NewBearerAuthorizer(sp), sp}, nil
}
func (d *dev) MetricsSocketPath() string {
return "mdm_statsd.socket"
}
func (d *dev) CreateARMResourceGroupRoleAssignment(ctx context.Context, fpAuthorizer autorest.Authorizer, resourceGroup string) error {
d.log.Print("development mode: applying resource group role assignment")

3
pkg/env/env.go поставляемый
Просмотреть файл

@ -32,6 +32,7 @@ type Interface interface {
GetSecret(context.Context, string) ([]byte, error)
Listen() (net.Listener, error)
ManagedDomain(string) (string, error)
MetricsSocketPath() string
Zones(vmSize string) ([]string, error)
}
@ -47,7 +48,7 @@ func NewEnv(ctx context.Context, log *logrus.Entry) (Interface, error) {
}
if strings.ToLower(os.Getenv("RP_MODE")) == "int" {
log.Warn("running in INT mode")
log.Warn("running in int mode")
return newInt(ctx, log, im, clientauthorizer.NewARM(log))
}

7
pkg/env/prod.go поставляемый
Просмотреть файл

@ -51,7 +51,8 @@ type prod struct {
func newProd(ctx context.Context, log *logrus.Entry, instancemetadata instancemetadata.InstanceMetadata, clientauthorizer clientauthorizer.ClientAuthorizer) (*prod, error) {
for _, key := range []string{
"PULL_SECRET",
"MDM_ACCOUNT",
"MDM_NAMESPACE",
} {
if _, found := os.LookupEnv(key); !found {
return nil, fmt.Errorf("environment variable %q unset", key)
@ -277,6 +278,10 @@ func (p *prod) ManagedDomain(domain string) (string, error) {
return domain + "." + p.Domain(), nil
}
func (p *prod) MetricsSocketPath() string {
return "/var/etw/mdm_statsd.socket"
}
func (p *prod) Zones(vmSize string) ([]string, error) {
zones, found := p.zones[vmSize]
if !found {

Просмотреть файл

@ -56,31 +56,31 @@ func Log(baseLog *logrus.Entry) func(http.Handler) http.Handler {
requestID := uuid.NewV4().String()
w.Header().Set("X-Ms-Request-Id", requestID)
log := baseLog.WithFields(logrus.Fields{"correlation-id": correlationID, "request-id": requestID})
log := baseLog.WithFields(logrus.Fields{"correlation_id": correlationID, "request_id": requestID})
r = r.WithContext(context.WithValue(r.Context(), ContextKeyLog, log))
defer func() {
log.WithFields(logrus.Fields{
"access": true,
"bodyReadBytes": r.Body.(*logReadCloser).bytes,
"bodyWrittenBytes": w.(*logResponseWriter).bytes,
"duration": time.Now().Sub(t).Seconds(),
"requestMethod": r.Method,
"requestPath": r.URL.Path,
"requestProto": r.Proto,
"requestRemoteAddr": r.RemoteAddr,
"requestUserAgent": r.UserAgent(),
"responseStatusCode": w.(*logResponseWriter).statusCode,
"access": true,
"body_read_bytes": r.Body.(*logReadCloser).bytes,
"body_written_bytes": w.(*logResponseWriter).bytes,
"duration": time.Now().Sub(t).Seconds(),
"request_method": r.Method,
"request_path": r.URL.Path,
"request_proto": r.Proto,
"request_remote_addr": r.RemoteAddr,
"request_user_agent": r.UserAgent(),
"response_status_code": w.(*logResponseWriter).statusCode,
}).Print()
}()
log.WithFields(logrus.Fields{
"access": true,
"requestMethod": r.Method,
"requestPath": r.URL.Path,
"requestProto": r.Proto,
"requestRemoteAddr": r.RemoteAddr,
"requestUserAgent": r.UserAgent(),
"access": true,
"request_method": r.Method,
"request_path": r.URL.Path,
"request_proto": r.Proto,
"request_remote_addr": r.RemoteAddr,
"request_user_agent": r.UserAgent(),
}).Print()
h.ServeHTTP(w, r)

Просмотреть файл

@ -5,7 +5,6 @@ package metrics
// Interface represents metrics interface
type Interface interface {
Close() error
EmitFloat(string, float64, map[string]string) error
EmitGauge(string, int64, map[string]string) error
EmitFloat(string, float64, map[string]string)
EmitGauge(string, int64, map[string]string)
}

Просмотреть файл

@ -5,14 +5,5 @@ package noop
type Noop struct{}
func (c *Noop) Close() error {
return nil
}
func (c *Noop) EmitFloat(stat string, value float64, dims map[string]string) error {
return nil
}
func (c *Noop) EmitGauge(stat string, value int64, dims map[string]string) error {
return nil
}
func (c *Noop) EmitFloat(stat string, value float64, dims map[string]string) {}
func (c *Noop) EmitGauge(stat string, value int64, dims map[string]string) {}

Просмотреть файл

@ -6,11 +6,9 @@ package statsd
// statsd implementation for https://genevamondocs.azurewebsites.net/collect/references/statsdref.html
import (
"context"
"io"
"fmt"
"net"
"os"
"strings"
"sync"
"time"
"github.com/Azure/go-autorest/tracing"
@ -19,31 +17,36 @@ import (
"github.com/Azure/ARO-RP/pkg/env"
"github.com/Azure/ARO-RP/pkg/metrics"
"github.com/Azure/ARO-RP/pkg/metrics/noop"
statsdazure "github.com/Azure/ARO-RP/pkg/metrics/statsd/azure"
statsdk8s "github.com/Azure/ARO-RP/pkg/metrics/statsd/k8s"
"github.com/Azure/ARO-RP/pkg/util/recover"
)
const defaultSocket = "mdm_statsd.socket"
type statsd struct {
env env.Interface
conn io.WriteCloser
mu sync.Mutex
log *logrus.Entry
env env.Interface
hostname string
account string
namespace string
conn net.Conn
ch chan *metric
now func() time.Time
hostname string
}
// New returns a new metrics.Interface
func New(ctx context.Context, log *logrus.Entry, _env env.Interface) (metrics.Interface, error) {
if os.Getenv("FEATURE_METRICS") == "" {
return &noop.Noop{}, nil
}
func New(ctx context.Context, log *logrus.Entry, env env.Interface) (metrics.Interface, error) {
s := &statsd{
env: _env,
log: log,
env: env,
account: os.Getenv("MDM_ACCOUNT"),
namespace: os.Getenv("MDM_NAMESPACE"),
ch: make(chan *metric, 1024),
now: time.Now,
}
@ -53,15 +56,12 @@ func New(ctx context.Context, log *logrus.Entry, _env env.Interface) (metrics.In
}
s.hostname = hostname
s.conn, err = net.Dial("unix", defaultSocket)
if _, ok := _env.(env.Dev); ok &&
err != nil &&
strings.HasSuffix(err.Error(), "connect: no such file or directory") {
log.Printf("%s does not exist; not outputting metrics", defaultSocket)
return &noop.Noop{}, nil
if s.account == "" {
s.account = "*"
}
if err != nil {
return nil, err
if s.namespace == "" {
s.namespace = "*"
}
// register azure client tracer
@ -70,17 +70,14 @@ func New(ctx context.Context, log *logrus.Entry, _env env.Interface) (metrics.In
// register k8s client tracer
k8smetrics.Register(statsdk8s.NewLatency(s), statsdk8s.NewResult(s))
go s.run()
return s, nil
}
// Close closes the connection
func (s *statsd) Close() error {
return s.conn.Close()
}
// EmitFloat records float information
func (s *statsd) EmitFloat(m string, value float64, dims map[string]string) error {
return s.emitMetric(metric{
func (s *statsd) EmitFloat(m string, value float64, dims map[string]string) {
s.emitMetric(&metric{
metric: m,
dims: dims,
valueFloat: &value,
@ -88,17 +85,17 @@ func (s *statsd) EmitFloat(m string, value float64, dims map[string]string) erro
}
// EmitGauge records gauge information
func (s *statsd) EmitGauge(m string, value int64, dims map[string]string) error {
return s.emitMetric(metric{
func (s *statsd) EmitGauge(m string, value int64, dims map[string]string) {
s.emitMetric(&metric{
metric: m,
dims: dims,
valueGauge: &value,
})
}
func (s *statsd) emitMetric(m metric) error {
m.account = "*"
m.namespace = "*"
func (s *statsd) emitMetric(m *metric) {
m.account = s.account
m.namespace = s.namespace
if m.dims == nil {
m.dims = map[string]string{}
}
@ -106,18 +103,61 @@ func (s *statsd) emitMetric(m metric) error {
m.dims["hostname"] = s.hostname
m.ts = s.now()
b, err := m.marshalStatsd()
if err != nil {
return err
s.ch <- m
}
func (s *statsd) run() {
defer recover.Panic(s.log)
var lastLog time.Time
for m := range s.ch {
err := s.write(m)
if err != nil &&
s.now().After(lastLog.Add(time.Second)) {
lastLog = s.now()
s.log.Error(err)
}
}
}
func (s *statsd) dial() (err error) {
s.conn, err = net.Dial("unix", s.env.MetricsSocketPath())
return
}
func (s *statsd) write(m *metric) (err error) {
if s.now().After(m.ts.Add(time.Minute)) {
return fmt.Errorf("discarding stale metric")
}
_, err = s.Write(b)
return err
}
b, err := m.marshalStatsd()
if err != nil {
return
}
// Send data to statsd daemon
func (s *statsd) Write(data []byte) (int, error) {
s.mu.Lock()
defer s.mu.Unlock()
return s.conn.Write(data)
if s.conn == nil {
err = s.dial()
if err != nil {
if _, ok := s.env.(env.Dev); ok {
err = nil
}
return
}
}
defer func() {
if err != nil && s.conn != nil {
s.conn.Close()
s.conn = nil
}
}()
err = s.conn.SetWriteDeadline(time.Now().Add(10 * time.Second))
if err != nil {
return
}
_, err = s.conn.Write(b)
return
}

Просмотреть файл

@ -4,57 +4,70 @@ package statsd
// Licensed under the Apache License 2.0.
import (
"bytes"
"bufio"
"net"
"testing"
"time"
"github.com/Azure/ARO-RP/pkg/env"
)
type writeCloser struct {
*bytes.Buffer
}
func (c *writeCloser) Close() error { return nil }
func TestEmitGauge(t *testing.T) {
wc := &writeCloser{Buffer: &bytes.Buffer{}}
c1, c2 := net.Pipe()
s := &statsd{
env: &env.Test{
TestLocation: "eastus",
},
conn: wc,
now: func() time.Time { return time.Time{} },
account: "*",
namespace: "*",
conn: c1,
ch: make(chan *metric),
now: func() time.Time { return time.Time{} },
}
err := s.EmitGauge("tests.test_key", 42, map[string]string{"key": "value"})
go s.run()
s.EmitGauge("tests.test_key", 42, map[string]string{"key": "value"})
m, err := bufio.NewReader(c2).ReadString('\n')
if err != nil {
t.Fatal(err)
}
if wc.String() != `{"Metric":"tests.test_key","Account":"*","Namespace":"*","Dims":{"hostname":"","key":"value","location":"eastus"},"TS":"0001-01-01T00:00:00.000"}:42|g`+"\n" {
t.Error(wc.String())
if m != `{"Metric":"tests.test_key","Account":"*","Namespace":"*","Dims":{"hostname":"","key":"value","location":"eastus"},"TS":"0001-01-01T00:00:00.000"}:42|g`+"\n" {
t.Error(m)
}
}
func TestEmitFloat(t *testing.T) {
wc := &writeCloser{Buffer: &bytes.Buffer{}}
c1, c2 := net.Pipe()
s := &statsd{
env: &env.Test{
TestLocation: "eastus",
},
conn: wc,
now: func() time.Time { return time.Time{} },
account: "*",
namespace: "*",
conn: c1,
ch: make(chan *metric),
now: func() time.Time { return time.Time{} },
}
err := s.EmitFloat("tests.test_key", 5, map[string]string{"key": "value"})
go s.run()
s.EmitFloat("tests.test_key", 5, map[string]string{"key": "value"})
m, err := bufio.NewReader(c2).ReadString('\n')
if err != nil {
t.Fatal(err)
}
if wc.String() != `{"Metric":"tests.test_key","Account":"*","Namespace":"*","Dims":{"hostname":"","key":"value","location":"eastus"},"TS":"0001-01-01T00:00:00.000"}:5.000000|f`+"\n" {
t.Error(wc.String())
if m != `{"Metric":"tests.test_key","Account":"*","Namespace":"*","Dims":{"hostname":"","key":"value","location":"eastus"},"TS":"0001-01-01T00:00:00.000"}:5.000000|f`+"\n" {
t.Error(m)
}
}

Просмотреть файл

@ -161,8 +161,10 @@ func (mon *monitor) workOne(ctx context.Context, log *logrus.Entry, doc *api.Ope
return err
}
return mon.m.EmitGauge("monitoring.apiserver.health", 1, map[string]string{
mon.m.EmitGauge("monitoring.apiserver.health", 1, map[string]string{
"resource": doc.OpenShiftCluster.ID,
"code": strconv.FormatInt(int64(statusCode), 10),
})
return nil
}

64
pkg/util/log/journald.go Normal file
Просмотреть файл

@ -0,0 +1,64 @@
package log
// Copyright (c) Microsoft Corporation.
// Licensed under the Apache License 2.0.
import (
"fmt"
"strings"
"github.com/coreos/go-systemd/journal"
"github.com/sirupsen/logrus"
)
type journaldHook struct{}
var _ logrus.Hook = (*journaldHook)(nil)
func (h *journaldHook) Levels() []logrus.Level {
return logrus.AllLevels
}
func (h *journaldHook) Fire(e *logrus.Entry) error {
var priority journal.Priority
switch e.Level {
case logrus.PanicLevel:
priority = journal.PriEmerg
case logrus.FatalLevel:
priority = journal.PriCrit
case logrus.ErrorLevel:
priority = journal.PriErr
case logrus.WarnLevel:
priority = journal.PriWarning
case logrus.InfoLevel:
priority = journal.PriInfo
default:
priority = journal.PriDebug
}
vars := make(map[string]string, len(e.Data))
for k, v := range e.Data {
vars[key(k)] = fmt.Sprint(v)
}
if e.Caller != nil {
vars["FUNC"], vars["FILE"] = relativeFilePathPrettier(e.Caller)
}
return journal.Send(e.Message, priority, vars)
}
func key(k string) string {
return strings.TrimPrefix(strings.Map(func(r rune) rune {
switch {
case r >= '0' && r <= '9',
r >= 'A' && r <= 'Z':
return r
case r >= 'a' && r <= 'z':
return r - 32
default:
return '_'
}
}, k), "_")
}

Просмотреть файл

@ -9,6 +9,7 @@ import (
"runtime"
"strings"
"github.com/coreos/go-systemd/journal"
"github.com/sirupsen/logrus"
)
@ -27,6 +28,10 @@ func GetLogger() *logrus.Entry {
CallerPrettyfier: relativeFilePathPrettier,
})
if journal.Enabled() {
logrus.AddHook(&journaldHook{})
}
log := logrus.NewEntry(logrus.StandardLogger())
l, err := logrus.ParseLevel(*loglevel)
@ -42,5 +47,5 @@ func GetLogger() *logrus.Entry {
func relativeFilePathPrettier(f *runtime.Frame) (string, string) {
file := strings.TrimPrefix(f.File, repopath)
function := f.Function[strings.LastIndexByte(f.Function, '/')+1:]
return fmt.Sprintf("%s()", function), fmt.Sprintf(" %s:%d", file, f.Line)
return fmt.Sprintf("%s()", function), fmt.Sprintf("%s:%d", file, f.Line)
}

Просмотреть файл

@ -26,13 +26,13 @@ func TestRelativeFilePathPrettier(t *testing.T) {
name: "current function",
f: &currentFunc,
wantFunction: "log.TestRelativeFilePathPrettier()",
wantFile: " pkg/util/log/log_test.go:11",
wantFile: "pkg/util/log/log_test.go:11",
},
{
name: "empty",
f: &runtime.Frame{},
wantFunction: "()",
wantFile: " :0",
wantFile: ":0",
},
{
name: "install",
@ -42,7 +42,7 @@ func TestRelativeFilePathPrettier(t *testing.T) {
Line: 623,
},
wantFunction: "install.installResources()",
wantFile: " pkg/install/1-installresources.go:623",
wantFile: "pkg/install/1-installresources.go:623",
},
}

225
vendor/github.com/coreos/go-systemd/journal/journal.go сгенерированный поставляемый Normal file
Просмотреть файл

@ -0,0 +1,225 @@
// Copyright 2015 CoreOS, Inc.
//
// 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.
// Package journal provides write bindings to the local systemd journal.
// It is implemented in pure Go and connects to the journal directly over its
// unix socket.
//
// To read from the journal, see the "sdjournal" package, which wraps the
// sd-journal a C API.
//
// http://www.freedesktop.org/software/systemd/man/systemd-journald.service.html
package journal
import (
"bytes"
"encoding/binary"
"errors"
"fmt"
"io"
"io/ioutil"
"net"
"os"
"strconv"
"strings"
"sync"
"sync/atomic"
"syscall"
"unsafe"
)
// Priority of a journal message
type Priority int
const (
PriEmerg Priority = iota
PriAlert
PriCrit
PriErr
PriWarning
PriNotice
PriInfo
PriDebug
)
var (
// This can be overridden at build-time:
// https://github.com/golang/go/wiki/GcToolchainTricks#including-build-information-in-the-executable
journalSocket = "/run/systemd/journal/socket"
// unixConnPtr atomically holds the local unconnected Unix-domain socket.
// Concrete safe pointer type: *net.UnixConn
unixConnPtr unsafe.Pointer
// onceConn ensures that unixConnPtr is initialized exactly once.
onceConn sync.Once
)
func init() {
onceConn.Do(initConn)
}
// Enabled checks whether the local systemd journal is available for logging.
func Enabled() bool {
onceConn.Do(initConn)
if (*net.UnixConn)(atomic.LoadPointer(&unixConnPtr)) == nil {
return false
}
if _, err := net.Dial("unixgram", journalSocket); err != nil {
return false
}
return true
}
// Send a message to the local systemd journal. vars is a map of journald
// fields to values. Fields must be composed of uppercase letters, numbers,
// and underscores, but must not start with an underscore. Within these
// restrictions, any arbitrary field name may be used. Some names have special
// significance: see the journalctl documentation
// (http://www.freedesktop.org/software/systemd/man/systemd.journal-fields.html)
// for more details. vars may be nil.
func Send(message string, priority Priority, vars map[string]string) error {
conn := (*net.UnixConn)(atomic.LoadPointer(&unixConnPtr))
if conn == nil {
return errors.New("could not initialize socket to journald")
}
socketAddr := &net.UnixAddr{
Name: journalSocket,
Net: "unixgram",
}
data := new(bytes.Buffer)
appendVariable(data, "PRIORITY", strconv.Itoa(int(priority)))
appendVariable(data, "MESSAGE", message)
for k, v := range vars {
appendVariable(data, k, v)
}
_, _, err := conn.WriteMsgUnix(data.Bytes(), nil, socketAddr)
if err == nil {
return nil
}
if !isSocketSpaceError(err) {
return err
}
// Large log entry, send it via tempfile and ancillary-fd.
file, err := tempFd()
if err != nil {
return err
}
defer file.Close()
_, err = io.Copy(file, data)
if err != nil {
return err
}
rights := syscall.UnixRights(int(file.Fd()))
_, _, err = conn.WriteMsgUnix([]byte{}, rights, socketAddr)
if err != nil {
return err
}
return nil
}
// Print prints a message to the local systemd journal using Send().
func Print(priority Priority, format string, a ...interface{}) error {
return Send(fmt.Sprintf(format, a...), priority, nil)
}
func appendVariable(w io.Writer, name, value string) {
if err := validVarName(name); err != nil {
fmt.Fprintf(os.Stderr, "variable name %s contains invalid character, ignoring\n", name)
}
if strings.ContainsRune(value, '\n') {
/* When the value contains a newline, we write:
* - the variable name, followed by a newline
* - the size (in 64bit little endian format)
* - the data, followed by a newline
*/
fmt.Fprintln(w, name)
binary.Write(w, binary.LittleEndian, uint64(len(value)))
fmt.Fprintln(w, value)
} else {
/* just write the variable and value all on one line */
fmt.Fprintf(w, "%s=%s\n", name, value)
}
}
// validVarName validates a variable name to make sure journald will accept it.
// The variable name must be in uppercase and consist only of characters,
// numbers and underscores, and may not begin with an underscore:
// https://www.freedesktop.org/software/systemd/man/sd_journal_print.html
func validVarName(name string) error {
if name == "" {
return errors.New("Empty variable name")
} else if name[0] == '_' {
return errors.New("Variable name begins with an underscore")
}
for _, c := range name {
if !(('A' <= c && c <= 'Z') || ('0' <= c && c <= '9') || c == '_') {
return errors.New("Variable name contains invalid characters")
}
}
return nil
}
// isSocketSpaceError checks whether the error is signaling
// an "overlarge message" condition.
func isSocketSpaceError(err error) bool {
opErr, ok := err.(*net.OpError)
if !ok || opErr == nil {
return false
}
sysErr, ok := opErr.Err.(*os.SyscallError)
if !ok || sysErr == nil {
return false
}
return sysErr.Err == syscall.EMSGSIZE || sysErr.Err == syscall.ENOBUFS
}
// tempFd creates a temporary, unlinked file under `/dev/shm`.
func tempFd() (*os.File, error) {
file, err := ioutil.TempFile("/dev/shm/", "journal.XXXXX")
if err != nil {
return nil, err
}
err = syscall.Unlink(file.Name())
if err != nil {
return nil, err
}
return file, nil
}
// initConn initializes the global `unixConnPtr` socket.
// It is meant to be called exactly once, at program startup.
func initConn() {
autobind, err := net.ResolveUnixAddr("unixgram", "")
if err != nil {
return
}
sock, err := net.ListenUnixgram("unixgram", autobind)
if err != nil {
return
}
atomic.StorePointer(&unixConnPtr, unsafe.Pointer(sock))
}

Просмотреть файл

@ -1,20 +0,0 @@
/*
Copyright 2018 The Kubernetes 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.
*/
// Code generated by main. DO NOT EDIT.
// This package contains the scheme of the automatically generated clientset.
package scheme

Просмотреть файл

@ -1,58 +0,0 @@
/*
Copyright 2018 The Kubernetes 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.
*/
// Code generated by main. DO NOT EDIT.
package scheme
import (
clusterv1alpha1 "github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1"
machinev1beta1 "github.com/openshift/cluster-api/pkg/apis/machine/v1beta1"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
runtime "k8s.io/apimachinery/pkg/runtime"
schema "k8s.io/apimachinery/pkg/runtime/schema"
serializer "k8s.io/apimachinery/pkg/runtime/serializer"
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
)
var Scheme = runtime.NewScheme()
var Codecs = serializer.NewCodecFactory(Scheme)
var ParameterCodec = runtime.NewParameterCodec(Scheme)
var localSchemeBuilder = runtime.SchemeBuilder{
clusterv1alpha1.AddToScheme,
machinev1beta1.AddToScheme,
}
// AddToScheme adds all types of this clientset into the given scheme. This allows composition
// of clientsets, like in:
//
// import (
// "k8s.io/client-go/kubernetes"
// clientsetscheme "k8s.io/client-go/kubernetes/scheme"
// aggregatorclientsetscheme "k8s.io/kube-aggregator/pkg/client/clientset_generated/clientset/scheme"
// )
//
// kclientset, _ := kubernetes.NewForConfig(c)
// _ = aggregatorclientsetscheme.AddToScheme(clientsetscheme.Scheme)
//
// After this, RawExtensions in Kubernetes types will serialize kube-aggregator types
// correctly.
var AddToScheme = localSchemeBuilder.AddToScheme
func init() {
v1.AddToGroupVersion(Scheme, schema.GroupVersion{Version: "v1"})
utilruntime.Must(AddToScheme(Scheme))
}

Просмотреть файл

@ -1,20 +0,0 @@
/*
Copyright 2018 The Kubernetes 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.
*/
// Code generated by main. DO NOT EDIT.
// This package has the automatically generated typed clients.
package v1beta1

Просмотреть файл

@ -1,27 +0,0 @@
/*
Copyright 2018 The Kubernetes 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.
*/
// Code generated by main. DO NOT EDIT.
package v1beta1
type MachineExpansion interface{}
type MachineClassExpansion interface{}
type MachineDeploymentExpansion interface{}
type MachineSetExpansion interface{}

Просмотреть файл

@ -1,191 +0,0 @@
/*
Copyright 2018 The Kubernetes 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.
*/
// Code generated by main. DO NOT EDIT.
package v1beta1
import (
"time"
v1beta1 "github.com/openshift/cluster-api/pkg/apis/machine/v1beta1"
scheme "github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/scheme"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
rest "k8s.io/client-go/rest"
)
// MachinesGetter has a method to return a MachineInterface.
// A group's client should implement this interface.
type MachinesGetter interface {
Machines(namespace string) MachineInterface
}
// MachineInterface has methods to work with Machine resources.
type MachineInterface interface {
Create(*v1beta1.Machine) (*v1beta1.Machine, error)
Update(*v1beta1.Machine) (*v1beta1.Machine, error)
UpdateStatus(*v1beta1.Machine) (*v1beta1.Machine, error)
Delete(name string, options *v1.DeleteOptions) error
DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error
Get(name string, options v1.GetOptions) (*v1beta1.Machine, error)
List(opts v1.ListOptions) (*v1beta1.MachineList, error)
Watch(opts v1.ListOptions) (watch.Interface, error)
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.Machine, err error)
MachineExpansion
}
// machines implements MachineInterface
type machines struct {
client rest.Interface
ns string
}
// newMachines returns a Machines
func newMachines(c *MachineV1beta1Client, namespace string) *machines {
return &machines{
client: c.RESTClient(),
ns: namespace,
}
}
// Get takes name of the machine, and returns the corresponding machine object, and an error if there is any.
func (c *machines) Get(name string, options v1.GetOptions) (result *v1beta1.Machine, err error) {
result = &v1beta1.Machine{}
err = c.client.Get().
Namespace(c.ns).
Resource("machines").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do().
Into(result)
return
}
// List takes label and field selectors, and returns the list of Machines that match those selectors.
func (c *machines) List(opts v1.ListOptions) (result *v1beta1.MachineList, err error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
result = &v1beta1.MachineList{}
err = c.client.Get().
Namespace(c.ns).
Resource("machines").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Do().
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested machines.
func (c *machines) Watch(opts v1.ListOptions) (watch.Interface, error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
opts.Watch = true
return c.client.Get().
Namespace(c.ns).
Resource("machines").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Watch()
}
// Create takes the representation of a machine and creates it. Returns the server's representation of the machine, and an error, if there is any.
func (c *machines) Create(machine *v1beta1.Machine) (result *v1beta1.Machine, err error) {
result = &v1beta1.Machine{}
err = c.client.Post().
Namespace(c.ns).
Resource("machines").
Body(machine).
Do().
Into(result)
return
}
// Update takes the representation of a machine and updates it. Returns the server's representation of the machine, and an error, if there is any.
func (c *machines) Update(machine *v1beta1.Machine) (result *v1beta1.Machine, err error) {
result = &v1beta1.Machine{}
err = c.client.Put().
Namespace(c.ns).
Resource("machines").
Name(machine.Name).
Body(machine).
Do().
Into(result)
return
}
// UpdateStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
func (c *machines) UpdateStatus(machine *v1beta1.Machine) (result *v1beta1.Machine, err error) {
result = &v1beta1.Machine{}
err = c.client.Put().
Namespace(c.ns).
Resource("machines").
Name(machine.Name).
SubResource("status").
Body(machine).
Do().
Into(result)
return
}
// Delete takes name of the machine and deletes it. Returns an error if one occurs.
func (c *machines) Delete(name string, options *v1.DeleteOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("machines").
Name(name).
Body(options).
Do().
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *machines) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
var timeout time.Duration
if listOptions.TimeoutSeconds != nil {
timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second
}
return c.client.Delete().
Namespace(c.ns).
Resource("machines").
VersionedParams(&listOptions, scheme.ParameterCodec).
Timeout(timeout).
Body(options).
Do().
Error()
}
// Patch applies the patch and returns the patched machine.
func (c *machines) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.Machine, err error) {
result = &v1beta1.Machine{}
err = c.client.Patch(pt).
Namespace(c.ns).
Resource("machines").
SubResource(subresources...).
Name(name).
Body(data).
Do().
Into(result)
return
}

Просмотреть файл

@ -1,104 +0,0 @@
/*
Copyright 2018 The Kubernetes 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.
*/
// Code generated by main. DO NOT EDIT.
package v1beta1
import (
v1beta1 "github.com/openshift/cluster-api/pkg/apis/machine/v1beta1"
"github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/scheme"
rest "k8s.io/client-go/rest"
)
type MachineV1beta1Interface interface {
RESTClient() rest.Interface
MachinesGetter
MachineClassesGetter
MachineDeploymentsGetter
MachineSetsGetter
}
// MachineV1beta1Client is used to interact with features provided by the machine.openshift.io group.
type MachineV1beta1Client struct {
restClient rest.Interface
}
func (c *MachineV1beta1Client) Machines(namespace string) MachineInterface {
return newMachines(c, namespace)
}
func (c *MachineV1beta1Client) MachineClasses(namespace string) MachineClassInterface {
return newMachineClasses(c, namespace)
}
func (c *MachineV1beta1Client) MachineDeployments(namespace string) MachineDeploymentInterface {
return newMachineDeployments(c, namespace)
}
func (c *MachineV1beta1Client) MachineSets(namespace string) MachineSetInterface {
return newMachineSets(c, namespace)
}
// NewForConfig creates a new MachineV1beta1Client for the given config.
func NewForConfig(c *rest.Config) (*MachineV1beta1Client, error) {
config := *c
if err := setConfigDefaults(&config); err != nil {
return nil, err
}
client, err := rest.RESTClientFor(&config)
if err != nil {
return nil, err
}
return &MachineV1beta1Client{client}, nil
}
// NewForConfigOrDie creates a new MachineV1beta1Client for the given config and
// panics if there is an error in the config.
func NewForConfigOrDie(c *rest.Config) *MachineV1beta1Client {
client, err := NewForConfig(c)
if err != nil {
panic(err)
}
return client
}
// New creates a new MachineV1beta1Client for the given RESTClient.
func New(c rest.Interface) *MachineV1beta1Client {
return &MachineV1beta1Client{c}
}
func setConfigDefaults(config *rest.Config) error {
gv := v1beta1.SchemeGroupVersion
config.GroupVersion = &gv
config.APIPath = "/apis"
config.NegotiatedSerializer = scheme.Codecs.WithoutConversion()
if config.UserAgent == "" {
config.UserAgent = rest.DefaultKubernetesUserAgent()
}
return nil
}
// RESTClient returns a RESTClient that is used to communicate
// with API server by this client implementation.
func (c *MachineV1beta1Client) RESTClient() rest.Interface {
if c == nil {
return nil
}
return c.restClient
}

Просмотреть файл

@ -1,174 +0,0 @@
/*
Copyright 2018 The Kubernetes 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.
*/
// Code generated by main. DO NOT EDIT.
package v1beta1
import (
"time"
v1beta1 "github.com/openshift/cluster-api/pkg/apis/machine/v1beta1"
scheme "github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/scheme"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
rest "k8s.io/client-go/rest"
)
// MachineClassesGetter has a method to return a MachineClassInterface.
// A group's client should implement this interface.
type MachineClassesGetter interface {
MachineClasses(namespace string) MachineClassInterface
}
// MachineClassInterface has methods to work with MachineClass resources.
type MachineClassInterface interface {
Create(*v1beta1.MachineClass) (*v1beta1.MachineClass, error)
Update(*v1beta1.MachineClass) (*v1beta1.MachineClass, error)
Delete(name string, options *v1.DeleteOptions) error
DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error
Get(name string, options v1.GetOptions) (*v1beta1.MachineClass, error)
List(opts v1.ListOptions) (*v1beta1.MachineClassList, error)
Watch(opts v1.ListOptions) (watch.Interface, error)
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.MachineClass, err error)
MachineClassExpansion
}
// machineClasses implements MachineClassInterface
type machineClasses struct {
client rest.Interface
ns string
}
// newMachineClasses returns a MachineClasses
func newMachineClasses(c *MachineV1beta1Client, namespace string) *machineClasses {
return &machineClasses{
client: c.RESTClient(),
ns: namespace,
}
}
// Get takes name of the machineClass, and returns the corresponding machineClass object, and an error if there is any.
func (c *machineClasses) Get(name string, options v1.GetOptions) (result *v1beta1.MachineClass, err error) {
result = &v1beta1.MachineClass{}
err = c.client.Get().
Namespace(c.ns).
Resource("machineclasses").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do().
Into(result)
return
}
// List takes label and field selectors, and returns the list of MachineClasses that match those selectors.
func (c *machineClasses) List(opts v1.ListOptions) (result *v1beta1.MachineClassList, err error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
result = &v1beta1.MachineClassList{}
err = c.client.Get().
Namespace(c.ns).
Resource("machineclasses").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Do().
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested machineClasses.
func (c *machineClasses) Watch(opts v1.ListOptions) (watch.Interface, error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
opts.Watch = true
return c.client.Get().
Namespace(c.ns).
Resource("machineclasses").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Watch()
}
// Create takes the representation of a machineClass and creates it. Returns the server's representation of the machineClass, and an error, if there is any.
func (c *machineClasses) Create(machineClass *v1beta1.MachineClass) (result *v1beta1.MachineClass, err error) {
result = &v1beta1.MachineClass{}
err = c.client.Post().
Namespace(c.ns).
Resource("machineclasses").
Body(machineClass).
Do().
Into(result)
return
}
// Update takes the representation of a machineClass and updates it. Returns the server's representation of the machineClass, and an error, if there is any.
func (c *machineClasses) Update(machineClass *v1beta1.MachineClass) (result *v1beta1.MachineClass, err error) {
result = &v1beta1.MachineClass{}
err = c.client.Put().
Namespace(c.ns).
Resource("machineclasses").
Name(machineClass.Name).
Body(machineClass).
Do().
Into(result)
return
}
// Delete takes name of the machineClass and deletes it. Returns an error if one occurs.
func (c *machineClasses) Delete(name string, options *v1.DeleteOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("machineclasses").
Name(name).
Body(options).
Do().
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *machineClasses) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
var timeout time.Duration
if listOptions.TimeoutSeconds != nil {
timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second
}
return c.client.Delete().
Namespace(c.ns).
Resource("machineclasses").
VersionedParams(&listOptions, scheme.ParameterCodec).
Timeout(timeout).
Body(options).
Do().
Error()
}
// Patch applies the patch and returns the patched machineClass.
func (c *machineClasses) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.MachineClass, err error) {
result = &v1beta1.MachineClass{}
err = c.client.Patch(pt).
Namespace(c.ns).
Resource("machineclasses").
SubResource(subresources...).
Name(name).
Body(data).
Do().
Into(result)
return
}

Просмотреть файл

@ -1,191 +0,0 @@
/*
Copyright 2018 The Kubernetes 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.
*/
// Code generated by main. DO NOT EDIT.
package v1beta1
import (
"time"
v1beta1 "github.com/openshift/cluster-api/pkg/apis/machine/v1beta1"
scheme "github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/scheme"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
rest "k8s.io/client-go/rest"
)
// MachineDeploymentsGetter has a method to return a MachineDeploymentInterface.
// A group's client should implement this interface.
type MachineDeploymentsGetter interface {
MachineDeployments(namespace string) MachineDeploymentInterface
}
// MachineDeploymentInterface has methods to work with MachineDeployment resources.
type MachineDeploymentInterface interface {
Create(*v1beta1.MachineDeployment) (*v1beta1.MachineDeployment, error)
Update(*v1beta1.MachineDeployment) (*v1beta1.MachineDeployment, error)
UpdateStatus(*v1beta1.MachineDeployment) (*v1beta1.MachineDeployment, error)
Delete(name string, options *v1.DeleteOptions) error
DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error
Get(name string, options v1.GetOptions) (*v1beta1.MachineDeployment, error)
List(opts v1.ListOptions) (*v1beta1.MachineDeploymentList, error)
Watch(opts v1.ListOptions) (watch.Interface, error)
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.MachineDeployment, err error)
MachineDeploymentExpansion
}
// machineDeployments implements MachineDeploymentInterface
type machineDeployments struct {
client rest.Interface
ns string
}
// newMachineDeployments returns a MachineDeployments
func newMachineDeployments(c *MachineV1beta1Client, namespace string) *machineDeployments {
return &machineDeployments{
client: c.RESTClient(),
ns: namespace,
}
}
// Get takes name of the machineDeployment, and returns the corresponding machineDeployment object, and an error if there is any.
func (c *machineDeployments) Get(name string, options v1.GetOptions) (result *v1beta1.MachineDeployment, err error) {
result = &v1beta1.MachineDeployment{}
err = c.client.Get().
Namespace(c.ns).
Resource("machinedeployments").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do().
Into(result)
return
}
// List takes label and field selectors, and returns the list of MachineDeployments that match those selectors.
func (c *machineDeployments) List(opts v1.ListOptions) (result *v1beta1.MachineDeploymentList, err error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
result = &v1beta1.MachineDeploymentList{}
err = c.client.Get().
Namespace(c.ns).
Resource("machinedeployments").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Do().
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested machineDeployments.
func (c *machineDeployments) Watch(opts v1.ListOptions) (watch.Interface, error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
opts.Watch = true
return c.client.Get().
Namespace(c.ns).
Resource("machinedeployments").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Watch()
}
// Create takes the representation of a machineDeployment and creates it. Returns the server's representation of the machineDeployment, and an error, if there is any.
func (c *machineDeployments) Create(machineDeployment *v1beta1.MachineDeployment) (result *v1beta1.MachineDeployment, err error) {
result = &v1beta1.MachineDeployment{}
err = c.client.Post().
Namespace(c.ns).
Resource("machinedeployments").
Body(machineDeployment).
Do().
Into(result)
return
}
// Update takes the representation of a machineDeployment and updates it. Returns the server's representation of the machineDeployment, and an error, if there is any.
func (c *machineDeployments) Update(machineDeployment *v1beta1.MachineDeployment) (result *v1beta1.MachineDeployment, err error) {
result = &v1beta1.MachineDeployment{}
err = c.client.Put().
Namespace(c.ns).
Resource("machinedeployments").
Name(machineDeployment.Name).
Body(machineDeployment).
Do().
Into(result)
return
}
// UpdateStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
func (c *machineDeployments) UpdateStatus(machineDeployment *v1beta1.MachineDeployment) (result *v1beta1.MachineDeployment, err error) {
result = &v1beta1.MachineDeployment{}
err = c.client.Put().
Namespace(c.ns).
Resource("machinedeployments").
Name(machineDeployment.Name).
SubResource("status").
Body(machineDeployment).
Do().
Into(result)
return
}
// Delete takes name of the machineDeployment and deletes it. Returns an error if one occurs.
func (c *machineDeployments) Delete(name string, options *v1.DeleteOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("machinedeployments").
Name(name).
Body(options).
Do().
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *machineDeployments) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
var timeout time.Duration
if listOptions.TimeoutSeconds != nil {
timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second
}
return c.client.Delete().
Namespace(c.ns).
Resource("machinedeployments").
VersionedParams(&listOptions, scheme.ParameterCodec).
Timeout(timeout).
Body(options).
Do().
Error()
}
// Patch applies the patch and returns the patched machineDeployment.
func (c *machineDeployments) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.MachineDeployment, err error) {
result = &v1beta1.MachineDeployment{}
err = c.client.Patch(pt).
Namespace(c.ns).
Resource("machinedeployments").
SubResource(subresources...).
Name(name).
Body(data).
Do().
Into(result)
return
}

Просмотреть файл

@ -1,191 +0,0 @@
/*
Copyright 2018 The Kubernetes 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.
*/
// Code generated by main. DO NOT EDIT.
package v1beta1
import (
"time"
v1beta1 "github.com/openshift/cluster-api/pkg/apis/machine/v1beta1"
scheme "github.com/openshift/cluster-api/pkg/client/clientset_generated/clientset/scheme"
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
types "k8s.io/apimachinery/pkg/types"
watch "k8s.io/apimachinery/pkg/watch"
rest "k8s.io/client-go/rest"
)
// MachineSetsGetter has a method to return a MachineSetInterface.
// A group's client should implement this interface.
type MachineSetsGetter interface {
MachineSets(namespace string) MachineSetInterface
}
// MachineSetInterface has methods to work with MachineSet resources.
type MachineSetInterface interface {
Create(*v1beta1.MachineSet) (*v1beta1.MachineSet, error)
Update(*v1beta1.MachineSet) (*v1beta1.MachineSet, error)
UpdateStatus(*v1beta1.MachineSet) (*v1beta1.MachineSet, error)
Delete(name string, options *v1.DeleteOptions) error
DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error
Get(name string, options v1.GetOptions) (*v1beta1.MachineSet, error)
List(opts v1.ListOptions) (*v1beta1.MachineSetList, error)
Watch(opts v1.ListOptions) (watch.Interface, error)
Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.MachineSet, err error)
MachineSetExpansion
}
// machineSets implements MachineSetInterface
type machineSets struct {
client rest.Interface
ns string
}
// newMachineSets returns a MachineSets
func newMachineSets(c *MachineV1beta1Client, namespace string) *machineSets {
return &machineSets{
client: c.RESTClient(),
ns: namespace,
}
}
// Get takes name of the machineSet, and returns the corresponding machineSet object, and an error if there is any.
func (c *machineSets) Get(name string, options v1.GetOptions) (result *v1beta1.MachineSet, err error) {
result = &v1beta1.MachineSet{}
err = c.client.Get().
Namespace(c.ns).
Resource("machinesets").
Name(name).
VersionedParams(&options, scheme.ParameterCodec).
Do().
Into(result)
return
}
// List takes label and field selectors, and returns the list of MachineSets that match those selectors.
func (c *machineSets) List(opts v1.ListOptions) (result *v1beta1.MachineSetList, err error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
result = &v1beta1.MachineSetList{}
err = c.client.Get().
Namespace(c.ns).
Resource("machinesets").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Do().
Into(result)
return
}
// Watch returns a watch.Interface that watches the requested machineSets.
func (c *machineSets) Watch(opts v1.ListOptions) (watch.Interface, error) {
var timeout time.Duration
if opts.TimeoutSeconds != nil {
timeout = time.Duration(*opts.TimeoutSeconds) * time.Second
}
opts.Watch = true
return c.client.Get().
Namespace(c.ns).
Resource("machinesets").
VersionedParams(&opts, scheme.ParameterCodec).
Timeout(timeout).
Watch()
}
// Create takes the representation of a machineSet and creates it. Returns the server's representation of the machineSet, and an error, if there is any.
func (c *machineSets) Create(machineSet *v1beta1.MachineSet) (result *v1beta1.MachineSet, err error) {
result = &v1beta1.MachineSet{}
err = c.client.Post().
Namespace(c.ns).
Resource("machinesets").
Body(machineSet).
Do().
Into(result)
return
}
// Update takes the representation of a machineSet and updates it. Returns the server's representation of the machineSet, and an error, if there is any.
func (c *machineSets) Update(machineSet *v1beta1.MachineSet) (result *v1beta1.MachineSet, err error) {
result = &v1beta1.MachineSet{}
err = c.client.Put().
Namespace(c.ns).
Resource("machinesets").
Name(machineSet.Name).
Body(machineSet).
Do().
Into(result)
return
}
// UpdateStatus was generated because the type contains a Status member.
// Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus().
func (c *machineSets) UpdateStatus(machineSet *v1beta1.MachineSet) (result *v1beta1.MachineSet, err error) {
result = &v1beta1.MachineSet{}
err = c.client.Put().
Namespace(c.ns).
Resource("machinesets").
Name(machineSet.Name).
SubResource("status").
Body(machineSet).
Do().
Into(result)
return
}
// Delete takes name of the machineSet and deletes it. Returns an error if one occurs.
func (c *machineSets) Delete(name string, options *v1.DeleteOptions) error {
return c.client.Delete().
Namespace(c.ns).
Resource("machinesets").
Name(name).
Body(options).
Do().
Error()
}
// DeleteCollection deletes a collection of objects.
func (c *machineSets) DeleteCollection(options *v1.DeleteOptions, listOptions v1.ListOptions) error {
var timeout time.Duration
if listOptions.TimeoutSeconds != nil {
timeout = time.Duration(*listOptions.TimeoutSeconds) * time.Second
}
return c.client.Delete().
Namespace(c.ns).
Resource("machinesets").
VersionedParams(&listOptions, scheme.ParameterCodec).
Timeout(timeout).
Body(options).
Do().
Error()
}
// Patch applies the patch and returns the patched machineSet.
func (c *machineSets) Patch(name string, pt types.PatchType, data []byte, subresources ...string) (result *v1beta1.MachineSet, err error) {
result = &v1beta1.MachineSet{}
err = c.client.Patch(pt).
Namespace(c.ns).
Resource("machinesets").
SubResource(subresources...).
Name(name).
Body(data).
Do().
Into(result)
return
}

6
vendor/github.com/ugorji/go/codec/go.mod сгенерированный поставляемый
Просмотреть файл

@ -1,5 +1,5 @@
module github.com/ugorji/go/codec
require (
github.com/ugorji/go v1.1.7
)
require github.com/ugorji/go v1.1.7
go 1.13

3
vendor/github.com/ugorji/go/codec/go.sum сгенерированный поставляемый Normal file
Просмотреть файл

@ -0,0 +1,3 @@
github.com/ugorji/go v1.1.7 h1:/68gy2h+1mWMrwZFeD1kQialdSzAb432dtpeJ42ovdo=
github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw=
github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY=