mirror of
https://github.com/openshift/installer.git
synced 2026-02-06 00:48:45 +01:00
pkg/asset: new target manifest-templates
1. Move files from manifests/content to templates directory 2. Create new asset called templates that the target manifest-templates can directly call 3. All template files are separate assets by themselves, and 'templates' asset depends on all leaf template assets 4. Manifest/tectonic assets now use templates as parent assets that they depend upon Other templates (e.g. ignition/machines) are not moved into assets in this commit. data/data/manifests: move all yaml content to its own files So that a yaml lint check can catch the inappropriate ones. No functional change at runtime.
This commit is contained in:
@@ -25,6 +25,7 @@ import (
|
||||
"github.com/openshift/installer/pkg/asset/installconfig"
|
||||
"github.com/openshift/installer/pkg/asset/kubeconfig"
|
||||
"github.com/openshift/installer/pkg/asset/manifests"
|
||||
"github.com/openshift/installer/pkg/asset/templates"
|
||||
destroybootstrap "github.com/openshift/installer/pkg/destroy/bootstrap"
|
||||
)
|
||||
|
||||
@@ -59,6 +60,16 @@ var (
|
||||
assets: []asset.WritableAsset{&manifests.Manifests{}, &manifests.Tectonic{}},
|
||||
}
|
||||
|
||||
manifestTemplatesTarget = target{
|
||||
name: "Manifest templates",
|
||||
command: &cobra.Command{
|
||||
Use: "manifest-templates",
|
||||
Short: "Generates the unrendered Kubernetes manifest templates",
|
||||
Long: "",
|
||||
},
|
||||
assets: []asset.WritableAsset{&templates.Templates{}},
|
||||
}
|
||||
|
||||
ignitionConfigsTarget = target{
|
||||
name: "Ignition Configs",
|
||||
command: &cobra.Command{
|
||||
@@ -84,7 +95,7 @@ var (
|
||||
assets: []asset.WritableAsset{&cluster.TerraformVariables{}, &kubeconfig.Admin{}, &cluster.Cluster{}},
|
||||
}
|
||||
|
||||
targets = []target{installConfigTarget, manifestsTarget, ignitionConfigsTarget, clusterTarget}
|
||||
targets = []target{installConfigTarget, manifestTemplatesTarget, manifestsTarget, ignitionConfigsTarget, clusterTarget}
|
||||
)
|
||||
|
||||
// Deprecated: Use 'create' subcommands instead.
|
||||
|
||||
@@ -1,9 +1,3 @@
|
||||
package bootkube
|
||||
|
||||
const (
|
||||
// TectonicNamespace is the constant to represent contents of Tectonic_Namespace.yaml file
|
||||
TectonicNamespace = `
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
@@ -11,5 +5,3 @@ metadata:
|
||||
labels: # network policy can only select by labels
|
||||
name: tectonic-system
|
||||
openshift.io/run-level: "1"
|
||||
`
|
||||
)
|
||||
@@ -1,9 +1,3 @@
|
||||
package bootkube
|
||||
|
||||
const (
|
||||
// OpenshiftWebConsoleNamespace is the constant to represent contents of Openshift_WebConsoleNamespace.yaml file
|
||||
OpenshiftWebConsoleNamespace = `
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
@@ -12,5 +6,3 @@ metadata:
|
||||
name: openshift-web-console
|
||||
labels:
|
||||
name: openshift-web-console
|
||||
`
|
||||
)
|
||||
@@ -0,0 +1,7 @@
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: openshift-machine-config-operator
|
||||
labels:
|
||||
name: openshift-machine-config-operator
|
||||
openshift.io/run-level: "1"
|
||||
@@ -1,9 +1,3 @@
|
||||
package bootkube
|
||||
|
||||
const (
|
||||
// OpenshiftClusterAPINamespace is the constant to represent contents of Openshift_ClusterApiNamespace.yaml file
|
||||
OpenshiftClusterAPINamespace = `
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
@@ -12,5 +6,3 @@ metadata:
|
||||
labels:
|
||||
name: openshift-cluster-api
|
||||
openshift.io/run-level: "1"
|
||||
`
|
||||
)
|
||||
@@ -0,0 +1,7 @@
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
# This is the namespace used to hold the service-serving-cert-signer.
|
||||
name: openshift-service-cert-signer
|
||||
labels:
|
||||
openshift.io/run-level: "1"
|
||||
@@ -1,9 +1,3 @@
|
||||
package bootkube
|
||||
|
||||
const (
|
||||
// AppVersionKind is the constant to represent contents of App_VersionKind.yaml file
|
||||
AppVersionKind = `
|
||||
---
|
||||
apiVersion: "apiextensions.k8s.io/v1beta1"
|
||||
kind: "CustomResourceDefinition"
|
||||
metadata:
|
||||
@@ -14,5 +8,3 @@ spec:
|
||||
names:
|
||||
plural: "appversions"
|
||||
kind: "AppVersion"
|
||||
`
|
||||
)
|
||||
@@ -1,9 +1,3 @@
|
||||
package bootkube
|
||||
|
||||
const (
|
||||
// AppVersionTectonicNetwork is the constant to represent contents of App_VersionTectonicNetwork.yaml file
|
||||
AppVersionTectonicNetwork = `
|
||||
---
|
||||
apiVersion: tco.coreos.com/v1
|
||||
kind: AppVersion
|
||||
metadata:
|
||||
@@ -19,5 +13,3 @@ status:
|
||||
paused: false
|
||||
upgradereq: 1
|
||||
upgradecomp: 0
|
||||
`
|
||||
)
|
||||
17
data/data/manifests/bootkube/cvo-overrides.yaml.template
Normal file
17
data/data/manifests/bootkube/cvo-overrides.yaml.template
Normal file
@@ -0,0 +1,17 @@
|
||||
apiVersion: config.openshift.io/v1
|
||||
kind: ClusterVersion
|
||||
metadata:
|
||||
namespace: openshift-cluster-version
|
||||
name: version
|
||||
spec:
|
||||
upstream: http://localhost:8080/graph
|
||||
channel: fast
|
||||
clusterID: {{.CVOClusterID}}
|
||||
overrides:
|
||||
- kind: Deployment # this conflicts with kube-core-operator
|
||||
namespace: openshift-cluster-network-operator
|
||||
name: cluster-network-operator
|
||||
unmanaged: true
|
||||
- kind: APIService # packages.apps.redhat.com fails to start properly
|
||||
name: v1alpha1.packages.apps.redhat.com
|
||||
unmanaged: true
|
||||
@@ -0,0 +1,17 @@
|
||||
apiVersion: v1
|
||||
kind: Endpoints
|
||||
metadata:
|
||||
name: etcd
|
||||
namespace: kube-system
|
||||
annotations:
|
||||
alpha.installer.openshift.io/dns-suffix: {{.EtcdEndpointDNSSuffix}}
|
||||
subsets:
|
||||
- addresses:
|
||||
{{- range $idx, $member := .EtcdEndpointHostnames }}
|
||||
- ip: 192.0.2.{{ add $idx 1 }}
|
||||
hostname: {{ $member }}
|
||||
{{- end }}
|
||||
ports:
|
||||
- name: etcd
|
||||
port: 2379
|
||||
protocol: TCP
|
||||
@@ -1,9 +1,3 @@
|
||||
package bootkube
|
||||
|
||||
const (
|
||||
// EtcdServiceKubeSystem is the constant to represent contents of etcd-service.yaml file
|
||||
EtcdServiceKubeSystem = `
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
@@ -18,5 +12,3 @@ spec:
|
||||
- name: etcd
|
||||
port: 2379
|
||||
protocol: TCP
|
||||
`
|
||||
)
|
||||
8
data/data/manifests/bootkube/kube-cloud-config.yaml
Normal file
8
data/data/manifests/bootkube/kube-cloud-config.yaml
Normal file
@@ -0,0 +1,8 @@
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: kube-cloud-cfg
|
||||
namespace: kube-system
|
||||
type: Opaque
|
||||
data:
|
||||
config: ""
|
||||
@@ -0,0 +1,8 @@
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: etcd-serving-ca
|
||||
namespace: kube-system
|
||||
data:
|
||||
ca-bundle.crt: |
|
||||
{{.EtcdCaCert}}
|
||||
@@ -0,0 +1,7 @@
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: root-ca
|
||||
namespace: kube-system
|
||||
data:
|
||||
ca.crt: {{.RootCaCert}}
|
||||
@@ -0,0 +1,9 @@
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: etcd-client
|
||||
namespace: kube-system
|
||||
type: SecretTypeTLS
|
||||
data:
|
||||
tls.crt: {{ .EtcdClientCert }}
|
||||
tls.key: {{ .EtcdClientKey }}
|
||||
@@ -0,0 +1,16 @@
|
||||
apiVersion: clusterversion.openshift.io/v1
|
||||
kind: CVOConfig
|
||||
metadata:
|
||||
namespace: openshift-cluster-version
|
||||
name: cluster-version-operator
|
||||
upstream: http://localhost:8080/graph
|
||||
channel: fast
|
||||
clusterID: {{.CVOClusterID}}
|
||||
overrides:
|
||||
- kind: Deployment # this conflicts with kube-core-operator
|
||||
namespace: openshift-cluster-network-operator
|
||||
name: cluster-network-operator
|
||||
unmanaged: true
|
||||
- kind: APIService # packages.apps.redhat.com fails to start properly
|
||||
name: v1alpha1.packages.apps.redhat.com
|
||||
unmanaged: true
|
||||
@@ -0,0 +1,9 @@
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: machine-config-server-tls
|
||||
namespace: openshift-machine-config-operator
|
||||
type: Opaque
|
||||
data:
|
||||
tls.crt: {{.McsTLSCert}}
|
||||
tls.key: {{.McsTLSKey}}
|
||||
@@ -0,0 +1,9 @@
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: service-serving-cert-signer-signing-key
|
||||
namespace: openshift-service-cert-signer
|
||||
type: kubernetes.io/tls
|
||||
data:
|
||||
tls.crt: {{.ServiceServingCaCert}}
|
||||
tls.key: {{.ServiceServingCaKey}}
|
||||
@@ -1,12 +1,3 @@
|
||||
package bootkube
|
||||
|
||||
import (
|
||||
"text/template"
|
||||
)
|
||||
|
||||
var (
|
||||
// Pull is the constant to represent contents of pull.yaml file
|
||||
Pull = template.Must(template.New("pull.json").Parse(`
|
||||
{
|
||||
"apiVersion": "v1",
|
||||
"kind": "Secret",
|
||||
@@ -19,5 +10,3 @@ var (
|
||||
".dockerconfigjson": "{{.PullSecret}}"
|
||||
}
|
||||
}
|
||||
`))
|
||||
)
|
||||
@@ -1,13 +1,3 @@
|
||||
package bootkube
|
||||
|
||||
import (
|
||||
"text/template"
|
||||
)
|
||||
|
||||
var (
|
||||
// TectonicNetworkOperator represents the template variable for tectonic-network-operator.yaml file
|
||||
TectonicNetworkOperator = template.Must(template.New("tectonic-network-operator.yaml").Parse(`
|
||||
---
|
||||
apiVersion: apps/v1beta2
|
||||
kind: DaemonSet
|
||||
metadata:
|
||||
@@ -67,5 +57,3 @@ spec:
|
||||
rollingUpdate:
|
||||
maxUnavailable: 1
|
||||
type: RollingUpdate
|
||||
`))
|
||||
)
|
||||
13
data/data/manifests/tectonic/binding-discovery.yaml
Normal file
13
data/data/manifests/tectonic/binding-discovery.yaml
Normal file
@@ -0,0 +1,13 @@
|
||||
kind: ClusterRoleBinding
|
||||
apiVersion: rbac.authorization.k8s.io/v1beta1
|
||||
metadata:
|
||||
name: discovery
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: ClusterRole
|
||||
name: system:discovery
|
||||
subjects:
|
||||
- kind: Group
|
||||
name: 'system:unauthenticated'
|
||||
- kind: Group
|
||||
name: 'system:authenticated'
|
||||
@@ -1,13 +1,3 @@
|
||||
package tectonic
|
||||
|
||||
import (
|
||||
"text/template"
|
||||
)
|
||||
|
||||
var (
|
||||
// CloudCredsSecret is the constant to represent contents of corresponding yaml file
|
||||
CloudCredsSecret = template.Must(template.New("cloud-creds-secret.yaml").Parse(`
|
||||
---
|
||||
kind: Secret
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
@@ -24,5 +14,3 @@ data:
|
||||
{{- else if .CloudCreds.OpenStack}}
|
||||
clouds.yaml: {{.CloudCreds.OpenStack.Base64encodeCloudCreds}}
|
||||
{{- end}}
|
||||
`))
|
||||
)
|
||||
@@ -1,9 +1,3 @@
|
||||
package tectonic
|
||||
|
||||
const (
|
||||
// AppVersionKubeAddon is the variable/constant representing the contents of the respective file
|
||||
AppVersionKubeAddon = `
|
||||
---
|
||||
apiVersion: tco.coreos.com/v1
|
||||
kind: AppVersion
|
||||
metadata:
|
||||
@@ -19,5 +13,3 @@ status:
|
||||
paused: false
|
||||
upgradereq: 1
|
||||
upgradecomp: 0
|
||||
`
|
||||
)
|
||||
@@ -1,13 +1,3 @@
|
||||
package tectonic
|
||||
|
||||
import (
|
||||
"text/template"
|
||||
)
|
||||
|
||||
var (
|
||||
// KubeAddonOperator is the variable/constant representing the contents of the respective file
|
||||
KubeAddonOperator = template.Must(template.New("kube-addon-operator.yaml").Parse(`
|
||||
---
|
||||
apiVersion: apps/v1beta2
|
||||
kind: Deployment
|
||||
metadata:
|
||||
@@ -59,5 +49,3 @@ spec:
|
||||
items:
|
||||
- key: addon-config
|
||||
path: addon-config
|
||||
`))
|
||||
)
|
||||
10
data/data/manifests/tectonic/role-admin.yaml
Normal file
10
data/data/manifests/tectonic/role-admin.yaml
Normal file
@@ -0,0 +1,10 @@
|
||||
kind: ClusterRole
|
||||
apiVersion: rbac.authorization.k8s.io/v1beta1
|
||||
metadata:
|
||||
name: admin
|
||||
rules:
|
||||
- apiGroups: ["*"]
|
||||
resources: ["*"]
|
||||
verbs: ["*"]
|
||||
- nonResourceURLs: ["*"]
|
||||
verbs: ["*"]
|
||||
@@ -1,13 +1,3 @@
|
||||
package tectonic
|
||||
|
||||
import (
|
||||
"text/template"
|
||||
)
|
||||
|
||||
var (
|
||||
// RoleCloudCredsSecretReader is the variable to represent contents of corresponding file
|
||||
RoleCloudCredsSecretReader = template.Must(template.New("role-cloud-creds-secret-reader.yaml").Parse(`
|
||||
---
|
||||
kind: Role
|
||||
apiVersion: rbac.authorization.k8s.io/v1beta1
|
||||
metadata:
|
||||
@@ -26,5 +16,3 @@ rules:
|
||||
resourceNames: ["openstack-creds"]
|
||||
{{- end}}
|
||||
verbs: ["get"]
|
||||
`))
|
||||
)
|
||||
67
data/data/manifests/tectonic/role-user.yaml
Normal file
67
data/data/manifests/tectonic/role-user.yaml
Normal file
@@ -0,0 +1,67 @@
|
||||
kind: ClusterRole
|
||||
apiVersion: rbac.authorization.k8s.io/v1beta1
|
||||
metadata:
|
||||
name: user
|
||||
rules:
|
||||
- apiGroups: [""]
|
||||
resources: [
|
||||
"bindings", "configmaps", "events", "pods", "replicationcontrollers",
|
||||
"secrets", "services", "serviceaccounts",
|
||||
"pods/attach",
|
||||
"pods/binding",
|
||||
"pods/exec",
|
||||
"pods/log",
|
||||
"pods/portforward",
|
||||
"pods/proxy",
|
||||
"pods/status",
|
||||
"replicationcontrollers/scale",
|
||||
"replicationcontrollers/status",
|
||||
"services/proxy",
|
||||
"services/status"
|
||||
]
|
||||
verbs: ["*"]
|
||||
nonResourceURLs: []
|
||||
|
||||
- apiGroups: [""]
|
||||
resources: [
|
||||
"componentstatuses", "endpoints", "limitranges", "nodes", "nodes/proxy", "nodes/status",
|
||||
"namespaces", "namespaces/status", "namespaces/finalize",
|
||||
"persistentvolumeclaims", "persistentvolumeclaims/status", "persistentvolumes", "resourcequotas",
|
||||
"resourcequotas/status"
|
||||
]
|
||||
verbs: ["get", "list", "watch", "proxy", "redirect"]
|
||||
nonResourceURLs: []
|
||||
|
||||
- apiGroups: ["apps", "batch", "autoscaling", "policy"]
|
||||
resources: ["*"]
|
||||
verbs: ["*"]
|
||||
nonResourceURLs: []
|
||||
|
||||
- apiGroups: ["extensions"]
|
||||
resources: [
|
||||
"daemonsets", "deployments", "horizontalpodautoscalers", "ingresses",
|
||||
"jobs", "replicasets", "replicationcontrollers",
|
||||
|
||||
"daemonsets/status",
|
||||
"deployments/rollback",
|
||||
"deployments/scale",
|
||||
"deployments/status",
|
||||
"horizontalpodautoscalers/status",
|
||||
"ingresses/status",
|
||||
"jobs/status",
|
||||
"replicasets/scale",
|
||||
"replicasets/status",
|
||||
"replicationcontrollers/scale"
|
||||
]
|
||||
verbs: ["*"]
|
||||
nonResourceURLs: []
|
||||
|
||||
- apiGroups: ["extensions"]
|
||||
resources: ["networkpolicies", "thirdpartyresources"]
|
||||
verbs: ["get", "list", "watch", "proxy", "redirect"]
|
||||
nonResourceURLs: []
|
||||
|
||||
- apiGroups: ["rbac.authorization.k8s.io"]
|
||||
resources: ["*"]
|
||||
verbs: ["get", "list", "watch", "proxy", "redirect"]
|
||||
nonResourceURLs: []
|
||||
@@ -0,0 +1,15 @@
|
||||
kind: ClusterRoleBinding
|
||||
apiVersion: rbac.authorization.k8s.io/v1beta1
|
||||
metadata:
|
||||
name: admin-user
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
namespace: tectonic-system
|
||||
name: default
|
||||
- kind: ServiceAccount
|
||||
namespace: openshift-ingress
|
||||
name: tectonic-ingress-controller-operator
|
||||
roleRef:
|
||||
kind: ClusterRole
|
||||
name: cluster-admin
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"apiVersion": "v1",
|
||||
"kind": "Secret",
|
||||
"type": "kubernetes.io/dockerconfigjson",
|
||||
"metadata": {
|
||||
"namespace": "tectonic-system",
|
||||
"name": "coreos-pull-secret"
|
||||
},
|
||||
"data": {
|
||||
".dockerconfigjson": "{{.PullSecret}}"
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
package bootkube
|
||||
|
||||
const (
|
||||
// OpenshiftMachineConfigOperator is the constant to represent contents of Openshift_MachineConfigOperator.yaml file
|
||||
OpenshiftMachineConfigOperator = `
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: openshift-machine-config-operator
|
||||
labels:
|
||||
name: openshift-machine-config-operator
|
||||
openshift.io/run-level: "1"
|
||||
`
|
||||
)
|
||||
@@ -1,15 +0,0 @@
|
||||
package bootkube
|
||||
|
||||
const (
|
||||
// OpenshiftServiceCertSignerNamespace is the constant to represent the contents of 09-openshift-service-signer-namespace.yaml
|
||||
OpenshiftServiceCertSignerNamespace = `
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
# This is the namespace used to hold the service-serving-cert-signer.
|
||||
name: openshift-service-cert-signer
|
||||
labels:
|
||||
openshift.io/run-level: "1"
|
||||
`
|
||||
)
|
||||
@@ -1,55 +0,0 @@
|
||||
package bootkube
|
||||
|
||||
import (
|
||||
"text/template"
|
||||
)
|
||||
|
||||
var (
|
||||
// CVOOverrides is the constant to represent contents of cvo-override.yaml file
|
||||
// This is a gate to prevent CVO from installing these operators which is conflicting
|
||||
// with already owned resources by tectonic-operators.
|
||||
// This files can be dropped when the overrides list becomes empty.
|
||||
// IMPORTANT: You must also edit LegacyCVOOverrides
|
||||
CVOOverrides = template.Must(template.New("cvo-override.yaml").Parse(`
|
||||
apiVersion: config.openshift.io/v1
|
||||
kind: ClusterVersion
|
||||
metadata:
|
||||
namespace: openshift-cluster-version
|
||||
name: version
|
||||
spec:
|
||||
upstream: http://localhost:8080/graph
|
||||
channel: fast
|
||||
clusterID: {{.CVOClusterID}}
|
||||
overrides:
|
||||
- kind: Deployment # this conflicts with kube-core-operator
|
||||
namespace: openshift-cluster-network-operator
|
||||
name: cluster-network-operator
|
||||
unmanaged: true
|
||||
- kind: APIService # packages.apps.redhat.com fails to start properly
|
||||
name: v1alpha1.packages.apps.redhat.com
|
||||
unmanaged: true
|
||||
`))
|
||||
|
||||
// LegacyCVOOverrides is the constant to represent contents of legacy-cvo-override.yaml file
|
||||
// This is a gate to prevent CVO from installing these operators which is conflicting
|
||||
// with already owned resources by tectonic-operators.
|
||||
// This files can be dropped when the overrides list becomes empty.
|
||||
LegacyCVOOverrides = template.Must(template.New("cvo-override.yaml").Parse(`
|
||||
apiVersion: clusterversion.openshift.io/v1
|
||||
kind: CVOConfig
|
||||
metadata:
|
||||
namespace: openshift-cluster-version
|
||||
name: cluster-version-operator
|
||||
upstream: http://localhost:8080/graph
|
||||
channel: fast
|
||||
clusterID: {{.CVOClusterID}}
|
||||
overrides:
|
||||
- kind: Deployment # this conflicts with kube-core-operator
|
||||
namespace: openshift-cluster-network-operator
|
||||
name: cluster-network-operator
|
||||
unmanaged: true
|
||||
- kind: APIService # packages.apps.redhat.com fails to start properly
|
||||
name: v1alpha1.packages.apps.redhat.com
|
||||
unmanaged: true
|
||||
`))
|
||||
)
|
||||
@@ -1,34 +0,0 @@
|
||||
package bootkube
|
||||
|
||||
import (
|
||||
"text/template"
|
||||
)
|
||||
|
||||
var customTmplFuncs = template.FuncMap{
|
||||
"add": func(i, j int) int {
|
||||
return i + j
|
||||
},
|
||||
}
|
||||
|
||||
var (
|
||||
// EtcdServiceEndpointsKubeSystem is the constant to represent contents of etcd-service-endpoints.yaml file.
|
||||
EtcdServiceEndpointsKubeSystem = template.Must(template.New("etcd-service-endpoints.yaml").Funcs(customTmplFuncs).Parse(`
|
||||
apiVersion: v1
|
||||
kind: Endpoints
|
||||
metadata:
|
||||
name: etcd
|
||||
namespace: kube-system
|
||||
annotations:
|
||||
alpha.installer.openshift.io/dns-suffix: {{.EtcdEndpointDNSSuffix}}
|
||||
subsets:
|
||||
- addresses:
|
||||
{{- range $idx, $member := .EtcdEndpointHostnames }}
|
||||
- ip: 192.0.2.{{ add $idx 1 }}
|
||||
hostname: {{ $member }}
|
||||
{{- end }}
|
||||
ports:
|
||||
- name: etcd
|
||||
port: 2379
|
||||
protocol: TCP
|
||||
`))
|
||||
)
|
||||
@@ -1,19 +0,0 @@
|
||||
package bootkube
|
||||
|
||||
import (
|
||||
"text/template"
|
||||
)
|
||||
|
||||
var (
|
||||
// KubeCloudConfig is the constant to represent contents of kube_cloudconfig.yaml file
|
||||
KubeCloudConfig = template.Must(template.New("kube-cloud-config.yaml").Parse(`
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: kube-cloud-cfg
|
||||
namespace: kube-system
|
||||
type: Opaque
|
||||
data:
|
||||
config: ""
|
||||
`))
|
||||
)
|
||||
@@ -1,18 +0,0 @@
|
||||
package bootkube
|
||||
|
||||
import "text/template"
|
||||
|
||||
var (
|
||||
// KubeSystemConfigmapEtcdServingCA is the constant to represent contents of kube-system-configmap-etcd-serving-ca.yaml file
|
||||
KubeSystemConfigmapEtcdServingCA = template.Must(template.New("kube-system-configmap-etcd-serving-ca.yaml").Parse(`
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: etcd-serving-ca
|
||||
namespace: kube-system
|
||||
data:
|
||||
ca-bundle.crt: |
|
||||
{{.EtcdCaCert}}
|
||||
`))
|
||||
)
|
||||
@@ -1,17 +0,0 @@
|
||||
package bootkube
|
||||
|
||||
import "text/template"
|
||||
|
||||
var (
|
||||
// KubeSystemConfigmapRootCA is the constant to represent contents of kube-system-configmap-root-ca.yaml file
|
||||
KubeSystemConfigmapRootCA = template.Must(template.New("kube-system-configmap-root-ca.yaml").Parse(`
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: root-ca
|
||||
namespace: kube-system
|
||||
data:
|
||||
ca.crt: {{.RootCaCert}}
|
||||
`))
|
||||
)
|
||||
@@ -1,20 +0,0 @@
|
||||
package bootkube
|
||||
|
||||
import (
|
||||
"text/template"
|
||||
)
|
||||
|
||||
var (
|
||||
// KubeSystemSecretEtcdClient is the constant to represent contents of kube-system-secret-etcd-client.yaml file
|
||||
KubeSystemSecretEtcdClient = template.Must(template.New("kube-system-secret-etcd-client.yaml").Parse(`
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: etcd-client
|
||||
namespace: kube-system
|
||||
type: SecretTypeTLS
|
||||
data:
|
||||
tls.crt: {{ .EtcdClientCert }}
|
||||
tls.key: {{ .EtcdClientKey }}
|
||||
`))
|
||||
)
|
||||
@@ -1,20 +0,0 @@
|
||||
package bootkube
|
||||
|
||||
import (
|
||||
"text/template"
|
||||
)
|
||||
|
||||
var (
|
||||
// MachineConfigServerTLSSecret is the constant to represent contents of machine_configservertlssecret.yaml file
|
||||
MachineConfigServerTLSSecret = template.Must(template.New("machine-config-server-tls-secret.yaml").Parse(`
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: machine-config-server-tls
|
||||
namespace: openshift-machine-config-operator
|
||||
type: Opaque
|
||||
data:
|
||||
tls.crt: {{.McsTLSCert}}
|
||||
tls.key: {{.McsTLSKey}}
|
||||
`))
|
||||
)
|
||||
@@ -1,20 +0,0 @@
|
||||
package bootkube
|
||||
|
||||
import (
|
||||
"text/template"
|
||||
)
|
||||
|
||||
var (
|
||||
// OpenshiftServiceCertSignerSecret is the constant to represent the contents of openshift-service-signer-secret.yaml
|
||||
OpenshiftServiceCertSignerSecret = template.Must(template.New("openshift-service-signer-secret.yaml").Parse(`
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: service-serving-cert-signer-signing-key
|
||||
namespace: openshift-service-cert-signer
|
||||
type: kubernetes.io/tls
|
||||
data:
|
||||
tls.crt: {{.ServiceServingCaCert}}
|
||||
tls.key: {{.ServiceServingCaKey}}
|
||||
`))
|
||||
)
|
||||
@@ -1,21 +0,0 @@
|
||||
package tectonic
|
||||
|
||||
const (
|
||||
// BindingDiscovery is the variable/constant representing the contents of the respective file
|
||||
BindingDiscovery = `
|
||||
---
|
||||
kind: ClusterRoleBinding
|
||||
apiVersion: rbac.authorization.k8s.io/v1beta1
|
||||
metadata:
|
||||
name: discovery
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: ClusterRole
|
||||
name: system:discovery
|
||||
subjects:
|
||||
- kind: Group
|
||||
name: 'system:unauthenticated'
|
||||
- kind: Group
|
||||
name: 'system:authenticated'
|
||||
`
|
||||
)
|
||||
@@ -1,18 +0,0 @@
|
||||
package tectonic
|
||||
|
||||
const (
|
||||
// RoleAdmin is the variable/constant representing the contents of the respective file
|
||||
RoleAdmin = `
|
||||
---
|
||||
kind: ClusterRole
|
||||
apiVersion: rbac.authorization.k8s.io/v1beta1
|
||||
metadata:
|
||||
name: admin
|
||||
rules:
|
||||
- apiGroups: ["*"]
|
||||
resources: ["*"]
|
||||
verbs: ["*"]
|
||||
- nonResourceURLs: ["*"]
|
||||
verbs: ["*"]
|
||||
`
|
||||
)
|
||||
@@ -1,75 +0,0 @@
|
||||
package tectonic
|
||||
|
||||
const (
|
||||
// RoleUser is the variable/constant representing the contents of the respective file
|
||||
RoleUser = `
|
||||
---
|
||||
kind: ClusterRole
|
||||
apiVersion: rbac.authorization.k8s.io/v1beta1
|
||||
metadata:
|
||||
name: user
|
||||
rules:
|
||||
- apiGroups: [""]
|
||||
resources: [
|
||||
"bindings", "configmaps", "events", "pods", "replicationcontrollers",
|
||||
"secrets", "services", "serviceaccounts",
|
||||
"pods/attach",
|
||||
"pods/binding",
|
||||
"pods/exec",
|
||||
"pods/log",
|
||||
"pods/portforward",
|
||||
"pods/proxy",
|
||||
"pods/status",
|
||||
"replicationcontrollers/scale",
|
||||
"replicationcontrollers/status",
|
||||
"services/proxy",
|
||||
"services/status"
|
||||
]
|
||||
verbs: ["*"]
|
||||
nonResourceURLs: []
|
||||
|
||||
- apiGroups: [""]
|
||||
resources: [
|
||||
"componentstatuses", "endpoints", "limitranges", "nodes", "nodes/proxy", "nodes/status",
|
||||
"namespaces", "namespaces/status", "namespaces/finalize",
|
||||
"persistentvolumeclaims", "persistentvolumeclaims/status", "persistentvolumes", "resourcequotas",
|
||||
"resourcequotas/status"
|
||||
]
|
||||
verbs: ["get", "list", "watch", "proxy", "redirect"]
|
||||
nonResourceURLs: []
|
||||
|
||||
- apiGroups: ["apps", "batch", "autoscaling", "policy"]
|
||||
resources: ["*"]
|
||||
verbs: ["*"]
|
||||
nonResourceURLs: []
|
||||
|
||||
- apiGroups: ["extensions"]
|
||||
resources: [
|
||||
"daemonsets", "deployments", "horizontalpodautoscalers", "ingresses",
|
||||
"jobs", "replicasets", "replicationcontrollers",
|
||||
|
||||
"daemonsets/status",
|
||||
"deployments/rollback",
|
||||
"deployments/scale",
|
||||
"deployments/status",
|
||||
"horizontalpodautoscalers/status",
|
||||
"ingresses/status",
|
||||
"jobs/status",
|
||||
"replicasets/scale",
|
||||
"replicasets/status",
|
||||
"replicationcontrollers/scale"
|
||||
]
|
||||
verbs: ["*"]
|
||||
nonResourceURLs: []
|
||||
|
||||
- apiGroups: ["extensions"]
|
||||
resources: ["networkpolicies", "thirdpartyresources"]
|
||||
verbs: ["get", "list", "watch", "proxy", "redirect"]
|
||||
nonResourceURLs: []
|
||||
|
||||
- apiGroups: ["rbac.authorization.k8s.io"]
|
||||
resources: ["*"]
|
||||
verbs: ["get", "list", "watch", "proxy", "redirect"]
|
||||
nonResourceURLs: []
|
||||
`
|
||||
)
|
||||
@@ -1,23 +0,0 @@
|
||||
package tectonic
|
||||
|
||||
const (
|
||||
// BindingAdmin is the variable/constant representing the contents of the respective file
|
||||
BindingAdmin = `
|
||||
---
|
||||
kind: ClusterRoleBinding
|
||||
apiVersion: rbac.authorization.k8s.io/v1beta1
|
||||
metadata:
|
||||
name: admin-user
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
namespace: tectonic-system
|
||||
name: default
|
||||
- kind: ServiceAccount
|
||||
namespace: openshift-ingress
|
||||
name: tectonic-ingress-controller-operator
|
||||
roleRef:
|
||||
kind: ClusterRole
|
||||
name: cluster-admin
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
`
|
||||
)
|
||||
@@ -1,23 +0,0 @@
|
||||
package tectonic
|
||||
|
||||
import (
|
||||
"text/template"
|
||||
)
|
||||
|
||||
var (
|
||||
// PullTectonicSystem is the variable/constant representing the contents of the respective file
|
||||
PullTectonicSystem = template.Must(template.New("tectonic-system-02-pull.json").Parse(`
|
||||
{
|
||||
"apiVersion": "v1",
|
||||
"kind": "Secret",
|
||||
"type": "kubernetes.io/dockerconfigjson",
|
||||
"metadata": {
|
||||
"namespace": "tectonic-system",
|
||||
"name": "coreos-pull-secret"
|
||||
},
|
||||
"data": {
|
||||
".dockerconfigjson": "{{.PullSecret}}"
|
||||
}
|
||||
}
|
||||
`))
|
||||
)
|
||||
@@ -13,7 +13,7 @@ import (
|
||||
|
||||
"github.com/openshift/installer/pkg/asset"
|
||||
"github.com/openshift/installer/pkg/asset/installconfig"
|
||||
"github.com/openshift/installer/pkg/asset/manifests/content/bootkube"
|
||||
"github.com/openshift/installer/pkg/asset/templates/content/bootkube"
|
||||
"github.com/openshift/installer/pkg/asset/tls"
|
||||
)
|
||||
|
||||
@@ -25,6 +25,12 @@ var (
|
||||
kubeSysConfigPath = filepath.Join(manifestDir, "cluster-config.yaml")
|
||||
|
||||
_ asset.WritableAsset = (*Manifests)(nil)
|
||||
|
||||
customTmplFuncs = template.FuncMap{
|
||||
"add": func(i, j int) int {
|
||||
return i + j
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
// Manifests generates the dependent operator config.yaml files
|
||||
@@ -54,6 +60,27 @@ func (m *Manifests) Dependencies() []asset.Asset {
|
||||
&tls.EtcdClientCertKey{},
|
||||
&tls.MCSCertKey{},
|
||||
&tls.KubeletCertKey{},
|
||||
|
||||
&bootkube.KubeCloudConfig{},
|
||||
&bootkube.MachineConfigServerTLSSecret{},
|
||||
&bootkube.OpenshiftServiceCertSignerSecret{},
|
||||
&bootkube.Pull{},
|
||||
&bootkube.TectonicNetworkOperator{},
|
||||
&bootkube.CVOOverrides{},
|
||||
&bootkube.LegacyCVOOverrides{},
|
||||
&bootkube.EtcdServiceEndpointsKubeSystem{},
|
||||
&bootkube.KubeSystemConfigmapEtcdServingCA{},
|
||||
&bootkube.KubeSystemConfigmapRootCA{},
|
||||
&bootkube.KubeSystemSecretEtcdClient{},
|
||||
|
||||
&bootkube.TectonicNamespace{},
|
||||
&bootkube.OpenshiftWebConsoleNamespace{},
|
||||
&bootkube.OpenshiftMachineConfigOperator{},
|
||||
&bootkube.OpenshiftClusterAPINamespace{},
|
||||
&bootkube.OpenshiftServiceCertSignerNamespace{},
|
||||
&bootkube.AppVersionKind{},
|
||||
&bootkube.AppVersionTectonicNetwork{},
|
||||
&bootkube.EtcdServiceKubeSystem{},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -131,27 +158,68 @@ func (m *Manifests) generateBootKubeManifests(dependencies asset.Parents) []*ass
|
||||
EtcdEndpointDNSSuffix: installConfig.Config.BaseDomain,
|
||||
}
|
||||
|
||||
assetData := map[string][]byte{
|
||||
"kube-cloud-config.yaml": applyTemplateData(bootkube.KubeCloudConfig, templateData),
|
||||
"machine-config-server-tls-secret.yaml": applyTemplateData(bootkube.MachineConfigServerTLSSecret, templateData),
|
||||
"openshift-service-signer-secret.yaml": applyTemplateData(bootkube.OpenshiftServiceCertSignerSecret, templateData),
|
||||
"pull.json": applyTemplateData(bootkube.Pull, templateData),
|
||||
"tectonic-network-operator.yaml": applyTemplateData(bootkube.TectonicNetworkOperator, templateData),
|
||||
"cvo-overrides.yaml": applyTemplateData(bootkube.CVOOverrides, templateData),
|
||||
"legacy-cvo-overrides.yaml": applyTemplateData(bootkube.LegacyCVOOverrides, templateData),
|
||||
"etcd-service-endpoints.yaml": applyTemplateData(bootkube.EtcdServiceEndpointsKubeSystem, templateData),
|
||||
"kube-system-configmap-etcd-serving-ca.yaml": applyTemplateData(bootkube.KubeSystemConfigmapEtcdServingCA, templateData),
|
||||
"kube-system-configmap-root-ca.yaml": applyTemplateData(bootkube.KubeSystemConfigmapRootCA, templateData),
|
||||
"kube-system-secret-etcd-client.yaml": applyTemplateData(bootkube.KubeSystemSecretEtcdClient, templateData),
|
||||
kubeCloudConfig := &bootkube.KubeCloudConfig{}
|
||||
machineConfigServerTLSSecret := &bootkube.MachineConfigServerTLSSecret{}
|
||||
openshiftServiceCertSignerSecret := &bootkube.OpenshiftServiceCertSignerSecret{}
|
||||
pull := &bootkube.Pull{}
|
||||
tectonicNetworkOperator := &bootkube.TectonicNetworkOperator{}
|
||||
cVOOverrides := &bootkube.CVOOverrides{}
|
||||
legacyCVOOverrides := &bootkube.LegacyCVOOverrides{}
|
||||
etcdServiceEndpointsKubeSystem := &bootkube.EtcdServiceEndpointsKubeSystem{}
|
||||
kubeSystemConfigmapEtcdServingCA := &bootkube.KubeSystemConfigmapEtcdServingCA{}
|
||||
kubeSystemConfigmapRootCA := &bootkube.KubeSystemConfigmapRootCA{}
|
||||
kubeSystemSecretEtcdClient := &bootkube.KubeSystemSecretEtcdClient{}
|
||||
|
||||
"01-tectonic-namespace.yaml": []byte(bootkube.TectonicNamespace),
|
||||
"03-openshift-web-console-namespace.yaml": []byte(bootkube.OpenshiftWebConsoleNamespace),
|
||||
"04-openshift-machine-config-operator.yaml": []byte(bootkube.OpenshiftMachineConfigOperator),
|
||||
"05-openshift-cluster-api-namespace.yaml": []byte(bootkube.OpenshiftClusterAPINamespace),
|
||||
"09-openshift-service-signer-namespace.yaml": []byte(bootkube.OpenshiftServiceCertSignerNamespace),
|
||||
"app-version-kind.yaml": []byte(bootkube.AppVersionKind),
|
||||
"app-version-tectonic-network.yaml": []byte(bootkube.AppVersionTectonicNetwork),
|
||||
"etcd-service.yaml": []byte(bootkube.EtcdServiceKubeSystem),
|
||||
tectonicNamespace := &bootkube.TectonicNamespace{}
|
||||
openshiftWebConsoleNamespace := &bootkube.OpenshiftWebConsoleNamespace{}
|
||||
openshiftMachineConfigOperator := &bootkube.OpenshiftMachineConfigOperator{}
|
||||
openshiftClusterAPINamespace := &bootkube.OpenshiftClusterAPINamespace{}
|
||||
openshiftServiceCertSignerNamespace := &bootkube.OpenshiftServiceCertSignerNamespace{}
|
||||
appVersionKind := &bootkube.AppVersionKind{}
|
||||
appVersionTectonicNetwork := &bootkube.AppVersionTectonicNetwork{}
|
||||
etcdServiceKubeSystem := &bootkube.EtcdServiceKubeSystem{}
|
||||
dependencies.Get(
|
||||
kubeCloudConfig,
|
||||
machineConfigServerTLSSecret,
|
||||
openshiftServiceCertSignerSecret,
|
||||
pull,
|
||||
tectonicNetworkOperator,
|
||||
cVOOverrides,
|
||||
legacyCVOOverrides,
|
||||
etcdServiceEndpointsKubeSystem,
|
||||
kubeSystemConfigmapEtcdServingCA,
|
||||
kubeSystemConfigmapRootCA,
|
||||
kubeSystemSecretEtcdClient,
|
||||
tectonicNamespace,
|
||||
openshiftWebConsoleNamespace,
|
||||
openshiftMachineConfigOperator,
|
||||
openshiftClusterAPINamespace,
|
||||
openshiftServiceCertSignerNamespace,
|
||||
appVersionKind,
|
||||
appVersionTectonicNetwork,
|
||||
etcdServiceKubeSystem,
|
||||
)
|
||||
assetData := map[string][]byte{
|
||||
"kube-cloud-config.yaml": applyTemplateData(kubeCloudConfig.Files()[0].Data, templateData),
|
||||
"machine-config-server-tls-secret.yaml": applyTemplateData(machineConfigServerTLSSecret.Files()[0].Data, templateData),
|
||||
"openshift-service-signer-secret.yaml": applyTemplateData(openshiftServiceCertSignerSecret.Files()[0].Data, templateData),
|
||||
"pull.json": applyTemplateData(pull.Files()[0].Data, templateData),
|
||||
"tectonic-network-operator.yaml": applyTemplateData(tectonicNetworkOperator.Files()[0].Data, templateData),
|
||||
"cvo-overrides.yaml": applyTemplateData(cVOOverrides.Files()[0].Data, templateData),
|
||||
"legacy-cvo-overrides.yaml": applyTemplateData(legacyCVOOverrides.Files()[0].Data, templateData),
|
||||
"etcd-service-endpoints.yaml": applyTemplateData(etcdServiceEndpointsKubeSystem.Files()[0].Data, templateData),
|
||||
"kube-system-configmap-etcd-serving-ca.yaml": applyTemplateData(kubeSystemConfigmapEtcdServingCA.Files()[0].Data, templateData),
|
||||
"kube-system-configmap-root-ca.yaml": applyTemplateData(kubeSystemConfigmapRootCA.Files()[0].Data, templateData),
|
||||
"kube-system-secret-etcd-client.yaml": applyTemplateData(kubeSystemSecretEtcdClient.Files()[0].Data, templateData),
|
||||
|
||||
"01-tectonic-namespace.yaml": []byte(tectonicNamespace.Files()[0].Data),
|
||||
"03-openshift-web-console-namespace.yaml": []byte(openshiftWebConsoleNamespace.Files()[0].Data),
|
||||
"04-openshift-machine-config-operator.yaml": []byte(openshiftMachineConfigOperator.Files()[0].Data),
|
||||
"05-openshift-cluster-api-namespace.yaml": []byte(openshiftClusterAPINamespace.Files()[0].Data),
|
||||
"09-openshift-service-signer-namespace.yaml": []byte(openshiftServiceCertSignerNamespace.Files()[0].Data),
|
||||
"app-version-kind.yaml": []byte(appVersionKind.Files()[0].Data),
|
||||
"app-version-tectonic-network.yaml": []byte(appVersionTectonicNetwork.Files()[0].Data),
|
||||
"etcd-service.yaml": []byte(etcdServiceKubeSystem.Files()[0].Data),
|
||||
}
|
||||
|
||||
files := make([]*asset.File, 0, len(assetData))
|
||||
@@ -165,7 +233,8 @@ func (m *Manifests) generateBootKubeManifests(dependencies asset.Parents) []*ass
|
||||
return files
|
||||
}
|
||||
|
||||
func applyTemplateData(template *template.Template, templateData interface{}) []byte {
|
||||
func applyTemplateData(data []byte, templateData interface{}) []byte {
|
||||
template := template.Must(template.New("template").Funcs(customTmplFuncs).Parse(string(data)))
|
||||
buf := &bytes.Buffer{}
|
||||
if err := template.Execute(buf, templateData); err != nil {
|
||||
panic(err)
|
||||
|
||||
@@ -14,7 +14,7 @@ import (
|
||||
"github.com/openshift/installer/pkg/asset"
|
||||
"github.com/openshift/installer/pkg/asset/installconfig"
|
||||
"github.com/openshift/installer/pkg/asset/machines"
|
||||
content "github.com/openshift/installer/pkg/asset/manifests/content/tectonic"
|
||||
"github.com/openshift/installer/pkg/asset/templates/content/tectonic"
|
||||
"github.com/openshift/installer/pkg/asset/tls"
|
||||
)
|
||||
|
||||
@@ -51,6 +51,16 @@ func (t *Tectonic) Dependencies() []asset.Asset {
|
||||
&machines.Worker{},
|
||||
&machines.Master{},
|
||||
&kubeAddonOperator{},
|
||||
|
||||
&tectonic.BindingDiscovery{},
|
||||
&tectonic.AppVersionKubeAddon{},
|
||||
&tectonic.KubeAddonOperator{},
|
||||
&tectonic.RoleAdmin{},
|
||||
&tectonic.RoleUser{},
|
||||
&tectonic.BindingAdmin{},
|
||||
&tectonic.PullTectonicSystem{},
|
||||
&tectonic.CloudCredsSecret{},
|
||||
&tectonic.RoleCloudCredsSecretReader{},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,25 +107,44 @@ func (t *Tectonic) Generate(dependencies asset.Parents) error {
|
||||
CloudCreds: cloudCreds,
|
||||
}
|
||||
|
||||
bindingDiscovery := &tectonic.BindingDiscovery{}
|
||||
appVersionKubeAddon := &tectonic.AppVersionKubeAddon{}
|
||||
kubeAddonOperator := &tectonic.KubeAddonOperator{}
|
||||
roleAdmin := &tectonic.RoleAdmin{}
|
||||
roleUser := &tectonic.RoleUser{}
|
||||
bindingAdmin := &tectonic.BindingAdmin{}
|
||||
pullTectonicSystem := &tectonic.PullTectonicSystem{}
|
||||
cloudCredsSecret := &tectonic.CloudCredsSecret{}
|
||||
roleCloudCredsSecretReader := &tectonic.RoleCloudCredsSecretReader{}
|
||||
dependencies.Get(
|
||||
bindingDiscovery,
|
||||
appVersionKubeAddon,
|
||||
kubeAddonOperator,
|
||||
roleAdmin,
|
||||
roleUser,
|
||||
bindingAdmin,
|
||||
pullTectonicSystem,
|
||||
cloudCredsSecret,
|
||||
roleCloudCredsSecretReader)
|
||||
assetData := map[string][]byte{
|
||||
"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_binding-discovery.yaml": []byte(bindingDiscovery.Files()[0].Data),
|
||||
"99_kube-addon-00-appversion.yaml": []byte(appVersionKubeAddon.Files()[0].Data),
|
||||
"99_kube-addon-01-operator.yaml": applyTemplateData(kubeAddonOperator.Files()[0].Data, templateData),
|
||||
"99_openshift-cluster-api_cluster.yaml": clusterk8sio.Raw,
|
||||
"99_openshift-cluster-api_master-machines.yaml": master.MachinesRaw,
|
||||
"99_openshift-cluster-api_master-user-data-secret.yaml": master.UserDataSecretRaw,
|
||||
"99_openshift-cluster-api_worker-machineset.yaml": worker.MachineSetRaw,
|
||||
"99_openshift-cluster-api_worker-user-data-secret.yaml": worker.UserDataSecretRaw,
|
||||
"99_role-admin.yaml": []byte(content.RoleAdmin),
|
||||
"99_role-user.yaml": []byte(content.RoleUser),
|
||||
"99_tectonic-system-00-binding-admin.yaml": []byte(content.BindingAdmin),
|
||||
"99_tectonic-system-02-pull.json": applyTemplateData(content.PullTectonicSystem, templateData),
|
||||
"99_role-admin.yaml": []byte(roleAdmin.Files()[0].Data),
|
||||
"99_role-user.yaml": []byte(roleUser.Files()[0].Data),
|
||||
"99_tectonic-system-00-binding-admin.yaml": []byte(bindingAdmin.Files()[0].Data),
|
||||
"99_tectonic-system-02-pull.json": applyTemplateData(pullTectonicSystem.Files()[0].Data, templateData),
|
||||
}
|
||||
|
||||
switch platform {
|
||||
case "aws", "openstack":
|
||||
assetData["99_cloud-creds-secret.yaml"] = applyTemplateData(content.CloudCredsSecret, templateData)
|
||||
assetData["99_role-cloud-creds-secret-reader.yaml"] = applyTemplateData(content.RoleCloudCredsSecretReader, templateData)
|
||||
assetData["99_cloud-creds-secret.yaml"] = applyTemplateData(cloudCredsSecret.Files()[0].Data, templateData)
|
||||
assetData["99_role-cloud-creds-secret-reader.yaml"] = applyTemplateData(roleCloudCredsSecretReader.Files()[0].Data, templateData)
|
||||
}
|
||||
|
||||
// addon goes to openshift system
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
package bootkube
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/openshift/installer/pkg/asset"
|
||||
"github.com/openshift/installer/pkg/asset/templates/content"
|
||||
)
|
||||
|
||||
const (
|
||||
tectonicNamespaceFileName = "01-tectonic-namespace.yaml"
|
||||
)
|
||||
|
||||
var _ asset.WritableAsset = (*TectonicNamespace)(nil)
|
||||
|
||||
// TectonicNamespace is the constant to represent contents of Tectonic_Namespace.yaml file
|
||||
type TectonicNamespace struct {
|
||||
fileName string
|
||||
FileList []*asset.File
|
||||
}
|
||||
|
||||
// Dependencies returns all of the dependencies directly needed by the asset
|
||||
func (t *TectonicNamespace) Dependencies() []asset.Asset {
|
||||
return []asset.Asset{}
|
||||
}
|
||||
|
||||
// Name returns the human-friendly name of the asset.
|
||||
func (t *TectonicNamespace) Name() string {
|
||||
return "TectonicNamespace"
|
||||
}
|
||||
|
||||
// Generate generates the actual files by this asset
|
||||
func (t *TectonicNamespace) Generate(parents asset.Parents) error {
|
||||
t.fileName = tectonicNamespaceFileName
|
||||
data, err := content.GetBootkubeTemplate(t.fileName)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
t.FileList = []*asset.File{
|
||||
{
|
||||
Filename: filepath.Join(content.TemplateDir, t.fileName),
|
||||
Data: []byte(data),
|
||||
},
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Files returns the files generated by the asset.
|
||||
func (t *TectonicNamespace) Files() []*asset.File {
|
||||
// Files returns the files generated by the asset.
|
||||
return t.FileList
|
||||
}
|
||||
|
||||
// Load returns the asset from disk.
|
||||
func (t *TectonicNamespace) Load(f asset.FileFetcher) (bool, error) {
|
||||
file, err := f.FetchByName(filepath.Join(content.TemplateDir, tectonicNamespaceFileName))
|
||||
if err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
return false, nil
|
||||
}
|
||||
return false, err
|
||||
}
|
||||
t.FileList = []*asset.File{file}
|
||||
return true, nil
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package bootkube
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/openshift/installer/pkg/asset"
|
||||
"github.com/openshift/installer/pkg/asset/templates/content"
|
||||
)
|
||||
|
||||
const (
|
||||
openshiftWebConsoleNamespaceFileName = "03-openshift-web-console-namespace.yaml"
|
||||
)
|
||||
|
||||
var _ asset.WritableAsset = (*OpenshiftWebConsoleNamespace)(nil)
|
||||
|
||||
// OpenshiftWebConsoleNamespace is the constant to represent contents of Openshift_WebConsoleNamespace.yaml file
|
||||
type OpenshiftWebConsoleNamespace struct {
|
||||
fileName string
|
||||
FileList []*asset.File
|
||||
}
|
||||
|
||||
// Dependencies returns all of the dependencies directly needed by the asset
|
||||
func (t *OpenshiftWebConsoleNamespace) Dependencies() []asset.Asset {
|
||||
return []asset.Asset{}
|
||||
}
|
||||
|
||||
// Name returns the human-friendly name of the asset.
|
||||
func (t *OpenshiftWebConsoleNamespace) Name() string {
|
||||
return "OpenshiftWebConsoleNamespace"
|
||||
}
|
||||
|
||||
// Generate generates the actual files by this asset
|
||||
func (t *OpenshiftWebConsoleNamespace) Generate(parents asset.Parents) error {
|
||||
t.fileName = openshiftWebConsoleNamespaceFileName
|
||||
data, err := content.GetBootkubeTemplate(t.fileName)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
t.FileList = []*asset.File{
|
||||
{
|
||||
Filename: filepath.Join(content.TemplateDir, t.fileName),
|
||||
Data: []byte(data),
|
||||
},
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Files returns the files generated by the asset.
|
||||
func (t *OpenshiftWebConsoleNamespace) Files() []*asset.File {
|
||||
return t.FileList
|
||||
}
|
||||
|
||||
// Load returns the asset from disk.
|
||||
func (t *OpenshiftWebConsoleNamespace) Load(f asset.FileFetcher) (bool, error) {
|
||||
file, err := f.FetchByName(filepath.Join(content.TemplateDir, openshiftWebConsoleNamespaceFileName))
|
||||
if err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
return false, nil
|
||||
}
|
||||
return false, err
|
||||
}
|
||||
t.FileList = []*asset.File{file}
|
||||
return true, nil
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package bootkube
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/openshift/installer/pkg/asset"
|
||||
"github.com/openshift/installer/pkg/asset/templates/content"
|
||||
)
|
||||
|
||||
const (
|
||||
openshiftMachineConfigOperatorFileName = "04-openshift-machine-config-operator.yaml"
|
||||
)
|
||||
|
||||
var _ asset.WritableAsset = (*OpenshiftMachineConfigOperator)(nil)
|
||||
|
||||
// OpenshiftMachineConfigOperator is the constant to represent contents of Openshift_MachineConfigOperator.yaml file
|
||||
type OpenshiftMachineConfigOperator struct {
|
||||
fileName string
|
||||
FileList []*asset.File
|
||||
}
|
||||
|
||||
// Dependencies returns all of the dependencies directly needed by the asset
|
||||
func (t *OpenshiftMachineConfigOperator) Dependencies() []asset.Asset {
|
||||
return []asset.Asset{}
|
||||
}
|
||||
|
||||
// Name returns the human-friendly name of the asset.
|
||||
func (t *OpenshiftMachineConfigOperator) Name() string {
|
||||
return "OpenshiftMachineConfigOperator"
|
||||
}
|
||||
|
||||
// Generate generates the actual files by this asset
|
||||
func (t *OpenshiftMachineConfigOperator) Generate(parents asset.Parents) error {
|
||||
t.fileName = openshiftMachineConfigOperatorFileName
|
||||
data, err := content.GetBootkubeTemplate(t.fileName)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
t.FileList = []*asset.File{
|
||||
{
|
||||
Filename: filepath.Join(content.TemplateDir, t.fileName),
|
||||
Data: []byte(data),
|
||||
},
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Files returns the files generated by the asset.
|
||||
func (t *OpenshiftMachineConfigOperator) Files() []*asset.File {
|
||||
return t.FileList
|
||||
}
|
||||
|
||||
// Load returns the asset from disk.
|
||||
func (t *OpenshiftMachineConfigOperator) Load(f asset.FileFetcher) (bool, error) {
|
||||
file, err := f.FetchByName(filepath.Join(content.TemplateDir, openshiftMachineConfigOperatorFileName))
|
||||
if err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
return false, nil
|
||||
}
|
||||
return false, err
|
||||
}
|
||||
t.FileList = []*asset.File{file}
|
||||
return true, nil
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package bootkube
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/openshift/installer/pkg/asset"
|
||||
"github.com/openshift/installer/pkg/asset/templates/content"
|
||||
)
|
||||
|
||||
const (
|
||||
openshiftClusterAPINamespaceFileName = "05-openshift-cluster-api-namespace.yaml"
|
||||
)
|
||||
|
||||
var _ asset.WritableAsset = (*OpenshiftClusterAPINamespace)(nil)
|
||||
|
||||
// OpenshiftClusterAPINamespace is the constant to represent contents of Openshift_ClusterApiNamespace.yaml file
|
||||
type OpenshiftClusterAPINamespace struct {
|
||||
fileName string
|
||||
FileList []*asset.File
|
||||
}
|
||||
|
||||
// Dependencies returns all of the dependencies directly needed by the asset
|
||||
func (t *OpenshiftClusterAPINamespace) Dependencies() []asset.Asset {
|
||||
return []asset.Asset{}
|
||||
}
|
||||
|
||||
// Name returns the human-friendly name of the asset.
|
||||
func (t *OpenshiftClusterAPINamespace) Name() string {
|
||||
return "OpenshiftClusterAPINamespace"
|
||||
}
|
||||
|
||||
// Generate generates the actual files by this asset
|
||||
func (t *OpenshiftClusterAPINamespace) Generate(parents asset.Parents) error {
|
||||
t.fileName = openshiftClusterAPINamespaceFileName
|
||||
data, err := content.GetBootkubeTemplate(t.fileName)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
t.FileList = []*asset.File{
|
||||
{
|
||||
Filename: filepath.Join(content.TemplateDir, t.fileName),
|
||||
Data: []byte(data),
|
||||
},
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Files returns the files generated by the asset.
|
||||
func (t *OpenshiftClusterAPINamespace) Files() []*asset.File {
|
||||
return t.FileList
|
||||
}
|
||||
|
||||
// Load returns the asset from disk.
|
||||
func (t *OpenshiftClusterAPINamespace) Load(f asset.FileFetcher) (bool, error) {
|
||||
file, err := f.FetchByName(filepath.Join(content.TemplateDir, openshiftClusterAPINamespaceFileName))
|
||||
if err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
return false, nil
|
||||
}
|
||||
return false, err
|
||||
}
|
||||
t.FileList = []*asset.File{file}
|
||||
return true, nil
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package bootkube
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/openshift/installer/pkg/asset"
|
||||
"github.com/openshift/installer/pkg/asset/templates/content"
|
||||
)
|
||||
|
||||
const (
|
||||
openshiftServiceCertSignerNamespaceFileName = "09-openshift-service-cert-signer-namespace.yaml"
|
||||
)
|
||||
|
||||
var _ asset.WritableAsset = (*OpenshiftServiceCertSignerNamespace)(nil)
|
||||
|
||||
// OpenshiftServiceCertSignerNamespace is the constant to represent the contents of 09-openshift-service-signer-namespace.yaml
|
||||
type OpenshiftServiceCertSignerNamespace struct {
|
||||
fileName string
|
||||
FileList []*asset.File
|
||||
}
|
||||
|
||||
// Dependencies returns all of the dependencies directly needed by the asset
|
||||
func (t *OpenshiftServiceCertSignerNamespace) Dependencies() []asset.Asset {
|
||||
return []asset.Asset{}
|
||||
}
|
||||
|
||||
// Name returns the human-friendly name of the asset.
|
||||
func (t *OpenshiftServiceCertSignerNamespace) Name() string {
|
||||
return "OpenshiftServiceCertSignerNamespace"
|
||||
}
|
||||
|
||||
// Generate generates the actual files by this asset
|
||||
func (t *OpenshiftServiceCertSignerNamespace) Generate(parents asset.Parents) error {
|
||||
t.fileName = openshiftServiceCertSignerNamespaceFileName
|
||||
data, err := content.GetBootkubeTemplate(t.fileName)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
t.FileList = []*asset.File{
|
||||
{
|
||||
Filename: filepath.Join(content.TemplateDir, t.fileName),
|
||||
Data: []byte(data),
|
||||
},
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Files returns the files generated by the asset.
|
||||
func (t *OpenshiftServiceCertSignerNamespace) Files() []*asset.File {
|
||||
return t.FileList
|
||||
}
|
||||
|
||||
// Load returns the asset from disk.
|
||||
func (t *OpenshiftServiceCertSignerNamespace) Load(f asset.FileFetcher) (bool, error) {
|
||||
file, err := f.FetchByName(filepath.Join(content.TemplateDir, openshiftServiceCertSignerNamespaceFileName))
|
||||
if err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
return false, nil
|
||||
}
|
||||
return false, err
|
||||
}
|
||||
t.FileList = []*asset.File{file}
|
||||
return true, nil
|
||||
}
|
||||
65
pkg/asset/templates/content/bootkube/app-version-kind.go
Normal file
65
pkg/asset/templates/content/bootkube/app-version-kind.go
Normal file
@@ -0,0 +1,65 @@
|
||||
package bootkube
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/openshift/installer/pkg/asset"
|
||||
"github.com/openshift/installer/pkg/asset/templates/content"
|
||||
)
|
||||
|
||||
const (
|
||||
appVersionKindFileName = "app-version-kind.yaml"
|
||||
)
|
||||
|
||||
var _ asset.WritableAsset = (*AppVersionKind)(nil)
|
||||
|
||||
// AppVersionKind is the constant to represent contents of App_VersionKind.yaml file
|
||||
type AppVersionKind struct {
|
||||
fileName string
|
||||
FileList []*asset.File
|
||||
}
|
||||
|
||||
// Dependencies returns all of the dependencies directly needed by the asset
|
||||
func (t *AppVersionKind) Dependencies() []asset.Asset {
|
||||
return []asset.Asset{}
|
||||
}
|
||||
|
||||
// Name returns the human-friendly name of the asset.
|
||||
func (t *AppVersionKind) Name() string {
|
||||
return "AppVersionKind"
|
||||
}
|
||||
|
||||
// Generate generates the actual files by this asset
|
||||
func (t *AppVersionKind) Generate(parents asset.Parents) error {
|
||||
t.fileName = appVersionKindFileName
|
||||
data, err := content.GetBootkubeTemplate(t.fileName)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
t.FileList = []*asset.File{
|
||||
{
|
||||
Filename: filepath.Join(content.TemplateDir, t.fileName),
|
||||
Data: []byte(data),
|
||||
},
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Files returns the files generated by the asset.
|
||||
func (t *AppVersionKind) Files() []*asset.File {
|
||||
return t.FileList
|
||||
}
|
||||
|
||||
// Load returns the asset from disk.
|
||||
func (t *AppVersionKind) Load(f asset.FileFetcher) (bool, error) {
|
||||
file, err := f.FetchByName(filepath.Join(content.TemplateDir, appVersionKindFileName))
|
||||
if err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
return false, nil
|
||||
}
|
||||
return false, err
|
||||
}
|
||||
t.FileList = []*asset.File{file}
|
||||
return true, nil
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package bootkube
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/openshift/installer/pkg/asset"
|
||||
"github.com/openshift/installer/pkg/asset/templates/content"
|
||||
)
|
||||
|
||||
const (
|
||||
appVersionTectonicNetworkFileName = "app-version-tectonic-network.yaml"
|
||||
)
|
||||
|
||||
var _ asset.WritableAsset = (*AppVersionTectonicNetwork)(nil)
|
||||
|
||||
// AppVersionTectonicNetwork is the constant to represent contents of App_VersionTectonicNetwork.yaml file
|
||||
type AppVersionTectonicNetwork struct {
|
||||
fileName string
|
||||
FileList []*asset.File
|
||||
}
|
||||
|
||||
// Dependencies returns all of the dependencies directly needed by the asset
|
||||
func (t *AppVersionTectonicNetwork) Dependencies() []asset.Asset {
|
||||
return []asset.Asset{}
|
||||
}
|
||||
|
||||
// Name returns the human-friendly name of the asset.
|
||||
func (t *AppVersionTectonicNetwork) Name() string {
|
||||
return "AppVersionTectonicNetwork"
|
||||
}
|
||||
|
||||
// Generate generates the actual files by this asset
|
||||
func (t *AppVersionTectonicNetwork) Generate(parents asset.Parents) error {
|
||||
t.fileName = appVersionTectonicNetworkFileName
|
||||
data, err := content.GetBootkubeTemplate(t.fileName)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
t.FileList = []*asset.File{
|
||||
{
|
||||
Filename: filepath.Join(content.TemplateDir, t.fileName),
|
||||
Data: []byte(data),
|
||||
},
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Files returns the files generated by the asset.
|
||||
func (t *AppVersionTectonicNetwork) Files() []*asset.File {
|
||||
return t.FileList
|
||||
}
|
||||
|
||||
// Load returns the asset from disk.
|
||||
func (t *AppVersionTectonicNetwork) Load(f asset.FileFetcher) (bool, error) {
|
||||
file, err := f.FetchByName(filepath.Join(content.TemplateDir, appVersionTectonicNetworkFileName))
|
||||
if err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
return false, nil
|
||||
}
|
||||
return false, err
|
||||
}
|
||||
t.FileList = []*asset.File{file}
|
||||
return true, nil
|
||||
}
|
||||
68
pkg/asset/templates/content/bootkube/cvo-overrides.go
Normal file
68
pkg/asset/templates/content/bootkube/cvo-overrides.go
Normal file
@@ -0,0 +1,68 @@
|
||||
package bootkube
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/openshift/installer/pkg/asset"
|
||||
"github.com/openshift/installer/pkg/asset/templates/content"
|
||||
)
|
||||
|
||||
const (
|
||||
cVOOverridesFileName = "cvo-overrides.yaml.template"
|
||||
)
|
||||
|
||||
var _ asset.WritableAsset = (*CVOOverrides)(nil)
|
||||
|
||||
// CVOOverrides is the constant to represent contents of cvo-override.yaml.template file
|
||||
// This is a gate to prevent CVO from installing these operators which is conflicting
|
||||
// with already owned resources by tectonic-operators.
|
||||
// This files can be dropped when the overrides list becomes empty.
|
||||
type CVOOverrides struct {
|
||||
fileName string
|
||||
FileList []*asset.File
|
||||
}
|
||||
|
||||
// Dependencies returns all of the dependencies directly needed by the asset
|
||||
func (t *CVOOverrides) Dependencies() []asset.Asset {
|
||||
return []asset.Asset{}
|
||||
}
|
||||
|
||||
// Name returns the human-friendly name of the asset.
|
||||
func (t *CVOOverrides) Name() string {
|
||||
return "CVOOverrides"
|
||||
}
|
||||
|
||||
// Generate generates the actual files by this asset
|
||||
func (t *CVOOverrides) Generate(parents asset.Parents) error {
|
||||
t.fileName = cVOOverridesFileName
|
||||
data, err := content.GetBootkubeTemplate(t.fileName)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
t.FileList = []*asset.File{
|
||||
{
|
||||
Filename: filepath.Join(content.TemplateDir, t.fileName),
|
||||
Data: []byte(data),
|
||||
},
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Files returns the files generated by the asset.
|
||||
func (t *CVOOverrides) Files() []*asset.File {
|
||||
return t.FileList
|
||||
}
|
||||
|
||||
// Load returns the asset from disk.
|
||||
func (t *CVOOverrides) Load(f asset.FileFetcher) (bool, error) {
|
||||
file, err := f.FetchByName(filepath.Join(content.TemplateDir, cVOOverridesFileName))
|
||||
if err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
return false, nil
|
||||
}
|
||||
return false, err
|
||||
}
|
||||
t.FileList = []*asset.File{file}
|
||||
return true, nil
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package bootkube
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/openshift/installer/pkg/asset"
|
||||
"github.com/openshift/installer/pkg/asset/templates/content"
|
||||
)
|
||||
|
||||
const (
|
||||
etcdServiceEndpointsKubeSystemFileName = "etcd-service-endpoints.yaml.template"
|
||||
)
|
||||
|
||||
var _ asset.WritableAsset = (*EtcdServiceEndpointsKubeSystem)(nil)
|
||||
|
||||
// EtcdServiceEndpointsKubeSystem is the constant to represent contents of etcd-service-endpoints.yaml.template file.
|
||||
type EtcdServiceEndpointsKubeSystem struct {
|
||||
fileName string
|
||||
FileList []*asset.File
|
||||
}
|
||||
|
||||
// Dependencies returns all of the dependencies directly needed by the asset
|
||||
func (t *EtcdServiceEndpointsKubeSystem) Dependencies() []asset.Asset {
|
||||
return []asset.Asset{}
|
||||
}
|
||||
|
||||
// Name returns the human-friendly name of the asset.
|
||||
func (t *EtcdServiceEndpointsKubeSystem) Name() string {
|
||||
return "EtcdServiceEndpointsKubeSystem"
|
||||
}
|
||||
|
||||
// Generate generates the actual files by this asset
|
||||
func (t *EtcdServiceEndpointsKubeSystem) Generate(parents asset.Parents) error {
|
||||
t.fileName = etcdServiceEndpointsKubeSystemFileName
|
||||
data, err := content.GetBootkubeTemplate(t.fileName)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
t.FileList = []*asset.File{
|
||||
{
|
||||
Filename: filepath.Join(content.TemplateDir, t.fileName),
|
||||
Data: []byte(data),
|
||||
},
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Files returns the files generated by the asset.
|
||||
func (t *EtcdServiceEndpointsKubeSystem) Files() []*asset.File {
|
||||
return t.FileList
|
||||
}
|
||||
|
||||
// Load returns the asset from disk.
|
||||
func (t *EtcdServiceEndpointsKubeSystem) Load(f asset.FileFetcher) (bool, error) {
|
||||
file, err := f.FetchByName(filepath.Join(content.TemplateDir, etcdServiceEndpointsKubeSystemFileName))
|
||||
if err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
return false, nil
|
||||
}
|
||||
return false, err
|
||||
}
|
||||
t.FileList = []*asset.File{file}
|
||||
return true, nil
|
||||
}
|
||||
65
pkg/asset/templates/content/bootkube/etcd-service.go
Normal file
65
pkg/asset/templates/content/bootkube/etcd-service.go
Normal file
@@ -0,0 +1,65 @@
|
||||
package bootkube
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/openshift/installer/pkg/asset"
|
||||
"github.com/openshift/installer/pkg/asset/templates/content"
|
||||
)
|
||||
|
||||
const (
|
||||
etcdServiceKubeSystemFileName = "etcd-service.yaml"
|
||||
)
|
||||
|
||||
var _ asset.WritableAsset = (*EtcdServiceKubeSystem)(nil)
|
||||
|
||||
// EtcdServiceKubeSystem is the constant to represent contents of etcd-service.yaml file
|
||||
type EtcdServiceKubeSystem struct {
|
||||
fileName string
|
||||
FileList []*asset.File
|
||||
}
|
||||
|
||||
// Dependencies returns all of the dependencies directly needed by the asset
|
||||
func (t *EtcdServiceKubeSystem) Dependencies() []asset.Asset {
|
||||
return []asset.Asset{}
|
||||
}
|
||||
|
||||
// Name returns the human-friendly name of the asset.
|
||||
func (t *EtcdServiceKubeSystem) Name() string {
|
||||
return "EtcdServiceKubeSystem"
|
||||
}
|
||||
|
||||
// Generate generates the actual files by this asset
|
||||
func (t *EtcdServiceKubeSystem) Generate(parents asset.Parents) error {
|
||||
t.fileName = etcdServiceKubeSystemFileName
|
||||
data, err := content.GetBootkubeTemplate(t.fileName)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
t.FileList = []*asset.File{
|
||||
{
|
||||
Filename: filepath.Join(content.TemplateDir, t.fileName),
|
||||
Data: []byte(data),
|
||||
},
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Files returns the files generated by the asset.
|
||||
func (t *EtcdServiceKubeSystem) Files() []*asset.File {
|
||||
return t.FileList
|
||||
}
|
||||
|
||||
// Load returns the asset from disk.
|
||||
func (t *EtcdServiceKubeSystem) Load(f asset.FileFetcher) (bool, error) {
|
||||
file, err := f.FetchByName(filepath.Join(content.TemplateDir, etcdServiceKubeSystemFileName))
|
||||
if err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
return false, nil
|
||||
}
|
||||
return false, err
|
||||
}
|
||||
t.FileList = []*asset.File{file}
|
||||
return true, nil
|
||||
}
|
||||
65
pkg/asset/templates/content/bootkube/kube-cloud-config.go
Normal file
65
pkg/asset/templates/content/bootkube/kube-cloud-config.go
Normal file
@@ -0,0 +1,65 @@
|
||||
package bootkube
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/openshift/installer/pkg/asset"
|
||||
"github.com/openshift/installer/pkg/asset/templates/content"
|
||||
)
|
||||
|
||||
const (
|
||||
kubeCloudConfigFileName = "kube-cloud-config.yaml"
|
||||
)
|
||||
|
||||
var _ asset.WritableAsset = (*KubeCloudConfig)(nil)
|
||||
|
||||
// KubeCloudConfig is the constant to represent contents of kube_cloudconfig.yaml file
|
||||
type KubeCloudConfig struct {
|
||||
fileName string
|
||||
FileList []*asset.File
|
||||
}
|
||||
|
||||
// Dependencies returns all of the dependencies directly needed by the asset
|
||||
func (t *KubeCloudConfig) Dependencies() []asset.Asset {
|
||||
return []asset.Asset{}
|
||||
}
|
||||
|
||||
// Name returns the human-friendly name of the asset.
|
||||
func (t *KubeCloudConfig) Name() string {
|
||||
return "KubeCloudConfig"
|
||||
}
|
||||
|
||||
// Generate generates the actual files by this asset
|
||||
func (t *KubeCloudConfig) Generate(parents asset.Parents) error {
|
||||
t.fileName = kubeCloudConfigFileName
|
||||
data, err := content.GetBootkubeTemplate(t.fileName)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
t.FileList = []*asset.File{
|
||||
{
|
||||
Filename: filepath.Join(content.TemplateDir, t.fileName),
|
||||
Data: []byte(data),
|
||||
},
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Files returns the files generated by the asset.
|
||||
func (t *KubeCloudConfig) Files() []*asset.File {
|
||||
return t.FileList
|
||||
}
|
||||
|
||||
// Load returns the asset from disk.
|
||||
func (t *KubeCloudConfig) Load(f asset.FileFetcher) (bool, error) {
|
||||
file, err := f.FetchByName(filepath.Join(content.TemplateDir, kubeCloudConfigFileName))
|
||||
if err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
return false, nil
|
||||
}
|
||||
return false, err
|
||||
}
|
||||
t.FileList = []*asset.File{file}
|
||||
return true, nil
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package bootkube
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/openshift/installer/pkg/asset"
|
||||
"github.com/openshift/installer/pkg/asset/templates/content"
|
||||
)
|
||||
|
||||
const (
|
||||
kubeSystemConfigmapEtcdServingCAFileName = "kube-system-configmap-etcd-serving-ca.yaml.template"
|
||||
)
|
||||
|
||||
var _ asset.WritableAsset = (*KubeSystemConfigmapEtcdServingCA)(nil)
|
||||
|
||||
// KubeSystemConfigmapEtcdServingCA is the constant to represent contents of kube-system-configmap-etcd-serving-ca.yaml.template file.
|
||||
type KubeSystemConfigmapEtcdServingCA struct {
|
||||
fileName string
|
||||
FileList []*asset.File
|
||||
}
|
||||
|
||||
// Dependencies returns all of the dependencies directly needed by the asset
|
||||
func (t *KubeSystemConfigmapEtcdServingCA) Dependencies() []asset.Asset {
|
||||
return []asset.Asset{}
|
||||
}
|
||||
|
||||
// Name returns the human-friendly name of the asset.
|
||||
func (t *KubeSystemConfigmapEtcdServingCA) Name() string {
|
||||
return "KubeSystemConfigmapEtcdServingCA"
|
||||
}
|
||||
|
||||
// Generate generates the actual files by this asset
|
||||
func (t *KubeSystemConfigmapEtcdServingCA) Generate(parents asset.Parents) error {
|
||||
t.fileName = kubeSystemConfigmapEtcdServingCAFileName
|
||||
data, err := content.GetBootkubeTemplate(t.fileName)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
t.FileList = []*asset.File{
|
||||
{
|
||||
Filename: filepath.Join(content.TemplateDir, t.fileName),
|
||||
Data: []byte(data),
|
||||
},
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Files returns the files generated by the asset.
|
||||
func (t *KubeSystemConfigmapEtcdServingCA) Files() []*asset.File {
|
||||
return t.FileList
|
||||
}
|
||||
|
||||
// Load returns the asset from disk.
|
||||
func (t *KubeSystemConfigmapEtcdServingCA) Load(f asset.FileFetcher) (bool, error) {
|
||||
file, err := f.FetchByName(filepath.Join(content.TemplateDir, kubeSystemConfigmapEtcdServingCAFileName))
|
||||
if err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
return false, nil
|
||||
}
|
||||
return false, err
|
||||
}
|
||||
t.FileList = []*asset.File{file}
|
||||
return true, nil
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package bootkube
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/openshift/installer/pkg/asset"
|
||||
"github.com/openshift/installer/pkg/asset/templates/content"
|
||||
)
|
||||
|
||||
const (
|
||||
kubeSystemConfigmapRootCAFileName = "kube-system-configmap-root-ca.yaml.template"
|
||||
)
|
||||
|
||||
var _ asset.WritableAsset = (*KubeSystemConfigmapRootCA)(nil)
|
||||
|
||||
// KubeSystemConfigmapRootCA is the constant to represent contents of kube-system-configmap-root-ca.yaml.template file.
|
||||
type KubeSystemConfigmapRootCA struct {
|
||||
fileName string
|
||||
FileList []*asset.File
|
||||
}
|
||||
|
||||
// Dependencies returns all of the dependencies directly needed by the asset
|
||||
func (t *KubeSystemConfigmapRootCA) Dependencies() []asset.Asset {
|
||||
return []asset.Asset{}
|
||||
}
|
||||
|
||||
// Name returns the human-friendly name of the asset.
|
||||
func (t *KubeSystemConfigmapRootCA) Name() string {
|
||||
return "KubeSystemConfigmapRootCA"
|
||||
}
|
||||
|
||||
// Generate generates the actual files by this asset
|
||||
func (t *KubeSystemConfigmapRootCA) Generate(parents asset.Parents) error {
|
||||
t.fileName = kubeSystemConfigmapRootCAFileName
|
||||
data, err := content.GetBootkubeTemplate(t.fileName)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
t.FileList = []*asset.File{
|
||||
{
|
||||
Filename: filepath.Join(content.TemplateDir, t.fileName),
|
||||
Data: []byte(data),
|
||||
},
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Files returns the files generated by the asset.
|
||||
func (t *KubeSystemConfigmapRootCA) Files() []*asset.File {
|
||||
return t.FileList
|
||||
}
|
||||
|
||||
// Load returns the asset from disk.
|
||||
func (t *KubeSystemConfigmapRootCA) Load(f asset.FileFetcher) (bool, error) {
|
||||
file, err := f.FetchByName(filepath.Join(content.TemplateDir, kubeSystemConfigmapRootCAFileName))
|
||||
if err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
return false, nil
|
||||
}
|
||||
return false, err
|
||||
}
|
||||
t.FileList = []*asset.File{file}
|
||||
return true, nil
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package bootkube
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/openshift/installer/pkg/asset"
|
||||
"github.com/openshift/installer/pkg/asset/templates/content"
|
||||
)
|
||||
|
||||
const (
|
||||
kubeSystemSecretEtcdClientFileName = "kube-system-secret-etcd-client.yaml.template"
|
||||
)
|
||||
|
||||
var _ asset.WritableAsset = (*KubeSystemSecretEtcdClient)(nil)
|
||||
|
||||
// KubeSystemSecretEtcdClient is the constant to represent contents of kube-system-secret-etcd-client.yaml.template file.
|
||||
type KubeSystemSecretEtcdClient struct {
|
||||
fileName string
|
||||
FileList []*asset.File
|
||||
}
|
||||
|
||||
// Dependencies returns all of the dependencies directly needed by the asset
|
||||
func (t *KubeSystemSecretEtcdClient) Dependencies() []asset.Asset {
|
||||
return []asset.Asset{}
|
||||
}
|
||||
|
||||
// Name returns the human-friendly name of the asset.
|
||||
func (t *KubeSystemSecretEtcdClient) Name() string {
|
||||
return "KubeSystemSecretEtcdClient"
|
||||
}
|
||||
|
||||
// Generate generates the actual files by this asset
|
||||
func (t *KubeSystemSecretEtcdClient) Generate(parents asset.Parents) error {
|
||||
t.fileName = kubeSystemSecretEtcdClientFileName
|
||||
data, err := content.GetBootkubeTemplate(t.fileName)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
t.FileList = []*asset.File{
|
||||
{
|
||||
Filename: filepath.Join(content.TemplateDir, t.fileName),
|
||||
Data: []byte(data),
|
||||
},
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Files returns the files generated by the asset.
|
||||
func (t *KubeSystemSecretEtcdClient) Files() []*asset.File {
|
||||
return t.FileList
|
||||
}
|
||||
|
||||
// Load returns the asset from disk.
|
||||
func (t *KubeSystemSecretEtcdClient) Load(f asset.FileFetcher) (bool, error) {
|
||||
file, err := f.FetchByName(filepath.Join(content.TemplateDir, kubeSystemSecretEtcdClientFileName))
|
||||
if err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
return false, nil
|
||||
}
|
||||
return false, err
|
||||
}
|
||||
t.FileList = []*asset.File{file}
|
||||
return true, nil
|
||||
}
|
||||
68
pkg/asset/templates/content/bootkube/legacy-cvo-overrides.go
Normal file
68
pkg/asset/templates/content/bootkube/legacy-cvo-overrides.go
Normal file
@@ -0,0 +1,68 @@
|
||||
package bootkube
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/openshift/installer/pkg/asset"
|
||||
"github.com/openshift/installer/pkg/asset/templates/content"
|
||||
)
|
||||
|
||||
const (
|
||||
legacyCVOOverridesFileName = "legacy-cvo-overrides.yaml.template"
|
||||
)
|
||||
|
||||
var _ asset.WritableAsset = (*LegacyCVOOverrides)(nil)
|
||||
|
||||
// LegacyCVOOverrides is the constant to represent contents of legacy-cvo-override.yaml.template file
|
||||
// This is a gate to prevent CVO from installing these operators which is conflicting
|
||||
// with already owned resources by tectonic-operators.
|
||||
// This files can be dropped when the overrides list becomes empty.
|
||||
type LegacyCVOOverrides struct {
|
||||
fileName string
|
||||
FileList []*asset.File
|
||||
}
|
||||
|
||||
// Dependencies returns all of the dependencies directly needed by the asset
|
||||
func (t *LegacyCVOOverrides) Dependencies() []asset.Asset {
|
||||
return []asset.Asset{}
|
||||
}
|
||||
|
||||
// Name returns the human-friendly name of the asset.
|
||||
func (t *LegacyCVOOverrides) Name() string {
|
||||
return "LegacyCVOOverrides"
|
||||
}
|
||||
|
||||
// Generate generates the actual files by this asset
|
||||
func (t *LegacyCVOOverrides) Generate(parents asset.Parents) error {
|
||||
t.fileName = legacyCVOOverridesFileName
|
||||
data, err := content.GetBootkubeTemplate(t.fileName)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
t.FileList = []*asset.File{
|
||||
{
|
||||
Filename: filepath.Join(content.TemplateDir, t.fileName),
|
||||
Data: []byte(data),
|
||||
},
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Files returns the files generated by the asset.
|
||||
func (t *LegacyCVOOverrides) Files() []*asset.File {
|
||||
return t.FileList
|
||||
}
|
||||
|
||||
// Load returns the asset from disk.
|
||||
func (t *LegacyCVOOverrides) Load(f asset.FileFetcher) (bool, error) {
|
||||
file, err := f.FetchByName(filepath.Join(content.TemplateDir, legacyCVOOverridesFileName))
|
||||
if err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
return false, nil
|
||||
}
|
||||
return false, err
|
||||
}
|
||||
t.FileList = []*asset.File{file}
|
||||
return true, nil
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package bootkube
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/openshift/installer/pkg/asset"
|
||||
"github.com/openshift/installer/pkg/asset/templates/content"
|
||||
)
|
||||
|
||||
const (
|
||||
machineConfigServerTLSSecretFileName = "machine-config-server-tls-secret.yaml.template"
|
||||
)
|
||||
|
||||
var _ asset.WritableAsset = (*MachineConfigServerTLSSecret)(nil)
|
||||
|
||||
// MachineConfigServerTLSSecret is the constant to represent contents of machine_configservertlssecret.yaml.template file
|
||||
type MachineConfigServerTLSSecret struct {
|
||||
fileName string
|
||||
FileList []*asset.File
|
||||
}
|
||||
|
||||
// Dependencies returns all of the dependencies directly needed by the asset
|
||||
func (t *MachineConfigServerTLSSecret) Dependencies() []asset.Asset {
|
||||
return []asset.Asset{}
|
||||
}
|
||||
|
||||
// Name returns the human-friendly name of the asset.
|
||||
func (t *MachineConfigServerTLSSecret) Name() string {
|
||||
return "MachineConfigServerTLSSecret"
|
||||
}
|
||||
|
||||
// Generate generates the actual files by this asset
|
||||
func (t *MachineConfigServerTLSSecret) Generate(parents asset.Parents) error {
|
||||
t.fileName = machineConfigServerTLSSecretFileName
|
||||
data, err := content.GetBootkubeTemplate(t.fileName)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
t.FileList = []*asset.File{
|
||||
{
|
||||
Filename: filepath.Join(content.TemplateDir, t.fileName),
|
||||
Data: []byte(data),
|
||||
},
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Files returns the files generated by the asset.
|
||||
func (t *MachineConfigServerTLSSecret) Files() []*asset.File {
|
||||
return t.FileList
|
||||
}
|
||||
|
||||
// Load returns the asset from disk.
|
||||
func (t *MachineConfigServerTLSSecret) Load(f asset.FileFetcher) (bool, error) {
|
||||
file, err := f.FetchByName(filepath.Join(content.TemplateDir, machineConfigServerTLSSecretFileName))
|
||||
if err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
return false, nil
|
||||
}
|
||||
return false, err
|
||||
}
|
||||
t.FileList = []*asset.File{file}
|
||||
return true, nil
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package bootkube
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/openshift/installer/pkg/asset"
|
||||
"github.com/openshift/installer/pkg/asset/templates/content"
|
||||
)
|
||||
|
||||
const (
|
||||
openshiftServiceCertSignerSecretFileName = "openshift-service-cert-signer-ca-secret.yaml.template"
|
||||
)
|
||||
|
||||
var _ asset.WritableAsset = (*OpenshiftServiceCertSignerSecret)(nil)
|
||||
|
||||
// OpenshiftServiceCertSignerSecret is the constant to represent the contents of openshift-service-signer-secret.yaml.template
|
||||
type OpenshiftServiceCertSignerSecret struct {
|
||||
fileName string
|
||||
FileList []*asset.File
|
||||
}
|
||||
|
||||
// Dependencies returns all of the dependencies directly needed by the asset
|
||||
func (t *OpenshiftServiceCertSignerSecret) Dependencies() []asset.Asset {
|
||||
return []asset.Asset{}
|
||||
}
|
||||
|
||||
// Name returns the human-friendly name of the asset.
|
||||
func (t *OpenshiftServiceCertSignerSecret) Name() string {
|
||||
return "OpenshiftServiceCertSignerSecret"
|
||||
}
|
||||
|
||||
// Generate generates the actual files by this asset
|
||||
func (t *OpenshiftServiceCertSignerSecret) Generate(parents asset.Parents) error {
|
||||
t.fileName = openshiftServiceCertSignerSecretFileName
|
||||
data, err := content.GetBootkubeTemplate(t.fileName)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
t.FileList = []*asset.File{
|
||||
{
|
||||
Filename: filepath.Join(content.TemplateDir, t.fileName),
|
||||
Data: []byte(data),
|
||||
},
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Files returns the files generated by the asset.
|
||||
func (t *OpenshiftServiceCertSignerSecret) Files() []*asset.File {
|
||||
return t.FileList
|
||||
}
|
||||
|
||||
// Load returns the asset from disk.
|
||||
func (t *OpenshiftServiceCertSignerSecret) Load(f asset.FileFetcher) (bool, error) {
|
||||
file, err := f.FetchByName(filepath.Join(content.TemplateDir, openshiftServiceCertSignerSecretFileName))
|
||||
if err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
return false, nil
|
||||
}
|
||||
return false, err
|
||||
}
|
||||
t.FileList = []*asset.File{file}
|
||||
return true, nil
|
||||
}
|
||||
65
pkg/asset/templates/content/bootkube/pull.go
Normal file
65
pkg/asset/templates/content/bootkube/pull.go
Normal file
@@ -0,0 +1,65 @@
|
||||
package bootkube
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/openshift/installer/pkg/asset"
|
||||
"github.com/openshift/installer/pkg/asset/templates/content"
|
||||
)
|
||||
|
||||
const (
|
||||
pullFileName = "pull.yaml.template"
|
||||
)
|
||||
|
||||
var _ asset.WritableAsset = (*Pull)(nil)
|
||||
|
||||
// Pull is the constant to represent contents of pull.yaml.template file
|
||||
type Pull struct {
|
||||
fileName string
|
||||
FileList []*asset.File
|
||||
}
|
||||
|
||||
// Dependencies returns all of the dependencies directly needed by the asset
|
||||
func (t *Pull) Dependencies() []asset.Asset {
|
||||
return []asset.Asset{}
|
||||
}
|
||||
|
||||
// Name returns the human-friendly name of the asset.
|
||||
func (t *Pull) Name() string {
|
||||
return "Pull"
|
||||
}
|
||||
|
||||
// Generate generates the actual files by this asset
|
||||
func (t *Pull) Generate(parents asset.Parents) error {
|
||||
t.fileName = pullFileName
|
||||
data, err := content.GetBootkubeTemplate(t.fileName)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
t.FileList = []*asset.File{
|
||||
{
|
||||
Filename: filepath.Join(content.TemplateDir, t.fileName),
|
||||
Data: []byte(data),
|
||||
},
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Files returns the files generated by the asset.
|
||||
func (t *Pull) Files() []*asset.File {
|
||||
return t.FileList
|
||||
}
|
||||
|
||||
// Load returns the asset from disk.
|
||||
func (t *Pull) Load(f asset.FileFetcher) (bool, error) {
|
||||
file, err := f.FetchByName(filepath.Join(content.TemplateDir, pullFileName))
|
||||
if err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
return false, nil
|
||||
}
|
||||
return false, err
|
||||
}
|
||||
t.FileList = []*asset.File{file}
|
||||
return true, nil
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package bootkube
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/openshift/installer/pkg/asset"
|
||||
"github.com/openshift/installer/pkg/asset/templates/content"
|
||||
)
|
||||
|
||||
const (
|
||||
tectonicNetworkOperatorFileName = "tectonic-network-operator.yaml.template"
|
||||
)
|
||||
|
||||
var _ asset.WritableAsset = (*TectonicNetworkOperator)(nil)
|
||||
|
||||
// TectonicNetworkOperator represents the template variable for tectonic-network-operator.yaml.template file
|
||||
type TectonicNetworkOperator struct {
|
||||
fileName string
|
||||
FileList []*asset.File
|
||||
}
|
||||
|
||||
// Dependencies returns all of the dependencies directly needed by the asset
|
||||
func (t *TectonicNetworkOperator) Dependencies() []asset.Asset {
|
||||
return []asset.Asset{}
|
||||
}
|
||||
|
||||
// Name returns the human-friendly name of the asset.
|
||||
func (t *TectonicNetworkOperator) Name() string {
|
||||
return "TectonicNetworkOperator"
|
||||
}
|
||||
|
||||
// Generate generates the actual files by this asset
|
||||
func (t *TectonicNetworkOperator) Generate(parents asset.Parents) error {
|
||||
t.fileName = tectonicNetworkOperatorFileName
|
||||
data, err := content.GetBootkubeTemplate(t.fileName)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
t.FileList = []*asset.File{
|
||||
{
|
||||
Filename: filepath.Join(content.TemplateDir, t.fileName),
|
||||
Data: []byte(data),
|
||||
},
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Files returns the files generated by the asset.
|
||||
func (t *TectonicNetworkOperator) Files() []*asset.File {
|
||||
return t.FileList
|
||||
}
|
||||
|
||||
// Load returns the asset from disk.
|
||||
func (t *TectonicNetworkOperator) Load(f asset.FileFetcher) (bool, error) {
|
||||
file, err := f.FetchByName(filepath.Join(content.TemplateDir, tectonicNetworkOperatorFileName))
|
||||
if err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
return false, nil
|
||||
}
|
||||
return false, err
|
||||
}
|
||||
t.FileList = []*asset.File{file}
|
||||
return true, nil
|
||||
}
|
||||
36
pkg/asset/templates/content/helper.go
Normal file
36
pkg/asset/templates/content/helper.go
Normal file
@@ -0,0 +1,36 @@
|
||||
package content
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"path"
|
||||
|
||||
"github.com/openshift/installer/data"
|
||||
)
|
||||
|
||||
const (
|
||||
// TemplateDir is the target directory for all template assets' files
|
||||
TemplateDir = "templates"
|
||||
bootkubeDataDir = "manifests/bootkube/"
|
||||
tectonicDataDir = "manifests/tectonic/"
|
||||
)
|
||||
|
||||
// GetBootkubeTemplate returns the contents of the file in bootkube data dir
|
||||
func GetBootkubeTemplate(uri string) ([]byte, error) {
|
||||
return getFileContents(path.Join(bootkubeDataDir, uri))
|
||||
}
|
||||
|
||||
// GetTectonicTemplate returns the contents of the file in tectonic data dir
|
||||
func GetTectonicTemplate(uri string) ([]byte, error) {
|
||||
return getFileContents(path.Join(tectonicDataDir, uri))
|
||||
}
|
||||
|
||||
// getFileContents the content of the given URI, assuming that it's a file
|
||||
func getFileContents(uri string) ([]byte, error) {
|
||||
file, err := data.Assets.Open(uri)
|
||||
if err != nil {
|
||||
return []byte{}, err
|
||||
}
|
||||
defer file.Close()
|
||||
|
||||
return ioutil.ReadAll(file)
|
||||
}
|
||||
65
pkg/asset/templates/content/tectonic/binding-discovery.go
Normal file
65
pkg/asset/templates/content/tectonic/binding-discovery.go
Normal file
@@ -0,0 +1,65 @@
|
||||
package tectonic
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/openshift/installer/pkg/asset"
|
||||
"github.com/openshift/installer/pkg/asset/templates/content"
|
||||
)
|
||||
|
||||
const (
|
||||
bindingDiscoveryFileName = "binding-discovery.yaml"
|
||||
)
|
||||
|
||||
var _ asset.WritableAsset = (*BindingDiscovery)(nil)
|
||||
|
||||
// BindingDiscovery is the variable/constant representing the contents of the respective file
|
||||
type BindingDiscovery struct {
|
||||
fileName string
|
||||
FileList []*asset.File
|
||||
}
|
||||
|
||||
// Dependencies returns all of the dependencies directly needed by the asset
|
||||
func (t *BindingDiscovery) Dependencies() []asset.Asset {
|
||||
return []asset.Asset{}
|
||||
}
|
||||
|
||||
// Name returns the human-friendly name of the asset.
|
||||
func (t *BindingDiscovery) Name() string {
|
||||
return "BindingDiscovery"
|
||||
}
|
||||
|
||||
// Generate generates the actual files by this asset
|
||||
func (t *BindingDiscovery) Generate(parents asset.Parents) error {
|
||||
t.fileName = bindingDiscoveryFileName
|
||||
data, err := content.GetTectonicTemplate(t.fileName)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
t.FileList = []*asset.File{
|
||||
{
|
||||
Filename: filepath.Join(content.TemplateDir, t.fileName),
|
||||
Data: []byte(data),
|
||||
},
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Files returns the files generated by the asset.
|
||||
func (t *BindingDiscovery) Files() []*asset.File {
|
||||
return t.FileList
|
||||
}
|
||||
|
||||
// Load returns the asset from disk.
|
||||
func (t *BindingDiscovery) Load(f asset.FileFetcher) (bool, error) {
|
||||
file, err := f.FetchByName(filepath.Join(content.TemplateDir, bindingDiscoveryFileName))
|
||||
if err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
return false, nil
|
||||
}
|
||||
return false, err
|
||||
}
|
||||
t.FileList = []*asset.File{file}
|
||||
return true, nil
|
||||
}
|
||||
65
pkg/asset/templates/content/tectonic/cloud-creds-secret.go
Normal file
65
pkg/asset/templates/content/tectonic/cloud-creds-secret.go
Normal file
@@ -0,0 +1,65 @@
|
||||
package tectonic
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/openshift/installer/pkg/asset"
|
||||
"github.com/openshift/installer/pkg/asset/templates/content"
|
||||
)
|
||||
|
||||
const (
|
||||
cloudCredsSecretFileName = "cloud-creds-secret.yaml.template"
|
||||
)
|
||||
|
||||
var _ asset.WritableAsset = (*CloudCredsSecret)(nil)
|
||||
|
||||
// CloudCredsSecret is the constant to represent contents of corresponding yaml file
|
||||
type CloudCredsSecret struct {
|
||||
fileName string
|
||||
FileList []*asset.File
|
||||
}
|
||||
|
||||
// Dependencies returns all of the dependencies directly needed by the asset
|
||||
func (t *CloudCredsSecret) Dependencies() []asset.Asset {
|
||||
return []asset.Asset{}
|
||||
}
|
||||
|
||||
// Name returns the human-friendly name of the asset.
|
||||
func (t *CloudCredsSecret) Name() string {
|
||||
return "CloudCredsSecret"
|
||||
}
|
||||
|
||||
// Generate generates the actual files by this asset
|
||||
func (t *CloudCredsSecret) Generate(parents asset.Parents) error {
|
||||
t.fileName = cloudCredsSecretFileName
|
||||
data, err := content.GetTectonicTemplate(t.fileName)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
t.FileList = []*asset.File{
|
||||
{
|
||||
Filename: filepath.Join(content.TemplateDir, t.fileName),
|
||||
Data: []byte(data),
|
||||
},
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Files returns the files generated by the asset.
|
||||
func (t *CloudCredsSecret) Files() []*asset.File {
|
||||
return t.FileList
|
||||
}
|
||||
|
||||
// Load returns the asset from disk.
|
||||
func (t *CloudCredsSecret) Load(f asset.FileFetcher) (bool, error) {
|
||||
file, err := f.FetchByName(filepath.Join(content.TemplateDir, cloudCredsSecretFileName))
|
||||
if err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
return false, nil
|
||||
}
|
||||
return false, err
|
||||
}
|
||||
t.FileList = []*asset.File{file}
|
||||
return true, nil
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package tectonic
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/openshift/installer/pkg/asset"
|
||||
"github.com/openshift/installer/pkg/asset/templates/content"
|
||||
)
|
||||
|
||||
const (
|
||||
appVersionKubeAddonFileName = "kube-addon-00-appversion.yaml"
|
||||
)
|
||||
|
||||
var _ asset.WritableAsset = (*AppVersionKubeAddon)(nil)
|
||||
|
||||
// AppVersionKubeAddon is the variable/constant representing the contents of the respective file
|
||||
type AppVersionKubeAddon struct {
|
||||
fileName string
|
||||
FileList []*asset.File
|
||||
}
|
||||
|
||||
// Dependencies returns all of the dependencies directly needed by the asset
|
||||
func (t *AppVersionKubeAddon) Dependencies() []asset.Asset {
|
||||
return []asset.Asset{}
|
||||
}
|
||||
|
||||
// Name returns the human-friendly name of the asset.
|
||||
func (t *AppVersionKubeAddon) Name() string {
|
||||
return "AppVersionKubeAddon"
|
||||
}
|
||||
|
||||
// Generate generates the actual files by this asset
|
||||
func (t *AppVersionKubeAddon) Generate(parents asset.Parents) error {
|
||||
t.fileName = appVersionKubeAddonFileName
|
||||
data, err := content.GetTectonicTemplate(t.fileName)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
t.FileList = []*asset.File{
|
||||
{
|
||||
Filename: filepath.Join(content.TemplateDir, t.fileName),
|
||||
Data: []byte(data),
|
||||
},
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Files returns the files generated by the asset.
|
||||
func (t *AppVersionKubeAddon) Files() []*asset.File {
|
||||
return t.FileList
|
||||
}
|
||||
|
||||
// Load returns the asset from disk.
|
||||
func (t *AppVersionKubeAddon) Load(f asset.FileFetcher) (bool, error) {
|
||||
file, err := f.FetchByName(filepath.Join(content.TemplateDir, appVersionKubeAddonFileName))
|
||||
if err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
return false, nil
|
||||
}
|
||||
return false, err
|
||||
}
|
||||
t.FileList = []*asset.File{file}
|
||||
return true, nil
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package tectonic
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/openshift/installer/pkg/asset"
|
||||
"github.com/openshift/installer/pkg/asset/templates/content"
|
||||
)
|
||||
|
||||
const (
|
||||
kubeAddonOperatorFileName = "kube-addon-01-operator.yaml.template"
|
||||
)
|
||||
|
||||
var _ asset.WritableAsset = (*KubeAddonOperator)(nil)
|
||||
|
||||
// KubeAddonOperator is the variable/constant representing the contents of the respective file
|
||||
type KubeAddonOperator struct {
|
||||
fileName string
|
||||
FileList []*asset.File
|
||||
}
|
||||
|
||||
// Dependencies returns all of the dependencies directly needed by the asset
|
||||
func (t *KubeAddonOperator) Dependencies() []asset.Asset {
|
||||
return []asset.Asset{}
|
||||
}
|
||||
|
||||
// Name returns the human-friendly name of the asset.
|
||||
func (t *KubeAddonOperator) Name() string {
|
||||
return "KubeAddonOperator"
|
||||
}
|
||||
|
||||
// Generate generates the actual files by this asset
|
||||
func (t *KubeAddonOperator) Generate(parents asset.Parents) error {
|
||||
t.fileName = kubeAddonOperatorFileName
|
||||
data, err := content.GetTectonicTemplate(t.fileName)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
t.FileList = []*asset.File{
|
||||
{
|
||||
Filename: filepath.Join(content.TemplateDir, t.fileName),
|
||||
Data: []byte(data),
|
||||
},
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Files returns the files generated by the asset.
|
||||
func (t *KubeAddonOperator) Files() []*asset.File {
|
||||
return t.FileList
|
||||
}
|
||||
|
||||
// Load returns the asset from disk.
|
||||
func (t *KubeAddonOperator) Load(f asset.FileFetcher) (bool, error) {
|
||||
file, err := f.FetchByName(filepath.Join(content.TemplateDir, kubeAddonOperatorFileName))
|
||||
if err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
return false, nil
|
||||
}
|
||||
return false, err
|
||||
}
|
||||
t.FileList = []*asset.File{file}
|
||||
return true, nil
|
||||
}
|
||||
65
pkg/asset/templates/content/tectonic/role-admin.go
Normal file
65
pkg/asset/templates/content/tectonic/role-admin.go
Normal file
@@ -0,0 +1,65 @@
|
||||
package tectonic
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/openshift/installer/pkg/asset"
|
||||
"github.com/openshift/installer/pkg/asset/templates/content"
|
||||
)
|
||||
|
||||
const (
|
||||
roleAdminFileName = "role-admin.yaml"
|
||||
)
|
||||
|
||||
var _ asset.WritableAsset = (*RoleAdmin)(nil)
|
||||
|
||||
// RoleAdmin is the variable/constant representing the contents of the respective file
|
||||
type RoleAdmin struct {
|
||||
fileName string
|
||||
FileList []*asset.File
|
||||
}
|
||||
|
||||
// Dependencies returns all of the dependencies directly needed by the asset
|
||||
func (t *RoleAdmin) Dependencies() []asset.Asset {
|
||||
return []asset.Asset{}
|
||||
}
|
||||
|
||||
// Name returns the human-friendly name of the asset.
|
||||
func (t *RoleAdmin) Name() string {
|
||||
return "RoleAdmin"
|
||||
}
|
||||
|
||||
// Generate generates the actual files by this asset
|
||||
func (t *RoleAdmin) Generate(parents asset.Parents) error {
|
||||
t.fileName = roleAdminFileName
|
||||
data, err := content.GetTectonicTemplate(t.fileName)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
t.FileList = []*asset.File{
|
||||
{
|
||||
Filename: filepath.Join(content.TemplateDir, t.fileName),
|
||||
Data: []byte(data),
|
||||
},
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Files returns the files generated by the asset.
|
||||
func (t *RoleAdmin) Files() []*asset.File {
|
||||
return t.FileList
|
||||
}
|
||||
|
||||
// Load returns the asset from disk.
|
||||
func (t *RoleAdmin) Load(f asset.FileFetcher) (bool, error) {
|
||||
file, err := f.FetchByName(filepath.Join(content.TemplateDir, roleAdminFileName))
|
||||
if err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
return false, nil
|
||||
}
|
||||
return false, err
|
||||
}
|
||||
t.FileList = []*asset.File{file}
|
||||
return true, nil
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package tectonic
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/openshift/installer/pkg/asset"
|
||||
"github.com/openshift/installer/pkg/asset/templates/content"
|
||||
)
|
||||
|
||||
const (
|
||||
roleCloudCredsSecretReaderFileName = "role-cloud-creds-secret-reader.yaml.template"
|
||||
)
|
||||
|
||||
var _ asset.WritableAsset = (*RoleCloudCredsSecretReader)(nil)
|
||||
|
||||
// RoleCloudCredsSecretReader is the variable to represent contents of corresponding file
|
||||
type RoleCloudCredsSecretReader struct {
|
||||
fileName string
|
||||
FileList []*asset.File
|
||||
}
|
||||
|
||||
// Dependencies returns all of the dependencies directly needed by the asset
|
||||
func (t *RoleCloudCredsSecretReader) Dependencies() []asset.Asset {
|
||||
return []asset.Asset{}
|
||||
}
|
||||
|
||||
// Name returns the human-friendly name of the asset.
|
||||
func (t *RoleCloudCredsSecretReader) Name() string {
|
||||
return "RoleCloudCredsSecretReader"
|
||||
}
|
||||
|
||||
// Generate generates the actual files by this asset
|
||||
func (t *RoleCloudCredsSecretReader) Generate(parents asset.Parents) error {
|
||||
t.fileName = roleCloudCredsSecretReaderFileName
|
||||
data, err := content.GetTectonicTemplate(t.fileName)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
t.FileList = []*asset.File{
|
||||
{
|
||||
Filename: filepath.Join(content.TemplateDir, t.fileName),
|
||||
Data: []byte(data),
|
||||
},
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Files returns the files generated by the asset.
|
||||
func (t *RoleCloudCredsSecretReader) Files() []*asset.File {
|
||||
return t.FileList
|
||||
}
|
||||
|
||||
// Load returns the asset from disk.
|
||||
func (t *RoleCloudCredsSecretReader) Load(f asset.FileFetcher) (bool, error) {
|
||||
file, err := f.FetchByName(filepath.Join(content.TemplateDir, roleCloudCredsSecretReaderFileName))
|
||||
if err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
return false, nil
|
||||
}
|
||||
return false, err
|
||||
}
|
||||
t.FileList = []*asset.File{file}
|
||||
return true, nil
|
||||
}
|
||||
65
pkg/asset/templates/content/tectonic/role-user.go
Normal file
65
pkg/asset/templates/content/tectonic/role-user.go
Normal file
@@ -0,0 +1,65 @@
|
||||
package tectonic
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/openshift/installer/pkg/asset"
|
||||
"github.com/openshift/installer/pkg/asset/templates/content"
|
||||
)
|
||||
|
||||
const (
|
||||
roleUserFileName = "role-user.yaml"
|
||||
)
|
||||
|
||||
var _ asset.WritableAsset = (*RoleUser)(nil)
|
||||
|
||||
// RoleUser is the variable/constant representing the contents of the respective file
|
||||
type RoleUser struct {
|
||||
fileName string
|
||||
FileList []*asset.File
|
||||
}
|
||||
|
||||
// Dependencies returns all of the dependencies directly needed by the asset
|
||||
func (t *RoleUser) Dependencies() []asset.Asset {
|
||||
return []asset.Asset{}
|
||||
}
|
||||
|
||||
// Name returns the human-friendly name of the asset.
|
||||
func (t *RoleUser) Name() string {
|
||||
return "RoleUser"
|
||||
}
|
||||
|
||||
// Generate generates the actual files by this asset
|
||||
func (t *RoleUser) Generate(parents asset.Parents) error {
|
||||
t.fileName = roleUserFileName
|
||||
data, err := content.GetTectonicTemplate(t.fileName)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
t.FileList = []*asset.File{
|
||||
{
|
||||
Filename: filepath.Join(content.TemplateDir, t.fileName),
|
||||
Data: []byte(data),
|
||||
},
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Files returns the files generated by the asset.
|
||||
func (t *RoleUser) Files() []*asset.File {
|
||||
return t.FileList
|
||||
}
|
||||
|
||||
// Load returns the asset from disk.
|
||||
func (t *RoleUser) Load(f asset.FileFetcher) (bool, error) {
|
||||
file, err := f.FetchByName(filepath.Join(content.TemplateDir, roleUserFileName))
|
||||
if err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
return false, nil
|
||||
}
|
||||
return false, err
|
||||
}
|
||||
t.FileList = []*asset.File{file}
|
||||
return true, nil
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package tectonic
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/openshift/installer/pkg/asset"
|
||||
"github.com/openshift/installer/pkg/asset/templates/content"
|
||||
)
|
||||
|
||||
const (
|
||||
bindingAdminFileName = "tectonic-system-00-binding-admin.yaml"
|
||||
)
|
||||
|
||||
var _ asset.WritableAsset = (*BindingAdmin)(nil)
|
||||
|
||||
// BindingAdmin is the variable/constant representing the contents of the respective file
|
||||
type BindingAdmin struct {
|
||||
fileName string
|
||||
FileList []*asset.File
|
||||
}
|
||||
|
||||
// Dependencies returns all of the dependencies directly needed by the asset
|
||||
func (t *BindingAdmin) Dependencies() []asset.Asset {
|
||||
return []asset.Asset{}
|
||||
}
|
||||
|
||||
// Name returns the human-friendly name of the asset.
|
||||
func (t *BindingAdmin) Name() string {
|
||||
return "BindingAdmin"
|
||||
}
|
||||
|
||||
// Generate generates the actual files by this asset
|
||||
func (t *BindingAdmin) Generate(parents asset.Parents) error {
|
||||
t.fileName = bindingAdminFileName
|
||||
data, err := content.GetTectonicTemplate(t.fileName)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
t.FileList = []*asset.File{
|
||||
{
|
||||
Filename: filepath.Join(content.TemplateDir, t.fileName),
|
||||
Data: []byte(data),
|
||||
},
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Files returns the files generated by the asset.
|
||||
func (t *BindingAdmin) Files() []*asset.File {
|
||||
return t.FileList
|
||||
}
|
||||
|
||||
// Load returns the asset from disk.
|
||||
func (t *BindingAdmin) Load(f asset.FileFetcher) (bool, error) {
|
||||
file, err := f.FetchByName(filepath.Join(content.TemplateDir, bindingAdminFileName))
|
||||
if err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
return false, nil
|
||||
}
|
||||
return false, err
|
||||
}
|
||||
t.FileList = []*asset.File{file}
|
||||
return true, nil
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package tectonic
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"github.com/openshift/installer/pkg/asset"
|
||||
"github.com/openshift/installer/pkg/asset/templates/content"
|
||||
)
|
||||
|
||||
const (
|
||||
pullTectonicSystemFileName = "tectonic-system-02-pull.yaml.template"
|
||||
)
|
||||
|
||||
var _ asset.WritableAsset = (*PullTectonicSystem)(nil)
|
||||
|
||||
// PullTectonicSystem is the variable/constant representing the contents of the respective file
|
||||
type PullTectonicSystem struct {
|
||||
fileName string
|
||||
FileList []*asset.File
|
||||
}
|
||||
|
||||
// Dependencies returns all of the dependencies directly needed by the asset
|
||||
func (t *PullTectonicSystem) Dependencies() []asset.Asset {
|
||||
return []asset.Asset{}
|
||||
}
|
||||
|
||||
// Name returns the human-friendly name of the asset.
|
||||
func (t *PullTectonicSystem) Name() string {
|
||||
return "PullTectonicSystem"
|
||||
}
|
||||
|
||||
// Generate generates the actual files by this asset
|
||||
func (t *PullTectonicSystem) Generate(parents asset.Parents) error {
|
||||
t.fileName = pullTectonicSystemFileName
|
||||
data, err := content.GetTectonicTemplate(t.fileName)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
t.FileList = []*asset.File{
|
||||
{
|
||||
Filename: filepath.Join(content.TemplateDir, t.fileName),
|
||||
Data: []byte(data),
|
||||
},
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Files returns the files generated by the asset.
|
||||
func (t *PullTectonicSystem) Files() []*asset.File {
|
||||
return t.FileList
|
||||
}
|
||||
|
||||
// Load returns the asset from disk.
|
||||
func (t *PullTectonicSystem) Load(f asset.FileFetcher) (bool, error) {
|
||||
file, err := f.FetchByName(filepath.Join(content.TemplateDir, pullTectonicSystemFileName))
|
||||
if err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
return false, nil
|
||||
}
|
||||
return false, err
|
||||
}
|
||||
t.FileList = []*asset.File{file}
|
||||
return true, nil
|
||||
}
|
||||
161
pkg/asset/templates/templates.go
Normal file
161
pkg/asset/templates/templates.go
Normal file
@@ -0,0 +1,161 @@
|
||||
// Package templates deals with creating template assets that will be used by other assets
|
||||
package templates
|
||||
|
||||
import (
|
||||
"github.com/openshift/installer/pkg/asset"
|
||||
"github.com/openshift/installer/pkg/asset/templates/content/bootkube"
|
||||
"github.com/openshift/installer/pkg/asset/templates/content/tectonic"
|
||||
)
|
||||
|
||||
var _ asset.WritableAsset = (*Templates)(nil)
|
||||
|
||||
// Templates generates the dependent unrendered template files
|
||||
type Templates struct {
|
||||
FileList []*asset.File
|
||||
}
|
||||
|
||||
// Name returns a human friendly name for the templates asset
|
||||
func (m *Templates) Name() string {
|
||||
return "Common Templates"
|
||||
}
|
||||
|
||||
// Dependencies returns all of the dependencies directly needed by a
|
||||
// Templates asset.
|
||||
func (m *Templates) Dependencies() []asset.Asset {
|
||||
return []asset.Asset{
|
||||
&bootkube.KubeCloudConfig{},
|
||||
&bootkube.MachineConfigServerTLSSecret{},
|
||||
&bootkube.OpenshiftServiceCertSignerSecret{},
|
||||
&bootkube.Pull{},
|
||||
&bootkube.TectonicNetworkOperator{},
|
||||
&bootkube.CVOOverrides{},
|
||||
&bootkube.LegacyCVOOverrides{},
|
||||
&bootkube.EtcdServiceEndpointsKubeSystem{},
|
||||
&bootkube.KubeSystemConfigmapEtcdServingCA{},
|
||||
&bootkube.KubeSystemConfigmapRootCA{},
|
||||
&bootkube.KubeSystemSecretEtcdClient{},
|
||||
&bootkube.TectonicNamespace{},
|
||||
&bootkube.OpenshiftWebConsoleNamespace{},
|
||||
&bootkube.OpenshiftMachineConfigOperator{},
|
||||
&bootkube.OpenshiftClusterAPINamespace{},
|
||||
&bootkube.OpenshiftServiceCertSignerNamespace{},
|
||||
&bootkube.AppVersionKind{},
|
||||
&bootkube.AppVersionTectonicNetwork{},
|
||||
&bootkube.EtcdServiceKubeSystem{},
|
||||
&tectonic.BindingDiscovery{},
|
||||
&tectonic.AppVersionKubeAddon{},
|
||||
&tectonic.KubeAddonOperator{},
|
||||
&tectonic.RoleAdmin{},
|
||||
&tectonic.RoleUser{},
|
||||
&tectonic.BindingAdmin{},
|
||||
&tectonic.PullTectonicSystem{},
|
||||
&tectonic.CloudCredsSecret{},
|
||||
&tectonic.RoleCloudCredsSecretReader{},
|
||||
}
|
||||
}
|
||||
|
||||
// Generate generates the respective operator config.yml files
|
||||
func (m *Templates) Generate(dependencies asset.Parents) error {
|
||||
kubeCloudConfig := &bootkube.KubeCloudConfig{}
|
||||
machineConfigServerTLSSecret := &bootkube.MachineConfigServerTLSSecret{}
|
||||
openshiftServiceCertSignerSecret := &bootkube.OpenshiftServiceCertSignerSecret{}
|
||||
pull := &bootkube.Pull{}
|
||||
tectonicNetworkOperator := &bootkube.TectonicNetworkOperator{}
|
||||
cVOOverrides := &bootkube.CVOOverrides{}
|
||||
legacyCVOOverrides := &bootkube.LegacyCVOOverrides{}
|
||||
etcdServiceEndpointsKubeSystem := &bootkube.EtcdServiceEndpointsKubeSystem{}
|
||||
kubeSystemConfigmapEtcdServingCA := &bootkube.KubeSystemConfigmapEtcdServingCA{}
|
||||
kubeSystemConfigmapRootCA := &bootkube.KubeSystemConfigmapRootCA{}
|
||||
kubeSystemSecretEtcdClient := &bootkube.KubeSystemSecretEtcdClient{}
|
||||
tectonicNamespace := &bootkube.TectonicNamespace{}
|
||||
openshiftWebConsoleNamespace := &bootkube.OpenshiftWebConsoleNamespace{}
|
||||
openshiftMachineConfigOperator := &bootkube.OpenshiftMachineConfigOperator{}
|
||||
openshiftClusterAPINamespace := &bootkube.OpenshiftClusterAPINamespace{}
|
||||
openshiftServiceCertSignerNamespace := &bootkube.OpenshiftServiceCertSignerNamespace{}
|
||||
appVersionKind := &bootkube.AppVersionKind{}
|
||||
appVersionTectonicNetwork := &bootkube.AppVersionTectonicNetwork{}
|
||||
etcdServiceKubeSystem := &bootkube.EtcdServiceKubeSystem{}
|
||||
|
||||
bindingDiscovery := &tectonic.BindingDiscovery{}
|
||||
appVersionKubeAddon := &tectonic.AppVersionKubeAddon{}
|
||||
kubeAddonOperator := &tectonic.KubeAddonOperator{}
|
||||
roleAdmin := &tectonic.RoleAdmin{}
|
||||
roleUser := &tectonic.RoleUser{}
|
||||
bindingAdmin := &tectonic.BindingAdmin{}
|
||||
pullTectonicSystem := &tectonic.PullTectonicSystem{}
|
||||
cloudCredsSecret := &tectonic.CloudCredsSecret{}
|
||||
roleCloudCredsSecretReader := &tectonic.RoleCloudCredsSecretReader{}
|
||||
|
||||
dependencies.Get(
|
||||
kubeCloudConfig,
|
||||
machineConfigServerTLSSecret,
|
||||
openshiftServiceCertSignerSecret,
|
||||
pull,
|
||||
tectonicNetworkOperator,
|
||||
cVOOverrides,
|
||||
legacyCVOOverrides,
|
||||
etcdServiceEndpointsKubeSystem,
|
||||
kubeSystemConfigmapEtcdServingCA,
|
||||
kubeSystemConfigmapRootCA,
|
||||
kubeSystemSecretEtcdClient,
|
||||
tectonicNamespace,
|
||||
openshiftWebConsoleNamespace,
|
||||
openshiftMachineConfigOperator,
|
||||
openshiftClusterAPINamespace,
|
||||
openshiftServiceCertSignerNamespace,
|
||||
appVersionKind,
|
||||
appVersionTectonicNetwork,
|
||||
etcdServiceKubeSystem,
|
||||
bindingDiscovery,
|
||||
appVersionKubeAddon,
|
||||
kubeAddonOperator,
|
||||
roleAdmin,
|
||||
roleUser,
|
||||
bindingAdmin,
|
||||
pullTectonicSystem,
|
||||
cloudCredsSecret,
|
||||
roleCloudCredsSecretReader)
|
||||
|
||||
m.FileList = []*asset.File{}
|
||||
m.FileList = append(m.FileList, kubeCloudConfig.Files()...)
|
||||
m.FileList = append(m.FileList, machineConfigServerTLSSecret.Files()...)
|
||||
m.FileList = append(m.FileList, openshiftServiceCertSignerSecret.Files()...)
|
||||
m.FileList = append(m.FileList, pull.Files()...)
|
||||
m.FileList = append(m.FileList, tectonicNetworkOperator.Files()...)
|
||||
m.FileList = append(m.FileList, cVOOverrides.Files()...)
|
||||
m.FileList = append(m.FileList, legacyCVOOverrides.Files()...)
|
||||
m.FileList = append(m.FileList, etcdServiceEndpointsKubeSystem.Files()...)
|
||||
m.FileList = append(m.FileList, kubeSystemConfigmapEtcdServingCA.Files()...)
|
||||
m.FileList = append(m.FileList, kubeSystemConfigmapRootCA.Files()...)
|
||||
m.FileList = append(m.FileList, kubeSystemSecretEtcdClient.Files()...)
|
||||
m.FileList = append(m.FileList, tectonicNamespace.Files()...)
|
||||
m.FileList = append(m.FileList, openshiftWebConsoleNamespace.Files()...)
|
||||
m.FileList = append(m.FileList, openshiftMachineConfigOperator.Files()...)
|
||||
m.FileList = append(m.FileList, openshiftClusterAPINamespace.Files()...)
|
||||
m.FileList = append(m.FileList, openshiftServiceCertSignerNamespace.Files()...)
|
||||
m.FileList = append(m.FileList, appVersionKind.Files()...)
|
||||
m.FileList = append(m.FileList, appVersionTectonicNetwork.Files()...)
|
||||
m.FileList = append(m.FileList, etcdServiceKubeSystem.Files()...)
|
||||
|
||||
m.FileList = append(m.FileList, bindingDiscovery.Files()...)
|
||||
m.FileList = append(m.FileList, appVersionKubeAddon.Files()...)
|
||||
m.FileList = append(m.FileList, kubeAddonOperator.Files()...)
|
||||
m.FileList = append(m.FileList, roleAdmin.Files()...)
|
||||
m.FileList = append(m.FileList, roleUser.Files()...)
|
||||
m.FileList = append(m.FileList, bindingAdmin.Files()...)
|
||||
m.FileList = append(m.FileList, pullTectonicSystem.Files()...)
|
||||
m.FileList = append(m.FileList, cloudCredsSecret.Files()...)
|
||||
m.FileList = append(m.FileList, roleCloudCredsSecretReader.Files()...)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// Files returns the files generated by the asset.
|
||||
func (m *Templates) Files() []*asset.File {
|
||||
return m.FileList
|
||||
}
|
||||
|
||||
// Load returns the manifests asset from disk.
|
||||
func (m *Templates) Load(f asset.FileFetcher) (bool, error) {
|
||||
return false, nil
|
||||
}
|
||||
Reference in New Issue
Block a user