1
0
mirror of https://github.com/openshift/installer.git synced 2026-02-06 09:47:02 +01:00

manifests: make tectonic/ flat dir

This commit is contained in:
Abhinav Dahiya
2018-09-25 18:00:51 -07:00
parent af81270eef
commit e2d9fd3064
25 changed files with 108 additions and 184 deletions

View File

@@ -80,39 +80,12 @@ wait_for_pods() {
# Wait for Kubernetes pods
wait_for_pods kube-system
echo "Creating initial roles..."
kubectl delete --filename rbac/role-admin.yaml
kubectl create --filename ingress/svc-account.yaml
kubectl create --filename rbac/role-admin.yaml
kubectl create --filename rbac/role-user.yaml
kubectl create --filename rbac/binding-admin.yaml
kubectl create --filename rbac/binding-discovery.yaml
echo "Creating cluster config for Tectonic..."
kubectl create --filename cluster-config.yaml
kubectl create --filename ingress/cluster-config.yaml
echo "Creating Tectonic secrets..."
kubectl create --filename secrets/pull.json
kubectl create --filename secrets/ingress-tls.yaml
kubectl create --filename secrets/ca-cert.yaml
kubectl create --filename ingress/pull.json
echo "Creating operators..."
kubectl create --filename security/priviledged-scc-tectonic.yaml
kubectl create --filename updater/app-version-kind.yaml
kubectl create --filename updater/migration-status-kind.yaml
kubectl create --filename updater/operators/kube-core-operator.yaml
kubectl create --filename updater/operators/kube-addon-operator.yaml
kubectl create --filename updater/operators/tectonic-ingress-controller-operator.yaml
kubectl --namespace=tectonic-system get customresourcedefinition appversions.tco.coreos.com
kubectl create --filename updater/app_versions/app-version-tectonic-cluster.yaml
kubectl create --filename updater/app_versions/app-version-kube-core.yaml
kubectl create --filename updater/app_versions/app-version-kube-addon.yaml
kubectl create --filename updater/app_versions/app-version-tectonic-ingress.yaml
for file in $(find . -type f -maxdepth 1)
do
echo "Creating object from file: $file ..."
kubectl create --filename "$file"
echo "Done creating object from file: $file ..."
done
# Wait for Tectonic pods
wait_for_pods tectonic-system

View File

@@ -0,0 +1,26 @@
load("@io_bazel_rules_go//go:def.bzl", "go_library")
go_library(
name = "go_default_library",
srcs = [
"binding-discovery.go",
"kube-addon-00-appversion.go",
"kube-addon-01-operator.go",
"kube-core-00-appversion.go",
"kube-core-00-operator.go",
"role-admin.go",
"role-user.go",
"tectonic-ingress-00-appversion.go",
"tectonic-ingress-01-cluster-config.go",
"tectonic-ingress-02-tls.go",
"tectonic-ingress-03-pull.go",
"tectonic-ingress-04-svc-account.go",
"tectonic-ingress-05-operator.go",
"tectonic-system-00-binding-admin.go",
"tectonic-system-01-ca-cert.go",
"tectonic-system-02-privileged-scc.go",
"tectonic-system-03-pull.go",
],
importpath = "github.com/openshift/installer/pkg/asset/manifests/content/tectonic",
visibility = ["//visibility:public"],
)

View File

@@ -1,4 +1,4 @@
package rbac
package tectonic
const (
// BindingDiscovery is the variable/constant representing the contents of the respective file

View File

@@ -1,12 +0,0 @@
package ingress
const (
// SvcAccount is the variable/constant representing the contents of the respective file
SvcAccount = `
apiVersion: v1
kind: ServiceAccount
metadata:
name: tectonic-ingress-controller-operator
namespace: openshift-ingress
`
)

View File

@@ -1,4 +1,4 @@
package appversions
package tectonic
const (
// AppVersionKubeAddon is the variable/constant representing the contents of the respective file

View File

@@ -1,4 +1,4 @@
package appversions
package tectonic
const (
// AppVersionKubeCore is the variable/constant representing the contents of the respective file

View File

@@ -1,4 +1,4 @@
package operators
package tectonic
import (
"text/template"
@@ -6,8 +6,7 @@ import (
var (
// KubeCoreOperator is the variable/constant representing the contents of the respective file
KubeCoreOperator = template.Must(template.New("kube-core-operator.yaml").Parse(`
---
KubeCoreOperator = template.Must(template.New("kube-core-00-operator.yaml").Parse(`
apiVersion: apps/v1beta2
kind: Deployment
metadata:

View File

@@ -1,4 +1,4 @@
package rbac
package tectonic
const (
// RoleAdmin is the variable/constant representing the contents of the respective file

View File

@@ -1,4 +1,4 @@
package rbac
package tectonic
const (
// RoleUser is the variable/constant representing the contents of the respective file

View File

@@ -1,19 +0,0 @@
package secrets
import (
"text/template"
)
var (
// CaCert is the variable/constant representing the contents of the respective file
CaCert = template.Must(template.New("ca-cert.yaml").Parse(`
apiVersion: v1
kind: Secret
metadata:
name: tectonic-ca-cert-secret
namespace: tectonic-system
type: Opaque
data:
ca-cert: {{.IngressCaCert}}
`))
)

View File

@@ -1,4 +1,4 @@
package appversions
package tectonic
const (
// AppVersionTectonicIngress is the variable/constant representing the contents of the respective file

View File

@@ -1,12 +1,12 @@
package ingress
package tectonic
import (
"text/template"
)
var (
// ClusterConfig is the variable/constant representing the contents of the respective file
ClusterConfig = template.Must(template.New("cluster-config.yaml").Parse(`
// ClusterConfigTectonicIngress is the variable/constant representing the contents of the respective file
ClusterConfigTectonicIngress = template.Must(template.New("tectonic-ingress-01-cluster-config.yaml").Parse(`
apiVersion: v1
kind: ConfigMap
metadata:

View File

@@ -1,12 +1,12 @@
package secrets
package tectonic
import (
"text/template"
)
var (
// IngressTLS is the variable/constant representing the contents of the respective file
IngressTLS = template.Must(template.New("ingress-tls.yaml").Parse(`
// TLSTectonicIngress is the variable/constant representing the contents of the respective file
TLSTectonicIngress = template.Must(template.New("tectonic-ingress-02-tls.yaml").Parse(`
apiVersion: v1
kind: Secret
metadata:

View File

@@ -1,12 +1,12 @@
package ingress
package tectonic
import (
"text/template"
)
var (
// Pull is the variable/constant representing the contents of the respective file
Pull = template.Must(template.New("pull.json").Parse(`
// PullTectonicIngress is the variable/constant representing the contents of the respective file
PullTectonicIngress = template.Must(template.New("tectonic-ingress-03-pull.json").Parse(`
{
"apiVersion": "v1",
"kind": "Secret",

View File

@@ -0,0 +1,12 @@
package tectonic
const (
// SvcAccountTectonicIngress is the variable/constant representing the contents of the respective file
SvcAccountTectonicIngress = `
apiVersion: v1
kind: ServiceAccount
metadata:
name: tectonic-ingress-controller-operator
namespace: openshift-ingress
`
)

View File

@@ -1,4 +1,4 @@
package operators
package tectonic
import (
"text/template"
@@ -6,8 +6,7 @@ import (
var (
// TectonicIngressControllerOperator is the variable/constant representing the contents of the respective file
TectonicIngressControllerOperator = template.Must(template.New("tectonic-ingress-controller-operator.yaml").Parse(`
---
TectonicIngressControllerOperator = template.Must(template.New("tectonic-ingress-05-operator.yaml").Parse(`
apiVersion: apps/v1beta2
kind: Deployment
metadata:

View File

@@ -1,4 +1,4 @@
package rbac
package tectonic
const (
// BindingAdmin is the variable/constant representing the contents of the respective file

View File

@@ -0,0 +1,19 @@
package tectonic
import (
"text/template"
)
var (
// CaCertTectonicSystem is the variable/constant representing the contents of the respective file
CaCertTectonicSystem = template.Must(template.New("tectonic-system-01-ca-cert.yaml").Parse(`
apiVersion: v1
kind: Secret
metadata:
name: tectonic-ca-cert-secret
namespace: tectonic-system
type: Opaque
data:
ca-cert: {{.IngressCaCert}}
`))
)

View File

@@ -1,9 +1,8 @@
package security
package tectonic
const (
// PriviledgedSccTectonic is the variable/constant representing the contents of the respective file
PriviledgedSccTectonic = `
---
// PriviledgedSccTectonicSystem is the variable/constant representing the contents of the respective file
PriviledgedSccTectonicSystem = `
apiVersion: security.openshift.io/v1
kind: SecurityContextConstraints
metadata:

View File

@@ -1,12 +1,12 @@
package secrets
package tectonic
import (
"text/template"
)
var (
// Pull is the variable/constant representing the contents of the respective file
Pull = template.Must(template.New("pull.json").Parse(`
// PullTectonicSystem is the variable/constant representing the contents of the respective file
PullTectonicSystem = template.Must(template.New("tectonic-system-03-pull.json").Parse(`
{
"apiVersion": "v1",
"kind": "Secret",

View File

@@ -1,18 +0,0 @@
package updater
const (
// AppVersionKind is the variable/constant representing the contents of the respective file
AppVersionKind = `
---
apiVersion: "apiextensions.k8s.io/v1beta1"
kind: "CustomResourceDefinition"
metadata:
name: "appversions.tco.coreos.com"
spec:
group: "tco.coreos.com"
version: "v1"
names:
plural: "appversions"
kind: "AppVersion"
`
)

View File

@@ -1,24 +0,0 @@
package appversions
import (
"text/template"
)
var (
// AppVersionTectonicCluster is the variable/constant representing the contents of the respective file
AppVersionTectonicCluster = template.Must(template.New("app-version-tectonic-cluster.yaml").Parse(`
apiVersion: tco.coreos.com/v1
kind: AppVersion
metadata:
name: tectonic-cluster
namespace: tectonic-system
labels:
managed-by-channel-operator: "true"
spec:
desiredVersion: {{.TectonicVersion}}
paused: false
status:
currentVersion: {{.TectonicVersion}}
paused: false
`))
)

View File

@@ -1,18 +0,0 @@
package updater
const (
// MigrationStatusKind is the variable/constant representing the contents of the respective file
MigrationStatusKind = `
---
apiVersion: "apiextensions.k8s.io/v1beta1"
kind: "CustomResourceDefinition"
metadata:
name: "migrationstatuses.kvo.coreos.com"
spec:
group: "kvo.coreos.com"
version: "v1"
names:
plural: "migrationstatuses"
kind: "MigrationStatus"
`
)

View File

@@ -7,13 +7,7 @@ import (
"github.com/openshift/installer/pkg/asset"
"github.com/openshift/installer/pkg/asset/installconfig"
"github.com/openshift/installer/pkg/asset/manifests/content/tectonic/ingress"
"github.com/openshift/installer/pkg/asset/manifests/content/tectonic/rbac"
"github.com/openshift/installer/pkg/asset/manifests/content/tectonic/secrets"
"github.com/openshift/installer/pkg/asset/manifests/content/tectonic/security"
"github.com/openshift/installer/pkg/asset/manifests/content/tectonic/updater"
"github.com/openshift/installer/pkg/asset/manifests/content/tectonic/updater/appversions"
"github.com/openshift/installer/pkg/asset/manifests/content/tectonic/updater/operators"
content "github.com/openshift/installer/pkg/asset/manifests/content/tectonic"
)
// tectonic generates the dependent resource manifests for tectonic (as against bootkube)
@@ -62,29 +56,23 @@ func (t *tectonic) Generate(dependencies map[asset.Asset]*asset.State) (*asset.S
}
assetData := map[string][]byte{
// template files
"secrets/ingress-tls.yaml": applyTemplateData(secrets.IngressTLS, templateData),
"secrets/ca-cert.yaml": applyTemplateData(secrets.CaCert, templateData),
"secrets/pull.json": applyTemplateData(secrets.Pull, templateData),
"updater/operators/tectonic-ingress-controller-operator.yaml": applyTemplateData(operators.TectonicIngressControllerOperator, templateData),
"updater/operators/kube-addon-operator.yaml": applyTemplateData(operators.KubeAddonOperator, templateData),
"updater/operators/kube-core-operator.yaml": applyTemplateData(operators.KubeCoreOperator, templateData),
"updater/app_versions/app-version-tectonic-cluster.yaml": applyTemplateData(appversions.AppVersionTectonicCluster, templateData),
"ingress/pull.json": applyTemplateData(ingress.Pull, templateData),
"ingress/cluster-config.yaml": applyTemplateData(ingress.ClusterConfig, templateData),
// constant files
"security/priviledged-scc-tectonic.yaml": []byte(security.PriviledgedSccTectonic),
"rbac/role-admin.yaml": []byte(rbac.RoleAdmin),
"rbac/binding-admin.yaml": []byte(rbac.BindingAdmin),
"rbac/binding-discovery.yaml": []byte(rbac.BindingDiscovery),
"rbac/role-user.yaml": []byte(rbac.RoleUser),
"updater/migration-status-kind.yaml": []byte(updater.MigrationStatusKind),
"updater/app_versions/app-version-kube-addon.yaml": []byte(appversions.AppVersionKubeAddon),
"updater/app_versions/app-version-tectonic-ingress.yaml": []byte(appversions.AppVersionTectonicIngress),
"updater/app_versions/app-version-kube-core.yaml": []byte(appversions.AppVersionKubeCore),
"updater/app-version-kind.yaml": []byte(updater.AppVersionKind),
"ingress/svc-account.yaml": []byte(ingress.SvcAccount),
"99_binding-discovery.yaml": []byte(content.BindingDiscovery),
"99_kube-addon-00-appversion.yaml": []byte(content.AppVersionKubeAddon),
"99_kube-addon-01-operator.yaml": applyTemplateData(content.KubeAddonOperator, templateData),
"99_kube-core-00-appversion.yaml": []byte(content.AppVersionKubeCore),
"99_kube-core-00-operator.yaml": applyTemplateData(content.KubeCoreOperator, templateData),
"99_role-admin.yaml": []byte(content.RoleAdmin),
"99_role-user.yaml": []byte(content.RoleUser),
"99_tectonic-ingress-00-appversion.yaml": []byte(content.AppVersionTectonicIngress),
"99_tectonic-ingress-01-cluster-config.yaml": applyTemplateData(content.ClusterConfigTectonicIngress, templateData),
"99_tectonic-ingress-02-tls.yaml": applyTemplateData(content.TLSTectonicIngress, templateData),
"99_tectonic-ingress-03-pull.json": applyTemplateData(content.PullTectonicIngress, templateData),
"99_tectonic-ingress-04-svc-account.yaml": []byte(content.SvcAccountTectonicIngress),
"99_tectonic-ingress-05-operator.yaml": applyTemplateData(content.TectonicIngressControllerOperator, templateData),
"99_tectonic-system-00-binding-admin.yaml": []byte(content.BindingAdmin),
"99_tectonic-system-01-ca-cert.yaml": applyTemplateData(content.CaCertTectonicSystem, templateData),
"99_tectonic-system-02-privileged-scc.yaml": []byte(content.PriviledgedSccTectonicSystem),
"99_tectonic-system-03-pull.json": applyTemplateData(content.PullTectonicSystem, templateData),
}
var assetContents []asset.Content